aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/shared/shared-video-miniature/video-filters.model.ts3
-rw-r--r--client/tsconfig.json2
-rw-r--r--server/helpers/peertube-crypto.ts2
-rw-r--r--server/helpers/utils.ts2
-rw-r--r--server/helpers/webtorrent.ts2
-rw-r--r--server/lib/auth/oauth.ts2
-rw-r--r--server/lib/client-html.ts2
-rw-r--r--server/lib/hls.ts2
-rw-r--r--server/models/video/video-streaming-playlist.ts4
-rw-r--r--server/tests/shared/streaming-playlists.ts2
-rw-r--r--server/tests/shared/tracker.ts2
-rw-r--r--server/tools/peertube-import-videos.ts3
-rw-r--r--shared/core-utils/common/index.ts2
-rw-r--r--shared/core-utils/common/random.ts8
-rw-r--r--shared/extra-utils/crypto.ts (renamed from shared/core-utils/common/crypto.ts)0
-rw-r--r--shared/extra-utils/index.ts1
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 @@
1import { intoArray, toBoolean } from '@app/helpers' 1import { intoArray, toBoolean } from '@app/helpers'
2import { AttributesOnly, getAllPrivacies } from '@shared/core-utils' 2import { getAllPrivacies } from '@shared/core-utils'
3import { AttributesOnly } from '@shared/typescript-utils'
3import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models' 4import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models'
4 5
5type VideoFiltersKeys = { 6type 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'
2import { createSign, createVerify } from 'crypto' 2import { createSign, createVerify } from 'crypto'
3import { Request } from 'express' 3import { Request } from 'express'
4import { cloneDeep } from 'lodash' 4import { cloneDeep } from 'lodash'
5import { sha256 } from '@shared/extra-utils'
5import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants' 6import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants'
6import { MActor } from '../types/models' 7import { MActor } from '../types/models'
7import { sha256 } from '@shared/core-utils/common/crypto'
8import { createPrivateKey, getPublicKey, promisify1, promisify2 } from './core-utils' 8import { createPrivateKey, getPublicKey, promisify1, promisify2 } from './core-utils'
9import { jsonld } from './custom-jsonld-signature' 9import { jsonld } from './custom-jsonld-signature'
10import { logger } from './logger' 10import { 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 @@
1import { remove } from 'fs-extra' 1import { remove } from 'fs-extra'
2import { Instance as ParseTorrent } from 'parse-torrent' 2import { Instance as ParseTorrent } from 'parse-torrent'
3import { join } from 'path' 3import { join } from 'path'
4import { sha256 } from '@shared/extra-utils'
4import { ResultList } from '../../shared' 5import { ResultList } from '../../shared'
5import { CONFIG } from '../initializers/config' 6import { CONFIG } from '../initializers/config'
6import { sha256 } from '@shared/core-utils/common/crypto'
7import { execPromise, execPromise2, randomBytesPromise } from './core-utils' 7import { execPromise, execPromise2, randomBytesPromise } from './core-utils'
8import { logger } from './logger' 8import { 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'
13import { MVideo } from '@server/types/models/video/video' 13import { MVideo } from '@server/types/models/video/video'
14import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file' 14import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file'
15import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist' 15import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist'
16import { sha1 } from '@shared/extra-utils'
16import { CONFIG } from '../initializers/config' 17import { CONFIG } from '../initializers/config'
17import { promisify2 } from './core-utils' 18import { promisify2 } from './core-utils'
18import { sha1 } from '@shared/core-utils/common/crypto'
19import { logger } from './logger' 19import { logger } from './logger'
20import { generateVideoImportTmpPath } from './utils' 20import { generateVideoImportTmpPath } from './utils'
21import { extractVideo } from './video' 21import { 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'
11import { sha1 } from '@shared/core-utils/common/crypto'
12import { randomBytesPromise } from '@server/helpers/core-utils' 11import { randomBytesPromise } from '@server/helpers/core-utils'
13import { MOAuthClient } from '@server/types/models' 12import { MOAuthClient } from '@server/types/models'
13import { sha1 } from '@shared/extra-utils'
14import { OAUTH_LIFETIME } from '../../initializers/constants' 14import { OAUTH_LIFETIME } from '../../initializers/constants'
15import { BypassLogin, getClient, getRefreshToken, getUser, revokeToken, saveToken } from './oauth-model' 15import { 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'
4import validator from 'validator' 4import validator from 'validator'
5import { toCompleteUUID } from '@server/helpers/custom-validators/misc' 5import { toCompleteUUID } from '@server/helpers/custom-validators/misc'
6import { escapeHTML } from '@shared/core-utils/renderer' 6import { escapeHTML } from '@shared/core-utils/renderer'
7import { sha256 } from '@shared/extra-utils'
7import { HTMLServerConfig } from '@shared/models' 8import { HTMLServerConfig } from '@shared/models'
8import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n' 9import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n'
9import { HttpStatusCode } from '../../shared/models/http/http-error-codes' 10import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
10import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos' 11import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos'
11import { isTestInstance } from '../helpers/core-utils' 12import { isTestInstance } from '../helpers/core-utils'
12import { sha256 } from '@shared/core-utils/common/crypto'
13import { logger } from '../helpers/logger' 13import { logger } from '../helpers/logger'
14import { mdToPlainText } from '../helpers/markdown' 14import { mdToPlainText } from '../helpers/markdown'
15import { CONFIG } from '../initializers/config' 15import { 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,
2import { flatten, uniq } from 'lodash' 2import { flatten, uniq } from 'lodash'
3import { basename, dirname, join } from 'path' 3import { basename, dirname, join } from 'path'
4import { MStreamingPlaylistFilesVideo, MVideo, MVideoUUID } from '@server/types/models' 4import { MStreamingPlaylistFilesVideo, MVideo, MVideoUUID } from '@server/types/models'
5import { sha256 } from '@shared/core-utils/common/crypto' 5import { sha256 } from '@shared/extra-utils'
6import { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamSize } from '../helpers/ffprobe-utils' 6import { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamSize } from '../helpers/ffprobe-utils'
7import { logger } from '../helpers/logger' 7import { logger } from '../helpers/logger'
8import { doRequest, doRequestAndSaveToFile } from '../helpers/requests' 8import { 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 {
18import { getHLSPublicFileUrl } from '@server/lib/object-storage' 18import { getHLSPublicFileUrl } from '@server/lib/object-storage'
19import { VideoFileModel } from '@server/models/video/video-file' 19import { VideoFileModel } from '@server/models/video/video-file'
20import { MStreamingPlaylist, MVideo } from '@server/types/models' 20import { MStreamingPlaylist, MVideo } from '@server/types/models'
21import { AttributesOnly } from '@shared/typescript-utils' 21import { sha1 } from '@shared/extra-utils'
22import { VideoStorage } from '@shared/models' 22import { VideoStorage } from '@shared/models'
23import { AttributesOnly } from '@shared/typescript-utils'
23import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' 24import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
24import { sha1 } from '@shared/core-utils/common/crypto'
25import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 25import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
26import { isArrayOf } from '../../helpers/custom-validators/misc' 26import { isArrayOf } from '../../helpers/custom-validators/misc'
27import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos' 27import { 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 @@
1import { expect } from 'chai' 1import { expect } from 'chai'
2import { basename } from 'path' 2import { basename } from 'path'
3import { removeFragmentedMP4Ext } from '@shared/core-utils' 3import { removeFragmentedMP4Ext } from '@shared/core-utils'
4import { sha256 } from '@shared/core-utils/common/crypto' 4import { sha256 } from '@shared/extra-utils'
5import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models' 5import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models'
6import { PeerTubeServer } from '@shared/server-commands' 6import { 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 @@
1import { expect } from 'chai' 1import { expect } from 'chai'
2import { sha1 } from '@shared/core-utils' 2import { sha1 } from '@shared/extra-utils'
3import { makeGetRequest } from '@shared/server-commands' 3import { makeGetRequest } from '@shared/server-commands'
4 4
5async function hlsInfohashExist (serverUrl: string, masterPlaylistUrl: string, fileNumber: number) { 5async 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'
5import { accessSync, constants } from 'fs' 5import { accessSync, constants } from 'fs'
6import { remove } from 'fs-extra' 6import { remove } from 'fs-extra'
7import { join } from 'path' 7import { join } from 'path'
8import { sha256 } from '@shared/core-utils/crypto' 8import { sha256, wait } from '@shared/core-utils'
9import { doRequestAndSaveToFile } from '../helpers/requests' 9import { doRequestAndSaveToFile } from '../helpers/requests'
10import { 10import {
11 assignToken, 11 assignToken,
@@ -15,7 +15,6 @@ import {
15 getLogger, 15 getLogger,
16 getServerCredentials 16 getServerCredentials
17} from './cli' 17} from './cli'
18import { wait } from '@shared/server-commands'
19import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl' 18import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl'
20import prompt = require('prompt') 19import 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 @@
1export * from './array' 1export * from './array'
2export * from './crypto' 2export * from './random'
3export * from './date' 3export * from './date'
4export * from './env' 4export * from './env'
5export * from './object' 5export * 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
2function randomInt (low: number, high: number) {
3 return Math.floor(Math.random() * (high - low) + low)
4}
5
6export {
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 @@
1export * from './crypto'
1export * from './ffprobe' 2export * from './ffprobe'
2export * from './file' 3export * from './file'