diff options
Diffstat (limited to 'scripts')
31 files changed, 131 insertions, 144 deletions
diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts index 788318313..3c3c666a1 100644 --- a/scripts/benchmark.ts +++ b/scripts/benchmark.ts | |||
@@ -1,10 +1,7 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import autocannon, { printResult } from 'autocannon' | 1 | import autocannon, { printResult } from 'autocannon' |
5 | import { writeJson } from 'fs-extra' | 2 | import { writeJson } from 'fs-extra' |
6 | import { createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | ||
7 | import { Video, VideoPrivacy } from '@shared/models' | 3 | import { Video, VideoPrivacy } from '@shared/models' |
4 | import { createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | ||
8 | 5 | ||
9 | let server: PeerTubeServer | 6 | let server: PeerTubeServer |
10 | let video: Video | 7 | let video: Video |
diff --git a/scripts/build/client.sh b/scripts/build/client.sh index e891b217c..bae91a2b6 100755 --- a/scripts/build/client.sh +++ b/scripts/build/client.sh | |||
@@ -35,6 +35,8 @@ languages=( | |||
35 | ["de"]="de-DE" | 35 | ["de"]="de-DE" |
36 | ["it"]="it-IT" | 36 | ["it"]="it-IT" |
37 | ["sq"]="sq" | 37 | ["sq"]="sq" |
38 | ["nn"]="nn" | ||
39 | ["nb"]="nb-NO" | ||
38 | ["kab"]="kab" | 40 | ["kab"]="kab" |
39 | ) | 41 | ) |
40 | 42 | ||
diff --git a/scripts/build/server.sh b/scripts/build/server.sh index b903f8250..a2dfc3dd9 100755 --- a/scripts/build/server.sh +++ b/scripts/build/server.sh | |||
@@ -4,7 +4,8 @@ set -eu | |||
4 | 4 | ||
5 | rm -rf ./dist | 5 | rm -rf ./dist |
6 | 6 | ||
7 | npm run tsc | 7 | npm run tsc -- -b --verbose |
8 | cp "./tsconfig.json" "./dist" | 8 | npm run resolve-tspaths:server |
9 | |||
9 | cp -r "./server/static" "./server/assets" "./dist/server" | 10 | cp -r "./server/static" "./server/assets" "./dist/server" |
10 | cp -r "./server/lib/emails" "./dist/server/lib" | 11 | cp -r "./server/lib/emails" "./dist/server/lib" |
diff --git a/scripts/ci.sh b/scripts/ci.sh index a628cbced..2bacf2a2e 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh | |||
@@ -23,7 +23,7 @@ runTest () { | |||
23 | joblog="$jobname-ci.log" | 23 | joblog="$jobname-ci.log" |
24 | 24 | ||
25 | parallel -j $jobs --retries $retries \ | 25 | parallel -j $jobs --retries $retries \ |
26 | "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --require ./dist/server/tests/register.js --bail {}" \ | 26 | "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --bail {}" \ |
27 | ::: $files | 27 | ::: $files |
28 | 28 | ||
29 | cat "$joblog" | uniq -c | 29 | cat "$joblog" | uniq -c |
@@ -40,7 +40,10 @@ findTestFiles () { | |||
40 | find $1 -type f -name "*.js" $exception | xargs echo | 40 | find $1 -type f -name "*.js" $exception | xargs echo |
41 | } | 41 | } |
42 | 42 | ||
43 | if [ "$1" = "client" ]; then | 43 | if [ "$1" = "types-package" ]; then |
44 | npm run generate-types-package 0.0.0 | ||
45 | npm run tsc -- --noEmit --esModuleInterop packages/types/tests/test.ts | ||
46 | elif [ "$1" = "client" ]; then | ||
44 | npm run build | 47 | npm run build |
45 | 48 | ||
46 | feedsFiles=$(findTestFiles ./dist/server/tests/feeds) | 49 | feedsFiles=$(findTestFiles ./dist/server/tests/feeds) |
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh index f85daf810..5c30c7639 100755 --- a/scripts/clean/server/test.sh +++ b/scripts/clean/server/test.sh | |||
@@ -20,9 +20,9 @@ dropRedis () { | |||
20 | port=$((9000+$1)) | 20 | port=$((9000+$1)) |
21 | host="localhost" | 21 | host="localhost" |
22 | 22 | ||
23 | redis-cli -h "$host" KEYS "bull-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL | 23 | redis-cli -h "$host" KEYS "bull-localhost:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL |
24 | redis-cli -h "$host" KEYS "redis-localhost:$port*" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL | 24 | redis-cli -h "$host" KEYS "redis-localhost:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL |
25 | redis-cli -h "$host" KEYS "*redis-localhost:$port-" | grep -v empty | xargs --no-run-if-empty redis-cli -h "$host" DEL | 25 | redis-cli -h "$host" KEYS "*redis-localhost:$port-" | grep -v empty | xargs -r redis-cli -h "$host" DEL |
26 | } | 26 | } |
27 | 27 | ||
28 | seq=$(seq 1 6) | 28 | seq=$(seq 1 6) |
diff --git a/scripts/client-build-stats.ts b/scripts/client-build-stats.ts index 70ceda975..d5ecd5fea 100644 --- a/scripts/client-build-stats.ts +++ b/scripts/client-build-stats.ts | |||
@@ -1,9 +1,6 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { readdir, stat } from 'fs-extra' | 1 | import { readdir, stat } from 'fs-extra' |
5 | import { join } from 'path' | 2 | import { join } from 'path' |
6 | import { root } from '@server/helpers/core-utils' | 3 | import { root } from '@shared/core-utils' |
7 | 4 | ||
8 | async function run () { | 5 | async function run () { |
9 | const result = { | 6 | const result = { |
diff --git a/scripts/create-import-video-file-job.ts b/scripts/create-import-video-file-job.ts index 071d36df4..97e9c7933 100644 --- a/scripts/create-import-video-file-job.ts +++ b/scripts/create-import-video-file-job.ts | |||
@@ -1,12 +1,9 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { program } from 'commander' | 1 | import { program } from 'commander' |
5 | import { resolve } from 'path' | 2 | import { resolve } from 'path' |
6 | import { VideoModel } from '../server/models/video/video' | 3 | import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' |
7 | import { initDatabaseModels } from '../server/initializers/database' | 4 | import { initDatabaseModels } from '../server/initializers/database' |
8 | import { JobQueue } from '../server/lib/job-queue' | 5 | import { JobQueue } from '../server/lib/job-queue' |
9 | import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' | 6 | import { VideoModel } from '../server/models/video/video' |
10 | 7 | ||
11 | program | 8 | program |
12 | .option('-v, --video [videoUUID]', 'Video UUID') | 9 | .option('-v, --video [videoUUID]', 'Video UUID') |
diff --git a/scripts/create-move-video-storage-job.ts b/scripts/create-move-video-storage-job.ts index 505bbd61b..7465c1ce0 100644 --- a/scripts/create-move-video-storage-job.ts +++ b/scripts/create-move-video-storage-job.ts | |||
@@ -1,13 +1,10 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { program } from 'commander' | 1 | import { program } from 'commander' |
5 | import { VideoModel } from '@server/models/video/video' | 2 | import { CONFIG } from '@server/initializers/config' |
6 | import { initDatabaseModels } from '@server/initializers/database' | 3 | import { initDatabaseModels } from '@server/initializers/database' |
7 | import { VideoStorage } from '@shared/models' | ||
8 | import { moveToExternalStorageState } from '@server/lib/video-state' | ||
9 | import { JobQueue } from '@server/lib/job-queue' | 4 | import { JobQueue } from '@server/lib/job-queue' |
10 | import { CONFIG } from '@server/initializers/config' | 5 | import { moveToExternalStorageState } from '@server/lib/video-state' |
6 | import { VideoModel } from '@server/models/video/video' | ||
7 | import { VideoState, VideoStorage } from '@shared/models' | ||
11 | 8 | ||
12 | program | 9 | program |
13 | .description('Move videos to another storage.') | 10 | .description('Move videos to another storage.') |
@@ -57,6 +54,16 @@ async function run () { | |||
57 | process.exit(-1) | 54 | process.exit(-1) |
58 | } | 55 | } |
59 | 56 | ||
57 | if (video.isLive) { | ||
58 | console.error('Cannot process live video') | ||
59 | process.exit(-1) | ||
60 | } | ||
61 | |||
62 | if (video.state === VideoState.TO_MOVE_TO_EXTERNAL_STORAGE) { | ||
63 | console.error('This video is already being moved to external storage') | ||
64 | process.exit(-1) | ||
65 | } | ||
66 | |||
60 | ids.push(video.id) | 67 | ids.push(video.id) |
61 | } else { | 68 | } else { |
62 | ids = await VideoModel.listLocalIds() | 69 | ids = await VideoModel.listLocalIds() |
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts index 244c38fcd..95e1e66cf 100755 --- a/scripts/create-transcoding-job.ts +++ b/scripts/create-transcoding-job.ts | |||
@@ -1,15 +1,12 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { program } from 'commander' | 1 | import { program } from 'commander' |
5 | import { VideoModel } from '../server/models/video/video' | 2 | import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' |
6 | import { initDatabaseModels } from '../server/initializers/database' | ||
7 | import { JobQueue } from '../server/lib/job-queue' | ||
8 | import { computeLowerResolutionsToTranscode } from '@server/helpers/ffprobe-utils' | 3 | import { computeLowerResolutionsToTranscode } from '@server/helpers/ffprobe-utils' |
9 | import { VideoState, VideoTranscodingPayload } from '@shared/models' | ||
10 | import { CONFIG } from '@server/initializers/config' | 4 | import { CONFIG } from '@server/initializers/config' |
11 | import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' | ||
12 | import { addTranscodingJob } from '@server/lib/video' | 5 | import { addTranscodingJob } from '@server/lib/video' |
6 | import { VideoState, VideoTranscodingPayload } from '@shared/models' | ||
7 | import { initDatabaseModels } from '../server/initializers/database' | ||
8 | import { JobQueue } from '../server/lib/job-queue' | ||
9 | import { VideoModel } from '../server/models/video/video' | ||
13 | 10 | ||
14 | program | 11 | program |
15 | .option('-v, --video [videoUUID]', 'Video UUID') | 12 | .option('-v, --video [videoUUID]', 'Video UUID') |
@@ -63,7 +60,11 @@ async function run () { | |||
63 | type: 'new-resolution-to-hls', | 60 | type: 'new-resolution-to-hls', |
64 | videoUUID: video.uuid, | 61 | videoUUID: video.uuid, |
65 | resolution, | 62 | resolution, |
63 | |||
64 | // FIXME: check the file has audio and is not in portrait mode | ||
66 | isPortraitMode: false, | 65 | isPortraitMode: false, |
66 | hasAudio: true, | ||
67 | |||
67 | copyCodecs: false, | 68 | copyCodecs: false, |
68 | isNewVideo: false, | 69 | isNewVideo: false, |
69 | isMaxQuality: maxResolution === resolution, | 70 | isMaxQuality: maxResolution === resolution, |
@@ -75,6 +76,10 @@ async function run () { | |||
75 | dataInput.push({ | 76 | dataInput.push({ |
76 | type: 'new-resolution-to-webtorrent', | 77 | type: 'new-resolution-to-webtorrent', |
77 | videoUUID: video.uuid, | 78 | videoUUID: video.uuid, |
79 | |||
80 | // FIXME: check the file has audio | ||
81 | hasAudio: true, | ||
82 | |||
78 | isNewVideo: false, | 83 | isNewVideo: false, |
79 | resolution: parseInt(options.resolution) | 84 | resolution: parseInt(options.resolution) |
80 | }) | 85 | }) |
diff --git a/scripts/dev/cli.sh b/scripts/dev/cli.sh index 4bf4808b8..327792a19 100755 --- a/scripts/dev/cli.sh +++ b/scripts/dev/cli.sh | |||
@@ -12,4 +12,5 @@ rm -rf ./dist/server/tools/ | |||
12 | mkdir -p "./dist/server/tools" | 12 | mkdir -p "./dist/server/tools" |
13 | cp -r "./server/tools/node_modules" "./dist/server/tools" | 13 | cp -r "./server/tools/node_modules" "./dist/server/tools" |
14 | 14 | ||
15 | npm run tsc -- --watch --sourceMap --project ./server/tools/tsconfig.json | 15 | cd ./server/tools |
16 | ../../node_modules/.bin/tsc-watch --build --verbose --onSuccess 'sh -c "cd ../../ && npm run resolve-tspaths:all"' | ||
diff --git a/scripts/dev/server.sh b/scripts/dev/server.sh index 5aac470eb..9dae43a63 100755 --- a/scripts/dev/server.sh +++ b/scripts/dev/server.sh | |||
@@ -5,7 +5,7 @@ set -eu | |||
5 | if [ ! -f "./client/dist/en-US/index.html" ]; then | 5 | if [ ! -f "./client/dist/en-US/index.html" ]; then |
6 | if [ -z ${1+x} ] || [ "$1" != "--skip-client" ]; then | 6 | if [ -z ${1+x} ] || [ "$1" != "--skip-client" ]; then |
7 | echo "client/dist/en-US/index.html does not exist, compile client files..." | 7 | echo "client/dist/en-US/index.html does not exist, compile client files..." |
8 | npm run build:client -- --light | 8 | npm run build:client |
9 | fi | 9 | fi |
10 | fi | 10 | fi |
11 | 11 | ||
@@ -14,15 +14,12 @@ mkdir -p "./client/dist" | |||
14 | rm -rf "./client/dist/locale" | 14 | rm -rf "./client/dist/locale" |
15 | cp -r "./client/src/locale" "./client/dist/locale" | 15 | cp -r "./client/src/locale" "./client/dist/locale" |
16 | 16 | ||
17 | rm -rf "./dist" | 17 | mkdir -p "./dist/server/lib" |
18 | 18 | ||
19 | mkdir "./dist" | 19 | npm run tsc -- -b -v --incremental |
20 | cp "./tsconfig.json" "./dist" | 20 | npm run resolve-tspaths:server |
21 | 21 | ||
22 | npm run tsc -- --incremental --sourceMap | ||
23 | cp -r ./server/static ./server/assets ./dist/server | 22 | cp -r ./server/static ./server/assets ./dist/server |
24 | cp -r "./server/lib/emails" "./dist/server/lib" | 23 | cp -r "./server/lib/emails" "./dist/server/lib" |
25 | 24 | ||
26 | NODE_ENV=test node node_modules/.bin/concurrently -k \ | 25 | ./node_modules/.bin/tsc-watch --build --preserveWatchOutput --verbose --onSuccess 'sh -c "npm run resolve-tspaths:server && NODE_ENV=test node dist/server"' |
27 | "node_modules/.bin/nodemon --delay 1 --watch ./dist dist/server" \ | ||
28 | "node_modules/.bin/tsc --incremental --sourceMap --preserveWatchOutput -w" | ||
diff --git a/scripts/e2e/browserstack.sh b/scripts/e2e/browserstack.sh index fb125ea23..ad6268d42 100755 --- a/scripts/e2e/browserstack.sh +++ b/scripts/e2e/browserstack.sh | |||
@@ -2,8 +2,4 @@ | |||
2 | 2 | ||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | npm run clean:server:test | 5 | cd client/e2e && ../node_modules/.bin/wdio run ./wdio.browserstack.conf.ts |
6 | |||
7 | npm run concurrently -- -k -s first \ | ||
8 | "cd client/e2e && ../node_modules/.bin/wdio run ./wdio.browserstack.conf.ts" \ | ||
9 | "NODE_ENV=test NODE_APP_INSTANCE=1 NODE_CONFIG='{ \"rates_limit\": { \"api\": { \"max\": 5000 }, \"login\": { \"max\": 5000 } }, \"log\": { \"level\": \"warn\" }, \"signup\": { \"enabled\": false } }' node dist/server" | ||
diff --git a/scripts/e2e/local.sh b/scripts/e2e/local.sh index fe8b7f559..0e0368c52 100755 --- a/scripts/e2e/local.sh +++ b/scripts/e2e/local.sh | |||
@@ -2,16 +2,6 @@ | |||
2 | 2 | ||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | npm run clean:server:test | 5 | cd client/e2e |
6 | 6 | ||
7 | config="{" | 7 | ../node_modules/.bin/wdio run ./wdio.local.conf.ts |
8 | config+=" \"rates_limit\": { \"api\": { \"max\": 5000 }, \"login\": { \"max\": 5000 } }" | ||
9 | config+=", \"log\": { \"level\": \"warn\" }" | ||
10 | config+=", \"signup\": { \"enabled\": false }" | ||
11 | config+=", \"transcoding\": { \"enabled\": false }" | ||
12 | config+="}" | ||
13 | |||
14 | npm run concurrently -- -k -s first \ | ||
15 | "cd client/e2e && ../node_modules/.bin/wdio run ./wdio.local.conf.ts" \ | ||
16 | "NODE_ENV=test NODE_CONFIG='$config' NODE_APP_INSTANCE=1 node dist/server" \ | ||
17 | "NODE_ENV=test NODE_CONFIG='$config' NODE_APP_INSTANCE=2 node dist/server" | ||
diff --git a/scripts/generate-code-contributors.ts b/scripts/generate-code-contributors.ts index 70b33c0d3..5357daf04 100755 --- a/scripts/generate-code-contributors.ts +++ b/scripts/generate-code-contributors.ts | |||
@@ -1,7 +1,4 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | 1 | import { CLICommand } from '@shared/server-commands' |
2 | registerTSPaths() | ||
3 | |||
4 | import { CLICommand } from '@shared/extra-utils' | ||
5 | 2 | ||
6 | run() | 3 | run() |
7 | .then(() => process.exit(0)) | 4 | .then(() => process.exit(0)) |
diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.ts index b363a1bdc..7556866e6 100755 --- a/scripts/i18n/create-custom-files.ts +++ b/scripts/i18n/create-custom-files.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { writeJSON } from 'fs-extra' | 1 | import { writeJSON } from 'fs-extra' |
2 | import { values } from 'lodash' | 2 | import { values } from 'lodash' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { registerTSPaths } from '../../server/helpers/register-ts-paths' | 4 | import { root } from '@shared/core-utils' |
5 | import { | 5 | import { |
6 | buildLanguages, | 6 | buildLanguages, |
7 | VIDEO_CATEGORIES, | 7 | VIDEO_CATEGORIES, |
@@ -14,9 +14,7 @@ import { | |||
14 | } from '../../server/initializers/constants' | 14 | } from '../../server/initializers/constants' |
15 | import { I18N_LOCALES } from '../../shared/core-utils/i18n' | 15 | import { I18N_LOCALES } from '../../shared/core-utils/i18n' |
16 | 16 | ||
17 | registerTSPaths() | 17 | const videojs = require(join(root(), 'client', 'src', 'locale', 'videojs.en-US.json')) |
18 | |||
19 | const videojs = require(join(__dirname, '../../../client/src/locale/videojs.en-US.json')) | ||
20 | const playerKeys = { | 18 | const playerKeys = { |
21 | 'Quality': 'Quality', | 19 | 'Quality': 'Quality', |
22 | 'Auto': 'Auto', | 20 | 'Auto': 'Auto', |
@@ -51,6 +49,9 @@ const playerKeys = { | |||
51 | 'Buffer Progress': 'Buffer Progress', | 49 | 'Buffer Progress': 'Buffer Progress', |
52 | 'Buffer State': 'Buffer State', | 50 | 'Buffer State': 'Buffer State', |
53 | 'Live Latency': 'Live Latency', | 51 | 'Live Latency': 'Live Latency', |
52 | 'P2P': 'P2P', | ||
53 | 'enabled': 'enabled', | ||
54 | 'disabled': 'disabled', | ||
54 | ' off': ' off', | 55 | ' off': ' off', |
55 | 'Player mode': 'Player mode' | 56 | 'Player mode': 'Player mode' |
56 | } | 57 | } |
@@ -97,7 +98,7 @@ writeAll().catch(err => { | |||
97 | }) | 98 | }) |
98 | 99 | ||
99 | async function writeAll () { | 100 | async function writeAll () { |
100 | const localePath = join(__dirname, '../../../client/src/locale') | 101 | const localePath = join(root(), 'client', 'src', 'locale') |
101 | 102 | ||
102 | await writeJSON(join(localePath, 'player.en-US.json'), playerKeys, { spaces: 4 }) | 103 | await writeJSON(join(localePath, 'player.en-US.json'), playerKeys, { spaces: 4 }) |
103 | await writeJSON(join(localePath, 'server.en-US.json'), serverKeys, { spaces: 4 }) | 104 | await writeJSON(join(localePath, 'server.en-US.json'), serverKeys, { spaces: 4 }) |
diff --git a/scripts/i18n/update.sh b/scripts/i18n/update.sh index 0524c9e5d..4cf0d65b7 100755 --- a/scripts/i18n/update.sh +++ b/scripts/i18n/update.sh | |||
@@ -8,7 +8,7 @@ cd client | |||
8 | npm run ng -- extract-i18n --out-file src/locale/angular.xlf | 8 | npm run ng -- extract-i18n --out-file src/locale/angular.xlf |
9 | 9 | ||
10 | # Merge new translations in other language files | 10 | # Merge new translations in other language files |
11 | node ./node_modules/.bin/xliffmerge -p ./.xliffmerge.json "ar" "ca-ES" "gl-ES" "cs-CZ" "da-DK" "de-DE" "el-GR" "en-GB" "en-US" "eo" "es-ES" "eu-ES" "fa-IR" "fi-FI" "fr-FR" "gd" "gl-ES" "hu-HU" "it-IT" "ja-JP" "jbo" "kab" "ko-KR" "lt-LT" "nb-NO" "nl-NL" "oc" "pl-PL" "pt-BR" "pt-PT" "ru-RU" "sk-SK" "sl-SI" "sv-SE" "ta" "th-TH" "tr-TR" "uk-UA" "vi-VN" "zh-Hans-CN" "zh-Hant-TW" | 11 | node ./node_modules/.bin/xliffmerge -p ./.xliffmerge.json "ar" "ca-ES" "gl-ES" "cs-CZ" "da-DK" "de-DE" "el-GR" "en-GB" "en-US" "eo" "es-ES" "eu-ES" "fa-IR" "fi-FI" "fr-FR" "gd" "gl-ES" "hu-HU" "it-IT" "ja-JP" "jbo" "kab" "ko-KR" "lt-LT" "nb-NO" "nl-NL" "oc" "pl-PL" "pt-BR" "pt-PT" "ru-RU" "sk-SK" "sl-SI" "sv-SE" "ta" "th-TH" "tr-TR" "uk-UA" "vi-VN" "zh-Hans-CN" "zh-Hant-TW" "nn" "nb-NO" |
12 | 12 | ||
13 | # Add our strings too | 13 | # Add our strings too |
14 | cd ../ | 14 | cd ../ |
diff --git a/scripts/migrations/peertube-2.1.ts b/scripts/migrations/peertube-2.1.ts index 4bbc203c1..2e316d996 100644 --- a/scripts/migrations/peertube-2.1.ts +++ b/scripts/migrations/peertube-2.1.ts | |||
@@ -1,15 +1,12 @@ | |||
1 | import { registerTSPaths } from '../../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { initDatabaseModels, sequelizeTypescript } from '../../server/initializers/database' | ||
5 | import * as Sequelize from 'sequelize' | ||
6 | import { join } from 'path' | ||
7 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, STATIC_PATHS, WEBSERVER } from '@server/initializers/constants' | ||
8 | import { pathExists, stat, writeFile } from 'fs-extra' | 1 | import { pathExists, stat, writeFile } from 'fs-extra' |
9 | import { createTorrentPromise } from '@server/helpers/webtorrent' | ||
10 | import { CONFIG } from '@server/initializers/config' | ||
11 | import parseTorrent from 'parse-torrent' | 2 | import parseTorrent from 'parse-torrent' |
3 | import { join } from 'path' | ||
4 | import * as Sequelize from 'sequelize' | ||
12 | import { logger } from '@server/helpers/logger' | 5 | import { logger } from '@server/helpers/logger' |
6 | import { createTorrentPromise } from '@server/helpers/webtorrent' | ||
7 | import { CONFIG } from '@server/initializers/config' | ||
8 | import { HLS_STREAMING_PLAYLIST_DIRECTORY, STATIC_PATHS, WEBSERVER } from '@server/initializers/constants' | ||
9 | import { initDatabaseModels, sequelizeTypescript } from '../../server/initializers/database' | ||
13 | 10 | ||
14 | run() | 11 | run() |
15 | .then(() => process.exit(0)) | 12 | .then(() => process.exit(0)) |
diff --git a/scripts/migrations/peertube-4.0.ts b/scripts/migrations/peertube-4.0.ts index abf431888..64cf45474 100644 --- a/scripts/migrations/peertube-4.0.ts +++ b/scripts/migrations/peertube-4.0.ts | |||
@@ -1,16 +1,13 @@ | |||
1 | import { registerTSPaths } from '../../server/helpers/register-ts-paths' | 1 | import Bluebird from 'bluebird' |
2 | registerTSPaths() | 2 | import { move, readFile, writeFile } from 'fs-extra' |
3 | |||
4 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' | ||
5 | import { JobQueue } from '@server/lib/job-queue' | 5 | import { JobQueue } from '@server/lib/job-queue' |
6 | import { initDatabaseModels } from '../../server/initializers/database' | ||
7 | import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getHlsResolutionPlaylistFilename } from '@server/lib/paths' | 6 | import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getHlsResolutionPlaylistFilename } from '@server/lib/paths' |
8 | import { VideoPathManager } from '@server/lib/video-path-manager' | 7 | import { VideoPathManager } from '@server/lib/video-path-manager' |
9 | import { VideoModel } from '@server/models/video/video' | 8 | import { VideoModel } from '@server/models/video/video' |
10 | import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' | 9 | import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' |
11 | import { move, readFile, writeFile } from 'fs-extra' | 10 | import { initDatabaseModels } from '../../server/initializers/database' |
12 | import Bluebird from 'bluebird' | ||
13 | import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' | ||
14 | 11 | ||
15 | run() | 12 | run() |
16 | .then(() => process.exit(0)) | 13 | .then(() => process.exit(0)) |
diff --git a/scripts/nightly.sh b/scripts/nightly.sh index 5ad603929..572277f9d 100755 --- a/scripts/nightly.sh +++ b/scripts/nightly.sh | |||
@@ -32,7 +32,7 @@ sed -i 's/"version": "\([^"]\+\)"/"version": "\1-'"$nightly_version"'"/' ./packa | |||
32 | "$directory_name/client/package.json" "$directory_name/config" \ | 32 | "$directory_name/client/package.json" "$directory_name/config" \ |
33 | "$directory_name/dist" "$directory_name/package.json" \ | 33 | "$directory_name/dist" "$directory_name/package.json" \ |
34 | "$directory_name/scripts" "$directory_name/support" \ | 34 | "$directory_name/scripts" "$directory_name/support" \ |
35 | "$directory_name/tsconfig.json" "$directory_name/yarn.lock") | 35 | "$directory_name/yarn.lock") |
36 | 36 | ||
37 | # temporary setup | 37 | # temporary setup |
38 | cd .. | 38 | cd .. |
diff --git a/scripts/parse-log.ts b/scripts/parse-log.ts index 6cd3a1860..d3c93cee5 100755 --- a/scripts/parse-log.ts +++ b/scripts/parse-log.ts | |||
@@ -1,15 +1,12 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { program } from 'commander' | 1 | import { program } from 'commander' |
5 | import { createReadStream, readdir } from 'fs-extra' | 2 | import { createReadStream, readdir } from 'fs-extra' |
6 | import { join } from 'path' | 3 | import { join } from 'path' |
7 | import { createInterface } from 'readline' | 4 | import { createInterface } from 'readline' |
5 | import { format as sqlFormat } from 'sql-formatter' | ||
6 | import { inspect } from 'util' | ||
8 | import * as winston from 'winston' | 7 | import * as winston from 'winston' |
9 | import { labelFormatter, mtimeSortFilesDesc } from '../server/helpers/logger' | 8 | import { labelFormatter, mtimeSortFilesDesc } from '../server/helpers/logger' |
10 | import { CONFIG } from '../server/initializers/config' | 9 | import { CONFIG } from '../server/initializers/config' |
11 | import { inspect } from 'util' | ||
12 | import { format as sqlFormat } from 'sql-formatter' | ||
13 | 10 | ||
14 | program | 11 | program |
15 | .option('-l, --level [level]', 'Level log (debug/info/warn/error)') | 12 | .option('-l, --level [level]', 'Level log (debug/info/warn/error)') |
diff --git a/scripts/plugin/install.ts b/scripts/plugin/install.ts index de045c2d2..0795d7c93 100755 --- a/scripts/plugin/install.ts +++ b/scripts/plugin/install.ts | |||
@@ -1,10 +1,7 @@ | |||
1 | import { registerTSPaths } from '../../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { initDatabaseModels } from '../../server/initializers/database' | ||
5 | import { program } from 'commander' | 1 | import { program } from 'commander' |
6 | import { PluginManager } from '../../server/lib/plugins/plugin-manager' | ||
7 | import { isAbsolute } from 'path' | 2 | import { isAbsolute } from 'path' |
3 | import { initDatabaseModels } from '../../server/initializers/database' | ||
4 | import { PluginManager } from '../../server/lib/plugins/plugin-manager' | ||
8 | 5 | ||
9 | program | 6 | program |
10 | .option('-n, --npm-name [npmName]', 'Plugin to install') | 7 | .option('-n, --npm-name [npmName]', 'Plugin to install') |
diff --git a/scripts/plugin/uninstall.ts b/scripts/plugin/uninstall.ts index 1e14cc18f..152b651dd 100755 --- a/scripts/plugin/uninstall.ts +++ b/scripts/plugin/uninstall.ts | |||
@@ -1,8 +1,5 @@ | |||
1 | import { registerTSPaths } from '../../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { initDatabaseModels } from '../../server/initializers/database' | ||
5 | import { program } from 'commander' | 1 | import { program } from 'commander' |
2 | import { initDatabaseModels } from '../../server/initializers/database' | ||
6 | import { PluginManager } from '../../server/lib/plugins/plugin-manager' | 3 | import { PluginManager } from '../../server/lib/plugins/plugin-manager' |
7 | 4 | ||
8 | program | 5 | program |
diff --git a/scripts/print-transcode-command.ts b/scripts/print-transcode-command.ts index 352145252..21667f544 100644 --- a/scripts/print-transcode-command.ts +++ b/scripts/print-transcode-command.ts | |||
@@ -1,10 +1,7 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { program } from 'commander' | 1 | import { program } from 'commander' |
5 | import ffmpeg from 'fluent-ffmpeg' | 2 | import ffmpeg from 'fluent-ffmpeg' |
6 | import { buildx264VODCommand, runCommand, TranscodeOptions } from '@server/helpers/ffmpeg-utils' | ||
7 | import { exit } from 'process' | 3 | import { exit } from 'process' |
4 | import { buildx264VODCommand, runCommand, TranscodeOptions } from '@server/helpers/ffmpeg-utils' | ||
8 | import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/video-transcoding-profiles' | 5 | import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/video-transcoding-profiles' |
9 | 6 | ||
10 | program | 7 | program |
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts index 9df80d503..bb1e8e024 100755 --- a/scripts/prune-storage.ts +++ b/scripts/prune-storage.ts | |||
@@ -1,21 +1,19 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | 1 | import { map } from 'bluebird' |
2 | registerTSPaths() | 2 | import { readdir, remove, stat } from 'fs-extra' |
3 | 3 | import { uniq, values } from 'lodash' | |
4 | import { start, get } from 'prompt' | 4 | import { basename, join } from 'path' |
5 | import { join, basename } from 'path' | 5 | import { get, start } from 'prompt' |
6 | import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' | ||
7 | import { VideoFileModel } from '@server/models/video/video-file' | ||
8 | import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' | ||
9 | import { ThumbnailType } from '@shared/models' | ||
10 | import { getUUIDFromFilename } from '../server/helpers/utils' | ||
6 | import { CONFIG } from '../server/initializers/config' | 11 | import { CONFIG } from '../server/initializers/config' |
7 | import { VideoModel } from '../server/models/video/video' | ||
8 | import { initDatabaseModels } from '../server/initializers/database' | 12 | import { initDatabaseModels } from '../server/initializers/database' |
9 | import { readdir, remove, stat } from 'fs-extra' | 13 | import { ActorImageModel } from '../server/models/actor/actor-image' |
10 | import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy' | 14 | import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy' |
11 | import { map } from 'bluebird' | ||
12 | import { getUUIDFromFilename } from '../server/helpers/utils' | ||
13 | import { ThumbnailModel } from '../server/models/video/thumbnail' | 15 | import { ThumbnailModel } from '../server/models/video/thumbnail' |
14 | import { ActorImageModel } from '../server/models/actor/actor-image' | 16 | import { VideoModel } from '../server/models/video/video' |
15 | import { uniq, values } from 'lodash' | ||
16 | import { ThumbnailType } from '@shared/models' | ||
17 | import { VideoFileModel } from '@server/models/video/video-file' | ||
18 | import { HLS_REDUNDANCY_DIRECTORY } from '@server/initializers/constants' | ||
19 | 17 | ||
20 | run() | 18 | run() |
21 | .then(() => process.exit(0)) | 19 | .then(() => process.exit(0)) |
@@ -40,6 +38,9 @@ async function run () { | |||
40 | 38 | ||
41 | toDelete = toDelete.concat( | 39 | toDelete = toDelete.concat( |
42 | await pruneDirectory(CONFIG.STORAGE.VIDEOS_DIR, doesWebTorrentFileExist()), | 40 | await pruneDirectory(CONFIG.STORAGE.VIDEOS_DIR, doesWebTorrentFileExist()), |
41 | |||
42 | await pruneDirectory(HLS_STREAMING_PLAYLIST_DIRECTORY, doesHLSPlaylistExist()), | ||
43 | |||
43 | await pruneDirectory(CONFIG.STORAGE.TORRENTS_DIR, doesTorrentFileExist()), | 44 | await pruneDirectory(CONFIG.STORAGE.TORRENTS_DIR, doesTorrentFileExist()), |
44 | 45 | ||
45 | await pruneDirectory(CONFIG.STORAGE.REDUNDANCY_DIR, doesRedundancyExist), | 46 | await pruneDirectory(CONFIG.STORAGE.REDUNDANCY_DIR, doesRedundancyExist), |
@@ -94,6 +95,10 @@ function doesWebTorrentFileExist () { | |||
94 | return (filePath: string) => VideoFileModel.doesOwnedWebTorrentVideoFileExist(basename(filePath)) | 95 | return (filePath: string) => VideoFileModel.doesOwnedWebTorrentVideoFileExist(basename(filePath)) |
95 | } | 96 | } |
96 | 97 | ||
98 | function doesHLSPlaylistExist () { | ||
99 | return (hlsPath: string) => VideoStreamingPlaylistModel.doesOwnedHLSPlaylistExist(basename(hlsPath)) | ||
100 | } | ||
101 | |||
97 | function doesTorrentFileExist () { | 102 | function doesTorrentFileExist () { |
98 | return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath)) | 103 | return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath)) |
99 | } | 104 | } |
diff --git a/scripts/regenerate-thumbnails.ts b/scripts/regenerate-thumbnails.ts index 50d06f6fd..a377baa61 100644 --- a/scripts/regenerate-thumbnails.ts +++ b/scripts/regenerate-thumbnails.ts | |||
@@ -1,13 +1,10 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { map } from 'bluebird' | 1 | import { map } from 'bluebird' |
5 | import { program } from 'commander' | 2 | import { program } from 'commander' |
6 | import { pathExists, remove } from 'fs-extra' | 3 | import { pathExists, remove } from 'fs-extra' |
7 | import { generateImageFilename, processImage } from '@server/helpers/image-utils' | 4 | import { generateImageFilename, processImage } from '@server/helpers/image-utils' |
8 | import { THUMBNAILS_SIZE } from '@server/initializers/constants' | 5 | import { THUMBNAILS_SIZE } from '@server/initializers/constants' |
9 | import { VideoModel } from '@server/models/video/video' | ||
10 | import { initDatabaseModels } from '@server/initializers/database' | 6 | import { initDatabaseModels } from '@server/initializers/database' |
7 | import { VideoModel } from '@server/models/video/video' | ||
11 | 8 | ||
12 | program | 9 | program |
13 | .description('Regenerate local thumbnails using preview files') | 10 | .description('Regenerate local thumbnails using preview files') |
diff --git a/scripts/release.sh b/scripts/release.sh index 6423d17ee..313087a29 100755 --- a/scripts/release.sh +++ b/scripts/release.sh | |||
@@ -76,7 +76,7 @@ rm -f "./client/dist/embed-stats.json" | |||
76 | "$directory_name/client/package.json" "$directory_name/config" \ | 76 | "$directory_name/client/package.json" "$directory_name/config" \ |
77 | "$directory_name/dist" "$directory_name/package.json" \ | 77 | "$directory_name/dist" "$directory_name/package.json" \ |
78 | "$directory_name/scripts" "$directory_name/support" \ | 78 | "$directory_name/scripts" "$directory_name/support" \ |
79 | "$directory_name/tsconfig.json" "$directory_name/yarn.lock") | 79 | "$directory_name/yarn.lock") |
80 | 80 | ||
81 | # temporary setup | 81 | # temporary setup |
82 | cd .. | 82 | cd .. |
@@ -118,3 +118,8 @@ rm -f "./client/dist/embed-stats.json" | |||
118 | git checkout "$branch" | 118 | git checkout "$branch" |
119 | fi | 119 | fi |
120 | ) | 120 | ) |
121 | |||
122 | # Release types package | ||
123 | npm run generate-types-package | ||
124 | cd types/dist | ||
125 | npm publish --access public | ||
diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts index 4c45396d4..b2e5639fb 100755 --- a/scripts/reset-password.ts +++ b/scripts/reset-password.ts | |||
@@ -1,10 +1,7 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import { program } from 'commander' | 1 | import { program } from 'commander' |
2 | import { isUserPasswordValid } from '../server/helpers/custom-validators/users' | ||
5 | import { initDatabaseModels } from '../server/initializers/database' | 3 | import { initDatabaseModels } from '../server/initializers/database' |
6 | import { UserModel } from '../server/models/user/user' | 4 | import { UserModel } from '../server/models/user/user' |
7 | import { isUserPasswordValid } from '../server/helpers/custom-validators/users' | ||
8 | 5 | ||
9 | program | 6 | program |
10 | .option('-u, --user [user]', 'User') | 7 | .option('-u, --user [user]', 'User') |
diff --git a/scripts/setup/cli.sh b/scripts/setup/cli.sh index ea327e5a1..f84260f23 100755 --- a/scripts/setup/cli.sh +++ b/scripts/setup/cli.sh | |||
@@ -9,8 +9,10 @@ rm -rf ./dist/server/tools/ | |||
9 | ( | 9 | ( |
10 | cd ./server/tools | 10 | cd ./server/tools |
11 | yarn install --pure-lockfile | 11 | yarn install --pure-lockfile |
12 | ../../node_modules/.bin/tsc --build --verbose | ||
12 | ) | 13 | ) |
13 | 14 | ||
14 | npm run tsc -- --build ./server/tools/tsconfig.json | ||
15 | cp -r "./server/tools/node_modules" "./dist/server/tools" | 15 | cp -r "./server/tools/node_modules" "./dist/server/tools" |
16 | cp "./tsconfig.json" "./dist" | 16 | |
17 | npm run resolve-tspaths:cli | ||
18 | npm run resolve-tspaths:server | ||
diff --git a/scripts/test.sh b/scripts/test.sh index 2dc79c6ce..4d1d8720a 100755 --- a/scripts/test.sh +++ b/scripts/test.sh | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | set -eu | 3 | set -eu |
4 | 4 | ||
5 | npm run ci -- types | ||
5 | npm run ci -- client | 6 | npm run ci -- client |
6 | npm run ci -- cli-plugin | 7 | npm run ci -- cli-plugin |
7 | npm run ci -- api-1 | 8 | npm run ci -- api-1 |
diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json new file mode 100644 index 000000000..0cfd927a6 --- /dev/null +++ b/scripts/tsconfig.json | |||
@@ -0,0 +1,10 @@ | |||
1 | { | ||
2 | "extends": "../tsconfig.base.json", | ||
3 | "compilerOptions": { | ||
4 | "outDir": "../dist/scripts" | ||
5 | }, | ||
6 | "references": [ | ||
7 | { "path": "../shared" }, | ||
8 | { "path": "../server" } | ||
9 | ] | ||
10 | } | ||
diff --git a/scripts/update-host.ts b/scripts/update-host.ts index c6eb9d533..bb54290a4 100755 --- a/scripts/update-host.ts +++ b/scripts/update-host.ts | |||
@@ -1,10 +1,7 @@ | |||
1 | import { registerTSPaths } from '../server/helpers/register-ts-paths' | 1 | import { updateTorrentMetadata } from '@server/helpers/webtorrent' |
2 | registerTSPaths() | 2 | import { getServerActor } from '@server/models/application/application' |
3 | |||
4 | import { WEBSERVER } from '../server/initializers/constants' | 3 | import { WEBSERVER } from '../server/initializers/constants' |
5 | import { ActorFollowModel } from '../server/models/actor/actor-follow' | 4 | import { initDatabaseModels } from '../server/initializers/database' |
6 | import { VideoModel } from '../server/models/video/video' | ||
7 | import { ActorModel } from '../server/models/actor/actor' | ||
8 | import { | 5 | import { |
9 | getLocalAccountActivityPubUrl, | 6 | getLocalAccountActivityPubUrl, |
10 | getLocalVideoActivityPubUrl, | 7 | getLocalVideoActivityPubUrl, |
@@ -12,13 +9,13 @@ import { | |||
12 | getLocalVideoChannelActivityPubUrl, | 9 | getLocalVideoChannelActivityPubUrl, |
13 | getLocalVideoCommentActivityPubUrl | 10 | getLocalVideoCommentActivityPubUrl |
14 | } from '../server/lib/activitypub/url' | 11 | } from '../server/lib/activitypub/url' |
15 | import { VideoShareModel } from '../server/models/video/video-share' | ||
16 | import { VideoCommentModel } from '../server/models/video/video-comment' | ||
17 | import { AccountModel } from '../server/models/account/account' | 12 | import { AccountModel } from '../server/models/account/account' |
13 | import { ActorModel } from '../server/models/actor/actor' | ||
14 | import { ActorFollowModel } from '../server/models/actor/actor-follow' | ||
15 | import { VideoModel } from '../server/models/video/video' | ||
18 | import { VideoChannelModel } from '../server/models/video/video-channel' | 16 | import { VideoChannelModel } from '../server/models/video/video-channel' |
19 | import { initDatabaseModels } from '../server/initializers/database' | 17 | import { VideoCommentModel } from '../server/models/video/video-comment' |
20 | import { updateTorrentUrls } from '@server/helpers/webtorrent' | 18 | import { VideoShareModel } from '../server/models/video/video-share' |
21 | import { getServerActor } from '@server/models/application/application' | ||
22 | 19 | ||
23 | run() | 20 | run() |
24 | .then(() => process.exit(0)) | 21 | .then(() => process.exit(0)) |
@@ -126,7 +123,7 @@ async function run () { | |||
126 | 123 | ||
127 | for (const file of video.VideoFiles) { | 124 | for (const file of video.VideoFiles) { |
128 | console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid) | 125 | console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid) |
129 | await updateTorrentUrls(video, file) | 126 | await updateTorrentMetadata(video, file) |
130 | 127 | ||
131 | await file.save() | 128 | await file.save() |
132 | } | 129 | } |
@@ -135,7 +132,7 @@ async function run () { | |||
135 | for (const file of (playlist?.VideoFiles || [])) { | 132 | for (const file of (playlist?.VideoFiles || [])) { |
136 | console.log('Updating fragmented torrent file %s of video %s.', file.resolution, video.uuid) | 133 | console.log('Updating fragmented torrent file %s of video %s.', file.resolution, video.uuid) |
137 | 134 | ||
138 | await updateTorrentUrls(video, file) | 135 | await updateTorrentMetadata(playlist, file) |
139 | 136 | ||
140 | await file.save() | 137 | await file.save() |
141 | } | 138 | } |