diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-17 13:58:07 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-17 13:58:07 +0100 |
commit | f304a1580b5ce7b6c5f9e25cd3ddc63ca8d8c6a1 (patch) | |
tree | 5d2b8e1c0e3ec05ad3e18cb59fe9ad84fac710eb | |
parent | c55e3d7227fe1453869e309025996b9d75256d5d (diff) | |
download | PeerTube-f304a1580b5ce7b6c5f9e25cd3ddc63ca8d8c6a1.tar.gz PeerTube-f304a1580b5ce7b6c5f9e25cd3ddc63ca8d8c6a1.tar.zst PeerTube-f304a1580b5ce7b6c5f9e25cd3ddc63ca8d8c6a1.zip |
Fix build
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-filters.model.ts | 3 | ||||
-rw-r--r-- | client/tsconfig.json | 2 | ||||
-rw-r--r-- | server/helpers/peertube-crypto.ts | 2 | ||||
-rw-r--r-- | server/helpers/utils.ts | 2 | ||||
-rw-r--r-- | server/helpers/webtorrent.ts | 2 | ||||
-rw-r--r-- | server/lib/auth/oauth.ts | 2 | ||||
-rw-r--r-- | server/lib/client-html.ts | 2 | ||||
-rw-r--r-- | server/lib/hls.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-streaming-playlist.ts | 4 | ||||
-rw-r--r-- | server/tests/shared/streaming-playlists.ts | 2 | ||||
-rw-r--r-- | server/tests/shared/tracker.ts | 2 | ||||
-rw-r--r-- | server/tools/peertube-import-videos.ts | 3 | ||||
-rw-r--r-- | shared/core-utils/common/index.ts | 2 | ||||
-rw-r--r-- | shared/core-utils/common/random.ts | 8 | ||||
-rw-r--r-- | shared/extra-utils/crypto.ts (renamed from shared/core-utils/common/crypto.ts) | 0 | ||||
-rw-r--r-- | shared/extra-utils/index.ts | 1 |
16 files changed, 25 insertions, 14 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-filters.model.ts b/client/src/app/shared/shared-video-miniature/video-filters.model.ts index 982880b0e..8ad2fcd5d 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters.model.ts +++ b/client/src/app/shared/shared-video-miniature/video-filters.model.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { intoArray, toBoolean } from '@app/helpers' | 1 | import { intoArray, toBoolean } from '@app/helpers' |
2 | import { AttributesOnly, getAllPrivacies } from '@shared/core-utils' | 2 | import { getAllPrivacies } from '@shared/core-utils' |
3 | import { AttributesOnly } from '@shared/typescript-utils' | ||
3 | import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models' | 4 | import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models' |
4 | 5 | ||
5 | type VideoFiltersKeys = { | 6 | type VideoFiltersKeys = { |
diff --git a/client/tsconfig.json b/client/tsconfig.json index d68b3058e..41814d036 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json | |||
@@ -35,6 +35,8 @@ | |||
35 | "@shared/models": [ "../shared/models" ], | 35 | "@shared/models": [ "../shared/models" ], |
36 | "@shared/core-utils": [ "../shared/core-utils" ], | 36 | "@shared/core-utils": [ "../shared/core-utils" ], |
37 | "@shared/core-utils/*": [ "../shared/core-utils/*" ], | 37 | "@shared/core-utils/*": [ "../shared/core-utils/*" ], |
38 | "@shared/typescript-utils": [ "../shared/typescript-utils" ], | ||
39 | "@shared/typescript-utils/*": [ "../shared/typescript-utils/*" ], | ||
38 | "@root-helpers/*": [ "src/root-helpers/*" ], | 40 | "@root-helpers/*": [ "src/root-helpers/*" ], |
39 | "fs": [ "src/shims/noop.ts" ], | 41 | "fs": [ "src/shims/noop.ts" ], |
40 | "http": [ "src/shims/http.ts" ], | 42 | "http": [ "src/shims/http.ts" ], |
diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts index 66a353204..b8f7c782a 100644 --- a/server/helpers/peertube-crypto.ts +++ b/server/helpers/peertube-crypto.ts | |||
@@ -2,9 +2,9 @@ import { compare, genSalt, hash } from 'bcrypt' | |||
2 | import { createSign, createVerify } from 'crypto' | 2 | import { createSign, createVerify } from 'crypto' |
3 | import { Request } from 'express' | 3 | import { Request } from 'express' |
4 | import { cloneDeep } from 'lodash' | 4 | import { cloneDeep } from 'lodash' |
5 | import { sha256 } from '@shared/extra-utils' | ||
5 | import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants' | 6 | import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants' |
6 | import { MActor } from '../types/models' | 7 | import { MActor } from '../types/models' |
7 | import { sha256 } from '@shared/core-utils/common/crypto' | ||
8 | import { createPrivateKey, getPublicKey, promisify1, promisify2 } from './core-utils' | 8 | import { createPrivateKey, getPublicKey, promisify1, promisify2 } from './core-utils' |
9 | import { jsonld } from './custom-jsonld-signature' | 9 | import { jsonld } from './custom-jsonld-signature' |
10 | import { logger } from './logger' | 10 | import { logger } from './logger' |
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts index d6a3dae95..bd85eaa56 100644 --- a/server/helpers/utils.ts +++ b/server/helpers/utils.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import { remove } from 'fs-extra' | 1 | import { remove } from 'fs-extra' |
2 | import { Instance as ParseTorrent } from 'parse-torrent' | 2 | import { Instance as ParseTorrent } from 'parse-torrent' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { sha256 } from '@shared/extra-utils' | ||
4 | import { ResultList } from '../../shared' | 5 | import { ResultList } from '../../shared' |
5 | import { CONFIG } from '../initializers/config' | 6 | import { CONFIG } from '../initializers/config' |
6 | import { sha256 } from '@shared/core-utils/common/crypto' | ||
7 | import { execPromise, execPromise2, randomBytesPromise } from './core-utils' | 7 | import { execPromise, execPromise2, randomBytesPromise } from './core-utils' |
8 | import { logger } from './logger' | 8 | import { logger } from './logger' |
9 | 9 | ||
diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index 03663d73c..68d532c48 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts | |||
@@ -13,9 +13,9 @@ import { VideoPathManager } from '@server/lib/video-path-manager' | |||
13 | import { MVideo } from '@server/types/models/video/video' | 13 | import { MVideo } from '@server/types/models/video/video' |
14 | import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file' | 14 | import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file' |
15 | import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist' | 15 | import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist' |
16 | import { sha1 } from '@shared/extra-utils' | ||
16 | import { CONFIG } from '../initializers/config' | 17 | import { CONFIG } from '../initializers/config' |
17 | import { promisify2 } from './core-utils' | 18 | import { promisify2 } from './core-utils' |
18 | import { sha1 } from '@shared/core-utils/common/crypto' | ||
19 | import { logger } from './logger' | 19 | import { logger } from './logger' |
20 | import { generateVideoImportTmpPath } from './utils' | 20 | import { generateVideoImportTmpPath } from './utils' |
21 | import { extractVideo } from './video' | 21 | import { extractVideo } from './video' |
diff --git a/server/lib/auth/oauth.ts b/server/lib/auth/oauth.ts index dc0022852..2bf7a6361 100644 --- a/server/lib/auth/oauth.ts +++ b/server/lib/auth/oauth.ts | |||
@@ -8,9 +8,9 @@ import { | |||
8 | UnauthorizedClientError, | 8 | UnauthorizedClientError, |
9 | UnsupportedGrantTypeError | 9 | UnsupportedGrantTypeError |
10 | } from 'oauth2-server' | 10 | } from 'oauth2-server' |
11 | import { sha1 } from '@shared/core-utils/common/crypto' | ||
12 | import { randomBytesPromise } from '@server/helpers/core-utils' | 11 | import { randomBytesPromise } from '@server/helpers/core-utils' |
13 | import { MOAuthClient } from '@server/types/models' | 12 | import { MOAuthClient } from '@server/types/models' |
13 | import { sha1 } from '@shared/extra-utils' | ||
14 | import { OAUTH_LIFETIME } from '../../initializers/constants' | 14 | import { OAUTH_LIFETIME } from '../../initializers/constants' |
15 | import { BypassLogin, getClient, getRefreshToken, getUser, revokeToken, saveToken } from './oauth-model' | 15 | import { BypassLogin, getClient, getRefreshToken, getUser, revokeToken, saveToken } from './oauth-model' |
16 | 16 | ||
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 91708839b..e7e439bfe 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts | |||
@@ -4,12 +4,12 @@ import { join } from 'path' | |||
4 | import validator from 'validator' | 4 | import validator from 'validator' |
5 | import { toCompleteUUID } from '@server/helpers/custom-validators/misc' | 5 | import { toCompleteUUID } from '@server/helpers/custom-validators/misc' |
6 | import { escapeHTML } from '@shared/core-utils/renderer' | 6 | import { escapeHTML } from '@shared/core-utils/renderer' |
7 | import { sha256 } from '@shared/extra-utils' | ||
7 | import { HTMLServerConfig } from '@shared/models' | 8 | import { HTMLServerConfig } from '@shared/models' |
8 | import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n' | 9 | import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n' |
9 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' | 10 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' |
10 | import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos' | 11 | import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos' |
11 | import { isTestInstance } from '../helpers/core-utils' | 12 | import { isTestInstance } from '../helpers/core-utils' |
12 | import { sha256 } from '@shared/core-utils/common/crypto' | ||
13 | import { logger } from '../helpers/logger' | 13 | import { logger } from '../helpers/logger' |
14 | import { mdToPlainText } from '../helpers/markdown' | 14 | import { mdToPlainText } from '../helpers/markdown' |
15 | import { CONFIG } from '../initializers/config' | 15 | import { CONFIG } from '../initializers/config' |
diff --git a/server/lib/hls.ts b/server/lib/hls.ts index e4904be5f..1574ff27b 100644 --- a/server/lib/hls.ts +++ b/server/lib/hls.ts | |||
@@ -2,7 +2,7 @@ import { close, ensureDir, move, open, outputJSON, read, readFile, remove, stat, | |||
2 | import { flatten, uniq } from 'lodash' | 2 | import { flatten, uniq } from 'lodash' |
3 | import { basename, dirname, join } from 'path' | 3 | import { basename, dirname, join } from 'path' |
4 | import { MStreamingPlaylistFilesVideo, MVideo, MVideoUUID } from '@server/types/models' | 4 | import { MStreamingPlaylistFilesVideo, MVideo, MVideoUUID } from '@server/types/models' |
5 | import { sha256 } from '@shared/core-utils/common/crypto' | 5 | import { sha256 } from '@shared/extra-utils' |
6 | import { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamSize } from '../helpers/ffprobe-utils' | 6 | import { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamSize } from '../helpers/ffprobe-utils' |
7 | import { logger } from '../helpers/logger' | 7 | import { logger } from '../helpers/logger' |
8 | import { doRequest, doRequestAndSaveToFile } from '../helpers/requests' | 8 | import { doRequest, doRequestAndSaveToFile } from '../helpers/requests' |
diff --git a/server/models/video/video-streaming-playlist.ts b/server/models/video/video-streaming-playlist.ts index 7b410f8ee..9957ffee3 100644 --- a/server/models/video/video-streaming-playlist.ts +++ b/server/models/video/video-streaming-playlist.ts | |||
@@ -18,10 +18,10 @@ import { | |||
18 | import { getHLSPublicFileUrl } from '@server/lib/object-storage' | 18 | import { getHLSPublicFileUrl } from '@server/lib/object-storage' |
19 | import { VideoFileModel } from '@server/models/video/video-file' | 19 | import { VideoFileModel } from '@server/models/video/video-file' |
20 | import { MStreamingPlaylist, MVideo } from '@server/types/models' | 20 | import { MStreamingPlaylist, MVideo } from '@server/types/models' |
21 | import { AttributesOnly } from '@shared/typescript-utils' | 21 | import { sha1 } from '@shared/extra-utils' |
22 | import { VideoStorage } from '@shared/models' | 22 | import { VideoStorage } from '@shared/models' |
23 | import { AttributesOnly } from '@shared/typescript-utils' | ||
23 | import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' | 24 | import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' |
24 | import { sha1 } from '@shared/core-utils/common/crypto' | ||
25 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' | 25 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' |
26 | import { isArrayOf } from '../../helpers/custom-validators/misc' | 26 | import { isArrayOf } from '../../helpers/custom-validators/misc' |
27 | import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos' | 27 | import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos' |
diff --git a/server/tests/shared/streaming-playlists.ts b/server/tests/shared/streaming-playlists.ts index 738dc90e1..7ca707f2e 100644 --- a/server/tests/shared/streaming-playlists.ts +++ b/server/tests/shared/streaming-playlists.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { expect } from 'chai' | 1 | import { expect } from 'chai' |
2 | import { basename } from 'path' | 2 | import { basename } from 'path' |
3 | import { removeFragmentedMP4Ext } from '@shared/core-utils' | 3 | import { removeFragmentedMP4Ext } from '@shared/core-utils' |
4 | import { sha256 } from '@shared/core-utils/common/crypto' | 4 | import { sha256 } from '@shared/extra-utils' |
5 | import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models' | 5 | import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models' |
6 | import { PeerTubeServer } from '@shared/server-commands' | 6 | import { PeerTubeServer } from '@shared/server-commands' |
7 | 7 | ||
diff --git a/server/tests/shared/tracker.ts b/server/tests/shared/tracker.ts index 699895d5f..9c1f0246a 100644 --- a/server/tests/shared/tracker.ts +++ b/server/tests/shared/tracker.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { expect } from 'chai' | 1 | import { expect } from 'chai' |
2 | import { sha1 } from '@shared/core-utils' | 2 | import { sha1 } from '@shared/extra-utils' |
3 | import { makeGetRequest } from '@shared/server-commands' | 3 | import { makeGetRequest } from '@shared/server-commands' |
4 | 4 | ||
5 | async function hlsInfohashExist (serverUrl: string, masterPlaylistUrl: string, fileNumber: number) { | 5 | async function hlsInfohashExist (serverUrl: string, masterPlaylistUrl: string, fileNumber: number) { |
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 8314551f6..44c42bad6 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts | |||
@@ -5,7 +5,7 @@ import { program } from 'commander' | |||
5 | import { accessSync, constants } from 'fs' | 5 | import { accessSync, constants } from 'fs' |
6 | import { remove } from 'fs-extra' | 6 | import { remove } from 'fs-extra' |
7 | import { join } from 'path' | 7 | import { join } from 'path' |
8 | import { sha256 } from '@shared/core-utils/crypto' | 8 | import { sha256, wait } from '@shared/core-utils' |
9 | import { doRequestAndSaveToFile } from '../helpers/requests' | 9 | import { doRequestAndSaveToFile } from '../helpers/requests' |
10 | import { | 10 | import { |
11 | assignToken, | 11 | assignToken, |
@@ -15,7 +15,6 @@ import { | |||
15 | getLogger, | 15 | getLogger, |
16 | getServerCredentials | 16 | getServerCredentials |
17 | } from './cli' | 17 | } from './cli' |
18 | import { wait } from '@shared/server-commands' | ||
19 | import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl' | 18 | import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl' |
20 | import prompt = require('prompt') | 19 | import prompt = require('prompt') |
21 | 20 | ||
diff --git a/shared/core-utils/common/index.ts b/shared/core-utils/common/index.ts index f9ba10d5e..720977ead 100644 --- a/shared/core-utils/common/index.ts +++ b/shared/core-utils/common/index.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | export * from './array' | 1 | export * from './array' |
2 | export * from './crypto' | 2 | export * from './random' |
3 | export * from './date' | 3 | export * from './date' |
4 | export * from './env' | 4 | export * from './env' |
5 | export * from './object' | 5 | export * from './object' |
diff --git a/shared/core-utils/common/random.ts b/shared/core-utils/common/random.ts new file mode 100644 index 000000000..705735d09 --- /dev/null +++ b/shared/core-utils/common/random.ts | |||
@@ -0,0 +1,8 @@ | |||
1 | // high excluded | ||
2 | function randomInt (low: number, high: number) { | ||
3 | return Math.floor(Math.random() * (high - low) + low) | ||
4 | } | ||
5 | |||
6 | export { | ||
7 | randomInt | ||
8 | } | ||
diff --git a/shared/core-utils/common/crypto.ts b/shared/extra-utils/crypto.ts index 1a583f1a0..1a583f1a0 100644 --- a/shared/core-utils/common/crypto.ts +++ b/shared/extra-utils/crypto.ts | |||
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index 38303cf1f..373d27cb4 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts | |||
@@ -1,2 +1,3 @@ | |||
1 | export * from './crypto' | ||
1 | export * from './ffprobe' | 2 | export * from './ffprobe' |
2 | export * from './file' | 3 | export * from './file' |