]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix build
authorChocobozzz <me@florianbigard.com>
Fri, 17 Dec 2021 12:58:07 +0000 (13:58 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 17 Dec 2021 12:58:07 +0000 (13:58 +0100)
16 files changed:
client/src/app/shared/shared-video-miniature/video-filters.model.ts
client/tsconfig.json
server/helpers/peertube-crypto.ts
server/helpers/utils.ts
server/helpers/webtorrent.ts
server/lib/auth/oauth.ts
server/lib/client-html.ts
server/lib/hls.ts
server/models/video/video-streaming-playlist.ts
server/tests/shared/streaming-playlists.ts
server/tests/shared/tracker.ts
server/tools/peertube-import-videos.ts
shared/core-utils/common/index.ts
shared/core-utils/common/random.ts [new file with mode: 0644]
shared/extra-utils/crypto.ts [moved from shared/core-utils/common/crypto.ts with 100% similarity]
shared/extra-utils/index.ts

index 982880b0e7c5b5af556b7a5930ae597317853038..8ad2fcd5d69392733cea535181cac05f677c2423 100644 (file)
@@ -1,5 +1,6 @@
 import { intoArray, toBoolean } from '@app/helpers'
-import { AttributesOnly, getAllPrivacies } from '@shared/core-utils'
+import { getAllPrivacies } from '@shared/core-utils'
+import { AttributesOnly } from '@shared/typescript-utils'
 import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models'
 
 type VideoFiltersKeys = {
index d68b3058e6f41662916117a42d08519d3fff961b..41814d0362500499541f63ca38016613a5117877 100644 (file)
@@ -35,6 +35,8 @@
       "@shared/models": [ "../shared/models" ],
       "@shared/core-utils": [ "../shared/core-utils" ],
       "@shared/core-utils/*": [ "../shared/core-utils/*" ],
+      "@shared/typescript-utils": [ "../shared/typescript-utils" ],
+      "@shared/typescript-utils/*": [ "../shared/typescript-utils/*" ],
       "@root-helpers/*": [ "src/root-helpers/*" ],
       "fs": [ "src/shims/noop.ts" ],
       "http": [ "src/shims/http.ts" ],
index 66a353204a20d71555c33e41846f6dd9227d030d..b8f7c782ae7b88ba88463d14f156d43d65a9dec1 100644 (file)
@@ -2,9 +2,9 @@ import { compare, genSalt, hash } from 'bcrypt'
 import { createSign, createVerify } from 'crypto'
 import { Request } from 'express'
 import { cloneDeep } from 'lodash'
+import { sha256 } from '@shared/extra-utils'
 import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants'
 import { MActor } from '../types/models'
-import { sha256 } from '@shared/core-utils/common/crypto'
 import { createPrivateKey, getPublicKey, promisify1, promisify2 } from './core-utils'
 import { jsonld } from './custom-jsonld-signature'
 import { logger } from './logger'
index d6a3dae9555ed3682cb2be7bab7d0f837bf31a7b..bd85eaa561b02a6ee40e4dec6b90255c5fadacf5 100644 (file)
@@ -1,9 +1,9 @@
 import { remove } from 'fs-extra'
 import { Instance as ParseTorrent } from 'parse-torrent'
 import { join } from 'path'
+import { sha256 } from '@shared/extra-utils'
 import { ResultList } from '../../shared'
 import { CONFIG } from '../initializers/config'
-import { sha256 } from '@shared/core-utils/common/crypto'
 import { execPromise, execPromise2, randomBytesPromise } from './core-utils'
 import { logger } from './logger'
 
index 03663d73c46c9857c4ce19e481bf048f468f5bdb..68d532c48995a2f5efde250c233aec100f800594 100644 (file)
@@ -13,9 +13,9 @@ import { VideoPathManager } from '@server/lib/video-path-manager'
 import { MVideo } from '@server/types/models/video/video'
 import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file'
 import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist'
+import { sha1 } from '@shared/extra-utils'
 import { CONFIG } from '../initializers/config'
 import { promisify2 } from './core-utils'
-import { sha1 } from '@shared/core-utils/common/crypto'
 import { logger } from './logger'
 import { generateVideoImportTmpPath } from './utils'
 import { extractVideo } from './video'
index dc0022852dbc10100653a3f919adfcf273f38e4f..2bf7a63617e935b105d6b0039486c396084a884e 100644 (file)
@@ -8,9 +8,9 @@ import {
   UnauthorizedClientError,
   UnsupportedGrantTypeError
 } from 'oauth2-server'
-import { sha1 } from '@shared/core-utils/common/crypto'
 import { randomBytesPromise } from '@server/helpers/core-utils'
 import { MOAuthClient } from '@server/types/models'
+import { sha1 } from '@shared/extra-utils'
 import { OAUTH_LIFETIME } from '../../initializers/constants'
 import { BypassLogin, getClient, getRefreshToken, getUser, revokeToken, saveToken } from './oauth-model'
 
index 91708839bb840b4f6de92a7b22a8ac7961c61502..e7e439bfe4bee38fbc00eb38c77fbb329efbe5ec 100644 (file)
@@ -4,12 +4,12 @@ import { join } from 'path'
 import validator from 'validator'
 import { toCompleteUUID } from '@server/helpers/custom-validators/misc'
 import { escapeHTML } from '@shared/core-utils/renderer'
+import { sha256 } from '@shared/extra-utils'
 import { HTMLServerConfig } from '@shared/models'
 import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n'
 import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
 import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos'
 import { isTestInstance } from '../helpers/core-utils'
-import { sha256 } from '@shared/core-utils/common/crypto'
 import { logger } from '../helpers/logger'
 import { mdToPlainText } from '../helpers/markdown'
 import { CONFIG } from '../initializers/config'
index e4904be5f3aae64ad93a4e57392f8a6cd63b9b3a..1574ff27bac29401a2e5731a9f3804819ca9cf8a 100644 (file)
@@ -2,7 +2,7 @@ import { close, ensureDir, move, open, outputJSON, read, readFile, remove, stat,
 import { flatten, uniq } from 'lodash'
 import { basename, dirname, join } from 'path'
 import { MStreamingPlaylistFilesVideo, MVideo, MVideoUUID } from '@server/types/models'
-import { sha256 } from '@shared/core-utils/common/crypto'
+import { sha256 } from '@shared/extra-utils'
 import { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamSize } from '../helpers/ffprobe-utils'
 import { logger } from '../helpers/logger'
 import { doRequest, doRequestAndSaveToFile } from '../helpers/requests'
index 7b410f8eea4ac00b26d18935ffead63d11b25ac5..9957ffee3c3b3d1a4dea8bef5ed6338769ad615a 100644 (file)
@@ -18,10 +18,10 @@ import {
 import { getHLSPublicFileUrl } from '@server/lib/object-storage'
 import { VideoFileModel } from '@server/models/video/video-file'
 import { MStreamingPlaylist, MVideo } from '@server/types/models'
-import { AttributesOnly } from '@shared/typescript-utils'
+import { sha1 } from '@shared/extra-utils'
 import { VideoStorage } from '@shared/models'
+import { AttributesOnly } from '@shared/typescript-utils'
 import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
-import { sha1 } from '@shared/core-utils/common/crypto'
 import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
 import { isArrayOf } from '../../helpers/custom-validators/misc'
 import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos'
index 738dc90e136549fa59dfb6e6d0b8a957655bdaa5..7ca707f2eff002c9c01669a12e8952e221661b1d 100644 (file)
@@ -1,7 +1,7 @@
 import { expect } from 'chai'
 import { basename } from 'path'
 import { removeFragmentedMP4Ext } from '@shared/core-utils'
-import { sha256 } from '@shared/core-utils/common/crypto'
+import { sha256 } from '@shared/extra-utils'
 import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models'
 import { PeerTubeServer } from '@shared/server-commands'
 
index 699895d5f327fcbc6d02631f3b7bbd513aa440f4..9c1f0246a3448c0219f75318c2dea6b62ff5baf9 100644 (file)
@@ -1,5 +1,5 @@
 import { expect } from 'chai'
-import { sha1 } from '@shared/core-utils'
+import { sha1 } from '@shared/extra-utils'
 import { makeGetRequest } from '@shared/server-commands'
 
 async function hlsInfohashExist (serverUrl: string, masterPlaylistUrl: string, fileNumber: number) {
index 8314551f64c03905a47ee5b47047f62a80055aa5..44c42bad6a4736d6ddbef2b8b87eb34005b111f1 100644 (file)
@@ -5,7 +5,7 @@ import { program } from 'commander'
 import { accessSync, constants } from 'fs'
 import { remove } from 'fs-extra'
 import { join } from 'path'
-import { sha256 } from '@shared/core-utils/crypto'
+import { sha256, wait } from '@shared/core-utils'
 import { doRequestAndSaveToFile } from '../helpers/requests'
 import {
   assignToken,
@@ -15,7 +15,6 @@ import {
   getLogger,
   getServerCredentials
 } from './cli'
-import { wait } from '@shared/server-commands'
 import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl'
 import prompt = require('prompt')
 
index f9ba10d5e0d2ace55f42bc2549ca6b414c825a6a..720977ead63dafa733d0dc748e96d88d768cd2d8 100644 (file)
@@ -1,5 +1,5 @@
 export * from './array'
-export * from './crypto'
+export * from './random'
 export * from './date'
 export * from './env'
 export * from './object'
diff --git a/shared/core-utils/common/random.ts b/shared/core-utils/common/random.ts
new file mode 100644 (file)
index 0000000..705735d
--- /dev/null
@@ -0,0 +1,8 @@
+// high excluded
+function randomInt (low: number, high: number) {
+  return Math.floor(Math.random() * (high - low) + low)
+}
+
+export {
+  randomInt
+}
index 38303cf1fa7521fedf7cc52a59e4e21d88b5cbb5..373d27cb4925925a8596fd21a509ee149134641b 100644 (file)
@@ -1,2 +1,3 @@
+export * from './crypto'
 export * from './ffprobe'
 export * from './file'