aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/create-import-video-file-job.ts3
-rwxr-xr-xscripts/create-transcoding-job.ts3
-rw-r--r--scripts/danger/clean/cleaner.ts3
-rwxr-xr-xscripts/generate-code-contributors.ts3
-rwxr-xr-xscripts/i18n/create-custom-files.ts3
-rwxr-xr-xscripts/i18n/xliff2json.ts3
-rw-r--r--scripts/optimize-old-videos.ts3
-rwxr-xr-xscripts/parse-log.ts3
-rwxr-xr-xscripts/plugin/install.ts3
-rwxr-xr-xscripts/plugin/uninstall.ts4
-rwxr-xr-xscripts/prune-storage.ts3
-rwxr-xr-xscripts/reset-password.ts3
-rwxr-xr-xscripts/update-host.ts3
-rw-r--r--server.ts11
-rw-r--r--server/helpers/register-ts-paths.ts16
-rw-r--r--server/tools/peertube-auth.ts3
-rw-r--r--server/tools/peertube-get-access-token.ts3
-rw-r--r--server/tools/peertube-import-videos.ts3
-rw-r--r--server/tools/peertube-plugins.ts3
-rw-r--r--server/tools/peertube-repl.ts3
-rw-r--r--server/tools/peertube-upload.ts3
-rw-r--r--server/tools/peertube-watch.ts3
-rw-r--r--server/tools/peertube.ts3
23 files changed, 82 insertions, 9 deletions
diff --git a/scripts/create-import-video-file-job.ts b/scripts/create-import-video-file-job.ts
index 2b636014a..204337d55 100644
--- a/scripts/create-import-video-file-job.ts
+++ b/scripts/create-import-video-file-job.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import * as program from 'commander' 4import * as program from 'commander'
2import { resolve } from 'path' 5import { resolve } from 'path'
3import { VideoModel } from '../server/models/video/video' 6import { VideoModel } from '../server/models/video/video'
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts
index 2eb872169..67a270a86 100755
--- a/scripts/create-transcoding-job.ts
+++ b/scripts/create-transcoding-job.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import * as program from 'commander' 4import * as program from 'commander'
2import { VideoModel } from '../server/models/video/video' 5import { VideoModel } from '../server/models/video/video'
3import { initDatabaseModels } from '../server/initializers' 6import { initDatabaseModels } from '../server/initializers'
diff --git a/scripts/danger/clean/cleaner.ts b/scripts/danger/clean/cleaner.ts
index d575af283..ed35ef79f 100644
--- a/scripts/danger/clean/cleaner.ts
+++ b/scripts/danger/clean/cleaner.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../../../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import * as Promise from 'bluebird' 4import * as Promise from 'bluebird'
2import * as rimraf from 'rimraf' 5import * as rimraf from 'rimraf'
3import { initDatabaseModels, sequelizeTypescript } from '../../../server/initializers' 6import { initDatabaseModels, sequelizeTypescript } from '../../../server/initializers'
diff --git a/scripts/generate-code-contributors.ts b/scripts/generate-code-contributors.ts
index c745b1cb2..8493d3d0c 100755
--- a/scripts/generate-code-contributors.ts
+++ b/scripts/generate-code-contributors.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import { doRequest } from '../server/helpers/requests' 4import { doRequest } from '../server/helpers/requests'
2import { readFileSync } from 'fs-extra' 5import { readFileSync } from 'fs-extra'
3 6
diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.ts
index 95897afa3..e946b8fd6 100755
--- a/scripts/i18n/create-custom-files.ts
+++ b/scripts/i18n/create-custom-files.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import * as jsToXliff12 from 'xliff/jsToXliff12' 4import * as jsToXliff12 from 'xliff/jsToXliff12'
2import { writeFile } from 'fs-extra' 5import { writeFile } from 'fs-extra'
3import { join } from 'path' 6import { join } from 'path'
diff --git a/scripts/i18n/xliff2json.ts b/scripts/i18n/xliff2json.ts
index 7e6de2893..68fc95f34 100755
--- a/scripts/i18n/xliff2json.ts
+++ b/scripts/i18n/xliff2json.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import * as xliff12ToJs from 'xliff/xliff12ToJs' 4import * as xliff12ToJs from 'xliff/xliff12ToJs'
2import { readFileSync, unlink, writeFile } from 'fs-extra' 5import { readFileSync, unlink, writeFile } from 'fs-extra'
3import { join } from 'path' 6import { join } from 'path'
diff --git a/scripts/optimize-old-videos.ts b/scripts/optimize-old-videos.ts
index 0b0e6037e..eb61ec43c 100644
--- a/scripts/optimize-old-videos.ts
+++ b/scripts/optimize-old-videos.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import { VIDEO_TRANSCODING_FPS } from '../server/initializers/constants' 4import { VIDEO_TRANSCODING_FPS } from '../server/initializers/constants'
2import { getDurationFromVideoFile, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../server/helpers/ffmpeg-utils' 5import { getDurationFromVideoFile, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../server/helpers/ffmpeg-utils'
3import { getMaxBitrate } from '../shared/models/videos' 6import { getMaxBitrate } from '../shared/models/videos'
diff --git a/scripts/parse-log.ts b/scripts/parse-log.ts
index 83ad45b72..9e6653ca3 100755
--- a/scripts/parse-log.ts
+++ b/scripts/parse-log.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import * as program from 'commander' 4import * as program from 'commander'
2import { createReadStream, readdir } from 'fs-extra' 5import { createReadStream, readdir } from 'fs-extra'
3import { join } from 'path' 6import { join } from 'path'
diff --git a/scripts/plugin/install.ts b/scripts/plugin/install.ts
index 5d7fe4ba0..54738f50f 100755
--- a/scripts/plugin/install.ts
+++ b/scripts/plugin/install.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import { initDatabaseModels } from '../../server/initializers/database' 4import { initDatabaseModels } from '../../server/initializers/database'
2import * as program from 'commander' 5import * as program from 'commander'
3import { PluginManager } from '../../server/lib/plugins/plugin-manager' 6import { PluginManager } from '../../server/lib/plugins/plugin-manager'
diff --git a/scripts/plugin/uninstall.ts b/scripts/plugin/uninstall.ts
index b5e1ddea2..c56f18466 100755
--- a/scripts/plugin/uninstall.ts
+++ b/scripts/plugin/uninstall.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import { initDatabaseModels } from '../../server/initializers/database' 4import { initDatabaseModels } from '../../server/initializers/database'
2import * as program from 'commander' 5import * as program from 'commander'
3import { PluginManager } from '../../server/lib/plugins/plugin-manager' 6import { PluginManager } from '../../server/lib/plugins/plugin-manager'
@@ -19,6 +22,7 @@ run()
19 }) 22 })
20 23
21async function run () { 24async function run () {
25
22 await initDatabaseModels(true) 26 await initDatabaseModels(true)
23 27
24 const toUninstall = program['npmName'] 28 const toUninstall = program['npmName']
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts
index df4bdeebe..c8968013b 100755
--- a/scripts/prune-storage.ts
+++ b/scripts/prune-storage.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import * as prompt from 'prompt' 4import * as prompt from 'prompt'
2import { join } from 'path' 5import { join } from 'path'
3import { CONFIG } from '../server/initializers/config' 6import { CONFIG } from '../server/initializers/config'
diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts
index 4a9037280..6126c3cd0 100755
--- a/scripts/reset-password.ts
+++ b/scripts/reset-password.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import * as program from 'commander' 4import * as program from 'commander'
2import { initDatabaseModels } from '../server/initializers' 5import { initDatabaseModels } from '../server/initializers'
3import { UserModel } from '../server/models/account/user' 6import { UserModel } from '../server/models/account/user'
diff --git a/scripts/update-host.ts b/scripts/update-host.ts
index 57919b998..a946d2e42 100755
--- a/scripts/update-host.ts
+++ b/scripts/update-host.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../server/helpers/register-ts-paths'
2registerTSPaths()
3
1import { WEBSERVER } from '../server/initializers/constants' 4import { WEBSERVER } from '../server/initializers/constants'
2import { ActorFollowModel } from '../server/models/activitypub/actor-follow' 5import { ActorFollowModel } from '../server/models/activitypub/actor-follow'
3import { VideoModel } from '../server/models/video/video' 6import { VideoModel } from '../server/models/video/video'
diff --git a/server.ts b/server.ts
index b49d10344..b2541eed6 100644
--- a/server.ts
+++ b/server.ts
@@ -1,13 +1,6 @@
1import { resolve } from 'path' 1import { registerTSPaths } from './server/helpers/register-ts-paths'
2 2
3const tsConfig = require('./tsconfig.json') 3registerTSPaths()
4const tsConfigPaths = require('tsconfig-paths')
5
6// Thanks: https://github.com/dividab/tsconfig-paths/issues/75#issuecomment-458936883
7tsConfigPaths.register({
8 baseUrl: resolve(tsConfig.compilerOptions.baseUrl || '', tsConfig.compilerOptions.outDir || ''),
9 paths: tsConfig.compilerOptions.paths
10})
11 4
12// FIXME: https://github.com/nodejs/node/pull/16853 5// FIXME: https://github.com/nodejs/node/pull/16853
13require('tls').DEFAULT_ECDH_CURVE = 'auto' 6require('tls').DEFAULT_ECDH_CURVE = 'auto'
diff --git a/server/helpers/register-ts-paths.ts b/server/helpers/register-ts-paths.ts
new file mode 100644
index 000000000..e8db369e3
--- /dev/null
+++ b/server/helpers/register-ts-paths.ts
@@ -0,0 +1,16 @@
1import { resolve } from 'path'
2const tsConfigPaths = require('tsconfig-paths')
3
4const tsConfig = require('../../tsconfig.json')
5
6function registerTSPaths () {
7 // Thanks: https://github.com/dividab/tsconfig-paths/issues/75#issuecomment-458936883
8 tsConfigPaths.register({
9 baseUrl: resolve(tsConfig.compilerOptions.baseUrl || '', tsConfig.compilerOptions.outDir || ''),
10 paths: tsConfig.compilerOptions.paths
11 })
12}
13
14export {
15 registerTSPaths
16}
diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.ts
index b5ecbd470..6597a5c36 100644
--- a/server/tools/peertube-auth.ts
+++ b/server/tools/peertube-auth.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
1import * as program from 'commander' 4import * as program from 'commander'
2import * as prompt from 'prompt' 5import * as prompt from 'prompt'
3import { getNetrc, getSettings, writeSettings } from './cli' 6import { getNetrc, getSettings, writeSettings } from './cli'
diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts
index 103495347..6d47d8922 100644
--- a/server/tools/peertube-get-access-token.ts
+++ b/server/tools/peertube-get-access-token.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
1import * as program from 'commander' 4import * as program from 'commander'
2import { getClient, Server, serverLogin } from '../../shared/extra-utils' 5import { getClient, Server, serverLogin } from '../../shared/extra-utils'
3 6
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index fcb90cca3..39184f46d 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
1// FIXME: https://github.com/nodejs/node/pull/16853 4// FIXME: https://github.com/nodejs/node/pull/16853
2require('tls').DEFAULT_ECDH_CURVE = 'auto' 5require('tls').DEFAULT_ECDH_CURVE = 'auto'
3 6
diff --git a/server/tools/peertube-plugins.ts b/server/tools/peertube-plugins.ts
index 20254b3b4..e40606107 100644
--- a/server/tools/peertube-plugins.ts
+++ b/server/tools/peertube-plugins.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
1import * as program from 'commander' 4import * as program from 'commander'
2import { PluginType } from '../../shared/models/plugins/plugin.type' 5import { PluginType } from '../../shared/models/plugins/plugin.type'
3import { getAccessToken } from '../../shared/extra-utils/users/login' 6import { getAccessToken } from '../../shared/extra-utils/users/login'
diff --git a/server/tools/peertube-repl.ts b/server/tools/peertube-repl.ts
index fbdec1613..ab6e215d9 100644
--- a/server/tools/peertube-repl.ts
+++ b/server/tools/peertube-repl.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
1import * as repl from 'repl' 4import * as repl from 'repl'
2import * as path from 'path' 5import * as path from 'path'
3import * as _ from 'lodash' 6import * as _ from 'lodash'
diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts
index 4569cbb85..f604c9bee 100644
--- a/server/tools/peertube-upload.ts
+++ b/server/tools/peertube-upload.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
1import * as program from 'commander' 4import * as program from 'commander'
2import { access, constants } from 'fs-extra' 5import { access, constants } from 'fs-extra'
3import { isAbsolute } from 'path' 6import { isAbsolute } from 'path'
diff --git a/server/tools/peertube-watch.ts b/server/tools/peertube-watch.ts
index 7c27c1364..9ac1d05f9 100644
--- a/server/tools/peertube-watch.ts
+++ b/server/tools/peertube-watch.ts
@@ -1,3 +1,6 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
1import * as program from 'commander' 4import * as program from 'commander'
2import { join } from 'path' 5import { join } from 'path'
3import { execSync } from 'child_process' 6import { execSync } from 'child_process'
diff --git a/server/tools/peertube.ts b/server/tools/peertube.ts
index ddfe5b771..fc85c4210 100644
--- a/server/tools/peertube.ts
+++ b/server/tools/peertube.ts
@@ -1,5 +1,8 @@
1#!/usr/bin/env node 1#!/usr/bin/env node
2 2
3import { registerTSPaths } from '../helpers/register-ts-paths'
4registerTSPaths()
5
3import * as program from 'commander' 6import * as program from 'commander'
4import { 7import {
5 version, 8 version,