ActivityPub-federated video streaming platform using P2P directly in your web browser
Migrate server to ESM
Chocobozzz3a4992633ee6
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 4e80ff2246..3bfdee6ebf 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -1,5 +1,6 @@{"extends": "standard-with-typescript",+ "root": true,"rules": {"eol-last": ["error",@@ -126,18 +127,20 @@]},"ignorePatterns": [- "node_modules/",- "server/tests/fixtures"+ "node_modules",+ "packages/tests/fixtures",+ "apps/**/dist",+ "packages/**/dist",+ "server/dist",+ "packages/types-generator/tests",+ "*.js",+ "/client",+ "/dist"],"parserOptions": {- "EXPERIMENTAL_useSourceOfProjectReferenceRedirect": true,"project": [- "./tsconfig.json",- "./shared/tsconfig.json",- "./scripts/tsconfig.json",- "./server/tsconfig.json",- "./server/tools/tsconfig.json",- "./packages/peertube-runner/tsconfig.json"- ]+ "./tsconfig.eslint.json"+ ],+ "EXPERIMENTAL_useSourceOfProjectReferenceRedirect": true}}diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.mdindex 80b7cba3c5..16863eceb8 100644--- a/.github/CONTRIBUTING.md+++ b/.github/CONTRIBUTING.md@@ -53,13 +53,25 @@ interested in, user interface, design, decentralized architecture...You can help to write the documentation of the REST API, code, architecture,demonstrations.-For the REST API you can see the documentation in [/support/doc/api](https://github.com/Chocobozzz/PeerTube/tree/develop/support/doc/api) directory.-Then, you can just open the `openapi.yaml` file in a special editor like [http://editor.swagger.io/](http://editor.swagger.io/) to easily see and edit the documentation. You can also use [redoc-cli](https://github.com/Redocly/redoc/blob/master/cli/README.md) and run `redoc-cli serve --watch support/doc/api/openapi.yaml` to see the final result.+### User documentation++The official user documentation is available on https://docs.joinpeertube.org/++You can update it by writing markdown files in the following repository: https://framagit.org/framasoft/peertube/documentation/++### REST API documentation++The [REST API documentation](https://docs.joinpeertube.org/api-rest-reference.html) is generated from `support/doc/api/openapi.yaml` file.+To quickly get a preview of your changes, you can generate the documentation *on the fly* using the following command:++```+npx @redocly/cli preview-docs ./support/doc/api/openapi.yaml+```Some hints:- * Routes are defined in [/server/controllers/](https://github.com/Chocobozzz/PeerTube/tree/develop/server/controllers) directory- * Parameters validators are defined in [/server/middlewares/validators](https://github.com/Chocobozzz/PeerTube/tree/develop/server/middlewares/validators) directory- * Models sent/received by the controllers are defined in [/shared/models](https://github.com/Chocobozzz/PeerTube/tree/develop/shared/models) directory+ * Routes are defined in [/server/server/controllers/](https://github.com/Chocobozzz/PeerTube/tree/develop/server/server/controllers) directory+ * Parameters validators are defined in [/server/server/middlewares/validators](https://github.com/Chocobozzz/PeerTube/tree/develop/server/server/middlewares/validators) directory+ * Models sent/received by the controllers are defined in [/packages/models](https://github.com/Chocobozzz/PeerTube/tree/develop/packages/models) directory## Improve the website@@ -242,15 +254,6 @@ To test emails with PeerTube:* Run [mailslurper](http://mailslurper.com/)* Run PeerTube using mailslurper SMTP port: `NODE_CONFIG='{ "smtp": { "hostname": "localhost", "port": 2500, "tls": false } }' NODE_ENV=dev node dist/server`-### OpenAPI documentation--The [REST API documentation](https://docs.joinpeertube.org/api-rest-reference.html) is generated from `support/doc/api/openapi.yaml` file.-To quickly get a preview of your changes, you can generate the documentation *on the fly* using the following command:--```-npx @redocly/cli preview-docs ./support/doc/api/openapi.yaml-```-### Environment variablesPeerTube can be configured using environment variables.diff --git a/.github/actions/reusable-prepare-peertube-build/action.yml b/.github/actions/reusable-prepare-peertube-build/action.ymlindex 03034f6cc9..13e22ceb47 100644--- a/.github/actions/reusable-prepare-peertube-build/action.yml+++ b/.github/actions/reusable-prepare-peertube-build/action.yml@@ -32,4 +32,12 @@ runs:- name: Install peertube runner dependenciesshell: bash- run: cd packages/peertube-runner && yarn install --frozen-lockfile+ run: cd apps/peertube-runner && yarn install --frozen-lockfile++ - name: Install peertube CLI dependencies+ shell: bash+ run: cd apps/peertube-cli && yarn install --frozen-lockfile++ - name: Display PeerTube dependencies+ shell: bash+ run: ls -l node_modules/@peertubediff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.ymlindex ab1780c740..5f56db3ad9 100644--- a/.github/workflows/benchmark.yml+++ b/.github/workflows/benchmark.yml@@ -71,7 +71,7 @@ jobs:- name: Run benchmarkrun: |- node dist/scripts/benchmark.js -o benchmark.json+ npm run benchmark-server -- -o benchmark.json- name: Display resultrun: |diff --git a/.github/workflows/codeql/codeql-config.yml b/.github/workflows/codeql/codeql-config.ymlindex 8b771ae99b..c96a4693e5 100644--- a/.github/workflows/codeql/codeql-config.yml+++ b/.github/workflows/codeql/codeql-config.yml@@ -1,4 +1,4 @@name: "PeerTube CodeQL config"paths-ignore:- - server/tests+ - packages/testsdiff --git a/.github/workflows/stats.yml b/.github/workflows/stats.ymlindex e772fdb813..573b42975f 100644--- a/.github/workflows/stats.yml+++ b/.github/workflows/stats.yml@@ -36,12 +36,12 @@ jobs:run: |wget "https://github.com/boyter/scc/releases/download/v3.0.0/scc-3.0.0-x86_64-unknown-linux.zip"unzip "scc-3.0.0-x86_64-unknown-linux.zip"- ./scc --format=json --exclude-dir .git,node_modules,client/node_modules,client/dist,dist,yarn.lock,client/yarn.lock,client/src/locale,test1,test2,test3,client/src/assets/images,config,storage,server/tests/fixtures,support/openapi,.idea,.vscode,docker-volume,ffmpeg-3,ffmpeg-4 > ./scc.json+ ./scc --format=json --exclude-dir .git,node_modules,client/node_modules,client/dist,dist,yarn.lock,client/yarn.lock,client/src/locale,test1,test2,test3,client/src/assets/images,config,storage,packages/tests/fixtures,support/openapi,.idea,.vscode,docker-volume,ffmpeg-3,ffmpeg-4 > ./scc.json- name: PeerTube client statsif: github.event_name != 'pull_request'run: |- node dist/scripts/client-build-stats.js > client-build-stats.json+ npm run client:build-stats > client-build-stats.json- name: PeerTube client lighthouse reportif: github.event_name != 'pull_request'diff --git a/.gitignore b/.gitignoreindex e0004004dd..55707fb808 100644--- a/.gitignore+++ b/.gitignore@@ -1,8 +1,8 @@# NPM instalation-/node_modules/-/server/tools/node_modules+node_modules*npm-debug.logyarn-error.log+.yarn# Testing/test1/@@ -11,8 +11,8 @@ yarn-error.log/test4//test5//test6/-/server/tests/fixtures/video_high_bitrate_1080p.mp4-/server/tests/fixtures/video_59fps.mp4+/packages/tests/fixtures/video_high_bitrate_1080p.mp4+/packages/tests/fixtures/video_59fps.mp4# Production/storage@@ -49,12 +49,14 @@ yarn-error.log/*.tar.xz/*.asc*.DS_Store-/server/tools/import-mediacore.ts/docker-volume//init.mp4# TypeScript*.tsbuildinfo-# Packages-/packages/types/dist/+# EsLint+.eslintcache++# Compiled output+distdiff --git a/.mocharc.cjs b/.mocharc.cjsnew file mode 100644index 0000000000..88566cfcb1--- /dev/null+++ b/.mocharc.cjs@@ -0,0 +1,10 @@+process.env.ESBK_TSCONFIG_PATH = './packages/tests/tsconfig.json'++module.exports = {+ "node-option": [+ "loader=tsx",+ "no-warnings",+ "conditions=peertube:tsx"+ ],+ "timeout": 30000+}diff --git a/apps/peertube-cli/.npmignore b/apps/peertube-cli/.npmignorenew file mode 100644index 0000000000..af17b9f328--- /dev/null+++ b/apps/peertube-cli/.npmignore@@ -0,0 +1,4 @@+src+meta.json+tsconfig.json+scriptsdiff --git a/apps/peertube-cli/README.md b/apps/peertube-cli/README.mdnew file mode 100644index 0000000000..b5b3790905--- /dev/null+++ b/apps/peertube-cli/README.md@@ -0,0 +1,43 @@+# PeerTube CLI++## Usage++See https://docs.joinpeertube.org/maintain/tools#remote-tools++## Dev++## Install dependencies++```bash+cd peertube-root+yarn install --pure-lockfile+cd apps/peertube-cli && yarn install --pure-lockfile+```++## Develop++```bash+cd peertube-root+npm run dev:peertube-cli+```++## Build++```bash+cd peertube-root+npm run build:peertube-cli+```++## Run++```bash+cd peertube-root+node apps/peertube-cli/dist/peertube-cli.js --help+```++## Publish on NPM++```bash+cd peertube-root+(cd apps/peertube-cli && npm version patch) && npm run build:peertube-cli && (cd apps/peertube-cli && npm publish --access=public)+```diff --git a/apps/peertube-cli/package.json b/apps/peertube-cli/package.jsonnew file mode 100644index 0000000000..a78319be21--- /dev/null+++ b/apps/peertube-cli/package.json@@ -0,0 +1,19 @@+{+ "name": "@peertube/peertube-cli",+ "version": "1.0.1",+ "type": "module",+ "main": "dist/peertube.js",+ "bin": "dist/peertube.js",+ "engines": {+ "node": ">=16.x"+ },+ "scripts": {},+ "license": "AGPL-3.0",+ "private": false,+ "devDependencies": {+ "application-config": "^2.0.0",+ "cli-table3": "^0.6.0",+ "netrc-parser": "^3.1.6"+ },+ "dependencies": {}+}diff --git a/apps/peertube-cli/scripts/build.js b/apps/peertube-cli/scripts/build.jsnew file mode 100644index 0000000000..a9139acfae--- /dev/null+++ b/apps/peertube-cli/scripts/build.js@@ -0,0 +1,27 @@+import * as esbuild from 'esbuild'+import { readFileSync } from 'fs'++const packageJSON = JSON.parse(readFileSync(new URL('../package.json', import.meta.url)))++export const esbuildOptions = {+ entryPoints: [ './src/peertube.ts' ],+ bundle: true,+ platform: 'node',+ format: 'esm',+ target: 'node16',+ external: [+ './lib-cov/fluent-ffmpeg',+ 'pg-hstore'+ ],+ outfile: './dist/peertube.js',+ banner: {+ js: `const require = (await import("node:module")).createRequire(import.meta.url);` ++ `const __filename = (await import("node:url")).fileURLToPath(import.meta.url);` ++ `const __dirname = (await import("node:path")).dirname(__filename);`+ },+ define: {+ 'process.env.PACKAGE_VERSION': `'${packageJSON.version}'`+ }+}++await esbuild.build(esbuildOptions)diff --git a/apps/peertube-cli/scripts/watch.js b/apps/peertube-cli/scripts/watch.jsnew file mode 100644index 0000000000..94e57199ce--- /dev/null+++ b/apps/peertube-cli/scripts/watch.js@@ -0,0 +1,7 @@+import * as esbuild from 'esbuild'+import { esbuildOptions } from './build.js'++const context = await esbuild.context(esbuildOptions)++// Enable watch mode+await context.watch()diff --git a/apps/peertube-cli/src/peertube-auth.ts b/apps/peertube-cli/src/peertube-auth.tsnew file mode 100644index 0000000000..1d30207c74--- /dev/null+++ b/apps/peertube-cli/src/peertube-auth.ts@@ -0,0 +1,171 @@+import CliTable3 from 'cli-table3'+import prompt from 'prompt'+import { Command } from '@commander-js/extra-typings'+import { assignToken, buildServer, getNetrc, getSettings, writeSettings } from './shared/index.js'++export function defineAuthProgram () {+ const program = new Command()+ .name('auth')+ .description('Register your accounts on remote instances to use them with other commands')++ program+ .command('add')+ .description('remember your accounts on remote instances for easier use')+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .option('--default', 'add the entry as the new default')+ .action(options => {+ /* eslint-disable no-import-assign */+ prompt.override = options+ prompt.start()+ prompt.get({+ properties: {+ url: {+ description: 'instance url',+ conform: value => isURLaPeerTubeInstance(value),+ message: 'It should be an URL (https://peertube.example.com)',+ required: true+ },+ username: {+ conform: value => typeof value === 'string' && value.length !== 0,+ message: 'Name must be only letters, spaces, or dashes',+ required: true+ },+ password: {+ hidden: true,+ replace: '*',+ required: true+ }+ }+ }, async (_, result) => {++ // Check credentials+ try {+ // Strip out everything after the domain:port.+ // See https://github.com/Chocobozzz/PeerTube/issues/3520+ result.url = stripExtraneousFromPeerTubeUrl(result.url)++ const server = buildServer(result.url)+ await assignToken(server, result.username, result.password)+ } catch (err) {+ console.error(err.message)+ process.exit(-1)+ }++ await setInstance(result.url, result.username, result.password, options.default)++ process.exit(0)+ })+ })++ program+ .command('del <url>')+ .description('Unregisters a remote instance')+ .action(async url => {+ await delInstance(url)++ process.exit(0)+ })++ program+ .command('list')+ .description('List registered remote instances')+ .action(async () => {+ const [ settings, netrc ] = await Promise.all([ getSettings(), getNetrc() ])++ const table = new CliTable3({+ head: [ 'instance', 'login' ],+ colWidths: [ 30, 30 ]+ }) as any++ settings.remotes.forEach(element => {+ if (!netrc.machines[element]) return++ table.push([+ element,+ netrc.machines[element].login+ ])+ })++ console.log(table.toString())++ process.exit(0)+ })++ program+ .command('set-default <url>')+ .description('Set an existing entry as default')+ .action(async url => {+ const settings = await getSettings()+ const instanceExists = settings.remotes.includes(url)++ if (instanceExists) {+ settings.default = settings.remotes.indexOf(url)+ await writeSettings(settings)++ process.exit(0)+ } else {+ console.log('<url> is not a registered instance.')+ process.exit(-1)+ }+ })++ program.addHelpText('after', '\n\n Examples:\n\n' ++ ' $ peertube auth add -u https://peertube.cpy.re -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD"\n' ++ ' $ peertube auth add -u https://peertube.cpy.re -U root\n' ++ ' $ peertube auth list\n' ++ ' $ peertube auth del https://peertube.cpy.re\n'+ )++ return program+}++// ---------------------------------------------------------------------------+// Private+// ---------------------------------------------------------------------------++async function delInstance (url: string) {+ const [ settings, netrc ] = await Promise.all([ getSettings(), getNetrc() ])++ const index = settings.remotes.indexOf(url)+ settings.remotes.splice(index)++ if (settings.default === index) settings.default = -1++ await writeSettings(settings)++ delete netrc.machines[url]++ await netrc.save()+}++async function setInstance (url: string, username: string, password: string, isDefault: boolean) {+ const [ settings, netrc ] = await Promise.all([ getSettings(), getNetrc() ])++ if (settings.remotes.includes(url) === false) {+ settings.remotes.push(url)+ }++ if (isDefault || settings.remotes.length === 1) {+ settings.default = settings.remotes.length - 1+ }++ await writeSettings(settings)++ netrc.machines[url] = { login: username, password }+ await netrc.save()+}++function isURLaPeerTubeInstance (url: string) {+ return url.startsWith('http://') || url.startsWith('https://')+}++function stripExtraneousFromPeerTubeUrl (url: string) {+ // Get everything before the 3rd /.+ const urlLength = url.includes('/', 8)+ ? url.indexOf('/', 8)+ : url.length++ return url.substring(0, urlLength)+}diff --git a/apps/peertube-cli/src/peertube-get-access-token.ts b/apps/peertube-cli/src/peertube-get-access-token.tsnew file mode 100644index 0000000000..3e0013182c--- /dev/null+++ b/apps/peertube-cli/src/peertube-get-access-token.ts@@ -0,0 +1,39 @@+import { Command } from '@commander-js/extra-typings'+import { assignToken, buildServer } from './shared/index.js'++export function defineGetAccessProgram () {+ const program = new Command()+ .name('get-access-token')+ .description('Get a peertube access token')+ .alias('token')++ program+ .option('-u, --url <url>', 'Server url')+ .option('-n, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .action(async options => {+ try {+ if (+ !options.url ||+ !options.username ||+ !options.password+ ) {+ if (!options.url) console.error('--url field is required.')+ if (!options.username) console.error('--username field is required.')+ if (!options.password) console.error('--password field is required.')++ process.exit(-1)+ }++ const server = buildServer(options.url)+ await assignToken(server, options.username, options.password)++ console.log(server.accessToken)+ } catch (err) {+ console.error('Cannot get access token: ' + err.message)+ process.exit(-1)+ }+ })++ return program+}diff --git a/apps/peertube-cli/src/peertube-plugins.ts b/apps/peertube-cli/src/peertube-plugins.tsnew file mode 100644index 0000000000..c9da562663--- /dev/null+++ b/apps/peertube-cli/src/peertube-plugins.ts@@ -0,0 +1,167 @@+import CliTable3 from 'cli-table3'+import { isAbsolute } from 'path'+import { Command } from '@commander-js/extra-typings'+import { PluginType, PluginType_Type } from '@peertube/peertube-models'+import { assignToken, buildServer, CommonProgramOptions, getServerCredentials } from './shared/index.js'++export function definePluginsProgram () {+ const program = new Command()++ program+ .name('plugins')+ .description('Manage instance plugins/themes')+ .alias('p')++ program+ .command('list')+ .description('List installed plugins')+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .option('-t, --only-themes', 'List themes only')+ .option('-P, --only-plugins', 'List plugins only')+ .action(async options => {+ try {+ await pluginsListCLI(options)+ } catch (err) {+ console.error('Cannot list plugins: ' + err.message)+ process.exit(-1)+ }+ })++ program+ .command('install')+ .description('Install a plugin or a theme')+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .option('-P --path <path>', 'Install from a path')+ .option('-n, --npm-name <npmName>', 'Install from npm')+ .option('--plugin-version <pluginVersion>', 'Specify the plugin version to install (only available when installing from npm)')+ .action(async options => {+ try {+ await installPluginCLI(options)+ } catch (err) {+ console.error('Cannot install plugin: ' + err.message)+ process.exit(-1)+ }+ })++ program+ .command('update')+ .description('Update a plugin or a theme')+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .option('-P --path <path>', 'Update from a path')+ .option('-n, --npm-name <npmName>', 'Update from npm')+ .action(async options => {+ try {+ await updatePluginCLI(options)+ } catch (err) {+ console.error('Cannot update plugin: ' + err.message)+ process.exit(-1)+ }+ })++ program+ .command('uninstall')+ .description('Uninstall a plugin or a theme')+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .option('-n, --npm-name <npmName>', 'NPM plugin/theme name')+ .action(async options => {+ try {+ await uninstallPluginCLI(options)+ } catch (err) {+ console.error('Cannot uninstall plugin: ' + err.message)+ process.exit(-1)+ }+ })++ return program+}++// ----------------------------------------------------------------------------++async function pluginsListCLI (options: CommonProgramOptions & { onlyThemes?: true, onlyPlugins?: true }) {+ const { url, username, password } = await getServerCredentials(options)+ const server = buildServer(url)+ await assignToken(server, username, password)++ let pluginType: PluginType_Type+ if (options.onlyThemes) pluginType = PluginType.THEME+ if (options.onlyPlugins) pluginType = PluginType.PLUGIN++ const { data } = await server.plugins.list({ start: 0, count: 100, sort: 'name', pluginType })++ const table = new CliTable3({+ head: [ 'name', 'version', 'homepage' ],+ colWidths: [ 50, 20, 50 ]+ }) as any++ for (const plugin of data) {+ const npmName = plugin.type === PluginType.PLUGIN+ ? 'peertube-plugin-' + plugin.name+ : 'peertube-theme-' + plugin.name++ table.push([+ npmName,+ plugin.version,+ plugin.homepage+ ])+ }++ console.log(table.toString())+}++async function installPluginCLI (options: CommonProgramOptions & { path?: string, npmName?: string, pluginVersion?: string }) {+ if (!options.path && !options.npmName) {+ throw new Error('You need to specify the npm name or the path of the plugin you want to install.')+ }++ if (options.path && !isAbsolute(options.path)) {+ throw new Error('Path should be absolute.')+ }++ const { url, username, password } = await getServerCredentials(options)+ const server = buildServer(url)+ await assignToken(server, username, password)++ await server.plugins.install({ npmName: options.npmName, path: options.path, pluginVersion: options.pluginVersion })++ console.log('Plugin installed.')+}++async function updatePluginCLI (options: CommonProgramOptions & { path?: string, npmName?: string }) {+ if (!options.path && !options.npmName) {+ throw new Error('You need to specify the npm name or the path of the plugin you want to update.')+ }++ if (options.path && !isAbsolute(options.path)) {+ throw new Error('Path should be absolute.')+ }++ const { url, username, password } = await getServerCredentials(options)+ const server = buildServer(url)+ await assignToken(server, username, password)++ await server.plugins.update({ npmName: options.npmName, path: options.path })++ console.log('Plugin updated.')+}++async function uninstallPluginCLI (options: CommonProgramOptions & { npmName?: string }) {+ if (!options.npmName) {+ throw new Error('You need to specify the npm name of the plugin/theme you want to uninstall.')+ }++ const { url, username, password } = await getServerCredentials(options)+ const server = buildServer(url)+ await assignToken(server, username, password)++ await server.plugins.uninstall({ npmName: options.npmName })++ console.log('Plugin uninstalled.')+}diff --git a/apps/peertube-cli/src/peertube-redundancy.ts b/apps/peertube-cli/src/peertube-redundancy.tsnew file mode 100644index 0000000000..56fc6366b2--- /dev/null+++ b/apps/peertube-cli/src/peertube-redundancy.ts@@ -0,0 +1,186 @@+import bytes from 'bytes'+import CliTable3 from 'cli-table3'+import { URL } from 'url'+import { Command } from '@commander-js/extra-typings'+import { forceNumber, uniqify } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoRedundanciesTarget } from '@peertube/peertube-models'+import { assignToken, buildServer, CommonProgramOptions, getServerCredentials } from './shared/index.js'++export function defineRedundancyProgram () {+ const program = new Command()+ .name('redundancy')+ .description('Manage instance redundancies')+ .alias('r')++ program+ .command('list-remote-redundancies')+ .description('List remote redundancies on your videos')+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .action(async options => {+ try {+ await listRedundanciesCLI({ target: 'my-videos', ...options })+ } catch (err) {+ console.error('Cannot list remote redundancies: ' + err.message)+ process.exit(-1)+ }+ })++ program+ .command('list-my-redundancies')+ .description('List your redundancies of remote videos')+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .action(async options => {+ try {+ await listRedundanciesCLI({ target: 'remote-videos', ...options })+ } catch (err) {+ console.error('Cannot list redundancies: ' + err.message)+ process.exit(-1)+ }+ })++ program+ .command('add')+ .description('Duplicate a video in your redundancy system')+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .requiredOption('-v, --video <videoId>', 'Video id to duplicate', parseInt)+ .action(async options => {+ try {+ await addRedundancyCLI(options)+ } catch (err) {+ console.error('Cannot duplicate video: ' + err.message)+ process.exit(-1)+ }+ })++ program+ .command('remove')+ .description('Remove a video from your redundancies')+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .requiredOption('-v, --video <videoId>', 'Video id to remove from redundancies', parseInt)+ .action(async options => {+ try {+ await removeRedundancyCLI(options)+ } catch (err) {+ console.error('Cannot remove redundancy: ' + err)+ process.exit(-1)+ }+ })++ return program+}++// ----------------------------------------------------------------------------++async function listRedundanciesCLI (options: CommonProgramOptions & { target: VideoRedundanciesTarget }) {+ const { target } = options++ const { url, username, password } = await getServerCredentials(options)+ const server = buildServer(url)+ await assignToken(server, username, password)++ const { data } = await server.redundancy.listVideos({ start: 0, count: 100, sort: 'name', target })++ const table = new CliTable3({+ head: [ 'video id', 'video name', 'video url', 'files', 'playlists', 'by instances', 'total size' ]+ }) as any++ for (const redundancy of data) {+ const webVideoFiles = redundancy.redundancies.files+ const streamingPlaylists = redundancy.redundancies.streamingPlaylists++ let totalSize = ''+ if (target === 'remote-videos') {+ const tmp = webVideoFiles.concat(streamingPlaylists)+ .reduce((a, b) => a + b.size, 0)++ // FIXME: don't use external dependency to stringify bytes: we already have the functions in the client+ totalSize = bytes(tmp)+ }++ const instances = uniqify(+ webVideoFiles.concat(streamingPlaylists)+ .map(r => r.fileUrl)+ .map(u => new URL(u).host)+ )++ table.push([+ redundancy.id.toString(),+ redundancy.name,+ redundancy.url,+ webVideoFiles.length,+ streamingPlaylists.length,+ instances.join('\n'),+ totalSize+ ])+ }++ console.log(table.toString())+}++async function addRedundancyCLI (options: { video: number } & CommonProgramOptions) {+ const { url, username, password } = await getServerCredentials(options)+ const server = buildServer(url)+ await assignToken(server, username, password)++ if (!options.video || isNaN(options.video)) {+ throw new Error('You need to specify the video id to duplicate and it should be a number.')+ }++ try {+ await server.redundancy.addVideo({ videoId: options.video })++ console.log('Video will be duplicated by your instance!')+ } catch (err) {+ if (err.message.includes(HttpStatusCode.CONFLICT_409)) {+ throw new Error('This video is already duplicated by your instance.')+ }++ if (err.message.includes(HttpStatusCode.NOT_FOUND_404)) {+ throw new Error('This video id does not exist.')+ }++ throw err+ }+}++async function removeRedundancyCLI (options: CommonProgramOptions & { video: number }) {+ const { url, username, password } = await getServerCredentials(options)+ const server = buildServer(url)+ await assignToken(server, username, password)++ if (!options.video || isNaN(options.video)) {+ throw new Error('You need to specify the video id to remove from your redundancies')+ }++ const videoId = forceNumber(options.video)++ const myVideoRedundancies = await server.redundancy.listVideos({ target: 'my-videos' })+ let videoRedundancy = myVideoRedundancies.data.find(r => videoId === r.id)++ if (!videoRedundancy) {+ const remoteVideoRedundancies = await server.redundancy.listVideos({ target: 'remote-videos' })+ videoRedundancy = remoteVideoRedundancies.data.find(r => videoId === r.id)+ }++ if (!videoRedundancy) {+ throw new Error('Video redundancy not found.')+ }++ const ids = videoRedundancy.redundancies.files+ .concat(videoRedundancy.redundancies.streamingPlaylists)+ .map(r => r.id)++ for (const id of ids) {+ await server.redundancy.removeVideo({ redundancyId: id })+ }++ console.log('Video redundancy removed!')+}diff --git a/apps/peertube-cli/src/peertube-upload.ts b/apps/peertube-cli/src/peertube-upload.tsnew file mode 100644index 0000000000..443f8ce1f2--- /dev/null+++ b/apps/peertube-cli/src/peertube-upload.ts@@ -0,0 +1,167 @@+import { access, constants } from 'fs/promises'+import { isAbsolute } from 'path'+import { inspect } from 'util'+import { Command } from '@commander-js/extra-typings'+import { VideoPrivacy } from '@peertube/peertube-models'+import { PeerTubeServer } from '@peertube/peertube-server-commands'+import { assignToken, buildServer, getServerCredentials, listOptions } from './shared/index.js'++type UploadOptions = {+ url?: string+ username?: string+ password?: string+ thumbnail?: string+ preview?: string+ file?: string+ videoName?: string+ category?: string+ licence?: string+ language?: string+ tags?: string+ nsfw?: true+ videoDescription?: string+ privacy?: number+ channelName?: string+ noCommentsEnabled?: true+ support?: string+ noWaitTranscoding?: true+ noDownloadEnabled?: true+}++export function defineUploadProgram () {+ const program = new Command('upload')+ .description('Upload a video on a PeerTube instance')+ .alias('up')++ program+ .option('-u, --url <url>', 'Server url')+ .option('-U, --username <username>', 'Username')+ .option('-p, --password <token>', 'Password')+ .option('-b, --thumbnail <thumbnailPath>', 'Thumbnail path')+ .option('-v, --preview <previewPath>', 'Preview path')+ .option('-f, --file <file>', 'Video absolute file path')+ .option('-n, --video-name <name>', 'Video name')+ .option('-c, --category <category_number>', 'Category number')+ .option('-l, --licence <licence_number>', 'Licence number')+ .option('-L, --language <language_code>', 'Language ISO 639 code (fr or en...)')+ .option('-t, --tags <tags>', 'Video tags', listOptions)+ .option('-N, --nsfw', 'Video is Not Safe For Work')+ .option('-d, --video-description <description>', 'Video description')+ .option('-P, --privacy <privacy_number>', 'Privacy', parseInt)+ .option('-C, --channel-name <channel_name>', 'Channel name')+ .option('--no-comments-enabled', 'Disable video comments')+ .option('-s, --support <support>', 'Video support text')+ .option('--no-wait-transcoding', 'Do not wait transcoding before publishing the video')+ .option('--no-download-enabled', 'Disable video download')+ .option('-v, --verbose <verbose>', 'Verbosity, from 0/\'error\' to 4/\'debug\'', 'info')+ .action(async options => {+ try {+ const { url, username, password } = await getServerCredentials(options)++ if (!options.videoName || !options.file) {+ if (!options.videoName) console.error('--video-name is required.')+ if (!options.file) console.error('--file is required.')++ process.exit(-1)+ }++ if (isAbsolute(options.file) === false) {+ console.error('File path should be absolute.')+ process.exit(-1)+ }++ await run({ ...options, url, username, password })+ } catch (err) {+ console.error('Cannot upload video: ' + err.message)+ process.exit(-1)+ }+ })++ return program+}++// ---------------------------------------------------------------------------+// Private+// ---------------------------------------------------------------------------++async function run (options: UploadOptions) {+ const { url, username, password } = options++ const server = buildServer(url)+ await assignToken(server, username, password)++ await access(options.file, constants.F_OK)++ console.log('Uploading %s video...', options.videoName)++ const baseAttributes = await buildVideoAttributesFromCommander(server, options)++ const attributes = {+ ...baseAttributes,++ fixture: options.file,+ thumbnailfile: options.thumbnail,+ previewfile: options.preview+ }++ try {+ await server.videos.upload({ attributes })+ console.log(`Video ${options.videoName} uploaded.`)+ process.exit(0)+ } catch (err) {+ const message = err.message || ''+ if (message.includes('413')) {+ console.error('Aborted: user quota is exceeded or video file is too big for this PeerTube instance.')+ } else {+ console.error(inspect(err))+ }++ process.exit(-1)+ }+}++async function buildVideoAttributesFromCommander (server: PeerTubeServer, options: UploadOptions, defaultAttributes: any = {}) {+ const defaultBooleanAttributes = {+ nsfw: false,+ commentsEnabled: true,+ downloadEnabled: true,+ waitTranscoding: true+ }++ const booleanAttributes: { [id in keyof typeof defaultBooleanAttributes]: boolean } | {} = {}++ for (const key of Object.keys(defaultBooleanAttributes)) {+ if (options[key] !== undefined) {+ booleanAttributes[key] = options[key]+ } else if (defaultAttributes[key] !== undefined) {+ booleanAttributes[key] = defaultAttributes[key]+ } else {+ booleanAttributes[key] = defaultBooleanAttributes[key]+ }+ }++ const videoAttributes = {+ name: options.videoName || defaultAttributes.name,+ category: options.category || defaultAttributes.category || undefined,+ licence: options.licence || defaultAttributes.licence || undefined,+ language: options.language || defaultAttributes.language || undefined,+ privacy: options.privacy || defaultAttributes.privacy || VideoPrivacy.PUBLIC,+ support: options.support || defaultAttributes.support || undefined,+ description: options.videoDescription || defaultAttributes.description || undefined,+ tags: options.tags || defaultAttributes.tags || undefined+ }++ Object.assign(videoAttributes, booleanAttributes)++ if (options.channelName) {+ const videoChannel = await server.channels.get({ channelName: options.channelName })++ Object.assign(videoAttributes, { channelId: videoChannel.id })++ if (!videoAttributes.support && videoChannel.support) {+ Object.assign(videoAttributes, { support: videoChannel.support })+ }+ }++ return videoAttributes+}diff --git a/server/tools/peertube.ts b/apps/peertube-cli/src/peertube.tssimilarity index 60%rename from server/tools/peertube.tsrename to apps/peertube-cli/src/peertube.tsindex b79917b4fe..e3565bb1a0 100644--- a/server/tools/peertube.ts+++ b/apps/peertube-cli/src/peertube.ts@@ -1,32 +1,24 @@#!/usr/bin/env node-import { CommandOptions, program } from 'commander'-import { getSettings, version } from './shared'+import { Command } from '@commander-js/extra-typings'+import { defineAuthProgram } from './peertube-auth.js'+import { defineGetAccessProgram } from './peertube-get-access-token.js'+import { definePluginsProgram } from './peertube-plugins.js'+import { defineRedundancyProgram } from './peertube-redundancy.js'+import { defineUploadProgram } from './peertube-upload.js'+import { getSettings, version } from './shared/index.js'++const program = new Command()program.version(version, '-v, --version').usage('[command] [options]')-/* Subcommands automatically loaded in the directory and beginning by peertube-* */-program- .command('auth [action]', 'register your accounts on remote instances to use them with other commands')- .command('upload', 'upload a video').alias('up')- .command('import-videos', 'import a video from a streaming platform').alias('import')- .command('get-access-token', 'get a peertube access token', { noHelp: true }).alias('token')- .command('plugins [action]', 'manage instance plugins/themes').alias('p')- .command('redundancy [action]', 'manage instance redundancies').alias('r')--/* Not Yet Implemented */-program- .command(- 'diagnostic [action]',- 'like couple therapy, but for your instance',- { noHelp: true } as CommandOptions- ).alias('d')- .command('admin',- 'manage an instance where you have elevated rights',- { noHelp: true } as CommandOptions- ).alias('a')+program.addCommand(defineAuthProgram())+program.addCommand(defineUploadProgram())+program.addCommand(defineRedundancyProgram())+program.addCommand(definePluginsProgram())+program.addCommand(defineGetAccessProgram())// help on no commandif (!process.argv.slice(2).length) {diff --git a/server/tools/shared/cli.ts b/apps/peertube-cli/src/shared/cli.tssimilarity index 50%rename from server/tools/shared/cli.tsrename to apps/peertube-cli/src/shared/cli.tsindex e010ab320e..080eb8237f 100644--- a/server/tools/shared/cli.ts+++ b/apps/peertube-cli/src/shared/cli.ts@@ -1,19 +1,23 @@-import { Command } from 'commander'+import applicationConfig from 'application-config'import { Netrc } from 'netrc-parser'import { join } from 'path'import { createLogger, format, transports } from 'winston'-import { getAppNumber, isTestInstance } from '@server/helpers/core-utils'-import { loadLanguages } from '@server/initializers/constants'-import { root } from '@shared/core-utils'-import { UserRole, VideoPrivacy } from '@shared/models'-import { PeerTubeServer } from '@shared/server-commands'+import { UserRole } from '@peertube/peertube-models'+import { getAppNumber, isTestInstance, root } from '@peertube/peertube-node-utils'+import { PeerTubeServer } from '@peertube/peertube-server-commands'++export type CommonProgramOptions = {+ url?: string+ username?: string+ password?: string+}let configName = 'PeerTube/CLI'if (isTestInstance()) configName += `-${getAppNumber()}`-const config = require('application-config')(configName)+const config = applicationConfig(configName)-const version = require(join(root(), 'package.json')).version+const version: string = process.env.PACKAGE_VERSIONasync function getAdminTokenOrDie (server: PeerTubeServer, username: string, password: string) {const token = await server.login.getAccessToken(username, password)@@ -32,13 +36,13 @@ interface Settings {default: number}-async function getSettings (): Promise<Settings> {- const defaultSettings = {+async function getSettings () {+ const defaultSettings: Settings = {remotes: [],default: -1}- const data = await config.read()+ const data = await config.read() as Promise<Settings>return Object.keys(data).length === 0? defaultSettings@@ -46,10 +50,8 @@ async function getSettings (): Promise<Settings> {}async function getNetrc () {- const Netrc = require('netrc-parser').Netrc-const netrc = isTestInstance()- ? new Netrc(join(root(), 'test' + getAppNumber(), 'netrc'))+ ? new Netrc(join(root(import.meta.url), 'test' + getAppNumber(), 'netrc')): new Netrc()await netrc.load()@@ -66,11 +68,10 @@ function deleteSettings () {}function getRemoteObjectOrDie (- program: Command,+ options: CommonProgramOptions,settings: Settings,netrc: Netrc): { url: string, username: string, password: string } {- const options = program.opts()function exitIfNoOptions (optionNames: string[], errorPrefix: string = '') {let exit = false@@ -119,85 +120,18 @@ function getRemoteObjectOrDie (return { url, username, password }}-function buildCommonVideoOptions (command: Command) {- function list (val) {- return val.split(',')- }-- return command- .option('-n, --video-name <name>', 'Video name')- .option('-c, --category <category_number>', 'Category number')- .option('-l, --licence <licence_number>', 'Licence number')- .option('-L, --language <language_code>', 'Language ISO 639 code (fr or en...)')- .option('-t, --tags <tags>', 'Video tags', list)- .option('-N, --nsfw', 'Video is Not Safe For Work')- .option('-d, --video-description <description>', 'Video description')- .option('-P, --privacy <privacy_number>', 'Privacy')- .option('-C, --channel-name <channel_name>', 'Channel name')- .option('--no-comments-enabled', 'Disable video comments')- .option('-s, --support <support>', 'Video support text')- .option('--no-wait-transcoding', 'Do not wait transcoding before publishing the video')- .option('--no-download-enabled', 'Disable video download')- .option('-v, --verbose <verbose>', 'Verbosity, from 0/\'error\' to 4/\'debug\'', 'info')-}--async function buildVideoAttributesFromCommander (server: PeerTubeServer, command: Command, defaultAttributes: any = {}) {- const options = command.opts()-- const defaultBooleanAttributes = {- nsfw: false,- commentsEnabled: true,- downloadEnabled: true,- waitTranscoding: true- }-- const booleanAttributes: { [id in keyof typeof defaultBooleanAttributes]: boolean } | {} = {}-- for (const key of Object.keys(defaultBooleanAttributes)) {- if (options[key] !== undefined) {- booleanAttributes[key] = options[key]- } else if (defaultAttributes[key] !== undefined) {- booleanAttributes[key] = defaultAttributes[key]- } else {- booleanAttributes[key] = defaultBooleanAttributes[key]- }- }-- const videoAttributes = {- name: options.videoName || defaultAttributes.name,- category: options.category || defaultAttributes.category || undefined,- licence: options.licence || defaultAttributes.licence || undefined,- language: options.language || defaultAttributes.language || undefined,- privacy: options.privacy || defaultAttributes.privacy || VideoPrivacy.PUBLIC,- support: options.support || defaultAttributes.support || undefined,- description: options.videoDescription || defaultAttributes.description || undefined,- tags: options.tags || defaultAttributes.tags || undefined- }-- Object.assign(videoAttributes, booleanAttributes)-- if (options.channelName) {- const videoChannel = await server.channels.get({ channelName: options.channelName })-- Object.assign(videoAttributes, { channelId: videoChannel.id })-- if (!videoAttributes.support && videoChannel.support) {- Object.assign(videoAttributes, { support: videoChannel.support })- }- }-- return videoAttributes+function listOptions (val: any) {+ return val.split(',')}-function getServerCredentials (program: Command) {+function getServerCredentials (options: CommonProgramOptions) {return Promise.all([ getSettings(), getNetrc() ]).then(([ settings, netrc ]) => {- return getRemoteObjectOrDie(program, settings, netrc)+ return getRemoteObjectOrDie(options, settings, netrc)})}function buildServer (url: string) {- loadLanguages()return new PeerTubeServer({ url })}@@ -253,8 +187,7 @@ export {getServerCredentials,- buildCommonVideoOptions,- buildVideoAttributesFromCommander,+ listOptions,getAdminTokenOrDie,buildServer,diff --git a/apps/peertube-cli/src/shared/index.ts b/apps/peertube-cli/src/shared/index.tsnew file mode 100644index 0000000000..a1fc9470b9--- /dev/null+++ b/apps/peertube-cli/src/shared/index.ts@@ -0,0 +1 @@+export * from './cli.js'diff --git a/apps/peertube-cli/tsconfig.json b/apps/peertube-cli/tsconfig.jsonnew file mode 100644index 0000000000..636bdb95a3--- /dev/null+++ b/apps/peertube-cli/tsconfig.json@@ -0,0 +1,15 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "baseUrl": "./",+ "outDir": "./dist",+ "rootDir": "src",+ "tsBuildInfoFile": "./dist/.tsbuildinfo"+ },+ "references": [+ { "path": "../../packages/core-utils" },+ { "path": "../../packages/models" },+ { "path": "../../packages/node-utils" },+ { "path": "../../packages/server-commands" }+ ]+}diff --git a/server/tools/yarn.lock b/apps/peertube-cli/yarn.locksimilarity index 78%rename from server/tools/yarn.lockrename to apps/peertube-cli/yarn.lockindex 025ef208df..76b36ee73e 100644--- a/server/tools/yarn.lock+++ b/apps/peertube-cli/yarn.lock@@ -3,26 +3,32 @@"@babel/code-frame@^7.0.0":- version "7.16.7"- resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789"- integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==+ version "7.22.10"+ resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.10.tgz#1c20e612b768fefa75f6e90d6ecb86329247f0a3"+ integrity sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA==dependencies:- "@babel/highlight" "^7.16.7"--"@babel/helper-validator-identifier@^7.16.7":- version "7.16.7"- resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad"- integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==--"@babel/highlight@^7.16.7":- version "7.16.10"- resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.16.10.tgz#744f2eb81579d6eea753c227b0f570ad785aba88"- integrity sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==+ "@babel/highlight" "^7.22.10"+ chalk "^2.4.2"++"@babel/helper-validator-identifier@^7.22.5":+ version "7.22.5"+ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193"+ integrity sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==++"@babel/highlight@^7.22.10":+ version "7.22.10"+ resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.10.tgz#02a3f6d8c1cb4521b2fd0ab0da8f4739936137d7"+ integrity sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==dependencies:- "@babel/helper-validator-identifier" "^7.16.7"- chalk "^2.0.0"+ "@babel/helper-validator-identifier" "^7.22.5"+ chalk "^2.4.2"js-tokens "^4.0.0"+"@colors/[email protected]":+ version "1.5.0"+ resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"+ integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==+ansi-regex@^5.0.1:version "5.0.1"resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"@@ -36,9 +42,9 @@ ansi-styles@^3.2.1:color-convert "^1.9.0"application-config-path@^0.1.0:- version "0.1.0"- resolved "https://registry.yarnpkg.com/application-config-path/-/application-config-path-0.1.0.tgz#193c5f0a86541a4c66fba1e2dc38583362ea5e8f"- integrity sha1-GTxfCoZUGkxm+6Hi3DhYM2LqXo8=+ version "0.1.1"+ resolved "https://registry.yarnpkg.com/application-config-path/-/application-config-path-0.1.1.tgz#8b5ac64ff6afdd9bd70ce69f6f64b6998f5f756e"+ integrity sha512-zy9cHePtMP0YhwG+CfHm0bgwdnga2X3gZexpdCwEj//dpb+TKajtiC8REEUJUSq6Ab4f9cgNy2l8ObXzCXFkEw==application-config@^2.0.0:version "2.0.0"@@ -49,7 +55,7 @@ application-config@^2.0.0:load-json-file "^6.2.0"write-json-file "^4.2.0"-chalk@^2.0.0:+chalk@^2.4.2:version "2.4.2"resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==@@ -59,13 +65,13 @@ chalk@^2.0.0:supports-color "^5.3.0"cli-table3@^0.6.0:- version "0.6.1"- resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.1.tgz#36ce9b7af4847f288d3cdd081fbd09bf7bd237b8"- integrity sha512-w0q/enDHhPLq44ovMGdQeeDLvwxwavsJX7oQGYt/LrBlYsyaxyDnp6z3QzFut/6kLLKnlcUVJLrpB7KBfgG/RA==+ version "0.6.3"+ resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.3.tgz#61ab765aac156b52f222954ffc607a6f01dbeeb2"+ integrity sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==dependencies:string-width "^4.2.0"optionalDependencies:- colors "1.4.0"+ "@colors/colors" "1.5.0"color-convert@^1.9.0:version "1.9.3"@@ -77,12 +83,7 @@ color-convert@^1.9.0:version "1.1.3"resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"- integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=-- version "1.4.0"- resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"- integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==+ integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==cross-spawn@^6.0.0:version "6.0.5"@@ -122,7 +123,7 @@ error-ex@^1.3.1:escape-string-regexp@^1.0.5:version "1.0.5"resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"- integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=+ integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==execa@^0.10.0:version "0.10.0"@@ -140,27 +141,27 @@ execa@^0.10.0:get-stream@^3.0.0:version "3.0.0"resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"- integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=+ integrity sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==graceful-fs@^4.1.15:- version "4.2.9"- resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96"- integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==+ version "4.2.11"+ resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"+ integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==has-flag@^3.0.0:version "3.0.0"resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"- integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=+ integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==imurmurhash@^0.1.4:version "0.1.4"resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"- integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=+ integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==is-arrayish@^0.2.1:version "0.2.1"resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"- integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=+ integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==is-fullwidth-code-point@^3.0.0:version "3.0.0"@@ -175,17 +176,17 @@ is-plain-obj@^2.0.0:is-stream@^1.1.0:version "1.1.0"resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"- integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=+ integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==is-typedarray@^1.0.0:version "1.0.0"resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"- integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=+ integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==isexe@^2.0.0:version "2.0.0"resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"- integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=+ integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==js-tokens@^4.0.0:version "4.0.0"@@ -240,14 +241,14 @@ nice-try@^1.0.4:npm-run-path@^2.0.0:version "2.0.2"resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"- integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=+ integrity sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==dependencies:path-key "^2.0.0"p-finally@^1.0.0:version "1.0.0"resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"- integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=+ integrity sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==parse-json@^5.0.0:version "5.2.0"@@ -262,29 +263,29 @@ parse-json@^5.0.0:path-key@^2.0.0, path-key@^2.0.1:version "2.0.1"resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"- integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=+ integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==semver@^5.5.0:- version "5.7.1"- resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"- integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==+ version "5.7.2"+ resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8"+ integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==semver@^6.0.0:- version "6.3.0"- resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"- integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==+ version "6.3.1"+ resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"+ integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==shebang-command@^1.2.0:version "1.2.0"resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"- integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=+ integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==dependencies:shebang-regex "^1.0.0"shebang-regex@^1.0.0:version "1.0.0"resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"- integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=+ integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==signal-exit@^3.0.0, signal-exit@^3.0.2:version "3.0.7"@@ -322,7 +323,7 @@ strip-bom@^4.0.0:strip-eof@^1.0.0:version "1.0.0"resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"- integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=+ integrity sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==supports-color@^5.3.0:version "5.5.0"diff --git a/packages/peertube-runner/.gitignore b/apps/peertube-runner/.gitignoresimilarity index 100%rename from packages/peertube-runner/.gitignorerename to apps/peertube-runner/.gitignorediff --git a/apps/peertube-runner/.npmignore b/apps/peertube-runner/.npmignorenew file mode 100644index 0000000000..af17b9f328--- /dev/null+++ b/apps/peertube-runner/.npmignore@@ -0,0 +1,4 @@+src+meta.json+tsconfig.json+scriptsdiff --git a/apps/peertube-runner/README.md b/apps/peertube-runner/README.mdnew file mode 100644index 0000000000..37760f867f--- /dev/null+++ b/apps/peertube-runner/README.md@@ -0,0 +1,43 @@+# PeerTube runner++Runner program to execute jobs (transcoding...) of remote PeerTube instances.++Commands below has to be run at the root of PeerTube git repository.++## Dev++### Install dependencies++```bash+cd peertube-root+yarn install --pure-lockfile+cd apps/peertube-runner && yarn install --pure-lockfile+```++### Develop++```bash+cd peertube-root+npm run dev:peertube-runner+```++### Build++```bash+cd peertube-root+npm run build:peertube-runner+```++### Run++```bash+cd peertube-root+node apps/peertube-runner/dist/peertube-runner.js --help+```++### Publish on NPM++```bash+cd peertube-root+(cd apps/peertube-runner && npm version patch) && npm run build:peertube-runner && (cd apps/peertube-runner && npm publish --access=public)+```diff --git a/packages/peertube-runner/package.json b/apps/peertube-runner/package.jsonsimilarity index 86%rename from packages/peertube-runner/package.jsonrename to apps/peertube-runner/package.jsonindex 1c525691a3..1dca15451c 100644--- a/packages/peertube-runner/package.json+++ b/apps/peertube-runner/package.json@@ -1,15 +1,18 @@{"name": "@peertube/peertube-runner","version": "0.0.5",+ "type": "module","main": "dist/peertube-runner.js","bin": "dist/peertube-runner.js",+ "engines": {+ "node": ">=16.x"+ },"license": "AGPL-3.0","dependencies": {},"devDependencies": {"@commander-js/extra-typings": "^10.0.3","@iarna/toml": "^2.2.5","env-paths": "^3.0.0",- "esbuild": "^0.17.15","net-ipc": "^2.0.1","pino": "^8.11.0","pino-pretty": "^10.0.0"diff --git a/apps/peertube-runner/scripts/build.js b/apps/peertube-runner/scripts/build.jsnew file mode 100644index 0000000000..f54ca35f34--- /dev/null+++ b/apps/peertube-runner/scripts/build.js@@ -0,0 +1,26 @@+import * as esbuild from 'esbuild'++const packageJSON = JSON.parse(readFileSync(new URL('../package.json', import.meta.url)))++export const esbuildOptions = {+ entryPoints: [ './src/peertube-runner.ts' ],+ bundle: true,+ platform: 'node',+ format: 'esm',+ target: 'node16',+ external: [+ './lib-cov/fluent-ffmpeg',+ 'pg-hstore'+ ],+ outfile: './dist/peertube-runner.js',+ banner: {+ js: `const require = (await import("node:module")).createRequire(import.meta.url);` ++ `const __filename = (await import("node:url")).fileURLToPath(import.meta.url);` ++ `const __dirname = (await import("node:path")).dirname(__filename);`+ },+ define: {+ 'process.env.PACKAGE_VERSION': `'${packageJSON.version}'`+ }+}++await esbuild.build(esbuildOptions)diff --git a/packages/peertube-runner/peertube-runner.ts b/apps/peertube-runner/src/peertube-runner.tssimilarity index 93%rename from packages/peertube-runner/peertube-runner.tsrename to apps/peertube-runner/src/peertube-runner.tsindex 32586c4d9f..67ca0e0ac9 100644--- a/packages/peertube-runner/peertube-runner.ts+++ b/apps/peertube-runner/src/peertube-runner.ts@@ -1,14 +1,12 @@#!/usr/bin/env nodeimport { Command, InvalidArgumentError } from '@commander-js/extra-typings'-import { listRegistered, registerRunner, unregisterRunner } from './register'-import { RunnerServer } from './server'-import { ConfigManager, logger } from './shared'--const packageJSON = require('./package.json')+import { listRegistered, registerRunner, unregisterRunner } from './register/index.js'+import { RunnerServer } from './server/index.js'+import { ConfigManager, logger } from './shared/index.js'const program = new Command()- .version(packageJSON.version)+ .version(process.env.PACKAGE_VERSION).option('--id <id>','Runner server id, so you can run multiple PeerTube server runners with different configurations on the same machine',diff --git a/apps/peertube-runner/src/register/index.ts b/apps/peertube-runner/src/register/index.tsnew file mode 100644index 0000000000..a7d6cf4578--- /dev/null+++ b/apps/peertube-runner/src/register/index.ts@@ -0,0 +1 @@+export * from './register.js'diff --git a/packages/peertube-runner/register/register.ts b/apps/peertube-runner/src/register/register.tssimilarity index 92%rename from packages/peertube-runner/register/register.tsrename to apps/peertube-runner/src/register/register.tsindex ca1bf0f5a9..e8af216612 100644--- a/packages/peertube-runner/register/register.ts+++ b/apps/peertube-runner/src/register/register.ts@@ -1,4 +1,4 @@-import { IPCClient } from '../shared/ipc'+import { IPCClient } from '../shared/ipc/index.js'export async function registerRunner (options: {url: stringdiff --git a/apps/peertube-runner/src/server/index.ts b/apps/peertube-runner/src/server/index.tsnew file mode 100644index 0000000000..e56cda526b--- /dev/null+++ b/apps/peertube-runner/src/server/index.ts@@ -0,0 +1 @@+export * from './server.js'diff --git a/apps/peertube-runner/src/server/process/index.ts b/apps/peertube-runner/src/server/process/index.tsnew file mode 100644index 0000000000..64a7b00fcd--- /dev/null+++ b/apps/peertube-runner/src/server/process/index.ts@@ -0,0 +1,2 @@+export * from './shared/index.js'+export * from './process.js'diff --git a/packages/peertube-runner/server/process/process.ts b/apps/peertube-runner/src/server/process/process.tssimilarity index 90%rename from packages/peertube-runner/server/process/process.tsrename to apps/peertube-runner/src/server/process/process.tsindex 1caafda8ce..e8a1d7c281 100644--- a/packages/peertube-runner/server/process/process.ts+++ b/apps/peertube-runner/src/server/process/process.ts@@ -1,14 +1,14 @@-import { logger } from 'packages/peertube-runner/shared/logger'import {RunnerJobLiveRTMPHLSTranscodingPayload,RunnerJobStudioTranscodingPayload,RunnerJobVODAudioMergeTranscodingPayload,RunnerJobVODHLSTranscodingPayload,RunnerJobVODWebVideoTranscodingPayload-} from '@shared/models'-import { processAudioMergeTranscoding, processHLSTranscoding, ProcessOptions, processWebVideoTranscoding } from './shared'-import { ProcessLiveRTMPHLSTranscoding } from './shared/process-live'-import { processStudioTranscoding } from './shared/process-studio'+} from '@peertube/peertube-models'+import { logger } from '../../shared/index.js'+import { processAudioMergeTranscoding, processHLSTranscoding, ProcessOptions, processWebVideoTranscoding } from './shared/index.js'+import { ProcessLiveRTMPHLSTranscoding } from './shared/process-live.js'+import { processStudioTranscoding } from './shared/process-studio.js'export async function processJob (options: ProcessOptions) {const { server, job } = optionsdiff --git a/packages/peertube-runner/server/process/shared/common.ts b/apps/peertube-runner/src/server/process/shared/common.tssimilarity index 84%rename from packages/peertube-runner/server/process/shared/common.tsrename to apps/peertube-runner/src/server/process/shared/common.tsindex a9b37bbc41..09241d93b4 100644--- a/packages/peertube-runner/server/process/shared/common.ts+++ b/apps/peertube-runner/src/server/process/shared/common.ts@@ -1,11 +1,11 @@-import { remove } from 'fs-extra'-import { ConfigManager, downloadFile, logger } from 'packages/peertube-runner/shared'+import { remove } from 'fs-extra/esm'import { join } from 'path'-import { buildUUID } from '@shared/extra-utils'-import { FFmpegEdition, FFmpegLive, FFmpegVOD, getDefaultAvailableEncoders, getDefaultEncodersToTry } from '@shared/ffmpeg'-import { RunnerJob, RunnerJobPayload } from '@shared/models'-import { PeerTubeServer } from '@shared/server-commands'-import { getTranscodingLogger } from './transcoding-logger'+import { FFmpegEdition, FFmpegLive, FFmpegVOD, getDefaultAvailableEncoders, getDefaultEncodersToTry } from '@peertube/peertube-ffmpeg'+import { RunnerJob, RunnerJobPayload } from '@peertube/peertube-models'+import { buildUUID } from '@peertube/peertube-node-utils'+import { PeerTubeServer } from '@peertube/peertube-server-commands'+import { ConfigManager, downloadFile, logger } from '../../../shared/index.js'+import { getTranscodingLogger } from './transcoding-logger.js'export type JobWithToken <T extends RunnerJobPayload = RunnerJobPayload> = RunnerJob<T> & { jobToken: string }diff --git a/apps/peertube-runner/src/server/process/shared/index.ts b/apps/peertube-runner/src/server/process/shared/index.tsnew file mode 100644index 0000000000..638bf127f1--- /dev/null+++ b/apps/peertube-runner/src/server/process/shared/index.ts@@ -0,0 +1,3 @@+export * from './common.js'+export * from './process-vod.js'+export * from './transcoding-logger.js'diff --git a/packages/peertube-runner/server/process/shared/process-live.ts b/apps/peertube-runner/src/server/process/shared/process-live.tssimilarity index 95%rename from packages/peertube-runner/server/process/shared/process-live.tsrename to apps/peertube-runner/src/server/process/shared/process-live.tsindex e1fc0e34e5..0dc4e5b134 100644--- a/packages/peertube-runner/server/process/shared/process-live.ts+++ b/apps/peertube-runner/src/server/process/shared/process-live.ts@@ -1,20 +1,20 @@import { FSWatcher, watch } from 'chokidar'import { FfmpegCommand } from 'fluent-ffmpeg'-import { ensureDir, remove } from 'fs-extra'-import { logger } from 'packages/peertube-runner/shared'+import { ensureDir, remove } from 'fs-extra/esm'import { basename, join } from 'path'-import { wait } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { ffprobePromise, getVideoStreamBitrate, getVideoStreamDimensionsInfo, hasAudioStream } from '@shared/ffmpeg'+import { wait } from '@peertube/peertube-core-utils'+import { ffprobePromise, getVideoStreamBitrate, getVideoStreamDimensionsInfo, hasAudioStream } from '@peertube/peertube-ffmpeg'import {LiveRTMPHLSTranscodingSuccess,LiveRTMPHLSTranscodingUpdatePayload,PeerTubeProblemDocument,RunnerJobLiveRTMPHLSTranscodingPayload,ServerErrorCode-} from '@shared/models'-import { ConfigManager } from '../../../shared/config-manager'-import { buildFFmpegLive, ProcessOptions } from './common'+} from '@peertube/peertube-models'+import { buildUUID } from '@peertube/peertube-node-utils'+import { ConfigManager } from '../../../shared/config-manager.js'+import { logger } from '../../../shared/index.js'+import { buildFFmpegLive, ProcessOptions } from './common.js'export class ProcessLiveRTMPHLSTranscoding {diff --git a/packages/peertube-runner/server/process/shared/process-studio.ts b/apps/peertube-runner/src/server/process/shared/process-studio.tssimilarity index 92%rename from packages/peertube-runner/server/process/shared/process-studio.tsrename to apps/peertube-runner/src/server/process/shared/process-studio.tsindex 7bb209e80a..11b7b7d9a9 100644--- a/packages/peertube-runner/server/process/shared/process-studio.ts+++ b/apps/peertube-runner/src/server/process/shared/process-studio.ts@@ -1,8 +1,6 @@-import { remove } from 'fs-extra'-import { logger } from 'packages/peertube-runner/shared'+import { remove } from 'fs-extra/esm'import { join } from 'path'-import { pick } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'+import { pick } from '@peertube/peertube-core-utils'import {RunnerJobStudioTranscodingPayload,VideoStudioTask,@@ -12,9 +10,11 @@ import {VideoStudioTaskPayload,VideoStudioTaskWatermarkPayload,VideoStudioTranscodingSuccess-} from '@shared/models'-import { ConfigManager } from '../../../shared/config-manager'-import { buildFFmpegEdition, downloadInputFile, JobWithToken, ProcessOptions, scheduleTranscodingProgress } from './common'+} from '@peertube/peertube-models'+import { buildUUID } from '@peertube/peertube-node-utils'+import { ConfigManager } from '../../../shared/config-manager.js'+import { logger } from '../../../shared/index.js'+import { buildFFmpegEdition, downloadInputFile, JobWithToken, ProcessOptions, scheduleTranscodingProgress } from './common.js'export async function processStudioTranscoding (options: ProcessOptions<RunnerJobStudioTranscodingPayload>) {const { server, job, runnerToken } = optionsdiff --git a/packages/peertube-runner/server/process/shared/process-vod.ts b/apps/peertube-runner/src/server/process/shared/process-vod.tssimilarity index 95%rename from packages/peertube-runner/server/process/shared/process-vod.tsrename to apps/peertube-runner/src/server/process/shared/process-vod.tsindex f7c076b276..fe1715ca91 100644--- a/packages/peertube-runner/server/process/shared/process-vod.ts+++ b/apps/peertube-runner/src/server/process/shared/process-vod.ts@@ -1,7 +1,5 @@-import { remove } from 'fs-extra'-import { logger } from 'packages/peertube-runner/shared'+import { remove } from 'fs-extra/esm'import { join } from 'path'-import { buildUUID } from '@shared/extra-utils'import {RunnerJobVODAudioMergeTranscodingPayload,RunnerJobVODHLSTranscodingPayload,@@ -9,9 +7,11 @@ import {VODAudioMergeTranscodingSuccess,VODHLSTranscodingSuccess,VODWebVideoTranscodingSuccess-} from '@shared/models'-import { ConfigManager } from '../../../shared/config-manager'-import { buildFFmpegVOD, downloadInputFile, ProcessOptions, scheduleTranscodingProgress } from './common'+} from '@peertube/peertube-models'+import { buildUUID } from '@peertube/peertube-node-utils'+import { ConfigManager } from '../../../shared/config-manager.js'+import { logger } from '../../../shared/index.js'+import { buildFFmpegVOD, downloadInputFile, ProcessOptions, scheduleTranscodingProgress } from './common.js'export async function processWebVideoTranscoding (options: ProcessOptions<RunnerJobVODWebVideoTranscodingPayload>) {const { server, job, runnerToken } = optionsdiff --git a/packages/peertube-runner/server/process/shared/transcoding-logger.ts b/apps/peertube-runner/src/server/process/shared/transcoding-logger.tssimilarity index 76%rename from packages/peertube-runner/server/process/shared/transcoding-logger.tsrename to apps/peertube-runner/src/server/process/shared/transcoding-logger.tsindex d0f928914f..041dd62ebb 100644--- a/packages/peertube-runner/server/process/shared/transcoding-logger.ts+++ b/apps/peertube-runner/src/server/process/shared/transcoding-logger.ts@@ -1,4 +1,4 @@-import { logger } from 'packages/peertube-runner/shared/logger'+import { logger } from '../../../shared/index.js'export function getTranscodingLogger () {return {diff --git a/packages/peertube-runner/server/server.ts b/apps/peertube-runner/src/server/server.tssimilarity index 93%rename from packages/peertube-runner/server/server.tsrename to apps/peertube-runner/src/server/server.tsindex 5fa86fa1ac..825e3f2979 100644--- a/packages/peertube-runner/server/server.ts+++ b/apps/peertube-runner/src/server/server.ts@@ -1,14 +1,15 @@-import { ensureDir, readdir, remove } from 'fs-extra'+import { ensureDir, remove } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { join } from 'path'import { io, Socket } from 'socket.io-client'-import { pick, shuffle, wait } from '@shared/core-utils'-import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'-import { PeerTubeServer as PeerTubeServerCommand } from '@shared/server-commands'-import { ConfigManager } from '../shared'-import { IPCServer } from '../shared/ipc'-import { logger } from '../shared/logger'-import { JobWithToken, processJob } from './process'-import { isJobSupported } from './shared'+import { pick, shuffle, wait } from '@peertube/peertube-core-utils'+import { PeerTubeProblemDocument, ServerErrorCode } from '@peertube/peertube-models'+import { PeerTubeServer as PeerTubeServerCommand } from '@peertube/peertube-server-commands'+import { ConfigManager } from '../shared/index.js'+import { IPCServer } from '../shared/ipc/index.js'+import { logger } from '../shared/logger.js'+import { JobWithToken, processJob } from './process/index.js'+import { isJobSupported } from './shared/index.js'type PeerTubeServer = PeerTubeServerCommand & {runnerToken: stringdiff --git a/apps/peertube-runner/src/server/shared/index.ts b/apps/peertube-runner/src/server/shared/index.tsnew file mode 100644index 0000000000..34d51196b3--- /dev/null+++ b/apps/peertube-runner/src/server/shared/index.ts@@ -0,0 +1 @@+export * from './supported-job.js'diff --git a/packages/peertube-runner/server/shared/supported-job.ts b/apps/peertube-runner/src/server/shared/supported-job.tssimilarity index 97%rename from packages/peertube-runner/server/shared/supported-job.tsrename to apps/peertube-runner/src/server/shared/supported-job.tsindex 1137d8206a..d905b5de27 100644--- a/packages/peertube-runner/server/shared/supported-job.ts+++ b/apps/peertube-runner/src/server/shared/supported-job.ts@@ -7,7 +7,7 @@ import {RunnerJobVODHLSTranscodingPayload,RunnerJobVODWebVideoTranscodingPayload,VideoStudioTaskPayload-} from '@shared/models'+} from '@peertube/peertube-models'const supportedMatrix = {'vod-web-video-transcoding': (_payload: RunnerJobVODWebVideoTranscodingPayload) => {diff --git a/packages/peertube-runner/shared/config-manager.ts b/apps/peertube-runner/src/shared/config-manager.tssimilarity index 94%rename from packages/peertube-runner/shared/config-manager.tsrename to apps/peertube-runner/src/shared/config-manager.tsindex 548eeab857..84a326a168 100644--- a/packages/peertube-runner/shared/config-manager.ts+++ b/apps/peertube-runner/src/shared/config-manager.ts@@ -1,9 +1,10 @@+import { parse, stringify } from '@iarna/toml'import envPaths from 'env-paths'-import { ensureDir, pathExists, readFile, remove, writeFile } from 'fs-extra'-import { merge } from 'lodash'-import { logger } from 'packages/peertube-runner/shared/logger'+import { ensureDir, pathExists, remove } from 'fs-extra/esm'+import { readFile, writeFile } from 'fs/promises'+import merge from 'lodash-es/merge.js'import { dirname, join } from 'path'-import { parse, stringify } from '@iarna/toml'+import { logger } from '../shared/index.js'const paths = envPaths('peertube-runner')diff --git a/packages/peertube-runner/shared/http.ts b/apps/peertube-runner/src/shared/http.tssimilarity index 92%rename from packages/peertube-runner/shared/http.tsrename to apps/peertube-runner/src/shared/http.tsindex df64dc168c..42886279c8 100644--- a/packages/peertube-runner/shared/http.ts+++ b/apps/peertube-runner/src/shared/http.ts@@ -1,7 +1,8 @@-import { createWriteStream, remove } from 'fs-extra'+import { createWriteStream } from 'fs'+import { remove } from 'fs-extra/esm'import { request as requestHTTP } from 'http'import { request as requestHTTPS, RequestOptions } from 'https'-import { logger } from './logger'+import { logger } from './logger.js'export function downloadFile (options: {url: stringdiff --git a/apps/peertube-runner/src/shared/index.ts b/apps/peertube-runner/src/shared/index.tsnew file mode 100644index 0000000000..951eef55b2--- /dev/null+++ b/apps/peertube-runner/src/shared/index.ts@@ -0,0 +1,3 @@+export * from './config-manager.js'+export * from './http.js'+export * from './logger.js'diff --git a/apps/peertube-runner/src/shared/ipc/index.ts b/apps/peertube-runner/src/shared/ipc/index.tsnew file mode 100644index 0000000000..337d4de167--- /dev/null+++ b/apps/peertube-runner/src/shared/ipc/index.ts@@ -0,0 +1,2 @@+export * from './ipc-client.js'+export * from './ipc-server.js'diff --git a/packages/peertube-runner/shared/ipc/ipc-client.ts b/apps/peertube-runner/src/shared/ipc/ipc-client.tssimilarity index 95%rename from packages/peertube-runner/shared/ipc/ipc-client.tsrename to apps/peertube-runner/src/shared/ipc/ipc-client.tsindex f8e72f97f9..aa5740dd16 100644--- a/packages/peertube-runner/shared/ipc/ipc-client.ts+++ b/apps/peertube-runner/src/shared/ipc/ipc-client.ts@@ -1,8 +1,8 @@import CliTable3 from 'cli-table3'-import { ensureDir } from 'fs-extra'+import { ensureDir } from 'fs-extra/esm'import { Client as NetIPC } from 'net-ipc'-import { ConfigManager } from '../config-manager'-import { IPCReponse, IPCReponseData, IPCRequest } from './shared'+import { ConfigManager } from '../config-manager.js'+import { IPCReponse, IPCReponseData, IPCRequest } from './shared/index.js'export class IPCClient {private netIPC: NetIPCdiff --git a/packages/peertube-runner/shared/ipc/ipc-server.ts b/apps/peertube-runner/src/shared/ipc/ipc-server.tssimilarity index 87%rename from packages/peertube-runner/shared/ipc/ipc-server.tsrename to apps/peertube-runner/src/shared/ipc/ipc-server.tsindex 4b67d01ae8..c684385044 100644--- a/packages/peertube-runner/shared/ipc/ipc-server.ts+++ b/apps/peertube-runner/src/shared/ipc/ipc-server.ts@@ -1,10 +1,10 @@-import { ensureDir } from 'fs-extra'+import { ensureDir } from 'fs-extra/esm'import { Server as NetIPC } from 'net-ipc'-import { pick } from '@shared/core-utils'-import { RunnerServer } from '../../server'-import { ConfigManager } from '../config-manager'-import { logger } from '../logger'-import { IPCReponse, IPCReponseData, IPCRequest } from './shared'+import { pick } from '@peertube/peertube-core-utils'+import { RunnerServer } from '../../server/index.js'+import { ConfigManager } from '../config-manager.js'+import { logger } from '../logger.js'+import { IPCReponse, IPCReponseData, IPCRequest } from './shared/index.js'export class IPCServer {private netIPC: NetIPCdiff --git a/apps/peertube-runner/src/shared/ipc/shared/index.ts b/apps/peertube-runner/src/shared/ipc/shared/index.tsnew file mode 100644index 0000000000..986acafb0b--- /dev/null+++ b/apps/peertube-runner/src/shared/ipc/shared/index.ts@@ -0,0 +1,2 @@+export * from './ipc-request.model.js'+export * from './ipc-response.model.js'diff --git a/packages/peertube-runner/shared/ipc/shared/ipc-request.model.ts b/apps/peertube-runner/src/shared/ipc/shared/ipc-request.model.tssimilarity index 100%rename from packages/peertube-runner/shared/ipc/shared/ipc-request.model.tsrename to apps/peertube-runner/src/shared/ipc/shared/ipc-request.model.tsdiff --git a/packages/peertube-runner/shared/ipc/shared/ipc-response.model.ts b/apps/peertube-runner/src/shared/ipc/shared/ipc-response.model.tssimilarity index 100%rename from packages/peertube-runner/shared/ipc/shared/ipc-response.model.tsrename to apps/peertube-runner/src/shared/ipc/shared/ipc-response.model.tsdiff --git a/packages/peertube-runner/shared/logger.ts b/apps/peertube-runner/src/shared/logger.tssimilarity index 77%rename from packages/peertube-runner/shared/logger.tsrename to apps/peertube-runner/src/shared/logger.tsindex bf0f41828e..ef5283892a 100644--- a/packages/peertube-runner/shared/logger.ts+++ b/apps/peertube-runner/src/shared/logger.ts@@ -1,7 +1,7 @@import { pino } from 'pino'import pretty from 'pino-pretty'-const logger = pino(pretty({+const logger = pino(pretty.default({colorize: true}))diff --git a/apps/peertube-runner/tsconfig.json b/apps/peertube-runner/tsconfig.jsonnew file mode 100644index 0000000000..03660b0ebd--- /dev/null+++ b/apps/peertube-runner/tsconfig.json@@ -0,0 +1,16 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "baseUrl": "./",+ "outDir": "./dist",+ "rootDir": "src",+ "tsBuildInfoFile": "./dist/.tsbuildinfo"+ },+ "references": [+ { "path": "../../packages/core-utils" },+ { "path": "../../packages/ffmpeg" },+ { "path": "../../packages/models" },+ { "path": "../../packages/node-utils" },+ { "path": "../../packages/server-commands" }+ ]+}diff --git a/packages/peertube-runner/yarn.lock b/apps/peertube-runner/yarn.locksimilarity index 100%rename from packages/peertube-runner/yarn.lockrename to apps/peertube-runner/yarn.lockdiff --git a/client/.eslintrc.json b/client/.eslintrc.jsonindex c5685b9dc1..e4c8d901bb 100644--- a/client/.eslintrc.json+++ b/client/.eslintrc.json@@ -14,6 +14,7 @@"project": ["tsconfig.eslint.json"],+ "EXPERIMENTAL_useSourceOfProjectReferenceRedirect": true,"createDefaultProgram": false},"extends": [diff --git a/client/e2e/wdio.main.conf.ts b/client/e2e/wdio.main.conf.tsindex 5ae7fa18bf..8e6ef51cff 100644--- a/client/e2e/wdio.main.conf.ts+++ b/client/e2e/wdio.main.conf.ts@@ -107,14 +107,6 @@ export const config = {tsNodeOpts: {project: require('path').join(__dirname, './tsconfig.json')- },-- tsConfigPathsOpts: {- baseUrl: './',- paths: {- '@server/*': [ '../../server/*' ],- '@shared/*': [ '../../shared/*' ]- }}},diff --git a/client/package.json b/client/package.jsonindex 149322192a..9c311622bc 100644--- a/client/package.json+++ b/client/package.json@@ -14,7 +14,7 @@},"scripts": {"lint": "npm run lint-ts && npm run lint-scss",- "lint-ts": "eslint --ext .ts src/standalone/**/*.ts && npm run ng lint",+ "lint-ts": "eslint --cache --ext .ts src/standalone/**/*.ts && npm run ng lint","lint-scss": "stylelint 'src/**/*.scss'","webpack": "webpack","eslint": "eslint",@@ -24,6 +24,9 @@"ngx-extractor": "ngx-extractor","stylelint": "stylelint"},+ "workspaces": [+ "../packages/*"+ ],"typings": "*.d.ts","devDependencies": {"@angular-devkit/build-angular": "^16.0.2",@@ -57,6 +60,8 @@"@peertube/maildev": "^1.2.0","@peertube/p2p-media-loader-core": "^1.0.14","@peertube/p2p-media-loader-hlsjs": "^1.0.14",+ "@peertube/peertube-core-utils": "*",+ "@peertube/peertube-models": "*","@peertube/videojs-contextmenu": "^5.5.0","@peertube/xliffmerge": "^2.0.3","@popperjs/core": "^2.11.5",@@ -86,7 +91,7 @@"buffer": "^6.0.3","chart.js": "^4.3.0","chartjs-plugin-zoom": "~2.0.1",- "chromedriver": "^113.0.0",+ "chromedriver": "^115.0.1","core-js": "^3.22.8","css-loader": "^6.2.0","debug": "^4.3.1",@@ -122,6 +127,7 @@"stylelint": "^15.1.0","stylelint-config-sass-guidelines": "^10.0.0","ts-loader": "^9.3.0",+ "ts-node": "^10.9.1","tslib": "^2.4.0","typescript": "~4.9.5","video.js": "^7.19.2",diff --git a/client/src/app/+about/about-follows/about-follows.component.ts b/client/src/app/+about/about-follows/about-follows.component.tsindex e1df8b813e..a542cdbf11 100644--- a/client/src/app/+about/about-follows/about-follows.component.ts+++ b/client/src/app/+about/about-follows/about-follows.component.ts@@ -2,7 +2,7 @@ import { SortMeta } from 'primeng/api'import { Component, OnInit } from '@angular/core'import { ComponentPagination, hasMoreItems, Notifier, RestService, ServerService } from '@app/core'import { InstanceFollowService } from '@app/shared/shared-instance'-import { Actor } from '@shared/models/actors'+import { Actor } from '@peertube/peertube-models'@Component({selector: 'my-about-follows',diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.tsindex fc52142158..85e973d7ba 100644--- a/client/src/app/+about/about-instance/about-instance.component.ts+++ b/client/src/app/+about/about-instance/about-instance.component.ts@@ -3,8 +3,8 @@ import { AfterViewChecked, Component, ElementRef, OnInit, ViewChild } from '@angimport { ActivatedRoute } from '@angular/router'import { Notifier, ServerService } from '@app/core'import { AboutHTML } from '@app/shared/shared-instance'+import { HTMLServerConfig, ServerStats } from '@peertube/peertube-models'import { copyToClipboard } from '@root-helpers/utils'-import { HTMLServerConfig, ServerStats } from '@shared/models/server'import { ResolverData } from './about-instance.resolver'import { ContactAdminModalComponent } from './contact-admin-modal.component'diff --git a/client/src/app/+about/about-instance/about-instance.resolver.ts b/client/src/app/+about/about-instance/about-instance.resolver.tsindex f52a95b88e..b5e8ccaa25 100644--- a/client/src/app/+about/about-instance/about-instance.resolver.ts+++ b/client/src/app/+about/about-instance/about-instance.resolver.ts@@ -4,7 +4,7 @@ import { Injectable } from '@angular/core'import { ServerService } from '@app/core'import { CustomMarkupService } from '@app/shared/shared-custom-markup'import { AboutHTML, InstanceService } from '@app/shared/shared-instance'-import { About, ServerStats } from '@shared/models/server'+import { About, ServerStats } from '@peertube/peertube-models'export type ResolverData = {serverStats: ServerStatsdiff --git a/client/src/app/+about/about-instance/contact-admin-modal.component.ts b/client/src/app/+about/about-instance/contact-admin-modal.component.tsindex 0e2bf51e82..38e577fcdf 100644--- a/client/src/app/+about/about-instance/contact-admin-modal.component.ts+++ b/client/src/app/+about/about-instance/contact-admin-modal.component.ts@@ -11,7 +11,7 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { InstanceService } from '@app/shared/shared-instance'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'-import { HTMLServerConfig, HttpStatusCode } from '@shared/models'+import { HTMLServerConfig, HttpStatusCode } from '@peertube/peertube-models'type Prefill = {subject?: stringdiff --git a/client/src/app/+about/about-instance/instance-statistics.component.ts b/client/src/app/+about/about-instance/instance-statistics.component.tsindex ac69844388..9eb56d0a46 100644--- a/client/src/app/+about/about-instance/instance-statistics.component.ts+++ b/client/src/app/+about/about-instance/instance-statistics.component.ts@@ -1,5 +1,5 @@import { Component, Input } from '@angular/core'-import { ServerStats } from '@shared/models/server'+import { ServerStats } from '@peertube/peertube-models'@Component({selector: 'my-instance-statistics',diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.tsindex 2ee168492c..b8afa66ff7 100644--- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts+++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts@@ -5,7 +5,7 @@ import { ComponentPagination, hasMoreItems, MarkdownService, User, UserService }import { SimpleMemoize } from '@app/helpers'import { Account, AccountService, Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature'-import { NSFWPolicyType, VideoSortField } from '@shared/models'+import { NSFWPolicyType, VideoSortField } from '@peertube/peertube-models'@Component({selector: 'my-account-video-channels',diff --git a/client/src/app/+accounts/account-videos/account-videos.component.ts b/client/src/app/+accounts/account-videos/account-videos.component.tsindex 13d1f857d8..d8e8377e12 100644--- a/client/src/app/+accounts/account-videos/account-videos.component.ts+++ b/client/src/app/+accounts/account-videos/account-videos.component.ts@@ -4,7 +4,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'import { ComponentPaginationLight, DisableForReuseHook, ScreenService } from '@app/core'import { Account, AccountService, VideoService } from '@app/shared/shared-main'import { VideoFilters } from '@app/shared/shared-video-miniature'-import { VideoSortField } from '@shared/models'+import { VideoSortField } from '@peertube/peertube-models'@Component({selector: 'my-account-videos',diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.tsindex 6d912e3256..156f358046 100644--- a/client/src/app/+accounts/accounts.component.ts+++ b/client/src/app/+accounts/accounts.component.ts@@ -13,7 +13,7 @@ import {VideoService} from '@app/shared/shared-main'import { AccountReportComponent, BlocklistService } from '@app/shared/shared-moderation'-import { HttpStatusCode, User, UserRight } from '@shared/models'+import { HttpStatusCode, User, UserRight } from '@peertube/peertube-models'@Component({templateUrl: './accounts.component.html',diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.tsindex 49092ea2aa..c0d7db99e8 100644--- a/client/src/app/+admin/admin.component.ts+++ b/client/src/app/+admin/admin.component.ts@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'import { AuthService, ScreenService, ServerService } from '@app/core'import { ListOverflowItem } from '@app/shared/shared-main'import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'@Component({templateUrl: './admin.component.html',diff --git a/client/src/app/+admin/config/config.routes.ts b/client/src/app/+admin/config/config.routes.tsindex 6d255ac463..96a4f3771b 100644--- a/client/src/app/+admin/config/config.routes.ts+++ b/client/src/app/+admin/config/config.routes.ts@@ -1,7 +1,7 @@import { Routes } from '@angular/router'import { EditCustomConfigComponent } from '@app/+admin/config/edit-custom-config'import { UserRightGuard } from '@app/core'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'export const ConfigRoutes: Routes = [{diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.tsindex 2122e67b2a..953c7d5409 100644--- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts+++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts@@ -3,7 +3,7 @@ import { SelectOptionsItem } from 'src/types/select-options-item.model'import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'import { FormGroup } from '@angular/forms'import { MenuService, ThemeService } from '@app/core'-import { HTMLServerConfig } from '@shared/models'+import { HTMLServerConfig } from '@peertube/peertube-models'import { ConfigService } from '../shared/config.service'@Component({diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.tsindex c3b85b196f..54c076b742 100644--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts@@ -27,7 +27,7 @@ import {import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { CustomPageService } from '@app/shared/shared-main/custom-page'-import { CustomConfig, CustomPage, HTMLServerConfig } from '@shared/models'+import { CustomConfig, CustomPage, HTMLServerConfig } from '@peertube/peertube-models'import { EditConfigurationService } from './edit-configuration.service'type ComponentCustomConfig = CustomConfig & {diff --git a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.tsindex 1d1fecf908..59629aa20b 100644--- a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts+++ b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts@@ -2,7 +2,7 @@import { SelectOptionsItem } from 'src/types/select-options-item.model'import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'import { FormGroup } from '@angular/forms'-import { HTMLServerConfig } from '@shared/models'+import { HTMLServerConfig } from '@peertube/peertube-models'import { ConfigService } from '../shared/config.service'import { EditConfigurationService, ResolutionOption } from './edit-configuration.service'diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.tsindex 6496e8753c..a2cd043960 100644--- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts+++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts@@ -2,7 +2,7 @@import { SelectOptionsItem } from 'src/types/select-options-item.model'import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'import { FormGroup } from '@angular/forms'-import { HTMLServerConfig } from '@shared/models'+import { HTMLServerConfig } from '@peertube/peertube-models'import { ConfigService } from '../shared/config.service'import { EditConfigurationService, ResolutionOption } from './edit-configuration.service'diff --git a/client/src/app/+admin/config/shared/config.service.ts b/client/src/app/+admin/config/shared/config.service.tsindex 80f495b41b..3c38949451 100644--- a/client/src/app/+admin/config/shared/config.service.ts+++ b/client/src/app/+admin/config/shared/config.service.ts@@ -2,7 +2,7 @@ import { catchError } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor } from '@app/core'-import { CustomConfig } from '@shared/models'+import { CustomConfig } from '@peertube/peertube-models'import { SelectOptionsItem } from '../../../../types/select-options-item.model'import { environment } from '../../../../environments/environment'diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.tsindex 6188922422..656a7bf87c 100644--- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts+++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts@@ -5,7 +5,7 @@ import { formatICU } from '@app/helpers'import { AdvancedInputFilter } from '@app/shared/shared-forms'import { InstanceFollowService } from '@app/shared/shared-instance'import { DropdownAction } from '@app/shared/shared-main'-import { ActorFollow } from '@shared/models'+import { ActorFollow } from '@peertube/peertube-models'@Component({selector: 'my-followers-list',diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.tsindex 6c8723c160..da6647f6bd 100644--- a/client/src/app/+admin/follows/following-list/following-list.component.ts+++ b/client/src/app/+admin/follows/following-list/following-list.component.ts@@ -3,7 +3,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'import { AdvancedInputFilter } from '@app/shared/shared-forms'import { InstanceFollowService } from '@app/shared/shared-instance'-import { ActorFollow } from '@shared/models'+import { ActorFollow } from '@peertube/peertube-models'import { FollowModalComponent } from './follow-modal.component'import { DropdownAction } from '@app/shared/shared-main'import { formatICU } from '@app/helpers'diff --git a/client/src/app/+admin/follows/follows.routes.ts b/client/src/app/+admin/follows/follows.routes.tsindex 718493dc74..e187f83ea3 100644--- a/client/src/app/+admin/follows/follows.routes.ts+++ b/client/src/app/+admin/follows/follows.routes.ts@@ -1,7 +1,7 @@import { Routes } from '@angular/router'import { VideoRedundanciesListComponent } from '@app/+admin/follows/video-redundancies-list'import { UserRightGuard } from '@app/core'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'import { FollowersListComponent } from './followers-list'import { FollowingListComponent } from './following-list/following-list.component'diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.tsindex efcefd5099..09fc038ceb 100644--- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts+++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts@@ -3,9 +3,8 @@ import { SortMeta } from 'primeng/api'import { Component, OnInit } from '@angular/core'import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'import { BytesPipe, RedundancyService } from '@app/shared/shared-main'+import { VideoRedundanciesTarget, VideoRedundancy, VideosRedundancyStats } from '@peertube/peertube-models'import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'-import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'-import { VideosRedundancyStats } from '@shared/models/server'@Component({selector: 'my-video-redundancies-list',diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancy-information.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancy-information.component.tsindex 6f3090c08b..779d190595 100644--- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancy-information.component.ts+++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancy-information.component.ts@@ -1,5 +1,5 @@import { Component, Input } from '@angular/core'-import { FileRedundancyInformation, StreamingPlaylistRedundancyInformation } from '@shared/models'+import { FileRedundancyInformation, StreamingPlaylistRedundancyInformation } from '@peertube/peertube-models'@Component({selector: 'my-video-redundancy-information',diff --git a/client/src/app/+admin/moderation/moderation.routes.ts b/client/src/app/+admin/moderation/moderation.routes.tsindex 378d2bed73..f0494de7b1 100644--- a/client/src/app/+admin/moderation/moderation.routes.ts+++ b/client/src/app/+admin/moderation/moderation.routes.ts@@ -3,7 +3,7 @@ import { AbuseListComponent } from '@app/+admin/moderation/abuse-list'import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from '@app/+admin/moderation/instance-blocklist'import { VideoBlockListComponent } from '@app/+admin/moderation/video-block-list'import { UserRightGuard } from '@app/core'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'import { RegistrationListComponent } from './registration-list'export const ModerationRoutes: Routes = [diff --git a/client/src/app/+admin/moderation/registration-list/admin-registration.service.ts b/client/src/app/+admin/moderation/registration-list/admin-registration.service.tsindex a9f13cf2fa..f8ab04c713 100644--- a/client/src/app/+admin/moderation/registration-list/admin-registration.service.ts+++ b/client/src/app/+admin/moderation/registration-list/admin-registration.service.ts@@ -4,8 +4,8 @@ import { catchError, concatMap, toArray } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'-import { arrayify } from '@shared/core-utils'-import { ResultList, UserRegistration, UserRegistrationUpdateState } from '@shared/models'+import { arrayify } from '@peertube/peertube-core-utils'+import { ResultList, UserRegistration, UserRegistrationUpdateState } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'@Injectable()diff --git a/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts b/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.tsindex 8f013cbd50..f8e346f50d 100644--- a/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts+++ b/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts@@ -3,7 +3,7 @@ import { Notifier, ServerService } from '@app/core'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'-import { UserRegistration } from '@shared/models'+import { UserRegistration } from '@peertube/peertube-models'import { AdminRegistrationService } from './admin-registration.service'import { REGISTRATION_MODERATION_RESPONSE_VALIDATOR } from './process-registration-validators'diff --git a/client/src/app/+admin/moderation/registration-list/registration-list.component.ts b/client/src/app/+admin/moderation/registration-list/registration-list.component.tsindex 35d9d13d72..1dc5e9077a 100644--- a/client/src/app/+admin/moderation/registration-list/registration-list.component.ts+++ b/client/src/app/+admin/moderation/registration-list/registration-list.component.ts@@ -5,7 +5,7 @@ import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, Simport { formatICU } from '@app/helpers'import { AdvancedInputFilter } from '@app/shared/shared-forms'import { DropdownAction } from '@app/shared/shared-main'-import { UserRegistration, UserRegistrationState } from '@shared/models'+import { UserRegistration, UserRegistrationState } from '@peertube/peertube-models'import { AdminRegistrationService } from './admin-registration.service'import { ProcessRegistrationModalComponent } from './process-registration-modal.component'diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.tsindex f365a2500f..3c6bda16c6 100644--- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts+++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts@@ -7,9 +7,9 @@ import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, Simport { AdvancedInputFilter } from '@app/shared/shared-forms'import { DropdownAction, VideoService } from '@app/shared/shared-main'import { VideoBlockService } from '@app/shared/shared-moderation'+import { buildVideoEmbedLink, decorateVideoLink } from '@peertube/peertube-core-utils'+import { VideoBlacklist, VideoBlacklistType, VideoBlacklistType_Type } from '@peertube/peertube-models'import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'-import { buildVideoEmbedLink, decorateVideoLink } from '@shared/core-utils'-import { VideoBlacklist, VideoBlacklistType } from '@shared/models'@Component({selector: 'my-video-block-list',@@ -21,7 +21,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit {totalRecords = 0sort: SortMeta = { field: 'createdAt', order: -1 }pagination: RestPagination = { count: this.rowsPerPage, start: 0 }- blocklistTypeFilter: VideoBlacklistType = undefined+ blocklistTypeFilter: VideoBlacklistType_TypevideoBlocklistActions: DropdownAction<VideoBlacklist>[][] = []diff --git a/client/src/app/+admin/overview/comments/video-comment-list.component.ts b/client/src/app/+admin/overview/comments/video-comment-list.component.tsindex b770726659..254e76a60f 100644--- a/client/src/app/+admin/overview/comments/video-comment-list.component.ts+++ b/client/src/app/+admin/overview/comments/video-comment-list.component.ts@@ -6,7 +6,7 @@ import { AdvancedInputFilter } from '@app/shared/shared-forms'import { DropdownAction } from '@app/shared/shared-main'import { BulkService } from '@app/shared/shared-moderation'import { VideoCommentAdmin, VideoCommentService } from '@app/shared/shared-video-comment'-import { FeedFormat, UserRight } from '@shared/models'+import { FeedFormat, UserRight } from '@peertube/peertube-models'import { formatICU } from '@app/helpers'@Component({diff --git a/client/src/app/+admin/overview/comments/video-comment.routes.ts b/client/src/app/+admin/overview/comments/video-comment.routes.tsindex f0bd440ad9..f670274300 100644--- a/client/src/app/+admin/overview/comments/video-comment.routes.ts+++ b/client/src/app/+admin/overview/comments/video-comment.routes.ts@@ -1,6 +1,6 @@import { Routes } from '@angular/router'import { UserRightGuard } from '@app/core'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'import { VideoCommentListComponent } from './video-comment-list.component'export const commentRoutes: Routes = [diff --git a/client/src/app/+admin/overview/users/user-edit/user-create.component.ts b/client/src/app/+admin/overview/users/user-edit/user-create.component.tsindex 0627aa8874..77acb99880 100644--- a/client/src/app/+admin/overview/users/user-edit/user-create.component.ts+++ b/client/src/app/+admin/overview/users/user-edit/user-create.component.ts@@ -14,7 +14,7 @@ import {} from '@app/shared/form-validators/user-validators'import { FormReactiveService } from '@app/shared/shared-forms'import { UserAdminService } from '@app/shared/shared-users'-import { UserCreate, UserRole } from '@shared/models'+import { UserCreate, UserRole } from '@peertube/peertube-models'import { UserEdit } from './user-edit'@Component({diff --git a/client/src/app/+admin/overview/users/user-edit/user-edit.ts b/client/src/app/+admin/overview/users/user-edit/user-edit.tsindex 9547da2d10..d61b7b0689 100644--- a/client/src/app/+admin/overview/users/user-edit/user-edit.ts+++ b/client/src/app/+admin/overview/users/user-edit/user-edit.ts@@ -2,9 +2,8 @@ import { Directive, OnInit } from '@angular/core'import { ConfigService } from '@app/+admin/config/shared/config.service'import { AuthService, ScreenService, ServerService, User } from '@app/core'import { FormReactive } from '@app/shared/shared-forms'-import { peertubeTranslate } from '@shared/core-utils'-import { USER_ROLE_LABELS } from '@shared/core-utils/users'-import { HTMLServerConfig, UserAdminFlag, UserRole } from '@shared/models'+import { peertubeTranslate, USER_ROLE_LABELS } from '@peertube/peertube-core-utils'+import { HTMLServerConfig, UserAdminFlag, UserRole } from '@peertube/peertube-models'import { SelectOptionsItem } from '../../../../../types/select-options-item.model'@Directive()diff --git a/client/src/app/+admin/overview/users/user-edit/user-password.component.ts b/client/src/app/+admin/overview/users/user-edit/user-password.component.tsindex ec93619f5d..af39c82afa 100644--- a/client/src/app/+admin/overview/users/user-edit/user-password.component.ts+++ b/client/src/app/+admin/overview/users/user-edit/user-password.component.ts@@ -3,7 +3,7 @@ import { Notifier } from '@app/core'import { USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { UserAdminService } from '@app/shared/shared-users'-import { UserUpdate } from '@shared/models'+import { UserUpdate } from '@peertube/peertube-models'@Component({selector: 'my-user-password',diff --git a/client/src/app/+admin/overview/users/user-edit/user-update.component.ts b/client/src/app/+admin/overview/users/user-edit/user-update.component.tsindex 25d02f0000..b55a519f3d 100644--- a/client/src/app/+admin/overview/users/user-edit/user-update.component.ts+++ b/client/src/app/+admin/overview/users/user-edit/user-update.component.ts@@ -11,7 +11,7 @@ import {} from '@app/shared/form-validators/user-validators'import { FormReactiveService } from '@app/shared/shared-forms'import { TwoFactorService, UserAdminService } from '@app/shared/shared-users'-import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models'+import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@peertube/peertube-models'import { UserEdit } from './user-edit'@Component({diff --git a/client/src/app/+admin/overview/users/user-list/user-list.component.ts b/client/src/app/+admin/overview/users/user-list/user-list.component.tsindex 5d5abf6f4d..a5a1552daf 100644--- a/client/src/app/+admin/overview/users/user-list/user-list.component.ts+++ b/client/src/app/+admin/overview/users/user-list/user-list.component.ts@@ -7,8 +7,8 @@ import { AdvancedInputFilter } from '@app/shared/shared-forms'import { Actor, DropdownAction } from '@app/shared/shared-main'import { AccountMutedStatus, BlocklistService, UserBanModalComponent, UserModerationDisplayType } from '@app/shared/shared-moderation'import { UserAdminService } from '@app/shared/shared-users'+import { User, UserRole, UserRoleType } from '@peertube/peertube-models'import { logger } from '@root-helpers/logger'-import { User, UserRole } from '@shared/models'type UserForList = User & {rawVideoQuota: number@@ -166,7 +166,7 @@ export class UserListComponent extends RestTable <User> implements OnInit {return 'UserListComponent'}- getRoleClass (role: UserRole) {+ getRoleClass (role: UserRoleType) {switch (role) {case UserRole.ADMINISTRATOR:return 'badge-purple'diff --git a/client/src/app/+admin/overview/users/users.routes.ts b/client/src/app/+admin/overview/users/users.routes.tsindex c9724e5fb4..d66b8c762d 100644--- a/client/src/app/+admin/overview/users/users.routes.ts+++ b/client/src/app/+admin/overview/users/users.routes.ts@@ -1,6 +1,6 @@import { Routes } from '@angular/router'import { UserRightGuard } from '@app/core'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'import { UserCreateComponent, UserUpdateComponent } from './user-edit'import { UserListComponent } from './user-list'diff --git a/client/src/app/+admin/overview/videos/video-admin.service.ts b/client/src/app/+admin/overview/videos/video-admin.service.tsindex 7224957068..9b33ed8e51 100644--- a/client/src/app/+admin/overview/videos/video-admin.service.ts+++ b/client/src/app/+admin/overview/videos/video-admin.service.ts@@ -5,8 +5,8 @@ import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'import { AdvancedInputFilter } from '@app/shared/shared-forms'import { CommonVideoParams, Video, VideoService } from '@app/shared/shared-main'-import { ResultList, VideoInclude, VideoPrivacy } from '@shared/models'-import { getAllPrivacies } from '@shared/core-utils'+import { ResultList, VideoInclude, VideoPrivacy } from '@peertube/peertube-models'+import { getAllPrivacies } from '@peertube/peertube-core-utils'@Injectable()export class VideoAdminService {diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.tsindex 2792a2d8a0..2e12a2b31b 100644--- a/client/src/app/+admin/overview/videos/video-list.component.ts+++ b/client/src/app/+admin/overview/videos/video-list.component.ts@@ -8,8 +8,8 @@ import { AdvancedInputFilter } from '@app/shared/shared-forms'import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'import { VideoBlockComponent, VideoBlockService } from '@app/shared/shared-moderation'import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature'-import { getAllFiles } from '@shared/core-utils'-import { UserRight, VideoFile, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'+import { getAllFiles } from '@peertube/peertube-core-utils'+import { UserRight, VideoFile, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@peertube/peertube-models'import { VideoAdminService } from './video-admin.service'@Component({diff --git a/client/src/app/+admin/overview/videos/video.routes.ts b/client/src/app/+admin/overview/videos/video.routes.tsindex 01cb5b4976..dfffd26967 100644--- a/client/src/app/+admin/overview/videos/video.routes.ts+++ b/client/src/app/+admin/overview/videos/video.routes.ts@@ -1,6 +1,6 @@import { Routes } from '@angular/router'import { UserRightGuard } from '@app/core'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'import { VideoListComponent } from './video-list.component'export const videosRoutes: Routes = [diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.tsindex 3fa1c56dc6..1b78a00cd1 100644--- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts+++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts@@ -4,8 +4,8 @@ import { ActivatedRoute, Router } from '@angular/router'import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service'import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core'import { PluginService } from '@app/core/plugins/plugin.service'-import { compareSemVer } from '@shared/core-utils'-import { PeerTubePlugin, PluginType } from '@shared/models'+import { compareSemVer } from '@peertube/peertube-core-utils'+import { PeerTubePlugin, PluginType, PluginType_Type } from '@peertube/peertube-models'@Component({selector: 'my-plugin-list-installed',@@ -13,7 +13,7 @@ import { PeerTubePlugin, PluginType } from '@shared/models'styleUrls: [ './plugin-list-installed.component.scss' ]})export class PluginListInstalledComponent implements OnInit {- pluginType: PluginType+ pluginType: PluginType_Typepagination: ComponentPagination = {currentPage: 1,@@ -48,7 +48,7 @@ export class PluginListInstalledComponent implements OnInit {this.route.queryParams.subscribe(query => {if (!query['pluginType']) return- this.pluginType = parseInt(query['pluginType'], 10)+ this.pluginType = parseInt(query['pluginType'], 10) as PluginType_Typethis.reloadPlugins()})diff --git a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.tsindex c03e37aa5c..5539d1c13c 100644--- a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts+++ b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts@@ -4,8 +4,8 @@ import { Component, OnInit } from '@angular/core'import { ActivatedRoute, Router } from '@angular/router'import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service'import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, PluginService } from '@app/core'+import { PeerTubePluginIndex, PluginType, PluginType_Type } from '@peertube/peertube-models'import { logger } from '@root-helpers/logger'-import { PeerTubePluginIndex, PluginType } from '@shared/models'@Component({selector: 'my-plugin-search',@@ -13,7 +13,7 @@ import { PeerTubePluginIndex, PluginType } from '@shared/models'styleUrls: [ './plugin-search.component.scss' ]})export class PluginSearchComponent implements OnInit {- pluginType: PluginType+ pluginType: PluginType_Typepagination: ComponentPagination = {currentPage: 1,@@ -53,7 +53,7 @@ export class PluginSearchComponent implements OnInit {this.route.queryParams.subscribe(query => {if (!query['pluginType']) return- this.pluginType = parseInt(query['pluginType'], 10)+ this.pluginType = parseInt(query['pluginType'], 10) as PluginType_Typethis.search = query['search'] || ''this.reloadPlugins()diff --git a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.tsindex b1a41567ee..9eee1a901a 100644--- a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts+++ b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts@@ -5,7 +5,7 @@ import { ActivatedRoute } from '@angular/router'import { HooksService, Notifier, PluginService } from '@app/core'import { BuildFormArgument } from '@app/shared/form-validators'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'-import { PeerTubePlugin, RegisterServerSettingOptions } from '@shared/models'+import { PeerTubePlugin, RegisterServerSettingOptions } from '@peertube/peertube-models'import { PluginApiService } from '../shared/plugin-api.service'@Component({diff --git a/client/src/app/+admin/plugins/plugins.routes.ts b/client/src/app/+admin/plugins/plugins.routes.tsindex f735a490bc..40660f1f41 100644--- a/client/src/app/+admin/plugins/plugins.routes.ts+++ b/client/src/app/+admin/plugins/plugins.routes.ts@@ -3,7 +3,7 @@ import { PluginListInstalledComponent } from '@app/+admin/plugins/plugin-list-inimport { PluginSearchComponent } from '@app/+admin/plugins/plugin-search/plugin-search.component'import { PluginShowInstalledComponent } from '@app/+admin/plugins/plugin-show-installed/plugin-show-installed.component'import { UserRightGuard } from '@app/core'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'export const PluginsRoutes: Routes = [{diff --git a/client/src/app/+admin/plugins/shared/plugin-api.service.ts b/client/src/app/+admin/plugins/shared/plugin-api.service.tsindex fbfdaea189..e1bd2f1256 100644--- a/client/src/app/+admin/plugins/shared/plugin-api.service.ts+++ b/client/src/app/+admin/plugins/shared/plugin-api.service.ts@@ -9,9 +9,10 @@ import {PeerTubePlugin,PeerTubePluginIndex,PluginType,+ PluginType_Type,RegisteredServerSettings,ResultList-} from '@shared/models'+} from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'@Injectable()@@ -25,7 +26,7 @@ export class PluginApiService {private pluginService: PluginService) { }- getPluginTypeLabel (type: PluginType) {+ getPluginTypeLabel (type: PluginType_Type) {if (type === PluginType.PLUGIN) {return $localize`plugin`}@@ -34,7 +35,7 @@ export class PluginApiService {}getPlugins (- pluginType: PluginType,+ pluginType: PluginType_Type,componentPagination: ComponentPagination,sort: string) {@@ -49,7 +50,7 @@ export class PluginApiService {}searchAvailablePlugins (- pluginType: PluginType,+ pluginType: PluginType_Type,componentPagination: ComponentPagination,sort: string,search?: string@@ -73,7 +74,7 @@ export class PluginApiService {.pipe(catchError(res => this.restExtractor.handleError(res)))}- getPluginRegisteredSettings (pluginName: string, pluginType: PluginType) {+ getPluginRegisteredSettings (pluginName: string, pluginType: PluginType_Type) {const npmName = this.pluginService.nameToNpmName(pluginName, pluginType)const path = PluginApiService.BASE_PLUGIN_URL + '/' + npmName + '/registered-settings'@@ -83,7 +84,7 @@ export class PluginApiService {)}- updatePluginSettings (pluginName: string, pluginType: PluginType, settings: any) {+ updatePluginSettings (pluginName: string, pluginType: PluginType_Type, settings: any) {const npmName = this.pluginService.nameToNpmName(pluginName, pluginType)const path = PluginApiService.BASE_PLUGIN_URL + '/' + npmName + '/settings'@@ -91,7 +92,7 @@ export class PluginApiService {.pipe(catchError(res => this.restExtractor.handleError(res)))}- uninstall (pluginName: string, pluginType: PluginType) {+ uninstall (pluginName: string, pluginType: PluginType_Type) {const body: ManagePlugin = {npmName: this.pluginService.nameToNpmName(pluginName, pluginType)}@@ -100,7 +101,7 @@ export class PluginApiService {.pipe(catchError(res => this.restExtractor.handleError(res)))}- update (pluginName: string, pluginType: PluginType) {+ update (pluginName: string, pluginType: PluginType_Type) {const body: ManagePlugin = {npmName: this.pluginService.nameToNpmName(pluginName, pluginType)}@@ -118,7 +119,7 @@ export class PluginApiService {.pipe(catchError(res => this.restExtractor.handleError(res)))}- getPluginOrThemeHref (type: PluginType, name: string) {+ getPluginOrThemeHref (type: PluginType_Type, name: string) {const typeString = type === PluginType.PLUGIN? 'plugin': 'theme'diff --git a/client/src/app/+admin/plugins/shared/plugin-card.component.ts b/client/src/app/+admin/plugins/shared/plugin-card.component.tsindex 462a6c213f..ae91f68874 100644--- a/client/src/app/+admin/plugins/shared/plugin-card.component.ts+++ b/client/src/app/+admin/plugins/shared/plugin-card.component.ts@@ -1,5 +1,5 @@import { Component, Input } from '@angular/core'-import { PeerTubePlugin, PeerTubePluginIndex, PluginType } from '@shared/models'+import { PeerTubePlugin, PeerTubePluginIndex, PluginType_Type } from '@peertube/peertube-models'import { PluginApiService } from './plugin-api.service'@Component({@@ -11,7 +11,7 @@ import { PluginApiService } from './plugin-api.service'export class PluginCardComponent {@Input() plugin: PeerTubePluginIndex | PeerTubePlugin@Input() version: string- @Input() pluginType: PluginType+ @Input() pluginType: PluginType_Typeconstructor (private pluginApiService: PluginApiServicediff --git a/client/src/app/+admin/plugins/shared/plugin-navigation.component.ts b/client/src/app/+admin/plugins/shared/plugin-navigation.component.tsindex 1c963f5216..c829bc9753 100644--- a/client/src/app/+admin/plugins/shared/plugin-navigation.component.ts+++ b/client/src/app/+admin/plugins/shared/plugin-navigation.component.ts@@ -1,5 +1,5 @@import { Component, Input } from '@angular/core'-import { PluginType } from '@shared/models/plugins'+import { PluginType_Type } from '@peertube/peertube-models'@Component({selector: 'my-plugin-navigation',@@ -7,5 +7,5 @@ import { PluginType } from '@shared/models/plugins'styleUrls: [ './plugin-navigation.component.scss' ]})export class PluginNavigationComponent {- @Input() pluginType: PluginType+ @Input() pluginType: PluginType_Type}diff --git a/client/src/app/+admin/shared/user-email-info.component.ts b/client/src/app/+admin/shared/user-email-info.component.tsindex e33948b605..0af905c847 100644--- a/client/src/app/+admin/shared/user-email-info.component.ts+++ b/client/src/app/+admin/shared/user-email-info.component.ts@@ -1,5 +1,5 @@import { Component, Input } from '@angular/core'-import { User, UserRegistration } from '@shared/models/users'+import { User, UserRegistration } from '@peertube/peertube-models'@Component({selector: 'my-user-email-info',diff --git a/client/src/app/+admin/shared/user-real-quota-info.component.ts b/client/src/app/+admin/shared/user-real-quota-info.component.tsindex 0a342c799d..dd78fa9f07 100644--- a/client/src/app/+admin/shared/user-real-quota-info.component.ts+++ b/client/src/app/+admin/shared/user-real-quota-info.component.ts@@ -1,6 +1,6 @@import { Component, Input, OnInit } from '@angular/core'import { ServerService } from '@app/core'-import { HTMLServerConfig, VideoResolution } from '@shared/models/index'+import { HTMLServerConfig, VideoResolution } from '@peertube/peertube-models'@Component({selector: 'my-user-real-quota-info',diff --git a/client/src/app/+admin/system/debug/debug.component.ts b/client/src/app/+admin/system/debug/debug.component.tsindex 1f4e71e8ac..5c86803ef2 100644--- a/client/src/app/+admin/system/debug/debug.component.ts+++ b/client/src/app/+admin/system/debug/debug.component.ts@@ -1,6 +1,6 @@import { Component, OnInit } from '@angular/core'import { Notifier } from '@app/core'-import { Debug } from '@shared/models'+import { Debug } from '@peertube/peertube-models'import { DebugService } from './debug.service'@Component({diff --git a/client/src/app/+admin/system/debug/debug.service.ts b/client/src/app/+admin/system/debug/debug.service.tsindex ab1d0a7fa0..24d3b2ab8e 100644--- a/client/src/app/+admin/system/debug/debug.service.ts+++ b/client/src/app/+admin/system/debug/debug.service.ts@@ -3,7 +3,7 @@ import { catchError } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor } from '@app/core'-import { Debug } from '@shared/models'+import { Debug } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'@Injectable()diff --git a/client/src/app/+admin/system/jobs/job.service.ts b/client/src/app/+admin/system/jobs/job.service.tsindex 031e2bad87..eae1dea7de 100644--- a/client/src/app/+admin/system/jobs/job.service.ts+++ b/client/src/app/+admin/system/jobs/job.service.ts@@ -4,7 +4,7 @@ import { catchError, map } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'-import { Job, ResultList } from '@shared/models'+import { Job, ResultList } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'import { JobStateClient } from '../../../../types/job-state-client.type'import { JobTypeClient } from '../../../../types/job-type-client.type'diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.tsindex 6e10c81ff2..4e6b4bf7b6 100644--- a/client/src/app/+admin/system/jobs/jobs.component.ts+++ b/client/src/app/+admin/system/jobs/jobs.component.ts@@ -1,9 +1,9 @@import { SortMeta } from 'primeng/api'import { Component, OnInit } from '@angular/core'import { Notifier, RestPagination, RestTable } from '@app/core'+import { escapeHTML } from '@peertube/peertube-core-utils'+import { Job, JobState, JobType } from '@peertube/peertube-models'import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'-import { escapeHTML } from '@shared/core-utils/renderer'-import { Job, JobState, JobType } from '@shared/models'import { JobStateClient } from '../../../../types/job-state-client.type'import { JobTypeClient } from '../../../../types/job-type-client.type'import { JobService } from './job.service'diff --git a/client/src/app/+admin/system/logs/log-row.model.ts b/client/src/app/+admin/system/logs/log-row.model.tsindex e83c7b064f..15799e8b0b 100644--- a/client/src/app/+admin/system/logs/log-row.model.ts+++ b/client/src/app/+admin/system/logs/log-row.model.ts@@ -1,6 +1,6 @@import omit from 'lodash-es/omit'import { logger } from '@root-helpers/logger'-import { ServerLogLevel } from '@shared/models'+import { ServerLogLevel } from '@peertube/peertube-models'export class LogRow {date: Datediff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.tsindex 939e710d71..22375fcd99 100644--- a/client/src/app/+admin/system/logs/logs.component.ts+++ b/client/src/app/+admin/system/logs/logs.component.ts@@ -1,6 +1,6 @@import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'import { LocalStorageService, Notifier } from '@app/core'-import { ServerLogLevel } from '@shared/models'+import { ServerLogLevel } from '@peertube/peertube-models'import { LogRow } from './log-row.model'import { LogsService } from './logs.service'diff --git a/client/src/app/+admin/system/logs/logs.service.ts b/client/src/app/+admin/system/logs/logs.service.tsindex 933a074a89..9e774d7fd9 100644--- a/client/src/app/+admin/system/logs/logs.service.ts+++ b/client/src/app/+admin/system/logs/logs.service.ts@@ -3,7 +3,7 @@ import { catchError, map } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestService } from '@app/core'-import { ServerLogLevel } from '@shared/models'+import { ServerLogLevel } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'import { LogRow } from './log-row.model'diff --git a/client/src/app/+admin/system/runners/runner-job-list/runner-job-list.component.ts b/client/src/app/+admin/system/runners/runner-job-list/runner-job-list.component.tsindex 2670eac86c..e75446d8c8 100644--- a/client/src/app/+admin/system/runners/runner-job-list/runner-job-list.component.ts+++ b/client/src/app/+admin/system/runners/runner-job-list/runner-job-list.component.ts@@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core'import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'import { formatICU } from '@app/helpers'import { DropdownAction } from '@app/shared/shared-main'-import { RunnerJob, RunnerJobState } from '@shared/models'+import { RunnerJob, RunnerJobState } from '@peertube/peertube-models'import { RunnerJobFormatted, RunnerService } from '../runner.service'import { AdvancedInputFilter } from '@app/shared/shared-forms'diff --git a/client/src/app/+admin/system/runners/runner-list/runner-list.component.ts b/client/src/app/+admin/system/runners/runner-list/runner-list.component.tsindex 7566f967eb..0964471f9c 100644--- a/client/src/app/+admin/system/runners/runner-list/runner-list.component.ts+++ b/client/src/app/+admin/system/runners/runner-list/runner-list.component.ts@@ -2,7 +2,7 @@ import { SortMeta } from 'primeng/api'import { Component, OnInit } from '@angular/core'import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'import { DropdownAction } from '@app/shared/shared-main'-import { Runner } from '@shared/models'+import { Runner } from '@peertube/peertube-models'import { RunnerService } from '../runner.service'@Component({diff --git a/client/src/app/+admin/system/runners/runner-registration-token-list/runner-registration-token-list.component.ts b/client/src/app/+admin/system/runners/runner-registration-token-list/runner-registration-token-list.component.tsindex 77908a2e19..c8a597b181 100644--- a/client/src/app/+admin/system/runners/runner-registration-token-list/runner-registration-token-list.component.ts+++ b/client/src/app/+admin/system/runners/runner-registration-token-list/runner-registration-token-list.component.ts@@ -2,7 +2,7 @@ import { SortMeta } from 'primeng/api'import { Component, OnInit } from '@angular/core'import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'import { DropdownAction } from '@app/shared/shared-main'-import { RunnerRegistrationToken } from '@shared/models'+import { RunnerRegistrationToken } from '@peertube/peertube-models'import { RunnerService } from '../runner.service'@Component({diff --git a/client/src/app/+admin/system/runners/runner.service.ts b/client/src/app/+admin/system/runners/runner.service.tsindex 3ab36c4ff6..94bdaad788 100644--- a/client/src/app/+admin/system/runners/runner.service.ts+++ b/client/src/app/+admin/system/runners/runner.service.ts@@ -4,9 +4,8 @@ import { catchError, concatMap, forkJoin, from, map, toArray } from 'rxjs'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService, ServerService } from '@app/core'-import { arrayify, peertubeTranslate } from '@shared/core-utils'-import { ResultList } from '@shared/models/common'-import { Runner, RunnerJob, RunnerJobAdmin, RunnerJobState, RunnerRegistrationToken } from '@shared/models/runners'+import { arrayify, peertubeTranslate } from '@peertube/peertube-core-utils'+import { ResultList, Runner, RunnerJob, RunnerJobAdmin, RunnerJobState, RunnerRegistrationToken } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'export type RunnerJobFormatted = RunnerJob & {diff --git a/client/src/app/+admin/system/runners/runners.routes.ts b/client/src/app/+admin/system/runners/runners.routes.tsindex fabe687d67..004c3bedda 100644--- a/client/src/app/+admin/system/runners/runners.routes.ts+++ b/client/src/app/+admin/system/runners/runners.routes.ts@@ -1,6 +1,6 @@import { Routes } from '@angular/router'import { UserRightGuard } from '@app/core'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'import { RunnerJobListComponent } from './runner-job-list'import { RunnerListComponent } from './runner-list'import { RunnerRegistrationTokenListComponent } from './runner-registration-token-list'diff --git a/client/src/app/+admin/system/system.routes.ts b/client/src/app/+admin/system/system.routes.tsindex 87e4b25b3b..169d52952b 100644--- a/client/src/app/+admin/system/system.routes.ts+++ b/client/src/app/+admin/system/system.routes.ts@@ -1,6 +1,6 @@import { Routes } from '@angular/router'import { UserRightGuard } from '@app/core'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'import { DebugComponent } from './debug'import { JobsComponent } from './jobs/jobs.component'import { LogsComponent } from './logs'diff --git a/client/src/app/+error-page/error-page.component.ts b/client/src/app/+error-page/error-page.component.tsindex 4fee013509..9cc4646dfe 100644--- a/client/src/app/+error-page/error-page.component.ts+++ b/client/src/app/+error-page/error-page.component.ts@@ -1,7 +1,7 @@import { Component, OnInit } from '@angular/core'import { Title } from '@angular/platform-browser'import { Router } from '@angular/router'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode, HttpStatusCodeType } from '@peertube/peertube-models'@Component({selector: 'my-error-page',@@ -9,7 +9,7 @@ import { HttpStatusCode } from '@shared/models'styleUrls: [ './error-page.component.scss' ]})export class ErrorPageComponent implements OnInit {- status = HttpStatusCode.NOT_FOUND_404+ status: HttpStatusCodeType = HttpStatusCode.NOT_FOUND_404type: 'video' | 'other' = 'other'public constructor (diff --git a/client/src/app/+login/login.component.ts b/client/src/app/+login/login.component.tsindex e486df61dd..a6906efa25 100644--- a/client/src/app/+login/login.component.ts+++ b/client/src/app/+login/login.component.ts@@ -8,8 +8,8 @@ import { USER_OTP_TOKEN_VALIDATOR } from '@app/shared/form-validators/user-validimport { FormReactive, FormReactiveService, InputTextComponent } from '@app/shared/shared-forms'import { InstanceAboutAccordionComponent } from '@app/shared/shared-instance'import { NgbAccordionDirective, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'-import { getExternalAuthHref } from '@shared/core-utils'-import { RegisteredExternalAuthConfig, ServerConfig, ServerErrorCode } from '@shared/models'+import { getExternalAuthHref } from '@peertube/peertube-core-utils'+import { RegisteredExternalAuthConfig, ServerConfig, ServerErrorCode } from '@peertube/peertube-models'@Component({selector: 'my-login',diff --git a/client/src/app/+manage/video-channel-edit/video-channel-create.component.ts b/client/src/app/+manage/video-channel-edit/video-channel-create.component.tsindex 8ca94b0b38..3f876078f8 100644--- a/client/src/app/+manage/video-channel-edit/video-channel-create.component.ts+++ b/client/src/app/+manage/video-channel-edit/video-channel-create.component.ts@@ -11,7 +11,7 @@ import {} from '@app/shared/form-validators/video-channel-validators'import { FormReactiveService } from '@app/shared/shared-forms'import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'-import { HttpStatusCode, VideoChannelCreate } from '@shared/models'+import { HttpStatusCode, VideoChannelCreate } from '@peertube/peertube-models'import { VideoChannelEdit } from './video-channel-edit'@Component({diff --git a/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts b/client/src/app/+manage/video-channel-edit/video-channel-update.component.tsindex f9045db352..3992e298e6 100644--- a/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts+++ b/client/src/app/+manage/video-channel-edit/video-channel-update.component.ts@@ -11,9 +11,9 @@ import {} from '@app/shared/form-validators/video-channel-validators'import { FormReactiveService } from '@app/shared/shared-forms'import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'-import { HTMLServerConfig, VideoChannelUpdate } from '@shared/models'+import { HTMLServerConfig, VideoChannelUpdate } from '@peertube/peertube-models'import { VideoChannelEdit } from './video-channel-edit'-import { shallowCopy } from '@shared/core-utils'+import { shallowCopy } from '@peertube/peertube-core-utils'@Component({selector: 'my-video-channel-update',diff --git a/client/src/app/+my-account/my-account-applications/my-account-applications.component.ts b/client/src/app/+my-account/my-account-applications/my-account-applications.component.tsindex e88cdd2286..281a12edac 100644--- a/client/src/app/+my-account/my-account-applications/my-account-applications.component.ts+++ b/client/src/app/+my-account/my-account-applications/my-account-applications.component.ts@@ -1,8 +1,7 @@import { Component, OnInit } from '@angular/core'import { AuthService, ConfirmService, Notifier, ScopedTokensService } from '@app/core'import { VideoService } from '@app/shared/shared-main'-import { FeedFormat } from '@shared/models'-import { ScopedToken } from '@shared/models/users/user-scoped-token'+import { FeedFormat, ScopedToken } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'@Component({diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.tsindex 1e8fa2a568..7bbd240d08 100644--- a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts+++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts@@ -4,7 +4,7 @@ import { Component, OnInit } from '@angular/core'import { AuthService, Notifier, ServerService, UserService } from '@app/core'import { USER_EMAIL_VALIDATOR, USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'-import { HttpStatusCode, User } from '@shared/models'+import { HttpStatusCode, User } from '@peertube/peertube-models'@Component({selector: 'my-account-change-email',diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.tsindex 805d500701..f916740bee 100644--- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts+++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts@@ -7,7 +7,7 @@ import {USER_PASSWORD_VALIDATOR} from '@app/shared/form-validators/user-validators'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'-import { HttpStatusCode, User } from '@shared/models'+import { HttpStatusCode, User } from '@peertube/peertube-models'@Component({selector: 'my-account-change-password',diff --git a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.tsindex 381d18922c..bf6accc3ed 100644--- a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts+++ b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts@@ -2,7 +2,7 @@ import { Subject } from 'rxjs'import { Component, Input, OnInit } from '@angular/core'import { Notifier, UserService } from '@app/core'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'-import { User, UserUpdateMe } from '@shared/models'+import { User, UserUpdateMe } from '@peertube/peertube-models'@Component({selector: 'my-account-email-preferences',diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.tsindex 2adc276a91..f4181340d2 100644--- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts+++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts@@ -3,8 +3,8 @@ import { Subject } from 'rxjs'import { Component, Input, OnInit } from '@angular/core'import { Notifier, ServerService, User } from '@app/core'import { UserNotificationService } from '@app/shared/shared-main'-import { objectKeysTyped } from '@shared/core-utils'-import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models'+import { objectKeysTyped } from '@peertube/peertube-core-utils'+import { UserNotificationSetting, UserNotificationSettingValue, UserRight, UserRightType } from '@peertube/peertube-models'@Component({selector: 'my-account-notification-preferences',@@ -19,7 +19,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {emailNotifications: { [ id in keyof UserNotificationSetting ]?: boolean } = {}webNotifications: { [ id in keyof UserNotificationSetting ]?: boolean } = {}labelNotifications: { [ id in keyof UserNotificationSetting ]?: string } = {}- rightNotifications: { [ id in keyof Partial<UserNotificationSetting> ]?: UserRight } = {}+ rightNotifications: { [ id in keyof Partial<UserNotificationSetting> ]?: UserRightType } = {}emailEnabled = falseprivate savePreferences = debounce(this.savePreferencesImpl.bind(this), 500)diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.tsindex a276bb1262..4b3b33bcce 100644--- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts+++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts@@ -3,7 +3,7 @@ import { HttpErrorResponse } from '@angular/common/http'import { AfterViewChecked, Component, OnInit } from '@angular/core'import { AuthService, Notifier, User, UserService } from '@app/core'import { genericUploadErrorHandler } from '@app/helpers'-import { shallowCopy } from '@shared/core-utils'+import { shallowCopy } from '@peertube/peertube-core-utils'@Component({selector: 'my-account-settings',diff --git a/client/src/app/+my-library/my-follows/my-followers.component.ts b/client/src/app/+my-library/my-follows/my-followers.component.tsindex 0dd9bf6f5f..4e3e5bcc46 100644--- a/client/src/app/+my-library/my-follows/my-followers.component.ts+++ b/client/src/app/+my-library/my-follows/my-followers.component.ts@@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router'import { AuthService, ComponentPagination, Notifier } from '@app/core'import { AdvancedInputFilter } from '@app/shared/shared-forms'import { UserSubscriptionService } from '@app/shared/shared-user-subscription'-import { ActorFollow } from '@shared/models'+import { ActorFollow } from '@peertube/peertube-models'@Component({templateUrl: './my-followers.component.html',diff --git a/client/src/app/+my-library/my-library.component.ts b/client/src/app/+my-library/my-library.component.tsindex ff901952fa..35eb617abe 100644--- a/client/src/app/+my-library/my-library.component.ts+++ b/client/src/app/+my-library/my-library.component.ts@@ -1,6 +1,6 @@import { Component, OnInit } from '@angular/core'import { AuthService, AuthUser, ScreenService, ServerService } from '@app/core'-import { HTMLServerConfig } from '@shared/models'+import { HTMLServerConfig } from '@peertube/peertube-models'import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component'@Component({diff --git a/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts b/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.tsindex ca7eb680b6..87e3894117 100644--- a/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts+++ b/client/src/app/+my-library/my-ownership/my-accept-ownership/my-accept-ownership.component.ts@@ -6,7 +6,7 @@ import { OWNERSHIP_CHANGE_CHANNEL_VALIDATOR } from '@app/shared/form-validators/import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { VideoOwnershipService } from '@app/shared/shared-main'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'-import { VideoChangeOwnership } from '@shared/models'+import { VideoChangeOwnership } from '@peertube/peertube-models'@Component({selector: 'my-accept-ownership',diff --git a/client/src/app/+my-library/my-ownership/my-ownership.component.ts b/client/src/app/+my-library/my-ownership/my-ownership.component.tsindex 8d6a42dfb3..4838eca277 100644--- a/client/src/app/+my-library/my-ownership/my-ownership.component.ts+++ b/client/src/app/+my-library/my-ownership/my-ownership.component.ts@@ -2,7 +2,7 @@ import { SortMeta } from 'primeng/api'import { Component, OnInit, ViewChild } from '@angular/core'import { Notifier, RestPagination, RestTable } from '@app/core'import { Account, VideoOwnershipService } from '@app/shared/shared-main'-import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '@shared/models'+import { VideoChangeOwnership, VideoChangeOwnershipStatus, VideoChangeOwnershipStatusType } from '@peertube/peertube-models'import { MyAcceptOwnershipComponent } from './my-accept-ownership/my-accept-ownership.component'@Component({@@ -32,7 +32,7 @@ export class MyOwnershipComponent extends RestTable implements OnInit {return 'MyOwnershipComponent'}- getStatusClass (status: VideoChangeOwnershipStatus) {+ getStatusClass (status: VideoChangeOwnershipStatusType) {switch (status) {case VideoChangeOwnershipStatus.ACCEPTED:return 'badge-green'diff --git a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.tsindex 1f7287f445..44e5c45b96 100644--- a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts+++ b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts@@ -3,8 +3,7 @@ import { mergeMap } from 'rxjs'import { Component, OnInit } from '@angular/core'import { AuthService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'import { DropdownAction, VideoChannelService, VideoChannelSyncService } from '@app/shared/shared-main'-import { HTMLServerConfig } from '@shared/models/server'-import { VideoChannelSync, VideoChannelSyncState } from '@shared/models/videos'+import { HTMLServerConfig, VideoChannelSync, VideoChannelSyncState, VideoChannelSyncStateType } from '@peertube/peertube-models'@Component({templateUrl: './my-video-channel-syncs.component.html',@@ -124,7 +123,7 @@ export class MyVideoChannelSyncsComponent extends RestTable implements OnInit {return '/my-library/video-channel-syncs/create'}- getSyncStateClass (stateId: VideoChannelSyncState) {+ getSyncStateClass (stateId: VideoChannelSyncStateType) {return [ 'pt-badge', MyVideoChannelSyncsComponent.STATE_CLASS_BY_ID[stateId] ]}diff --git a/client/src/app/+my-library/my-video-channel-syncs/video-channel-sync-edit/video-channel-sync-edit.component.ts b/client/src/app/+my-library/my-video-channel-syncs/video-channel-sync-edit/video-channel-sync-edit.component.tsindex a14ab5b922..a40a68764e 100644--- a/client/src/app/+my-library/my-video-channel-syncs/video-channel-sync-edit/video-channel-sync-edit.component.ts+++ b/client/src/app/+my-library/my-video-channel-syncs/video-channel-sync-edit/video-channel-sync-edit.component.ts@@ -7,7 +7,7 @@ import { listUserChannelsForSelect } from '@app/helpers'import { VIDEO_CHANNEL_EXTERNAL_URL_VALIDATOR } from '@app/shared/form-validators/video-channel-validators'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { VideoChannelService, VideoChannelSyncService } from '@app/shared/shared-main'-import { VideoChannelSyncCreate } from '@shared/models/videos'+import { VideoChannelSyncCreate } from '@peertube/peertube-models'@Component({selector: 'my-video-channel-sync-edit',diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts b/client/src/app/+my-library/my-video-imports/my-video-imports.component.tsindex 7d82f62b93..76cefa7bdf 100644--- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts+++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts@@ -2,7 +2,7 @@ import { SortMeta } from 'primeng/api'import { Component, OnInit } from '@angular/core'import { Notifier, RestPagination, RestTable } from '@app/core'import { Video, VideoImportService } from '@app/shared/shared-main'-import { VideoImport, VideoImportState } from '@shared/models'+import { VideoImport, VideoImportState, VideoImportStateType } from '@peertube/peertube-models'@Component({templateUrl: './my-video-imports.component.html',@@ -29,7 +29,7 @@ export class MyVideoImportsComponent extends RestTable implements OnInit {return 'MyVideoImportsComponent'}- getVideoImportStateClass (state: VideoImportState) {+ getVideoImportStateClass (state: VideoImportStateType) {switch (state) {case VideoImportState.FAILED:return 'badge-red'diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-create.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-create.component.tsindex 63f72df3f7..a54b3ca864 100644--- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-create.component.ts+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-create.component.ts@@ -11,8 +11,7 @@ import {} from '@app/shared/form-validators/video-playlist-validators'import { FormReactiveService } from '@app/shared/shared-forms'import { VideoPlaylistService } from '@app/shared/shared-video-playlist'-import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model'-import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model'+import { VideoPlaylistCreate, VideoPlaylistPrivacy } from '@peertube/peertube-models'import { MyVideoPlaylistEdit } from './my-video-playlist-edit'@Component({diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.tsindex 71db0592ae..127960a58b 100644--- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.ts+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.ts@@ -1,13 +1,12 @@import { FormReactive } from '@app/shared/shared-forms'-import { VideoConstant, VideoPlaylistPrivacy } from '@shared/models'-import { VideoPlaylist } from '@shared/models/videos/playlist/video-playlist.model'+import { VideoConstant, VideoPlaylist, VideoPlaylistPrivacyType } from '@peertube/peertube-models'import { SelectChannelItem } from '../../../types/select-options-item.model'export abstract class MyVideoPlaylistEdit extends FormReactive {// Declare it here to avoid errors in create templatevideoPlaylistToUpdate: VideoPlaylistuserVideoChannels: SelectChannelItem[] = []- videoPlaylistPrivacies: VideoConstant<VideoPlaylistPrivacy>[] = []+ videoPlaylistPrivacies: VideoConstant<VideoPlaylistPrivacyType>[] = []abstract isCreation (): booleanabstract getFormButtonTitle (): stringdiff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.tsindex c9739b6ccb..7a95887431 100644--- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts@@ -6,7 +6,7 @@ import { ComponentPagination, ConfirmService, HooksService, Notifier, ScreenServimport { DropdownAction } from '@app/shared/shared-main'import { VideoShareComponent } from '@app/shared/shared-share-modal'import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist'-import { VideoPlaylistType } from '@shared/models'+import { VideoPlaylistType } from '@peertube/peertube-models'@Component({templateUrl: './my-video-playlist-elements.component.html',diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.tsindex bbe8a5f803..f29a0cc45b 100644--- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts@@ -13,7 +13,7 @@ import {} from '@app/shared/form-validators/video-playlist-validators'import { FormReactiveService } from '@app/shared/shared-forms'import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'-import { VideoPlaylistUpdate } from '@shared/models'+import { VideoPlaylistUpdate } from '@peertube/peertube-models'import { MyVideoPlaylistEdit } from './my-video-playlist-edit'@Component({diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.tsindex 6341767447..08bd94fae2 100644--- a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts@@ -3,7 +3,7 @@ import { mergeMap } from 'rxjs/operators'import { Component } from '@angular/core'import { AuthService, ComponentPagination, ConfirmService, Notifier } from '@app/core'import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'-import { VideoPlaylistType } from '@shared/models'+import { VideoPlaylistType } from '@peertube/peertube-models'@Component({templateUrl: './my-video-playlists.component.html',diff --git a/client/src/app/+my-library/my-videos/my-videos.component.ts b/client/src/app/+my-library/my-videos/my-videos.component.tsindex 1827d6a0b8..4a76048783 100644--- a/client/src/app/+my-library/my-videos/my-videos.component.ts+++ b/client/src/app/+my-library/my-videos/my-videos.component.ts@@ -16,7 +16,7 @@ import {VideosSelectionComponent} from '@app/shared/shared-video-miniature'import { VideoPlaylistService } from '@app/shared/shared-video-playlist'-import { VideoChannel, VideoExistInPlaylist, VideosExistInPlaylists, VideoSortField } from '@shared/models'+import { VideoChannel, VideoExistInPlaylist, VideosExistInPlaylists, VideoSortField } from '@peertube/peertube-models'import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component'@Component({diff --git a/client/src/app/+search/search-filters.component.ts b/client/src/app/+search/search-filters.component.tsindex a6fc513834..b98acee18c 100644--- a/client/src/app/+search/search-filters.component.ts+++ b/client/src/app/+search/search-filters.component.ts@@ -1,7 +1,7 @@import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'import { ServerService } from '@app/core'import { AdvancedSearch } from '@app/shared/shared-search'-import { HTMLServerConfig, VideoConstant } from '@shared/models'+import { HTMLServerConfig, VideoConstant } from '@peertube/peertube-models'type FormOption = { id: string, label: string }diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.tsindex 31394a1d14..62e349c401 100644--- a/client/src/app/+search/search.component.ts+++ b/client/src/app/+search/search.component.ts@@ -9,7 +9,7 @@ import { Video, VideoChannel } from '@app/shared/shared-main'import { AdvancedSearch, SearchService } from '@app/shared/shared-search'import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature'import { VideoPlaylist } from '@app/shared/shared-video-playlist'-import { HTMLServerConfig, SearchTargetType } from '@shared/models'+import { HTMLServerConfig, SearchTargetType } from '@peertube/peertube-models'@Component({selector: 'my-search',diff --git a/client/src/app/+search/shared/abstract-lazy-load.resolver.ts b/client/src/app/+search/shared/abstract-lazy-load.resolver.tsindex 6765ba15e1..4e8b712933 100644--- a/client/src/app/+search/shared/abstract-lazy-load.resolver.ts+++ b/client/src/app/+search/shared/abstract-lazy-load.resolver.ts@@ -2,7 +2,7 @@ import { Observable } from 'rxjs'import { map } from 'rxjs/operators'import { ActivatedRouteSnapshot, Router } from '@angular/router'import { logger } from '@root-helpers/logger'-import { ResultList } from '@shared/models'+import { ResultList } from '@peertube/peertube-models'export abstract class AbstractLazyLoadResolver <T> {protected router: Routerdiff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.tsindex be51c36d1c..396971d986 100644--- a/client/src/app/+signup/+register/register.component.ts+++ b/client/src/app/+signup/+register/register.component.ts@@ -5,8 +5,7 @@ import { ActivatedRoute } from '@angular/router'import { AuthService } from '@app/core'import { HooksService } from '@app/core/plugins/hooks.service'import { InstanceAboutAccordionComponent } from '@app/shared/shared-instance'-import { UserRegister } from '@shared/models'-import { ServerConfig } from '@shared/models/server'+import { ServerConfig, UserRegister } from '@peertube/peertube-models'import { SignupService } from '../shared/signup.service'@Component({diff --git a/client/src/app/+signup/shared/signup.service.ts b/client/src/app/+signup/shared/signup.service.tsindex f647298be4..7c331437e0 100644--- a/client/src/app/+signup/shared/signup.service.ts+++ b/client/src/app/+signup/shared/signup.service.ts@@ -2,7 +2,7 @@ import { catchError, tap } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, UserService } from '@app/core'-import { UserRegister, UserRegistrationRequest } from '@shared/models'+import { UserRegister, UserRegistrationRequest } from '@peertube/peertube-models'@Injectable()export class SignupService {diff --git a/client/src/app/+stats/video/video-stats.component.ts b/client/src/app/+stats/video/video-stats.component.tsindex fa5e33ab6e..5bde5b01dc 100644--- a/client/src/app/+stats/video/video-stats.component.ts+++ b/client/src/app/+stats/video/video-stats.component.ts@@ -7,15 +7,15 @@ import { ActivatedRoute } from '@angular/router'import { Notifier, PeerTubeRouterService } from '@app/core'import { NumberFormatterPipe, VideoDetails } from '@app/shared/shared-main'import { LiveVideoService } from '@app/shared/shared-video-live'-import { secondsToTime } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models/http'+import { secondsToTime } from '@peertube/peertube-core-utils'import {+ HttpStatusCode,LiveVideoSession,VideoStatsOverall,VideoStatsRetention,VideoStatsTimeserie,VideoStatsTimeserieMetric-} from '@shared/models/videos'+} from '@peertube/peertube-models'import { VideoStatsService } from './video-stats.service'type ActiveGraphId = VideoStatsTimeserieMetric | 'retention' | 'countries'diff --git a/client/src/app/+stats/video/video-stats.service.ts b/client/src/app/+stats/video/video-stats.service.tsindex e019c87f71..5d48178921 100644--- a/client/src/app/+stats/video/video-stats.service.ts+++ b/client/src/app/+stats/video/video-stats.service.ts@@ -4,7 +4,7 @@ import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor } from '@app/core'import { VideoService } from '@app/shared/shared-main'-import { VideoStatsOverall, VideoStatsRetention, VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@shared/models/videos'+import { VideoStatsOverall, VideoStatsRetention, VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@peertube/peertube-models'@Injectable({providedIn: 'root'diff --git a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.tsindex 5e3946bf5e..7259903000 100644--- a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts+++ b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts@@ -4,7 +4,7 @@ import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core'import { ComponentPaginationLight, DisableForReuseHook, HooksService, ScreenService } from '@app/core'import { VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'import { MiniatureDisplayOptions, VideoFilters } from '@app/shared/shared-video-miniature'-import { Video, VideoSortField } from '@shared/models'+import { Video, VideoSortField } from '@peertube/peertube-models'@Component({selector: 'my-video-channel-videos',diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.tsindex f5bea66ec1..40b3b19b78 100644--- a/client/src/app/+video-channels/video-channels.component.ts+++ b/client/src/app/+video-channels/video-channels.component.ts@@ -8,7 +8,7 @@ import { Account, ListOverflowItem, VideoChannel, VideoChannelService, VideoServimport { BlocklistService } from '@app/shared/shared-moderation'import { SupportModalComponent } from '@app/shared/shared-support-modal'import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'-import { HttpStatusCode, UserRight } from '@shared/models'+import { HttpStatusCode, UserRight } from '@peertube/peertube-models'@Component({templateUrl: './video-channels.component.html',diff --git a/client/src/app/+video-studio/edit/video-studio-edit.component.ts b/client/src/app/+video-studio/edit/video-studio-edit.component.tsindex 3d618fbe15..40e9cf40a9 100644--- a/client/src/app/+video-studio/edit/video-studio-edit.component.ts+++ b/client/src/app/+video-studio/edit/video-studio-edit.component.ts@@ -5,8 +5,8 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { VideoDetails } from '@app/shared/shared-main'import { LoadingBarService } from '@ngx-loading-bar/core'import { logger } from '@root-helpers/logger'-import { secondsToTime } from '@shared/core-utils'-import { VideoStudioTask, VideoStudioTaskCut } from '@shared/models'+import { secondsToTime } from '@peertube/peertube-core-utils'+import { VideoStudioTask, VideoStudioTaskCut } from '@peertube/peertube-models'import { VideoStudioService } from '../shared'@Component({diff --git a/client/src/app/+video-studio/shared/video-studio.service.ts b/client/src/app/+video-studio/shared/video-studio.service.tsindex 8d8b2f0e54..a3aabd347c 100644--- a/client/src/app/+video-studio/shared/video-studio.service.ts+++ b/client/src/app/+video-studio/shared/video-studio.service.ts@@ -4,7 +4,7 @@ import { Injectable } from '@angular/core'import { RestExtractor } from '@app/core'import { objectToFormData } from '@app/helpers'import { VideoService } from '@app/shared/shared-main'-import { VideoStudioCreateEdition, VideoStudioTask } from '@shared/models'+import { VideoStudioCreateEdition, VideoStudioTask } from '@peertube/peertube-models'@Injectable()export class VideoStudioService {diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.tsindex 4ab2d42db2..e595cf2c98 100644--- a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts+++ b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts@@ -4,7 +4,7 @@ import { VIDEO_CAPTION_FILE_VALIDATOR, VIDEO_CAPTION_LANGUAGE_VALIDATOR } from 'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { VideoCaptionEdit } from '@app/shared/shared-main'import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'-import { HTMLServerConfig, VideoConstant } from '@shared/models'+import { HTMLServerConfig, VideoConstant } from '@peertube/peertube-models'@Component({selector: 'my-video-caption-add-modal',diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal-content/video-caption-edit-modal-content.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal-content/video-caption-edit-modal-content.component.tsindex 2cb470a246..6c6a30d96e 100644--- a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal-content/video-caption-edit-modal-content.component.ts+++ b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal-content/video-caption-edit-modal-content.component.ts@@ -3,7 +3,7 @@ import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validatorimport { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { VideoCaptionEdit, VideoCaptionService, VideoCaptionWithPathEdit } from '@app/shared/shared-main'import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'-import { HTMLServerConfig, VideoConstant } from '@shared/models'+import { HTMLServerConfig, VideoConstant } from '@peertube/peertube-models'import { ServerService } from '../../../../core'/**diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.tsindex 460960a01a..b0c1352f33 100644--- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts+++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts@@ -24,8 +24,6 @@ import { FormReactiveValidationMessages, FormValidatorService } from '@app/shareimport { InstanceService } from '@app/shared/shared-instance'import { VideoCaptionEdit, VideoCaptionWithPathEdit, VideoEdit, VideoService } from '@app/shared/shared-main'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'-import { logger } from '@root-helpers/logger'-import { PluginInfo } from '@root-helpers/plugins-manager'import {HTMLServerConfig,LiveVideo,@@ -34,9 +32,12 @@ import {RegisterClientVideoFieldOptions,VideoConstant,VideoDetails,- VideoPrivacy-} from '@shared/models'-import { VideoSource } from '@shared/models/videos/video-source'+ VideoPrivacy,+ VideoPrivacyType,+ VideoSource+} from '@peertube/peertube-models'+import { logger } from '@root-helpers/logger'+import { PluginInfo } from '@root-helpers/plugins-manager'import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service'import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component'import { VideoCaptionEditModalContentComponent } from './video-caption-edit-modal-content/video-caption-edit-modal-content.component'@@ -81,8 +82,8 @@ export class VideoEditComponent implements OnInit, OnDestroy {// So that it can be accessed in the templatereadonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY- videoPrivacies: VideoConstant<VideoPrivacy | typeof VideoEdit.SPECIAL_SCHEDULED_PRIVACY > [] = []- replayPrivacies: VideoConstant<VideoPrivacy> [] = []+ videoPrivacies: VideoConstant<VideoPrivacyType | typeof VideoEdit.SPECIAL_SCHEDULED_PRIVACY > [] = []+ replayPrivacies: VideoConstant<VideoPrivacyType> [] = []videoCategories: VideoConstant<number>[] = []videoLicences: VideoConstant<number>[] = []videoLanguages: VideoLanguages[] = []diff --git a/client/src/app/+videos/+video-edit/shared/video-upload.service.ts b/client/src/app/+videos/+video-edit/shared/video-upload.service.tsindex 50ca1a60be..c3f8936a99 100644--- a/client/src/app/+videos/+video-edit/shared/video-upload.service.ts+++ b/client/src/app/+videos/+video-edit/shared/video-upload.service.ts@@ -3,7 +3,7 @@ import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/himport { Injectable } from '@angular/core'import { AuthService, Notifier, ServerService } from '@app/core'import { BytesPipe, VideoService } from '@app/shared/shared-main'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'import { UploaderXFormData } from './uploaderx-form-data'@Injectable()diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.tsindex ba612f5531..f7a570ed3e 100644--- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts+++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts@@ -16,7 +16,7 @@ import {PeerTubeProblemDocument,ServerErrorCode,VideoPrivacy-} from '@shared/models'+} from '@peertube/peertube-models'import { VideoSend } from './video-send'@Component({diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.tsindex 4a1408a4af..97517e1c7f 100644--- a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts+++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts@@ -7,7 +7,7 @@ import { FormReactiveService } from '@app/shared/shared-forms'import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'import { LoadingBarService } from '@ngx-loading-bar/core'import { logger } from '@root-helpers/logger'-import { PeerTubeProblemDocument, ServerErrorCode, VideoUpdate } from '@shared/models'+import { PeerTubeProblemDocument, ServerErrorCode, VideoUpdate } from '@peertube/peertube-models'import { hydrateFormFromVideo } from '../shared/video-edit-utils'import { VideoSend } from './video-send'diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.tsindex 502f3818ec..634bd9914c 100644--- a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts+++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts@@ -8,7 +8,7 @@ import { FormReactiveService } from '@app/shared/shared-forms'import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'import { LoadingBarService } from '@ngx-loading-bar/core'import { logger } from '@root-helpers/logger'-import { VideoUpdate } from '@shared/models'+import { VideoUpdate } from '@peertube/peertube-models'import { hydrateFormFromVideo } from '../shared/video-edit-utils'import { VideoSend } from './video-send'diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts b/client/src/app/+videos/+video-edit/video-add-components/video-send.tsindex 9de373cd3e..56dcfa0e61 100644--- a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts+++ b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts@@ -6,16 +6,16 @@ import { listUserChannelsForSelect } from '@app/helpers'import { FormReactive } from '@app/shared/shared-forms'import { VideoCaptionEdit, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'import { LoadingBarService } from '@ngx-loading-bar/core'-import { HTMLServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'+import { HTMLServerConfig, VideoConstant, VideoPrivacyType } from '@peertube/peertube-models'@Directive()// eslint-disable-next-line @angular-eslint/directive-class-suffixexport abstract class VideoSend extends FormReactive implements OnInit {userVideoChannels: SelectChannelItem[] = []- videoPrivacies: VideoConstant<VideoPrivacy>[] = []+ videoPrivacies: VideoConstant<VideoPrivacyType>[] = []videoCaptions: VideoCaptionEdit[] = []- firstStepPrivacyId: VideoPrivacy+ firstStepPrivacyId: VideoPrivacyTypefirstStepChannelId: numberabstract firstStepDone: EventEmitter<string>@@ -31,7 +31,7 @@ export abstract class VideoSend extends FormReactive implements OnInit {protected serverConfig: HTMLServerConfig- protected highestPrivacy: VideoPrivacy+ protected highestPrivacy: VideoPrivacyTypeabstract canDeactivate (): CanComponentDeactivateResultdiff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.tsindex f7e1872a5d..cbf43ee5f2 100644--- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts+++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts@@ -10,7 +10,7 @@ import { FormReactiveService } from '@app/shared/shared-forms'import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'import { LoadingBarService } from '@ngx-loading-bar/core'import { logger } from '@root-helpers/logger'-import { HttpStatusCode, VideoCreateResult } from '@shared/models'+import { HttpStatusCode, VideoCreateResult } from '@peertube/peertube-models'import { VideoUploadService } from '../shared/video-upload.service'import { VideoSend } from './video-send'diff --git a/client/src/app/+videos/+video-edit/video-add.component.ts b/client/src/app/+videos/+video-edit/video-add.component.tsindex 460c37a38e..413fe4780d 100644--- a/client/src/app/+videos/+video-edit/video-add.component.ts+++ b/client/src/app/+videos/+video-edit/video-add.component.ts@@ -8,7 +8,7 @@ import {ServerService,UserService} from '@app/core'-import { HTMLServerConfig } from '@shared/models'+import { HTMLServerConfig } from '@peertube/peertube-models'import { VideoEditType } from './shared/video-edit.type'import { VideoGoLiveComponent } from './video-add-components/video-go-live.component'import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component'diff --git a/client/src/app/+videos/+video-edit/video-update.component.ts b/client/src/app/+videos/+video-edit/video-update.component.tsindex 6ad08cbadc..24d91a69a6 100644--- a/client/src/app/+videos/+video-edit/video-update.component.ts+++ b/client/src/app/+videos/+video-edit/video-update.component.ts@@ -12,9 +12,8 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { Video, VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main'import { LiveVideoService } from '@app/shared/shared-video-live'import { LoadingBarService } from '@ngx-loading-bar/core'-import { pick, simpleObjectsDeepEqual } from '@shared/core-utils'-import { HttpStatusCode, LiveVideo, LiveVideoUpdate, VideoPrivacy, VideoState } from '@shared/models'-import { VideoSource } from '@shared/models/videos/video-source'+import { pick, simpleObjectsDeepEqual } from '@peertube/peertube-core-utils'+import { HttpStatusCode, LiveVideo, LiveVideoUpdate, VideoPrivacy, VideoSource, VideoState } from '@peertube/peertube-models'import { hydrateFormFromVideo } from './shared/video-edit-utils'import { VideoUploadService } from './shared/video-upload.service'diff --git a/client/src/app/+videos/+video-edit/video-update.resolver.ts b/client/src/app/+videos/+video-edit/video-update.resolver.tsindex 2c99b36a8d..d114bfb2db 100644--- a/client/src/app/+videos/+video-edit/video-update.resolver.ts+++ b/client/src/app/+videos/+video-edit/video-update.resolver.ts@@ -4,9 +4,9 @@ import { Injectable } from '@angular/core'import { ActivatedRouteSnapshot } from '@angular/router'import { AuthService } from '@app/core'import { listUserChannelsForSelect } from '@app/helpers'-import { VideoCaptionService, VideoDetails, VideoService, VideoPasswordService } from '@app/shared/shared-main'+import { VideoCaptionService, VideoDetails, VideoPasswordService, VideoService } from '@app/shared/shared-main'import { LiveVideoService } from '@app/shared/shared-video-live'-import { VideoPrivacy } from '@shared/models/videos'+import { VideoPrivacy } from '@peertube/peertube-models'@Injectable()export class VideoUpdateResolver {diff --git a/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.ts b/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.tsindex e6c0d4de15..7c89b7e627 100644--- a/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.ts+++ b/client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.ts@@ -5,7 +5,7 @@ import { VideoShareComponent } from '@app/shared/shared-share-modal'import { SupportModalComponent } from '@app/shared/shared-support-modal'import { VideoActionsDisplayType, VideoDownloadComponent } from '@app/shared/shared-video-miniature'import { VideoPlaylist } from '@app/shared/shared-video-playlist'-import { UserVideoRateType, VideoCaption, VideoPrivacy } from '@shared/models/videos'+import { UserVideoRateType, VideoCaption, VideoPrivacy } from '@peertube/peertube-models'@Component({selector: 'my-action-buttons',diff --git a/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts b/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.tsindex 11966ce344..13a709cb0f 100644--- a/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts+++ b/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts@@ -3,7 +3,7 @@ import { Observable } from 'rxjs'import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output } from '@angular/core'import { Notifier, ScreenService } from '@app/core'import { VideoDetails, VideoService } from '@app/shared/shared-main'-import { UserVideoRateType } from '@shared/models'+import { UserVideoRateType } from '@peertube/peertube-models'@Component({selector: 'my-video-rate',diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.tsindex 1d9e10d0a8..a01bd31fe2 100644--- a/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts+++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts@@ -19,7 +19,7 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { Video } from '@app/shared/shared-main'import { VideoComment, VideoCommentService } from '@app/shared/shared-video-comment'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'-import { VideoCommentCreate } from '@shared/models'+import { VideoCommentCreate } from '@peertube/peertube-models'@Component({selector: 'my-video-comment-add',diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.tsindex 4c85df6575..14422010ff 100644--- a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts+++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts@@ -5,7 +5,7 @@ import { AuthService } from '@app/core/auth'import { Account, DropdownAction, Video } from '@app/shared/shared-main'import { CommentReportComponent } from '@app/shared/shared-moderation/report-modals/comment-report.component'import { VideoComment, VideoCommentThreadTree } from '@app/shared/shared-video-comment'-import { User, UserRight } from '@shared/models'+import { User, UserRight } from '@peertube/peertube-models'@Component({selector: 'my-video-comment',diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.tsindex 848936f91f..1a8c89bdc8 100644--- a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts+++ b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts@@ -5,7 +5,7 @@ import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifieimport { HooksService } from '@app/core/plugins/hooks.service'import { Syndication, VideoDetails } from '@app/shared/shared-main'import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/shared/shared-video-comment'-import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'+import { PeerTubeProblemDocument, ServerErrorCode } from '@peertube/peertube-models'@Component({selector: 'my-video-comments',diff --git a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.tsindex b51457e026..d2f8aa45de 100644--- a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts+++ b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts@@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'import { ServerService, User, UserService } from '@app/core'import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'import { isP2PEnabled } from '@root-helpers/video'-import { HTMLServerConfig, Video } from '@shared/models'+import { HTMLServerConfig, Video } from '@peertube/peertube-models'@Component({selector: 'my-privacy-concerns',diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.tsindex 8781ead7e6..497c48813a 100644--- a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts+++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts@@ -1,7 +1,7 @@import { Component, Input } from '@angular/core'import { AuthUser } from '@app/core'import { VideoDetails } from '@app/shared/shared-main'-import { VideoPrivacy, VideoState } from '@shared/models'+import { VideoPrivacy, VideoState } from '@peertube/peertube-models'@Component({selector: 'my-video-alert',diff --git a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.tsindex 97d71a510a..eca7cf87c2 100644--- a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts+++ b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts@@ -5,7 +5,7 @@ import { isInViewport } from '@app/helpers'import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist'import { getBoolOrDefault } from '@root-helpers/local-storage-utils'import { peertubeSessionStorage } from '@root-helpers/peertube-web-storage'-import { VideoPlaylistPrivacy } from '@shared/models'+import { VideoPlaylistPrivacy } from '@peertube/peertube-models'@Component({selector: 'my-video-watch-playlist',diff --git a/client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.ts b/client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.tsindex ba0d30f3da..174fd66103 100644--- a/client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.ts+++ b/client/src/app/+videos/+video-watch/shared/recommendations/recent-videos-recommendation.service.ts@@ -4,7 +4,7 @@ import { Injectable } from '@angular/core'import { ServerService, UserService } from '@app/core'import { Video, VideoService } from '@app/shared/shared-main'import { AdvancedSearch, SearchService } from '@app/shared/shared-search'-import { HTMLServerConfig } from '@shared/models'+import { HTMLServerConfig } from '@peertube/peertube-models'import { RecommendationInfo } from './recommendation-info.model'import { RecommendationService } from './recommendations.service'diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.tsindex 45de62519c..f109427ccd 100644--- a/client/src/app/+videos/+video-watch/video-watch.component.ts+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts@@ -22,9 +22,7 @@ import { Video, VideoCaptionService, VideoDetails, VideoFileTokenService, VideoSimport { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'import { LiveVideoService } from '@app/shared/shared-video-live'import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'-import { logger } from '@root-helpers/logger'-import { isP2PEnabled, videoRequiresFileToken, videoRequiresUserAuth } from '@root-helpers/video'-import { timeToInt } from '@shared/core-utils'+import { timeToInt } from '@peertube/peertube-core-utils'import {HTMLServerConfig,HttpStatusCode,@@ -34,8 +32,11 @@ import {Storyboard,VideoCaption,VideoPrivacy,- VideoState-} from '@shared/models'+ VideoState,+ VideoStateType+} from '@peertube/peertube-models'+import { logger } from '@root-helpers/logger'+import { isP2PEnabled, videoRequiresFileToken, videoRequiresUserAuth } from '@root-helpers/video'import {HLSOptions,PeerTubePlayer,@@ -812,7 +813,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {})}- private handleLiveStateChange (newState: VideoState) {+ private handleLiveStateChange (newState: VideoStateType) {if (newState !== VideoState.PUBLISHED) returnlogger.info('Loading video after live update.')diff --git a/client/src/app/+videos/video-list/overview/overview.service.ts b/client/src/app/+videos/video-list/overview/overview.service.tsindex 67a1adb28a..581c6b8460 100644--- a/client/src/app/+videos/video-list/overview/overview.service.ts+++ b/client/src/app/+videos/video-list/overview/overview.service.ts@@ -5,9 +5,8 @@ import { Injectable } from '@angular/core'import { RestExtractor, ServerService } from '@app/core'import { immutableAssign } from '@app/helpers'import { VideoService } from '@app/shared/shared-main'-import { objectKeysTyped } from '@shared/core-utils'-import { peertubeTranslate } from '@shared/core-utils/i18n'-import { VideosOverview as VideosOverviewServer } from '@shared/models'+import { objectKeysTyped, peertubeTranslate } from '@peertube/peertube-core-utils'+import { VideosOverview as VideosOverviewServer } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'import { VideosOverview } from './videos-overview.model'diff --git a/client/src/app/+videos/video-list/overview/videos-overview.model.ts b/client/src/app/+videos/video-list/overview/videos-overview.model.tsindex 6765ad9b77..1208d5a004 100644--- a/client/src/app/+videos/video-list/overview/videos-overview.model.ts+++ b/client/src/app/+videos/video-list/overview/videos-overview.model.ts@@ -1,5 +1,5 @@import { Video } from '@app/shared/shared-main'-import { VideoChannelSummary, VideoConstant, VideosOverview as VideosOverviewServer } from '@shared/models'+import { VideoChannelSummary, VideoConstant, VideosOverview as VideosOverviewServer } from '@peertube/peertube-models'export class VideosOverview implements VideosOverviewServer {channels: {diff --git a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts b/client/src/app/+videos/video-list/video-user-subscriptions.component.tsindex 04f02c138f..c9926488d3 100644--- a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts+++ b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts@@ -7,7 +7,7 @@ import { HooksService } from '@app/core/plugins/hooks.service'import { VideoService } from '@app/shared/shared-main'import { UserSubscriptionService } from '@app/shared/shared-user-subscription'import { VideoFilters } from '@app/shared/shared-video-miniature'-import { VideoSortField } from '@shared/models'+import { VideoSortField } from '@peertube/peertube-models'@Component({selector: 'my-videos-user-subscriptions',diff --git a/client/src/app/+videos/video-list/videos-list-common-page.component.ts b/client/src/app/+videos/video-list/videos-list-common-page.component.tsindex c8fa8ef302..32954f373c 100644--- a/client/src/app/+videos/video-list/videos-list-common-page.component.ts+++ b/client/src/app/+videos/video-list/videos-list-common-page.component.ts@@ -4,7 +4,7 @@ import { ComponentPaginationLight, DisableForReuseHook, MetaService, RedirectSerimport { HooksService } from '@app/core/plugins/hooks.service'import { VideoService } from '@app/shared/shared-main'import { VideoFilters, VideoFilterScope } from '@app/shared/shared-video-miniature/video-filters.model'-import { ClientFilterHookName, VideoSortField } from '@shared/models'+import { ClientFilterHookName, VideoSortField } from '@peertube/peertube-models'import { Subscription } from 'rxjs'export type VideosListCommonPageRouteData = {diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.tsindex 40e4ec35d5..360524d69c 100644--- a/client/src/app/app-routing.module.ts+++ b/client/src/app/app-routing.module.ts@@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'import { RouteReuseStrategy, RouterModule, Routes, UrlMatchResult, UrlSegment } from '@angular/router'import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'import { MenuGuards } from '@app/core/routing/menu-guard.service'-import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'+import { POSSIBLE_LOCALES } from '@peertube/peertube-core-utils'import { HomepageRedirectComponent, MetaGuard, PreloadSelectedModulesList } from './core'import { EmptyComponent } from './empty.component'import { USER_USERNAME_REGEX_CHARACTERS } from './shared/form-validators/user-validators'diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.tsindex f6d90cb648..4ad20bfd6b 100644--- a/client/src/app/app.component.ts+++ b/client/src/app/app.component.ts@@ -25,10 +25,10 @@ import { CustomModalComponent } from '@app/modal/custom-modal.component'import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap'import { LoadingBarService } from '@ngx-loading-bar/core'+import { getShortLocale } from '@peertube/peertube-core-utils'+import { BroadcastMessageLevel, HTMLServerConfig, UserRole } from '@peertube/peertube-models'import { logger } from '@root-helpers/logger'import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'-import { getShortLocale } from '@shared/core-utils/i18n'-import { BroadcastMessageLevel, HTMLServerConfig, UserRole } from '@shared/models'import { MenuService } from './core/menu/menu.service'import { POP_STATE_MODAL_DISMISS } from './helpers'import { GlobalIconName } from './shared/shared-icons'diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.tsindex 2260752653..a1e23bfbb8 100644--- a/client/src/app/core/auth/auth-user.model.ts+++ b/client/src/app/core/auth/auth-user.model.ts@@ -1,16 +1,16 @@import { Observable, of } from 'rxjs'import { map } from 'rxjs/operators'import { User } from '@app/core/users/user.model'-import { OAuthUserTokens } from '@root-helpers/users'-import { hasUserRight } from '@shared/core-utils/users'+import { hasUserRight } from '@peertube/peertube-core-utils'import {MyUser as ServerMyUserModel,MyUserSpecialPlaylist,User as ServerUserModel,- UserRight,+ UserRightType,UserRole,UserVideoQuota-} from '@shared/models'+} from '@peertube/peertube-models'+import { OAuthUserTokens } from '@root-helpers/users'export class AuthUser extends User implements ServerMyUserModel {oauthTokens: OAuthUserTokens@@ -42,7 +42,7 @@ export class AuthUser extends User implements ServerMyUserModel {this.oauthTokens.refreshToken = refreshToken}- hasRight (right: UserRight) {+ hasRight (right: UserRightType) {return hasUserRight(this.role.id, right)}diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.tsindex 6fe601d8d2..bc67ab7a06 100644--- a/client/src/app/core/auth/auth.service.ts+++ b/client/src/app/core/auth/auth.service.ts@@ -6,7 +6,7 @@ import { Injectable } from '@angular/core'import { Router } from '@angular/router'import { Notifier } from '@app/core/notification/notifier.service'import { logger, OAuthUserTokens, objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index'-import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models'+import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { RestExtractor } from '../rest/rest-extractor.service'import { RedirectService } from '../routing'diff --git a/client/src/app/core/menu/menu.service.ts b/client/src/app/core/menu/menu.service.tsindex d865c7da2e..39e89f6e3d 100644--- a/client/src/app/core/menu/menu.service.ts+++ b/client/src/app/core/menu/menu.service.ts@@ -2,7 +2,7 @@ import { fromEvent } from 'rxjs'import { debounceTime } from 'rxjs/operators'import { Injectable } from '@angular/core'import { GlobalIconName } from '@app/shared/shared-icons'-import { HTMLServerConfig } from '@shared/models/server'+import { HTMLServerConfig } from '@peertube/peertube-models'import { ScreenService } from '../wrappers'export type MenuLink = {diff --git a/client/src/app/core/notification/peertube-socket.service.ts b/client/src/app/core/notification/peertube-socket.service.tsindex 50a11e9485..15af9a3109 100644--- a/client/src/app/core/notification/peertube-socket.service.ts+++ b/client/src/app/core/notification/peertube-socket.service.ts@@ -1,7 +1,7 @@import { Subject } from 'rxjs'import { ManagerOptions, Socket, SocketOptions } from 'socket.io-client'import { Injectable } from '@angular/core'-import { LiveVideoEventPayload, LiveVideoEventType, UserNotification as UserNotificationServer } from '@shared/models'+import { LiveVideoEventPayload, LiveVideoEventType, UserNotification as UserNotificationServer } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { AuthService } from '../auth'diff --git a/client/src/app/core/plugins/hooks.service.ts b/client/src/app/core/plugins/hooks.service.tsindex d9fef83897..59c627c051 100644--- a/client/src/app/core/plugins/hooks.service.ts+++ b/client/src/app/core/plugins/hooks.service.ts@@ -3,7 +3,7 @@ import { mergeMap, switchMap } from 'rxjs/operators'import { Injectable } from '@angular/core'import { PluginService } from '@app/core/plugins/plugin.service'import { logger } from '@root-helpers/logger'-import { ClientActionHookName, ClientFilterHookName, PluginClientScope } from '@shared/models'+import { ClientActionHookName, ClientFilterHookName, PluginClientScope } from '@peertube/peertube-models'import { AuthService, AuthStatus } from '../auth'type RawFunction<U, T> = (params: U) => Tdiff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.tsindex bd8c61d9aa..d37b2e5f7e 100644--- a/client/src/app/core/plugins/plugin.service.ts+++ b/client/src/app/core/plugins/plugin.service.ts@@ -10,22 +10,22 @@ import { RestExtractor } from '@app/core/rest'import { ServerService } from '@app/core/server/server.service'import { getDevLocale, isOnDevLocale } from '@app/helpers'import { CustomModalComponent } from '@app/modal/custom-modal.component'-import { PluginInfo, PluginsManager } from '@root-helpers/plugins-manager'-import { getKeys } from '@shared/core-utils'-import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'+import { getCompleteLocale, getKeys, isDefaultLocale, peertubeTranslate } from '@peertube/peertube-core-utils'import {ClientHook,ClientHookName,PluginClientScope,PluginTranslation,PluginType,+ PluginType_Type,PublicServerSetting,RegisterClientFormFieldOptions,RegisterClientRouteOptions,RegisterClientSettingsScriptOptions,RegisterClientVideoFieldOptions,ServerConfigPlugin-} from '@shared/models'+} from '@peertube/peertube-models'+import { PluginInfo, PluginsManager } from '@root-helpers/plugins-manager'import { environment } from '../../../environments/environment'import { RegisterClientHelpers } from '../../../types/register-client-option.model'@@ -110,7 +110,7 @@ export class PluginService implements ClientHook {return this.pluginsManager.removePlugin(plugin)}- nameToNpmName (name: string, type: PluginType) {+ nameToNpmName (name: string, type: PluginType_Type) {const prefix = type === PluginType.PLUGIN? 'peertube-plugin-': 'peertube-theme-'diff --git a/client/src/app/core/renderer/html-renderer.service.ts b/client/src/app/core/renderer/html-renderer.service.tsindex 7776ccad50..37741c079e 100644--- a/client/src/app/core/renderer/html-renderer.service.ts+++ b/client/src/app/core/renderer/html-renderer.service.ts@@ -1,5 +1,5 @@import { Injectable } from '@angular/core'-import { getCustomMarkupSanitizeOptions, getDefaultSanitizeOptions } from '@shared/core-utils/renderer/html'+import { getCustomMarkupSanitizeOptions, getDefaultSanitizeOptions } from '@peertube/peertube-core-utils'import { LinkifierService } from './linkifier.service'@Injectable()diff --git a/client/src/app/core/renderer/markdown.service.ts b/client/src/app/core/renderer/markdown.service.tsindex ec3b683bb9..907b922327 100644--- a/client/src/app/core/renderer/markdown.service.ts+++ b/client/src/app/core/renderer/markdown.service.ts@@ -1,13 +1,14 @@import * as MarkdownIt from 'markdown-it'import { Injectable } from '@angular/core'-import { buildVideoLink, decorateVideoLink } from '@shared/core-utils'import {+ buildVideoLink,COMPLETE_RULES,+ decorateVideoLink,ENHANCED_RULES,ENHANCED_WITH_HTML_RULES,TEXT_RULES,TEXT_WITH_HTML_RULES-} from '@shared/core-utils/renderer/markdown'+} from '@peertube/peertube-core-utils'import { HtmlRendererService } from './html-renderer.service'type MarkdownParsers = {diff --git a/client/src/app/core/rest/rest-extractor.service.ts b/client/src/app/core/rest/rest-extractor.service.tsindex c6c1e183f7..bcc50c0f45 100644--- a/client/src/app/core/rest/rest-extractor.service.ts+++ b/client/src/app/core/rest/rest-extractor.service.ts@@ -1,10 +1,10 @@import { throwError as observableThrowError } from 'rxjs'+import { HttpHeaderResponse } from '@angular/common/http'import { Inject, Injectable, LOCALE_ID } from '@angular/core'import { Router } from '@angular/router'import { DateFormat, dateToHuman } from '@app/helpers'+import { HttpStatusCode, HttpStatusCodeType, ResultList } from '@peertube/peertube-models'import { logger } from '@root-helpers/logger'-import { HttpStatusCode, ResultList } from '@shared/models'-import { HttpHeaderResponse } from '@angular/common/http'@Injectable()export class RestExtractor {@@ -45,7 +45,11 @@ export class RestExtractor {return target}- redirectTo404IfNotFound (obj: { status: number }, type: 'video' | 'other', status = [ HttpStatusCode.NOT_FOUND_404 ]) {+ redirectTo404IfNotFound (+ obj: { status: HttpStatusCodeType },+ type: 'video' | 'other',+ status: HttpStatusCodeType[] = [ HttpStatusCode.NOT_FOUND_404 ]+ ) {if (obj?.status && status.includes(obj.status)) {// Do not use redirectService to avoid circular dependenciesthis.router.navigate([ '/404' ], { state: { type, obj }, skipLocationChange: true })diff --git a/client/src/app/core/routing/homepage-redirect.component.ts b/client/src/app/core/routing/homepage-redirect.component.tsindex 9e38480385..e9be832e0e 100644--- a/client/src/app/core/routing/homepage-redirect.component.ts+++ b/client/src/app/core/routing/homepage-redirect.component.ts@@ -1,6 +1,6 @@import { Component, OnInit } from '@angular/core'import { ActivatedRoute } from '@angular/router'-import { is18nPath } from '@shared/core-utils/i18n/i18n'+import { is18nPath } from '@peertube/peertube-core-utils'import { RedirectService } from './redirect.service'/*diff --git a/client/src/app/core/routing/meta.service.ts b/client/src/app/core/routing/meta.service.tsindex 97e440faf2..d50f0d65a0 100644--- a/client/src/app/core/routing/meta.service.ts+++ b/client/src/app/core/routing/meta.service.ts@@ -1,6 +1,6 @@import { Injectable } from '@angular/core'import { Meta, Title } from '@angular/platform-browser'-import { HTMLServerConfig } from '@shared/models/server'+import { HTMLServerConfig } from '@peertube/peertube-models'import { ServerService } from '../server'export interface MetaSettings {diff --git a/client/src/app/core/scoped-tokens/scoped-tokens.service.ts b/client/src/app/core/scoped-tokens/scoped-tokens.service.tsindex 038e5031c6..f7d192feba 100644--- a/client/src/app/core/scoped-tokens/scoped-tokens.service.ts+++ b/client/src/app/core/scoped-tokens/scoped-tokens.service.ts@@ -1,7 +1,7 @@import { catchError } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'-import { ScopedToken } from '@shared/models/users/user-scoped-token'+import { ScopedToken } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { RestExtractor } from '../rest'diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.tsindex 41cb4791ae..75ac8ddc18 100644--- a/client/src/app/core/server/server.service.ts+++ b/client/src/app/core/server/server.service.ts@@ -3,9 +3,16 @@ import { first, map, share, shareReplay, switchMap, tap } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Inject, Injectable, LOCALE_ID } from '@angular/core'import { getDevLocale, isOnDevLocale } from '@app/helpers'+import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@peertube/peertube-core-utils'+import {+ HTMLServerConfig,+ ServerConfig,+ ServerStats,+ VideoConstant,+ VideoPlaylistPrivacyType,+ VideoPrivacyType+} from '@peertube/peertube-models'import { logger } from '@root-helpers/logger'-import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'-import { HTMLServerConfig, ServerConfig, ServerStats, VideoConstant } from '@shared/models'import { environment } from '../../../environments/environment'@Injectable()@@ -21,8 +28,8 @@ export class ServerService {private localeObservable: Observable<any>private videoLicensesObservable: Observable<VideoConstant<number>[]>private videoCategoriesObservable: Observable<VideoConstant<number>[]>- private videoPrivaciesObservable: Observable<VideoConstant<number>[]>- private videoPlaylistPrivaciesObservable: Observable<VideoConstant<number>[]>+ private videoPrivaciesObservable: Observable<VideoConstant<VideoPrivacyType>[]>+ private videoPlaylistPrivaciesObservable: Observable<VideoConstant<VideoPlaylistPrivacyType>[]>private videoLanguagesObservable: Observable<VideoConstant<string>[]>private configObservable: Observable<ServerConfig>@@ -123,7 +130,7 @@ export class ServerService {getVideoPrivacies () {if (!this.videoPrivaciesObservable) {- this.videoPrivaciesObservable = this.loadAttributeEnum<number>(ServerService.BASE_VIDEO_URL, 'privacies')+ this.videoPrivaciesObservable = this.loadAttributeEnum<VideoPrivacyType>(ServerService.BASE_VIDEO_URL, 'privacies')}return this.videoPrivaciesObservable.pipe(first())@@ -131,7 +138,10 @@ export class ServerService {getVideoPlaylistPrivacies () {if (!this.videoPlaylistPrivaciesObservable) {- this.videoPlaylistPrivaciesObservable = this.loadAttributeEnum<number>(ServerService.BASE_VIDEO_PLAYLIST_URL, 'privacies')+ this.videoPlaylistPrivaciesObservable = this.loadAttributeEnum<VideoPlaylistPrivacyType>(+ ServerService.BASE_VIDEO_PLAYLIST_URL,+ 'privacies'+ )}return this.videoPlaylistPrivaciesObservable.pipe(first())diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.tsindex ead1770ba1..22eb5ddd3f 100644--- a/client/src/app/core/theme/theme.service.ts+++ b/client/src/app/core/theme/theme.service.ts@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'import { logger } from '@root-helpers/logger'import { capitalizeFirstLetter } from '@root-helpers/string'import { UserLocalStorageKeys } from '@root-helpers/users'-import { HTMLServerConfig, ServerConfigTheme } from '@shared/models'+import { HTMLServerConfig, ServerConfigTheme } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { AuthService } from '../auth'import { PluginService } from '../plugins/plugin.service'diff --git a/client/src/app/core/users/user-local-storage.service.ts b/client/src/app/core/users/user-local-storage.service.tsindex a87f3b98a4..431a57343e 100644--- a/client/src/app/core/users/user-local-storage.service.ts+++ b/client/src/app/core/users/user-local-storage.service.ts@@ -1,13 +1,11 @@-import { filter, throttleTime } from 'rxjs'import { Injectable } from '@angular/core'import { AuthService, AuthStatus } from '@app/core/auth'+import { objectKeysTyped } from '@peertube/peertube-core-utils'+import { NSFWPolicyType, UserRoleType, UserUpdateMe } from '@peertube/peertube-models'import { getBoolOrDefault } from '@root-helpers/local-storage-utils'import { logger } from '@root-helpers/logger'import { OAuthUserTokens, UserLocalStorageKeys } from '@root-helpers/users'-import { objectKeysTyped } from '@shared/core-utils'-import { UserRole, UserUpdateMe } from '@shared/models'-import { NSFWPolicyType } from '@shared/models/videos'import { ServerService } from '../server'import { LocalStorageService } from '../wrappers/storage.service'@@ -61,7 +59,7 @@ export class UserLocalStorageService {username: this.localStorageService.getItem(UserLocalStorageKeys.USERNAME),email: this.localStorageService.getItem(UserLocalStorageKeys.EMAIL),role: {- id: parseInt(this.localStorageService.getItem(UserLocalStorageKeys.ROLE), 10) as UserRole,+ id: parseInt(this.localStorageService.getItem(UserLocalStorageKeys.ROLE), 10) as UserRoleType,label: ''},@@ -74,7 +72,7 @@ export class UserLocalStorageService {username: stringemail: stringrole: {- id: UserRole+ id: UserRoleType}}) {this.localStorageService.setItem(UserLocalStorageKeys.ID, user.id.toString())diff --git a/client/src/app/core/users/user.model.ts b/client/src/app/core/users/user.model.tsindex 54b749a4c1..ffc7c2b44a 100644--- a/client/src/app/core/users/user.model.ts+++ b/client/src/app/core/users/user.model.ts@@ -1,17 +1,18 @@import { Account } from '@app/shared/shared-main/account/account.model'-import { objectKeysTyped } from '@shared/core-utils'-import { hasUserRight } from '@shared/core-utils/users'+import { hasUserRight, objectKeysTyped } from '@peertube/peertube-core-utils'import {ActorImage,HTMLServerConfig,NSFWPolicyType,User as UserServerModel,UserAdminFlag,+ UserAdminFlagType,UserNotificationSetting,- UserRight,+ UserRightType,UserRole,+ UserRoleType,VideoChannel-} from '@shared/models'+} from '@peertube/peertube-models'export class User implements UserServerModel {id: number@@ -23,7 +24,7 @@ export class User implements UserServerModel {emailPublic: booleannsfwPolicy: NSFWPolicyType- adminFlags?: UserAdminFlag+ adminFlags?: UserAdminFlagTypeautoPlayVideo: booleanautoPlayNextVideo: boolean@@ -35,7 +36,7 @@ export class User implements UserServerModel {videoLanguages: string[]role: {- id: UserRole+ id: UserRoleTypelabel: string}@@ -124,7 +125,7 @@ export class User implements UserServerModel {}}- hasRight (right: UserRight) {+ hasRight (right: UserRightType) {return hasUserRight(this.role.id, right)}diff --git a/client/src/app/core/users/user.service.ts b/client/src/app/core/users/user.service.tsindex b4024c02da..7ad0ee9bf8 100644--- a/client/src/app/core/users/user.service.ts+++ b/client/src/app/core/users/user.service.ts@@ -3,7 +3,7 @@ import { catchError, first, map, shareReplay } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { AuthService } from '@app/core/auth'-import { ActorImage, User as UserServerModel, UserUpdateMe, UserVideoQuota } from '@shared/models'+import { ActorImage, User as UserServerModel, UserUpdateMe, UserVideoQuota } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { RestExtractor } from '../rest'import { UserLocalStorageService } from './user-local-storage.service'diff --git a/client/src/app/header/search-typeahead.component.ts b/client/src/app/header/search-typeahead.component.tsindex d2549315cd..a3a04041ff 100644--- a/client/src/app/header/search-typeahead.component.ts+++ b/client/src/app/header/search-typeahead.component.ts@@ -5,7 +5,7 @@ import { AfterViewChecked, Component, OnDestroy, OnInit, QueryList, ViewChildrenimport { ActivatedRoute, Params, Router } from '@angular/router'import { AuthService, ServerService } from '@app/core'import { logger } from '@root-helpers/logger'-import { HTMLServerConfig, SearchTargetType } from '@shared/models'+import { HTMLServerConfig, SearchTargetType } from '@peertube/peertube-models'import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component'@Component({diff --git a/client/src/app/helpers/utils/channel.ts b/client/src/app/helpers/utils/channel.tsindex 83f36b70ff..fe59ea5678 100644--- a/client/src/app/helpers/utils/channel.ts+++ b/client/src/app/helpers/utils/channel.ts@@ -1,7 +1,7 @@import { minBy } from 'lodash-es'import { first, map } from 'rxjs/operators'import { SelectChannelItem } from 'src/types/select-options-item.model'-import { VideoChannel } from '@shared/models'+import { VideoChannel } from '@peertube/peertube-models'import { AuthService } from '../../core/auth'function listUserChannelsForSelect (authService: AuthService) {diff --git a/client/src/app/helpers/utils/upload.ts b/client/src/app/helpers/utils/upload.tsindex b609516128..b554150641 100644--- a/client/src/app/helpers/utils/upload.ts+++ b/client/src/app/helpers/utils/upload.ts@@ -1,6 +1,6 @@import { HttpErrorResponse } from '@angular/common/http'import { Notifier } from '@app/core'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'function genericUploadErrorHandler (options: {err: Pick<HttpErrorResponse, 'message' | 'status' | 'headers'>diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.tsindex f7ae697173..1ec5987c23 100644--- a/client/src/app/menu/language-chooser.component.ts+++ b/client/src/app/menu/language-chooser.component.ts@@ -1,8 +1,7 @@import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core'import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'-import { objectKeysTyped } from '@shared/core-utils'-import { getCompleteLocale, getShortLocale, I18N_LOCALES } from '@shared/core-utils/i18n'+import { getCompleteLocale, getShortLocale, I18N_LOCALES, objectKeysTyped } from '@peertube/peertube-core-utils'@Component({selector: 'my-language-chooser',diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.tsindex 410abe6fa4..6d309f15ab 100644--- a/client/src/app/menu/menu.component.ts+++ b/client/src/app/menu/menu.component.ts@@ -22,7 +22,7 @@ import { LanguageChooserComponent } from '@app/menu/language-chooser.component'import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service'import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'-import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models'+import { HTMLServerConfig, ServerConfig, UserRight, UserRightType, VideoConstant } from '@peertube/peertube-models'const debugLogger = debug('peertube:menu:MenuComponent')@@ -54,7 +54,7 @@ export class MenuComponent implements OnInit, OnDestroy {private htmlServerConfig: HTMLServerConfigprivate serverConfig: ServerConfig- private routesPerRight: { [role in UserRight]?: string } = {+ private routesPerRight: { [role in UserRightType]?: string } = {[UserRight.MANAGE_USERS]: '/admin/users',[UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends',[UserRight.MANAGE_ABUSES]: '/admin/moderation/abuses',diff --git a/client/src/app/modal/instance-config-warning-modal.component.ts b/client/src/app/modal/instance-config-warning-modal.component.tsindex 23c2c777e9..f8ab155ae9 100644--- a/client/src/app/modal/instance-config-warning-modal.component.ts+++ b/client/src/app/modal/instance-config-warning-modal.component.ts@@ -2,9 +2,9 @@ import { Location } from '@angular/common'import { Component, ElementRef, ViewChild } from '@angular/core'import { Notifier, User, UserService } from '@app/core'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'+import { About, ServerConfig } from '@peertube/peertube-models'import { logger } from '@root-helpers/logger'import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'-import { About, ServerConfig } from '@shared/models/server'@Component({selector: 'my-instance-config-warning-modal',diff --git a/client/src/app/shared/form-validators/video-playlist-validators.ts b/client/src/app/shared/form-validators/video-playlist-validators.tsindex 63af637a37..3cddcaad24 100644--- a/client/src/app/shared/form-validators/video-playlist-validators.ts+++ b/client/src/app/shared/form-validators/video-playlist-validators.ts@@ -1,6 +1,6 @@import { Validators, AbstractControl } from '@angular/forms'import { BuildFormValidator } from './form-validator.model'-import { VideoPlaylistPrivacy } from '@shared/models'+import { VideoPlaylistPrivacy, VideoPlaylistPrivacyType } from '@peertube/peertube-models'export const VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR: BuildFormValidator = {VALIDATORS: [@@ -42,7 +42,7 @@ export const VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR: BuildFormValidator = {}}-export function setPlaylistChannelValidator (channelControl: AbstractControl, privacy: VideoPlaylistPrivacy) {+export function setPlaylistChannelValidator (channelControl: AbstractControl, privacy: VideoPlaylistPrivacyType) {if (privacy.toString() === VideoPlaylistPrivacy.PUBLIC.toString()) {channelControl.setValidators([ Validators.required ])} else {diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts b/client/src/app/shared/shared-abuse-list/abuse-details.component.tsindex e15edf8c24..357dc4522a 100644--- a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts+++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts@@ -1,6 +1,6 @@import { Component, Input, OnInit } from '@angular/core'import { durationToString } from '@app/helpers'-import { AbusePredefinedReasonsString } from '@shared/models'+import { AbusePredefinedReasonsString } from '@peertube/peertube-models'import { ProcessedAbuse } from './processed-abuse.model'@Component({diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.tsindex d8470e9277..c38e1286f8 100644--- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts+++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts@@ -7,8 +7,8 @@ import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable }import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main'import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation'import { VideoCommentService } from '@app/shared/shared-video-comment'+import { AbuseState, AbuseStateType, AdminAbuse } from '@peertube/peertube-models'import { logger } from '@root-helpers/logger'-import { AbuseState, AdminAbuse } from '@shared/models'import { AdvancedInputFilter } from '../shared-forms'import { AbuseMessageModalComponent } from './abuse-message-modal.component'import { ModerationCommentModalComponent } from './moderation-comment-modal.component'@@ -144,7 +144,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit {})}- updateAbuseState (abuse: AdminAbuse, state: AbuseState) {+ updateAbuseState (abuse: AdminAbuse, state: AbuseStateType) {this.abuseService.updateAbuse(abuse, { state }).subscribe({next: () => this.reloadData(),diff --git a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.tsindex 12d503f566..8d20166f67 100644--- a/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts+++ b/client/src/app/shared/shared-abuse-list/abuse-message-modal.component.ts@@ -4,7 +4,7 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'import { logger } from '@root-helpers/logger'-import { AbuseMessage, UserAbuse } from '@shared/models'+import { AbuseMessage, UserAbuse } from '@peertube/peertube-models'import { ABUSE_MESSAGE_VALIDATOR } from '../form-validators/abuse-validators'import { AbuseService } from '../shared-moderation'diff --git a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.tsindex 4ad807d253..e42939f965 100644--- a/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts+++ b/client/src/app/shared/shared-abuse-list/moderation-comment-modal.component.ts@@ -4,7 +4,7 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { AbuseService } from '@app/shared/shared-moderation'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'-import { AdminAbuse } from '@shared/models'+import { AdminAbuse } from '@peertube/peertube-models'import { ABUSE_MODERATION_COMMENT_VALIDATOR } from '../form-validators/abuse-validators'@Component({diff --git a/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts b/client/src/app/shared/shared-abuse-list/processed-abuse.model.tsindex b9a9bd889d..076ccb40b7 100644--- a/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts+++ b/client/src/app/shared/shared-abuse-list/processed-abuse.model.ts@@ -1,5 +1,5 @@import { Account } from '@app/shared/shared-main'-import { AdminAbuse } from '@shared/models'+import { AdminAbuse } from '@peertube/peertube-models'// Don't use an abuse model because we need external services to compute some properties// And this model is only used in this componentdiff --git a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts b/client/src/app/shared/shared-actor-image/actor-avatar.component.tsindex ab2e02ad79..36babbe34c 100644--- a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts+++ b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts@@ -1,7 +1,7 @@import { Component, Input, OnChanges, OnInit } from '@angular/core'import { VideoChannel } from '../shared-main'import { Account } from '../shared-main/account/account.model'-import { objectKeysTyped } from '@shared/core-utils'+import { objectKeysTyped } from '@peertube/peertube-core-utils'type ActorInput = {name: stringdiff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.tsindex b49f64834c..4ab78a250b 100644--- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts+++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts@@ -10,7 +10,7 @@ import {PlaylistMiniatureMarkupData,VideoMiniatureMarkupData,VideosListMarkupData-} from '@shared/models'+} from '@peertube/peertube-models'import { DynamicElementService } from './dynamic-element.service'import {ButtonMarkupComponent,diff --git a/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts b/client/src/app/shared/shared-custom-markup/dynamic-element.service.tsindex a129070553..dc4f683ac0 100644--- a/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts+++ b/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts@@ -10,7 +10,7 @@ import {SimpleChanges,Type} from '@angular/core'-import { objectKeysTyped } from '@shared/core-utils'+import { objectKeysTyped } from '@peertube/peertube-core-utils'@Injectable()export class DynamicElementService {diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.tsindex 4f00eabd37..b731ccc64b 100644--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts@@ -3,7 +3,7 @@ import { finalize, map, switchMap, tap } from 'rxjs/operators'import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'import { MarkdownService, Notifier, UserService } from '@app/core'import { FindInBulkService } from '@app/shared/shared-search'-import { VideoSortField } from '@shared/models'+import { VideoSortField } from '@peertube/peertube-models'import { Video, VideoChannel, VideoService } from '../../shared-main'import { CustomMarkupComponent } from './shared'diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.tsindex 0baf2428b2..bca7444ecd 100644--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts@@ -1,7 +1,7 @@import { environment } from 'src/environments/environment'import { Component, ElementRef, Input, OnInit } from '@angular/core'import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'-import { buildPlaylistEmbedLink, buildVideoEmbedLink } from '@shared/core-utils'+import { buildPlaylistEmbedLink, buildVideoEmbedLink } from '@peertube/peertube-core-utils'import { CustomMarkupComponent } from './shared'@Component({diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.tsindex bd93929c9c..d692abbe36 100644--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts@@ -2,7 +2,7 @@ import { finalize } from 'rxjs/operators'import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'import { AuthService, Notifier } from '@app/core'import { FindInBulkService } from '@app/shared/shared-search'-import { objectKeysTyped } from '@shared/core-utils'+import { objectKeysTyped } from '@peertube/peertube-core-utils'import { Video } from '../../shared-main'import { MiniatureDisplayOptions } from '../../shared-video-miniature'import { CustomMarkupComponent } from './shared'diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.tsindex 81363be878..cbd5c7bf58 100644--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts@@ -1,8 +1,8 @@import { finalize } from 'rxjs/operators'import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'import { AuthService, Notifier } from '@app/core'-import { objectKeysTyped } from '@shared/core-utils'-import { VideoSortField } from '@shared/models'+import { objectKeysTyped } from '@peertube/peertube-core-utils'+import { VideoSortField } from '@peertube/peertube-models'import { Video, VideoService } from '../../shared-main'import { MiniatureDisplayOptions } from '../../shared-video-miniature'import { CustomMarkupComponent } from './shared'diff --git a/client/src/app/shared/shared-forms/dynamic-form-field.component.ts b/client/src/app/shared/shared-forms/dynamic-form-field.component.tsindex e1a1f80340..a95463944d 100644--- a/client/src/app/shared/shared-forms/dynamic-form-field.component.ts+++ b/client/src/app/shared/shared-forms/dynamic-form-field.component.ts@@ -1,6 +1,6 @@import { Component, Input } from '@angular/core'import { FormGroup } from '@angular/forms'-import { RegisterClientFormFieldOptions } from '@shared/models'+import { RegisterClientFormFieldOptions } from '@peertube/peertube-models'@Component({selector: 'my-dynamic-form-field',diff --git a/client/src/app/shared/shared-forms/form-validator.service.ts b/client/src/app/shared/shared-forms/form-validator.service.tsindex 14ee044b5d..e7dedf52ac 100644--- a/client/src/app/shared/shared-forms/form-validator.service.ts+++ b/client/src/app/shared/shared-forms/form-validator.service.ts@@ -1,6 +1,6 @@import { Injectable } from '@angular/core'import { AsyncValidatorFn, FormArray, FormBuilder, FormControl, FormGroup, ValidatorFn } from '@angular/forms'-import { objectKeysTyped } from '@shared/core-utils'+import { objectKeysTyped } from '@peertube/peertube-core-utils'import { BuildFormArgument, BuildFormDefaultValues } from '../form-validators/form-validator.model'import { FormReactiveErrors, FormReactiveValidationMessages } from './form-reactive.service'diff --git a/client/src/app/shared/shared-forms/markdown-textarea.component.ts b/client/src/app/shared/shared-forms/markdown-textarea.component.tsindex 036fab3d92..7edcf868ca 100644--- a/client/src/app/shared/shared-forms/markdown-textarea.component.ts+++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts@@ -6,7 +6,7 @@ import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@animport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'import { SafeHtml } from '@angular/platform-browser'import { MarkdownService, ScreenService } from '@app/core'-import { Video } from '@shared/models'+import { Video } from '@peertube/peertube-models'@Component({selector: 'my-markdown-textarea',diff --git a/client/src/app/shared/shared-forms/preview-upload.component.ts b/client/src/app/shared/shared-forms/preview-upload.component.tsindex cdfa26a230..3db7c34f77 100644--- a/client/src/app/shared/shared-forms/preview-upload.component.ts+++ b/client/src/app/shared/shared-forms/preview-upload.component.ts@@ -2,7 +2,7 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core'import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'import { ServerService } from '@app/core'import { imageToDataURL } from '@root-helpers/images'-import { HTMLServerConfig } from '@shared/models'+import { HTMLServerConfig } from '@peertube/peertube-models'import { BytesPipe } from '../shared-main'@Component({diff --git a/client/src/app/shared/shared-forms/timestamp-input.component.ts b/client/src/app/shared/shared-forms/timestamp-input.component.tsindex 79ca63673e..2804918526 100644--- a/client/src/app/shared/shared-forms/timestamp-input.component.ts+++ b/client/src/app/shared/shared-forms/timestamp-input.component.ts@@ -1,6 +1,6 @@import { ChangeDetectorRef, Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core'import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'-import { secondsToTime, timeToInt } from '@shared/core-utils'+import { secondsToTime, timeToInt } from '@peertube/peertube-core-utils'@Component({selector: 'my-timestamp-input',diff --git a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts b/client/src/app/shared/shared-instance/instance-about-accordion.component.tsindex a7c5218760..78d960d93f 100644--- a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts+++ b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts@@ -1,8 +1,7 @@import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'import { HooksService, Notifier } from '@app/core'import { NgbAccordionDirective } from '@ng-bootstrap/ng-bootstrap'-import { ClientFilterHookName, PluginClientScope } from '@shared/models/plugins'-import { About } from '@shared/models/server'+import { About, ClientFilterHookName, PluginClientScope } from '@peertube/peertube-models'import { InstanceService } from './instance.service'@Component({diff --git a/client/src/app/shared/shared-instance/instance-features-table.component.ts b/client/src/app/shared/shared-instance/instance-features-table.component.tsindex ab1b1458ad..11c6cc0ac8 100644--- a/client/src/app/shared/shared-instance/instance-features-table.component.ts+++ b/client/src/app/shared/shared-instance/instance-features-table.component.ts@@ -1,7 +1,7 @@import { Component, OnInit } from '@angular/core'import { ServerService } from '@app/core'import { formatICU } from '@app/helpers'-import { ServerConfig } from '@shared/models'+import { ServerConfig } from '@peertube/peertube-models'@Component({selector: 'my-instance-features-table',diff --git a/client/src/app/shared/shared-instance/instance-follow.service.ts b/client/src/app/shared/shared-instance/instance-follow.service.tsindex 7568fbbf44..f243273bac 100644--- a/client/src/app/shared/shared-instance/instance-follow.service.ts+++ b/client/src/app/shared/shared-instance/instance-follow.service.ts@@ -4,8 +4,8 @@ import { catchError, concatMap, toArray } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'-import { arrayify } from '@shared/core-utils'-import { ActivityPubActorType, ActorFollow, FollowState, ResultList, ServerFollowCreate } from '@shared/models'+import { arrayify } from '@peertube/peertube-core-utils'+import { ActivityPubActorType, ActorFollow, FollowState, ResultList, ServerFollowCreate } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { AdvancedInputFilter } from '../shared-forms'diff --git a/client/src/app/shared/shared-instance/instance.service.ts b/client/src/app/shared/shared-instance/instance.service.tsindex 3088f08996..9a55cf9724 100644--- a/client/src/app/shared/shared-instance/instance.service.ts+++ b/client/src/app/shared/shared-instance/instance.service.ts@@ -3,9 +3,8 @@ import { catchError, map } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { MarkdownService, RestExtractor, ServerService } from '@app/core'-import { objectKeysTyped } from '@shared/core-utils'-import { peertubeTranslate } from '@shared/core-utils/i18n'-import { About } from '@shared/models'+import { objectKeysTyped, peertubeTranslate } from '@peertube/peertube-core-utils'+import { About } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'export type AboutHTML = Pick<About['instance'],diff --git a/client/src/app/shared/shared-main/account/account.model.ts b/client/src/app/shared/shared-main/account/account.model.tsindex e34f6ef642..3a308fde59 100644--- a/client/src/app/shared/shared-main/account/account.model.ts+++ b/client/src/app/shared/shared-main/account/account.model.ts@@ -1,4 +1,4 @@-import { Account as ServerAccount, ActorImage, BlockStatus } from '@shared/models'+import { Account as ServerAccount, ActorImage, BlockStatus } from '@peertube/peertube-models'import { Actor } from './actor.model'export class Account extends Actor implements ServerAccount {diff --git a/client/src/app/shared/shared-main/account/account.service.ts b/client/src/app/shared/shared-main/account/account.service.tsindex 8f4abf0708..9c1afaa73e 100644--- a/client/src/app/shared/shared-main/account/account.service.ts+++ b/client/src/app/shared/shared-main/account/account.service.ts@@ -3,7 +3,7 @@ import { catchError, map, tap } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor } from '@app/core'-import { Account as ServerAccount } from '@shared/models'+import { Account as ServerAccount } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'import { Account } from './account.model'diff --git a/client/src/app/shared/shared-main/account/actor.model.ts b/client/src/app/shared/shared-main/account/actor.model.tsindex bce0409709..1a1dc2ce61 100644--- a/client/src/app/shared/shared-main/account/actor.model.ts+++ b/client/src/app/shared/shared-main/account/actor.model.ts@@ -1,5 +1,5 @@import { getAbsoluteAPIUrl, getAPIHost } from '@app/helpers'-import { Actor as ServerActor, ActorImage } from '@shared/models'+import { Actor as ServerActor, ActorImage } from '@peertube/peertube-models'export abstract class Actor implements ServerActor {id: numberdiff --git a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts b/client/src/app/shared/shared-main/auth/auth-interceptor.service.tsindex 93b3a93d6d..e1adf401be 100644--- a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts+++ b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts@@ -4,8 +4,7 @@ import { HTTP_INTERCEPTORS, HttpErrorResponse, HttpEvent, HttpHandler, HttpInterimport { Injectable, Injector } from '@angular/core'import { Router } from '@angular/router'import { AuthService } from '@app/core/auth/auth.service'-import { HttpStatusCode } from '@shared/models'-import { OAuth2ErrorCode, PeerTubeProblemDocument } from '@shared/models/server'+import { HttpStatusCode, OAuth2ErrorCode, PeerTubeProblemDocument } from '@peertube/peertube-models'@Injectable()export class AuthInterceptor implements HttpInterceptor {diff --git a/client/src/app/shared/shared-main/custom-page/custom-page.service.ts b/client/src/app/shared/shared-main/custom-page/custom-page.service.tsindex 2914dd6d93..6a2d3a1f5f 100644--- a/client/src/app/shared/shared-main/custom-page/custom-page.service.ts+++ b/client/src/app/shared/shared-main/custom-page/custom-page.service.ts@@ -3,7 +3,7 @@ import { catchError } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor } from '@app/core'-import { CustomPage } from '@shared/models'+import { CustomPage } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'@Injectable()diff --git a/client/src/app/shared/shared-main/feeds/syndication.model.ts b/client/src/app/shared/shared-main/feeds/syndication.model.tsindex cd6fbdb487..a615153130 100644--- a/client/src/app/shared/shared-main/feeds/syndication.model.ts+++ b/client/src/app/shared/shared-main/feeds/syndication.model.ts@@ -1,7 +1,7 @@-import { FeedFormat } from '@shared/models'+import { FeedFormatType } from '@peertube/peertube-models'export interface Syndication {- format: FeedFormat+ format: FeedFormatTypelabel: stringurl: string}diff --git a/client/src/app/shared/shared-main/misc/help.component.ts b/client/src/app/shared/shared-main/misc/help.component.tsindex 80fe0e1600..53eafc74fb 100644--- a/client/src/app/shared/shared-main/misc/help.component.ts+++ b/client/src/app/shared/shared-main/misc/help.component.ts@@ -1,6 +1,6 @@import { AfterContentInit, Component, ContentChildren, Input, OnChanges, OnInit, QueryList, TemplateRef } from '@angular/core'import { GlobalIconName } from '@app/shared/shared-icons'-import { ENHANCED_RULES, TEXT_RULES } from '@shared/core-utils/renderer/markdown'+import { ENHANCED_RULES, TEXT_RULES } from '@peertube/peertube-core-utils'import { PeerTubeTemplateDirective } from '../angular'@Component({diff --git a/client/src/app/shared/shared-main/plugins/plugin-placeholder.component.ts b/client/src/app/shared/shared-main/plugins/plugin-placeholder.component.tsindex 858eff9baf..2064b9089f 100644--- a/client/src/app/shared/shared-main/plugins/plugin-placeholder.component.ts+++ b/client/src/app/shared/shared-main/plugins/plugin-placeholder.component.ts@@ -1,5 +1,5 @@import { Component, Input } from '@angular/core'-import { PluginElementPlaceholder } from '@shared/models'+import { PluginElementPlaceholder } from '@peertube/peertube-models'@Component({selector: 'my-plugin-placeholder',diff --git a/client/src/app/shared/shared-main/plugins/plugin-selector.directive.ts b/client/src/app/shared/shared-main/plugins/plugin-selector.directive.tsindex 576569f193..ddb431dec3 100644--- a/client/src/app/shared/shared-main/plugins/plugin-selector.directive.ts+++ b/client/src/app/shared/shared-main/plugins/plugin-selector.directive.ts@@ -1,5 +1,5 @@import { Directive, ElementRef, Input, OnInit, Renderer2 } from '@angular/core'-import { PluginSelectorId } from '@shared/models'+import { PluginSelectorId } from '@peertube/peertube-models'@Directive({ selector: '[myPluginSelector]' })export class PluginSelectorDirective implements OnInit {diff --git a/client/src/app/shared/shared-main/users/user-history.service.ts b/client/src/app/shared/shared-main/users/user-history.service.tsindex 4cebbc7077..90a9a0eb97 100644--- a/client/src/app/shared/shared-main/users/user-history.service.ts+++ b/client/src/app/shared/shared-main/users/user-history.service.ts@@ -2,7 +2,7 @@ import { catchError, switchMap } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core'-import { ResultList } from '@shared/models'+import { ResultList } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'import { Video } from '../video/video.model'import { VideoService } from '../video/video.service'diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.tsindex 96e7b4dd04..865eff3785 100644--- a/client/src/app/shared/shared-main/users/user-notification.model.ts+++ b/client/src/app/shared/shared-main/users/user-notification.model.ts@@ -2,22 +2,23 @@ import { AuthUser } from '@app/core'import { Account } from '@app/shared/shared-main/account/account.model'import { Actor } from '@app/shared/shared-main/account/actor.model'import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model'-import { logger } from '@root-helpers/logger'import {- AbuseState,+ AbuseStateType,ActorInfo,FollowState,- PluginType,+ PluginType_Type,UserNotification as UserNotificationServer,UserNotificationType,+ UserNotificationType_Type,UserRight,VideoInfo-} from '@shared/models'+} from '@peertube/peertube-models'+import { logger } from '@root-helpers/logger'import { Video } from '../video'export class UserNotification implements UserNotificationServer {id: number- type: UserNotificationType+ type: UserNotificationType_Typeread: booleanvideo?: VideoInfo & {@@ -41,7 +42,7 @@ export class UserNotification implements UserNotificationServer {abuse?: {id: number- state: AbuseState+ state: AbuseStateTypevideo?: VideoInfo@@ -75,7 +76,7 @@ export class UserNotification implements UserNotificationServer {plugin?: {name: string- type: PluginType+ type: PluginType_TypelatestVersion: string}diff --git a/client/src/app/shared/shared-main/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.tsindex 0b3dd9a538..1f7adb9949 100644--- a/client/src/app/shared/shared-main/users/user-notification.service.ts+++ b/client/src/app/shared/shared-main/users/user-notification.service.ts@@ -4,7 +4,7 @@ import { HttpClient, HttpContext, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { AuthService, ComponentPaginationLight, PeerTubeSocket, RestExtractor, RestService } from '@app/core'import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client'-import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models'+import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'import { UserNotification } from './user-notification.model'diff --git a/client/src/app/shared/shared-main/users/user-notifications.component.ts b/client/src/app/shared/shared-main/users/user-notifications.component.tsindex 50005b855f..4318973faa 100644--- a/client/src/app/shared/shared-main/users/user-notifications.component.ts+++ b/client/src/app/shared/shared-main/users/user-notifications.component.ts@@ -1,7 +1,7 @@import { Subject } from 'rxjs'import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'import { ComponentPagination, hasMoreItems, Notifier } from '@app/core'-import { AbuseState } from '@shared/models'+import { AbuseState } from '@peertube/peertube-models'import { UserNotification } from './user-notification.model'import { UserNotificationService } from './user-notification.service'diff --git a/client/src/app/shared/shared-main/video-caption/video-caption.service.ts b/client/src/app/shared/shared-main/video-caption/video-caption.service.tsindex 21f31a7175..59c0969a9e 100644--- a/client/src/app/shared/shared-main/video-caption/video-caption.service.ts+++ b/client/src/app/shared/shared-main/video-caption/video-caption.service.ts@@ -5,8 +5,8 @@ import { Injectable } from '@angular/core'import { RestExtractor, ServerService } from '@app/core'import { objectToFormData, sortBy } from '@app/helpers'import { VideoPasswordService, VideoService } from '@app/shared/shared-main/video'-import { peertubeTranslate } from '@shared/core-utils/i18n'-import { ResultList, VideoCaption } from '@shared/models'+import { peertubeTranslate } from '@peertube/peertube-core-utils'+import { ResultList, VideoCaption } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'import { VideoCaptionEdit } from './video-caption-edit.model'diff --git a/client/src/app/shared/shared-main/video-channel-sync/video-channel-sync.service.ts b/client/src/app/shared/shared-main/video-channel-sync/video-channel-sync.service.tsindex a4e216869b..a7d71c1e04 100644--- a/client/src/app/shared/shared-main/video-channel-sync/video-channel-sync.service.ts+++ b/client/src/app/shared/shared-main/video-channel-sync/video-channel-sync.service.ts@@ -4,8 +4,7 @@ import { environment } from 'src/environments/environment'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'-import { ResultList } from '@shared/models/common'-import { VideoChannelSync, VideoChannelSyncCreate } from '@shared/models/videos'+import { ResultList, VideoChannelSync, VideoChannelSyncCreate } from '@peertube/peertube-models'import { Account, AccountService } from '../account'@Injectable({diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts b/client/src/app/shared/shared-main/video-channel/video-channel.model.tsindex db3e4b43fd..f141d553a8 100644--- a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts+++ b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts@@ -1,5 +1,5 @@import { getAbsoluteAPIUrl } from '@app/helpers'-import { Account as ServerAccount, ActorImage, VideoChannel as ServerVideoChannel, ViewsPerDate } from '@shared/models'+import { Account as ServerAccount, ActorImage, VideoChannel as ServerVideoChannel, ViewsPerDate } from '@peertube/peertube-models'import { Actor } from '../account/actor.model'export class VideoChannel extends Actor implements ServerVideoChannel {diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts b/client/src/app/shared/shared-main/video-channel/video-channel.service.tsindex 08811afec7..9a42fcc52d 100644--- a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts+++ b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts@@ -10,7 +10,7 @@ import {VideoChannelCreate,VideoChannelUpdate,VideosImportInChannelCreate-} from '@shared/models'+} from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'import { Account } from '../account'import { AccountService } from '../account/account.service'diff --git a/client/src/app/shared/shared-main/video/embed.component.ts b/client/src/app/shared/shared-main/video/embed.component.tsindex 43e3501978..017fbf357a 100644--- a/client/src/app/shared/shared-main/video/embed.component.ts+++ b/client/src/app/shared/shared-main/video/embed.component.ts@@ -2,8 +2,8 @@ import { environment } from 'src/environments/environment'import { Component, Input, OnInit } from '@angular/core'import { DomSanitizer, SafeHtml } from '@angular/platform-browser'import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'-import { buildVideoEmbedLink, decorateVideoLink } from '@shared/core-utils'-import { Video } from '@shared/models'+import { buildVideoEmbedLink, decorateVideoLink } from '@peertube/peertube-core-utils'+import { Video } from '@peertube/peertube-models'@Component({selector: 'my-embed',diff --git a/client/src/app/shared/shared-main/video/redundancy.service.ts b/client/src/app/shared/shared-main/video/redundancy.service.tsindex 4377d628a0..8904ee425b 100644--- a/client/src/app/shared/shared-main/video/redundancy.service.ts+++ b/client/src/app/shared/shared-main/video/redundancy.service.ts@@ -4,7 +4,7 @@ import { catchError, toArray } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'-import { ResultList, Video, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'+import { ResultList, Video, VideoRedundanciesTarget, VideoRedundancy } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'@Injectable()diff --git a/client/src/app/shared/shared-main/video/video-details.model.ts b/client/src/app/shared/shared-main/video/video-details.model.tsindex 5c36b56486..5ad0bb8573 100644--- a/client/src/app/shared/shared-main/video/video-details.model.ts+++ b/client/src/app/shared/shared-main/video/video-details.model.ts@@ -4,10 +4,10 @@ import {VideoConstant,VideoDetails as VideoDetailsServerModel,VideoFile,- VideoState,+ VideoStateType,VideoStreamingPlaylist,VideoStreamingPlaylistType-} from '@shared/models'+} from '@peertube/peertube-models'import { Video } from './video.model'export class VideoDetails extends Video implements VideoDetailsServerModel {@@ -20,7 +20,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {downloadEnabled: booleanwaitTranscoding: boolean- state: VideoConstant<VideoState>+ state: VideoConstant<VideoStateType>likesPercent: numberdislikesPercent: numberdiff --git a/client/src/app/shared/shared-main/video/video-edit.model.ts b/client/src/app/shared/shared-main/video/video-edit.model.tsindex 9129ab93ff..a3e736c0fa 100644--- a/client/src/app/shared/shared-main/video/video-edit.model.ts+++ b/client/src/app/shared/shared-main/video/video-edit.model.ts@@ -1,7 +1,7 @@import { getAbsoluteAPIUrl } from '@app/helpers'-import { VideoPassword, VideoPrivacy, VideoScheduleUpdate, VideoUpdate } from '@shared/models'+import { objectKeysTyped } from '@peertube/peertube-core-utils'+import { VideoPassword, VideoPrivacy, VideoPrivacyType, VideoScheduleUpdate, VideoUpdate } from '@peertube/peertube-models'import { VideoDetails } from './video-details.model'-import { objectKeysTyped } from '@shared/core-utils'export class VideoEdit implements VideoUpdate {static readonly SPECIAL_SCHEDULED_PRIVACY = -1@@ -17,7 +17,7 @@ export class VideoEdit implements VideoUpdate {downloadEnabled: booleanwaitTranscoding: booleanchannelId: number- privacy: VideoPrivacy+ privacy: VideoPrivacyTypevideoPassword?: stringsupport: stringthumbnailfile?: anydiff --git a/client/src/app/shared/shared-main/video/video-file-token.service.ts b/client/src/app/shared/shared-main/video/video-file-token.service.tsindex 9bca5b9ec3..87a9528958 100644--- a/client/src/app/shared/shared-main/video/video-file-token.service.ts+++ b/client/src/app/shared/shared-main/video/video-file-token.service.ts@@ -2,7 +2,7 @@ import { catchError, map, of, tap } from 'rxjs'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor } from '@app/core'-import { VideoToken } from '@shared/models'+import { VideoToken } from '@peertube/peertube-models'import { VideoService } from './video.service'import { VideoPasswordService } from './video-password.service'diff --git a/client/src/app/shared/shared-main/video/video-import.service.ts b/client/src/app/shared/shared-main/video/video-import.service.tsindex 607c08d714..bb90524013 100644--- a/client/src/app/shared/shared-main/video/video-import.service.ts+++ b/client/src/app/shared/shared-main/video/video-import.service.ts@@ -5,8 +5,8 @@ import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService, ServerService, UserService } from '@app/core'import { objectToFormData } from '@app/helpers'-import { peertubeTranslate } from '@shared/core-utils/i18n'-import { ResultList, VideoImport, VideoImportCreate, VideoUpdate } from '@shared/models'+import { peertubeTranslate } from '@peertube/peertube-core-utils'+import { ResultList, VideoImport, VideoImportCreate, VideoUpdate } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'@Injectable()diff --git a/client/src/app/shared/shared-main/video/video-ownership.service.ts b/client/src/app/shared/shared-main/video/video-ownership.service.tsindex 1e8f7f68cc..03e8fc946c 100644--- a/client/src/app/shared/shared-main/video/video-ownership.service.ts+++ b/client/src/app/shared/shared-main/video/video-ownership.service.ts@@ -4,7 +4,7 @@ import { catchError } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'-import { ResultList, VideoChangeOwnership, VideoChangeOwnershipAccept, VideoChangeOwnershipCreate } from '@shared/models'+import { ResultList, VideoChangeOwnership, VideoChangeOwnershipAccept, VideoChangeOwnershipCreate } from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'@Injectable()diff --git a/client/src/app/shared/shared-main/video/video-password.service.ts b/client/src/app/shared/shared-main/video/video-password.service.tsindex d5b0406f87..156efd60fa 100644--- a/client/src/app/shared/shared-main/video/video-password.service.ts+++ b/client/src/app/shared/shared-main/video/video-password.service.ts@@ -1,4 +1,4 @@-import { ResultList, VideoPassword } from '@shared/models'+import { ResultList, VideoPassword } from '@peertube/peertube-models'import { Injectable } from '@angular/core'import { catchError, switchMap } from 'rxjs'import { HttpClient, HttpHeaders } from '@angular/common/http'diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.tsindex 1d077a6130..ed28fb3f80 100644--- a/client/src/app/shared/shared-main/video/video.model.ts+++ b/client/src/app/shared/shared-main/video/video.model.ts@@ -2,8 +2,7 @@ import { AuthUser } from '@app/core'import { User } from '@app/core/users/user.model'import { durationToString, formatICU, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers'import { Actor } from '@app/shared/shared-main/account/actor.model'-import { buildVideoWatchPath, getAllFiles } from '@shared/core-utils'-import { peertubeTranslate } from '@shared/core-utils/i18n'+import { buildVideoWatchPath, getAllFiles, peertubeTranslate } from '@peertube/peertube-core-utils'import {ActorImage,HTMLServerConfig,@@ -12,11 +11,13 @@ import {VideoConstant,VideoFile,VideoPrivacy,+ VideoPrivacyType,VideoScheduleUpdate,VideoState,+ VideoStateType,VideoStreamingPlaylist,VideoStreamingPlaylistType-} from '@shared/models'+} from '@peertube/peertube-models'export class Video implements VideoServerModel {byVideoChannel: string@@ -30,7 +31,7 @@ export class Video implements VideoServerModel {category: VideoConstant<number>licence: VideoConstant<number>language: VideoConstant<string>- privacy: VideoConstant<VideoPrivacy>+ privacy: VideoConstant<VideoPrivacyType>truncatedDescription: stringdescription: string@@ -70,7 +71,7 @@ export class Video implements VideoServerModel {originInstanceHost: stringwaitTranscoding?: boolean- state?: VideoConstant<VideoState>+ state?: VideoConstant<VideoStateType>scheduledUpdate?: VideoScheduleUpdateblacklisted?: booleandiff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.tsindex a980c2dcf3..9b2bc5dee4 100644--- a/client/src/app/shared/shared-main/video/video.service.ts+++ b/client/src/app/shared/shared-main/video/video.service.ts@@ -5,7 +5,7 @@ import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http'import { Injectable } from '@angular/core'import { AuthService, ComponentPaginationLight, ConfirmService, RestExtractor, RestService, ServerService, UserService } from '@app/core'import { objectToFormData } from '@app/helpers'-import { arrayify } from '@shared/core-utils'+import { arrayify } from '@peertube/peertube-core-utils'import {BooleanBothQuery,FeedFormat,@@ -21,13 +21,14 @@ import {VideoConstant,VideoDetails as VideoDetailsServerModel,VideoFileMetadata,- VideoInclude,+ VideoIncludeType,VideoPrivacy,+ VideoPrivacyType,VideoSortField,+ VideoSource,VideoTranscodingCreate,VideoUpdate-} from '@shared/models'-import { VideoSource } from '@shared/models/videos/video-source'+} from '@peertube/peertube-models'import { environment } from '../../../../environments/environment'import { Account } from '../account/account.model'import { AccountService } from '../account/account.service'@@ -40,11 +41,11 @@ import { Video } from './video.model'export type CommonVideoParams = {videoPagination?: ComponentPaginationLightsort: VideoSortField | SortMeta- include?: VideoInclude+ include?: VideoIncludeTypeisLocal?: booleancategoryOneOf?: number[]languageOneOf?: string[]- privacyOneOf?: VideoPrivacy[]+ privacyOneOf?: VideoPrivacyType[]isLive?: booleanskipCount?: booleannsfw?: BooleanBothQuery@@ -455,7 +456,7 @@ export class VideoService {)}- explainedPrivacyLabels (serverPrivacies: VideoConstant<VideoPrivacy>[], defaultPrivacyId = VideoPrivacy.PUBLIC) {+ explainedPrivacyLabels (serverPrivacies: VideoConstant<VideoPrivacyType>[], defaultPrivacyId: VideoPrivacyType = VideoPrivacy.PUBLIC) {const descriptions = {[VideoPrivacy.PRIVATE]: $localize`Only I can see this video`,[VideoPrivacy.UNLISTED]: $localize`Only shareable via a private link`,@@ -478,7 +479,7 @@ export class VideoService {}}- getHighestAvailablePrivacy (serverPrivacies: VideoConstant<VideoPrivacy>[]) {+ getHighestAvailablePrivacy (serverPrivacies: VideoConstant<VideoPrivacyType>[]) {// We do not add a password as this requires additional configuration.const order = [VideoPrivacy.PRIVATE,diff --git a/client/src/app/shared/shared-moderation/abuse.service.ts b/client/src/app/shared/shared-moderation/abuse.service.tsindex 5d1539f69d..8055b6dd17 100644--- a/client/src/app/shared/shared-moderation/abuse.service.ts+++ b/client/src/app/shared/shared-moderation/abuse.service.ts@@ -15,7 +15,7 @@ import {AdminAbuse,ResultList,UserAbuse-} from '@shared/models'+} from '@peertube/peertube-models'import { environment } from '../../../environments/environment'@Injectable()diff --git a/client/src/app/shared/shared-moderation/account-block.model.ts b/client/src/app/shared/shared-moderation/account-block.model.tsindex 8f76c69dce..a5bde327a9 100644--- a/client/src/app/shared/shared-moderation/account-block.model.ts+++ b/client/src/app/shared/shared-moderation/account-block.model.ts@@ -1,4 +1,4 @@-import { AccountBlock as AccountBlockServer } from '@shared/models'+import { AccountBlock as AccountBlockServer } from '@peertube/peertube-models'import { Account } from '@app/shared/shared-main'export class AccountBlock implements AccountBlockServer {diff --git a/client/src/app/shared/shared-moderation/blocklist.service.ts b/client/src/app/shared/shared-moderation/blocklist.service.tsindex 0fb7536e57..f755b812ab 100644--- a/client/src/app/shared/shared-moderation/blocklist.service.ts+++ b/client/src/app/shared/shared-moderation/blocklist.service.ts@@ -4,8 +4,8 @@ import { catchError, concatMap, map, toArray } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'-import { arrayify } from '@shared/core-utils'-import { AccountBlock as AccountBlockServer, BlockStatus, ResultList, ServerBlock } from '@shared/models'+import { arrayify } from '@peertube/peertube-core-utils'+import { AccountBlock as AccountBlockServer, BlockStatus, ResultList, ServerBlock } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { Account } from '../shared-main'import { AccountBlock } from './account-block.model'diff --git a/client/src/app/shared/shared-moderation/bulk.service.ts b/client/src/app/shared/shared-moderation/bulk.service.tsindex f0b8694215..36d1b0b1ed 100644--- a/client/src/app/shared/shared-moderation/bulk.service.ts+++ b/client/src/app/shared/shared-moderation/bulk.service.ts@@ -2,7 +2,7 @@ import { catchError } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor } from '@app/core'-import { BulkRemoveCommentsOfBody } from '@shared/models'+import { BulkRemoveCommentsOfBody } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'@Injectable()diff --git a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/account-report.component.tsindex d587a97091..042b57aa7e 100644--- a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts+++ b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts@@ -6,8 +6,8 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { Account } from '@app/shared/shared-main'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'-import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'-import { AbusePredefinedReasonsString } from '@shared/models'+import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils'+import { AbusePredefinedReasonsString } from '@peertube/peertube-models'import { AbuseService } from '../abuse.service'@Component({diff --git a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.tsindex e35d70c8f9..fd50b745a4 100644--- a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts+++ b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts@@ -6,8 +6,8 @@ import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { VideoComment } from '@app/shared/shared-video-comment'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'-import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'-import { AbusePredefinedReasonsString } from '@shared/models'+import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils'+import { AbusePredefinedReasonsString } from '@peertube/peertube-models'import { AbuseService } from '../abuse.service'@Component({diff --git a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/video-report.component.tsindex 16be8e0a14..479957d215 100644--- a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts+++ b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts@@ -6,8 +6,8 @@ import { ABUSE_REASON_VALIDATOR } from '@app/shared/form-validators/abuse-validaimport { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'-import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'-import { AbusePredefinedReasonsString } from '@shared/models'+import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils'+import { AbusePredefinedReasonsString } from '@peertube/peertube-models'import { Video } from '../../shared-main'import { AbuseService } from '../abuse.service'diff --git a/client/src/app/shared/shared-moderation/server-blocklist.component.ts b/client/src/app/shared/shared-moderation/server-blocklist.component.tsindex f1bcbd5611..4105645fa7 100644--- a/client/src/app/shared/shared-moderation/server-blocklist.component.ts+++ b/client/src/app/shared/shared-moderation/server-blocklist.component.ts@@ -2,7 +2,7 @@ import { SortMeta } from 'primeng/api'import { Directive, OnInit, ViewChild } from '@angular/core'import { Notifier, RestPagination, RestTable } from '@app/core'import { BatchDomainsModalComponent } from '@app/shared/shared-moderation/batch-domains-modal.component'-import { ServerBlock } from '@shared/models'+import { ServerBlock } from '@peertube/peertube-models'import { BlocklistComponentType, BlocklistService } from './blocklist.service'@Directive()diff --git a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts b/client/src/app/shared/shared-moderation/user-ban-modal.component.tsindex 34295c34a3..fcada7accf 100644--- a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts+++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts@@ -5,7 +5,7 @@ import { formatICU } from '@app/helpers'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'-import { User } from '@shared/models'+import { User } from '@peertube/peertube-models'import { USER_BAN_REASON_VALIDATOR } from '../form-validators/user-validators'import { Account } from '../shared-main'import { UserAdminService } from '../shared-users'diff --git a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.tsindex 50dccf8629..7de152e60b 100644--- a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts+++ b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts@@ -1,7 +1,7 @@import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'import { Account, DropdownAction } from '@app/shared/shared-main'-import { BulkRemoveCommentsOfBody, User, UserRight } from '@shared/models'+import { BulkRemoveCommentsOfBody, User, UserRight } from '@peertube/peertube-models'import { UserAdminService } from '../shared-users'import { BlocklistService } from './blocklist.service'import { BulkService } from './bulk.service'diff --git a/client/src/app/shared/shared-moderation/video-block.service.ts b/client/src/app/shared/shared-moderation/video-block.service.tsindex ab352a2d64..18950c92b4 100644--- a/client/src/app/shared/shared-moderation/video-block.service.ts+++ b/client/src/app/shared/shared-moderation/video-block.service.ts@@ -4,8 +4,8 @@ import { catchError, concatMap, toArray } from 'rxjs/operators'import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService } from '@app/core'-import { arrayify } from '@shared/core-utils'-import { ResultList, VideoBlacklist, VideoBlacklistType } from '@shared/models'+import { arrayify } from '@peertube/peertube-core-utils'+import { ResultList, VideoBlacklist, VideoBlacklistType, VideoBlacklistType_Type } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'@Injectable()@@ -22,7 +22,7 @@ export class VideoBlockService {pagination: RestPaginationsort: SortMetasearch?: string- type?: VideoBlacklistType+ type?: VideoBlacklistType_Type}): Observable<ResultList<VideoBlacklist>> {const { pagination, sort, search, type } = optionsdiff --git a/client/src/app/shared/shared-search/advanced-search.model.ts b/client/src/app/shared/shared-search/advanced-search.model.tsindex 29fe3e8dc9..b977a4801a 100644--- a/client/src/app/shared/shared-search/advanced-search.model.ts+++ b/client/src/app/shared/shared-search/advanced-search.model.ts@@ -6,7 +6,7 @@ import {VideoChannelsSearchQuery,VideoPlaylistsSearchQuery,VideosSearchQuery-} from '@shared/models'+} from '@peertube/peertube-models'export type AdvancedSearchResultType = 'videos' | 'playlists' | 'channels'diff --git a/client/src/app/shared/shared-search/find-in-bulk.service.ts b/client/src/app/shared/shared-search/find-in-bulk.service.tsindex 125d5e2b86..de57c7f642 100644--- a/client/src/app/shared/shared-search/find-in-bulk.service.ts+++ b/client/src/app/shared/shared-search/find-in-bulk.service.ts@@ -3,11 +3,11 @@ import { Observable, Subject } from 'rxjs'import { filter, first, map } from 'rxjs/operators'import { Injectable } from '@angular/core'import { buildBulkObservable } from '@app/helpers'-import { ResultList } from '@shared/models/common'+import { ResultList } from '@peertube/peertube-models'import { Video, VideoChannel } from '../shared-main'import { VideoPlaylist } from '../shared-video-playlist'-import { SearchService } from './search.service'import { AdvancedSearch } from './advanced-search.model'+import { SearchService } from './search.service'const debugLogger = debug('peertube:search:FindInBulkService')diff --git a/client/src/app/shared/shared-search/search.service.ts b/client/src/app/shared/shared-search/search.service.tsindex ad2de0f37f..281e0b4bd9 100644--- a/client/src/app/shared/shared-search/search.service.ts+++ b/client/src/app/shared/shared-search/search.service.ts@@ -9,7 +9,7 @@ import {Video as VideoServerModel,VideoChannel as VideoChannelServerModel,VideoPlaylist as VideoPlaylistServerModel-} from '@shared/models'+} from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { VideoPlaylist, VideoPlaylistService } from '../shared-video-playlist'import { AdvancedSearch } from './advanced-search.model'diff --git a/client/src/app/shared/shared-share-modal/video-share.component.ts b/client/src/app/shared/shared-share-modal/video-share.component.tsindex b09222c3e5..24c9cdecad 100644--- a/client/src/app/shared/shared-share-modal/video-share.component.ts+++ b/client/src/app/shared/shared-share-modal/video-share.component.ts@@ -5,8 +5,8 @@ import { VideoDetails } from '@app/shared/shared-main'import { VideoPlaylist } from '@app/shared/shared-video-playlist'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'-import { buildPlaylistLink, buildVideoLink, decoratePlaylistLink, decorateVideoLink } from '@shared/core-utils'-import { VideoCaption, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'+import { buildPlaylistLink, buildVideoLink, decoratePlaylistLink, decorateVideoLink } from '@peertube/peertube-core-utils'+import { VideoCaption, VideoPlaylistPrivacy, VideoPrivacy } from '@peertube/peertube-models'type Customizations = {startAtCheckbox: booleandiff --git a/client/src/app/shared/shared-support-modal/support-modal.component.ts b/client/src/app/shared/shared-support-modal/support-modal.component.tsindex f330228e13..d911b45d87 100644--- a/client/src/app/shared/shared-support-modal/support-modal.component.ts+++ b/client/src/app/shared/shared-support-modal/support-modal.component.ts@@ -2,7 +2,7 @@ import { Component, Input, ViewChild } from '@angular/core'import { MarkdownService } from '@app/core'import { VideoDetails } from '@app/shared/shared-main'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'-import { VideoChannel } from '@shared/models'+import { VideoChannel } from '@peertube/peertube-models'@Component({selector: 'my-support-modal',diff --git a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.tsindex ad5d30db2a..c9a5c97dbf 100644--- a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts+++ b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts@@ -1,6 +1,6 @@import { Component, EventEmitter, Input, Output } from '@angular/core'import { ScreenService } from '@app/core'-import { VideoState } from '@shared/models'+import { VideoState } from '@peertube/peertube-models'import { Video } from '../shared-main'@Component({diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts b/client/src/app/shared/shared-user-settings/user-interface-settings.component.tsindex c2c30d38b4..08c6b69330 100644--- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts+++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts@@ -2,7 +2,7 @@ import { Subject, Subscription } from 'rxjs'import { Component, Input, OnDestroy, OnInit } from '@angular/core'import { AuthService, Notifier, ServerService, ThemeService, UserService } from '@app/core'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'-import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models'+import { HTMLServerConfig, User, UserUpdateMe } from '@peertube/peertube-models'import { SelectOptionsItem } from 'src/types'@Component({diff --git a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts b/client/src/app/shared/shared-user-settings/user-video-settings.component.tsindex ed6e7fffd3..234d5b2172 100644--- a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts+++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts@@ -4,8 +4,7 @@ import { first } from 'rxjs/operators'import { Component, Input, OnDestroy, OnInit } from '@angular/core'import { AuthService, Notifier, ServerService, User, UserService } from '@app/core'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'-import { UserUpdateMe } from '@shared/models'-import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type'+import { NSFWPolicyType, UserUpdateMe } from '@peertube/peertube-models'@Component({selector: 'my-user-video-settings',diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts b/client/src/app/shared/shared-user-subscription/subscribe-button.component.tsindex a002bf4e7d..2a57518240 100644--- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts+++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts@@ -2,7 +2,7 @@ import { concat, forkJoin, merge } from 'rxjs'import { Component, Input, OnChanges, OnInit } from '@angular/core'import { AuthService, Notifier, RedirectService } from '@app/core'import { Account, VideoChannel, VideoService } from '@app/shared/shared-main'-import { FeedFormat } from '@shared/models'+import { FeedFormat } from '@peertube/peertube-models'import { UserSubscriptionService } from './user-subscription.service'@Component({diff --git a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts b/client/src/app/shared/shared-user-subscription/user-subscription.service.tsindex 9cf6b4d165..b83f7ebc53 100644--- a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts+++ b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts@@ -6,7 +6,7 @@ import { Injectable } from '@angular/core'import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core'import { buildBulkObservable } from '@app/helpers'import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'-import { ActorFollow, ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@shared/models'+import { ActorFollow, ResultList, VideoChannel as VideoChannelServer, VideoSortField } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'const debugLogger = debug('peertube:subscriptions:UserSubscriptionService')diff --git a/client/src/app/shared/shared-users/two-factor.service.ts b/client/src/app/shared/shared-users/two-factor.service.tsindex 9ff916f154..cb4450e8f2 100644--- a/client/src/app/shared/shared-users/two-factor.service.ts+++ b/client/src/app/shared/shared-users/two-factor.service.ts@@ -2,7 +2,7 @@ import { catchError } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, UserService } from '@app/core'-import { TwoFactorEnableResult } from '@shared/models'+import { TwoFactorEnableResult } from '@peertube/peertube-models'@Injectable()export class TwoFactorService {diff --git a/client/src/app/shared/shared-users/user-admin.service.ts b/client/src/app/shared/shared-users/user-admin.service.tsindex 5842bd2718..cc706343f2 100644--- a/client/src/app/shared/shared-users/user-admin.service.ts+++ b/client/src/app/shared/shared-users/user-admin.service.ts@@ -5,8 +5,8 @@ import { HttpClient, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor, RestPagination, RestService, ServerService, UserService } from '@app/core'import { getBytes } from '@root-helpers/bytes'-import { arrayify, peertubeTranslate } from '@shared/core-utils'-import { ResultList, User as UserServerModel, UserCreate, UserUpdate } from '@shared/models'+import { arrayify, peertubeTranslate } from '@peertube/peertube-core-utils'+import { ResultList, User as UserServerModel, UserCreate, UserUpdate } from '@peertube/peertube-models'@Injectable()export class UserAdminService {diff --git a/client/src/app/shared/shared-video-comment/video-comment-thread-tree.model.ts b/client/src/app/shared/shared-video-comment/video-comment-thread-tree.model.tsindex 9956c88a6f..62683f57fa 100644--- a/client/src/app/shared/shared-video-comment/video-comment-thread-tree.model.ts+++ b/client/src/app/shared/shared-video-comment/video-comment-thread-tree.model.ts@@ -1,4 +1,4 @@-import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '@shared/models'+import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '@peertube/peertube-models'import { VideoComment } from './video-comment.model'export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel {diff --git a/client/src/app/shared/shared-video-comment/video-comment.model.ts b/client/src/app/shared/shared-video-comment/video-comment.model.tsindex adab4cfbda..7048ed66fc 100644--- a/client/src/app/shared/shared-video-comment/video-comment.model.ts+++ b/client/src/app/shared/shared-video-comment/video-comment.model.ts@@ -4,7 +4,7 @@ import {Account as AccountInterface,VideoComment as VideoCommentServerModel,VideoCommentAdmin as VideoCommentAdminServerModel-} from '@shared/models'+} from '@peertube/peertube-models'export class VideoComment implements VideoCommentServerModel {id: numberdiff --git a/client/src/app/shared/shared-video-comment/video-comment.service.ts b/client/src/app/shared/shared-video-comment/video-comment.service.tsindex 3906652be6..d1db773c43 100644--- a/client/src/app/shared/shared-video-comment/video-comment.service.ts+++ b/client/src/app/shared/shared-video-comment/video-comment.service.ts@@ -14,7 +14,7 @@ import {VideoCommentAdmin,VideoCommentCreate,VideoCommentThreadTree as VideoCommentThreadTreeServerModel-} from '@shared/models'+} from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { VideoCommentThreadTree } from './video-comment-thread-tree.model'import { VideoComment } from './video-comment.model'diff --git a/client/src/app/shared/shared-video-live/live-stream-information.component.ts b/client/src/app/shared/shared-video-live/live-stream-information.component.tsindex 400a6fa01c..4089c88fb4 100644--- a/client/src/app/shared/shared-video-live/live-stream-information.component.ts+++ b/client/src/app/shared/shared-video-live/live-stream-information.component.ts@@ -1,7 +1,7 @@import { Component, ElementRef, ViewChild } from '@angular/core'import { Video } from '@app/shared/shared-main'import { NgbModal } from '@ng-bootstrap/ng-bootstrap'-import { LiveVideo, LiveVideoError, LiveVideoSession } from '@shared/models'+import { LiveVideo, LiveVideoError, LiveVideoErrorType, LiveVideoSession } from '@peertube/peertube-models'import { LiveVideoService } from './live-video.service'@Component({@@ -38,7 +38,7 @@ export class LiveStreamInformationComponent {getErrorLabel (session: LiveVideoSession) {if (!session.error) return undefined- const errors: { [ id in LiveVideoError ]: string } = {+ const errors: { [ id in LiveVideoErrorType ]: string } = {[LiveVideoError.BAD_SOCKET_HEALTH]: $localize`Server too slow`,[LiveVideoError.BLACKLISTED]: $localize`Live blacklisted`,[LiveVideoError.DURATION_EXCEEDED]: $localize`Max duration exceeded`,diff --git a/client/src/app/shared/shared-video-live/live-video.service.ts b/client/src/app/shared/shared-video-live/live-video.service.tsindex 89bfd84a01..8ac0eb9242 100644--- a/client/src/app/shared/shared-video-live/live-video.service.ts+++ b/client/src/app/shared/shared-video-live/live-video.service.ts@@ -2,7 +2,7 @@ import { catchError } from 'rxjs/operators'import { HttpClient } from '@angular/common/http'import { Injectable } from '@angular/core'import { RestExtractor } from '@app/core'-import { LiveVideo, LiveVideoCreate, LiveVideoSession, LiveVideoUpdate, ResultList, VideoCreateResult } from '@shared/models'+import { LiveVideo, LiveVideoCreate, LiveVideoSession, LiveVideoUpdate, ResultList, VideoCreateResult } from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { VideoService } from '../shared-main'diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.tsindex 9891aae2ee..4b3ed6e993 100644--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts@@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@aimport { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core'import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation'import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'-import { VideoCaption } from '@shared/models'+import { VideoCaption } from '@peertube/peertube-models'import {Actor,DropdownAction,diff --git a/client/src/app/shared/shared-video-miniature/video-download.component.ts b/client/src/app/shared/shared-video-miniature/video-download.component.tsindex 146ea7dfea..123f40b2f3 100644--- a/client/src/app/shared/shared-video-miniature/video-download.component.ts+++ b/client/src/app/shared/shared-video-miniature/video-download.component.ts@@ -6,8 +6,8 @@ import { HooksService } from '@app/core'import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'import { logger } from '@root-helpers/logger'import { videoRequiresFileToken } from '@root-helpers/video'-import { objectKeysTyped, pick } from '@shared/core-utils'-import { VideoCaption, VideoFile } from '@shared/models'+import { objectKeysTyped, pick } from '@peertube/peertube-core-utils'+import { VideoCaption, VideoFile } from '@peertube/peertube-models'import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoFileTokenService, VideoService } from '../shared-main'type DownloadType = 'video' | 'subtitles'diff --git a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts b/client/src/app/shared/shared-video-miniature/video-filters-header.component.tsindex a5da9ebf31..2826408e72 100644--- a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts+++ b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts@@ -4,7 +4,7 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@anguimport { FormBuilder, FormGroup } from '@angular/forms'import { AuthService } from '@app/core'import { ServerService } from '@app/core/server/server.service'-import { UserRight } from '@shared/models'+import { UserRight } from '@peertube/peertube-models'import { PeertubeModalService } from '../shared-main'import { VideoFilters } from './video-filters.model'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.tsindex f57a45eb1c..8db17c015a 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,8 +1,14 @@import { splitIntoArray, toBoolean } from '@app/helpers'-import { getAllPrivacies } from '@shared/core-utils'-import { escapeHTML } from '@shared/core-utils/renderer'-import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'+import { escapeHTML, getAllPrivacies } from '@peertube/peertube-core-utils'+import {+ BooleanBothQuery,+ NSFWPolicyType,+ VideoInclude,+ VideoIncludeType,+ VideoPrivacyType,+ VideoSortField+} from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'type VideoFiltersKeys = {[ id in keyof AttributesOnly<VideoFilters> ]: any@@ -207,8 +213,8 @@ export class VideoFilters {toVideosAPIObject () {let isLocal: boolean- let include: VideoInclude- let privacyOneOf: VideoPrivacy[]+ let include: VideoIncludeType+ let privacyOneOf: VideoPrivacyType[]if (this.scope === 'local') {isLocal = truediff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.tsindex d453f37a1d..11cd6726ea 100644--- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts+++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts@@ -11,7 +11,7 @@ import {Output} from '@angular/core'import { AuthService, ScreenService, ServerService, User } from '@app/core'-import { HTMLServerConfig, VideoExistInPlaylist, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models'+import { HTMLServerConfig, VideoExistInPlaylist, VideoPlaylistType, VideoPrivacy, VideoState } from '@peertube/peertube-models'import { LinkType } from '../../../types/link.type'import { ActorAvatarSize } from '../shared-actor-image/actor-avatar.component'import { Video, VideoService } from '../shared-main'diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.tsindex 14a5abd7af..afdef5ace8 100644--- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts+++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts@@ -15,8 +15,8 @@ import {} from '@app/core'import { GlobalIconName } from '@app/shared/shared-icons'import { logger } from '@root-helpers/logger'-import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils'-import { ResultList, UserRight, VideoSortField } from '@shared/models'+import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@peertube/peertube-core-utils'+import { ResultList, UserRight, VideoSortField } from '@peertube/peertube-models'import { Syndication, Video } from '../shared-main'import { VideoFilters, VideoFilterScope } from './video-filters.model'import { MiniatureDisplayOptions } from './video-miniature.component'diff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts b/client/src/app/shared/shared-video-miniature/videos-selection.component.tsindex 86fe502e24..286b33dd46 100644--- a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts+++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts@@ -2,8 +2,8 @@ import { Observable, Subject } from 'rxjs'import { AfterContentInit, Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef } from '@angular/core'import { ComponentPagination, Notifier, User } from '@app/core'import { logger } from '@root-helpers/logger'-import { objectKeysTyped } from '@shared/core-utils'-import { ResultList, VideosExistInPlaylists, VideoSortField } from '@shared/models'+import { objectKeysTyped } from '@peertube/peertube-core-utils'+import { ResultList, VideosExistInPlaylists, VideoSortField } from '@peertube/peertube-models'import { PeerTubeTemplateDirective, Video } from '../shared-main'import { MiniatureDisplayOptions } from './video-miniature.component'diff --git a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.tsindex f802416a42..84173ba697 100644--- a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts+++ b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts@@ -4,7 +4,7 @@ import { debounceTime, filter } from 'rxjs/operators'import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'import { AuthService, DisableForReuseHook, Notifier } from '@app/core'import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'-import { secondsToTime } from '@shared/core-utils'+import { secondsToTime } from '@peertube/peertube-core-utils'import {CachedVideoExistInPlaylist,Video,@@ -12,7 +12,7 @@ import {VideoPlaylistElementCreate,VideoPlaylistElementUpdate,VideoPlaylistPrivacy-} from '@shared/models'+} from '@peertube/peertube-models'import { VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR } from '../form-validators/video-playlist-validators'import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service'diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.tsindex b9a1d96236..0c0f11ecc6 100644--- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts+++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts@@ -2,8 +2,8 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Inimport { AuthService, Notifier, ServerService } from '@app/core'import { Video, VideoService } from '@app/shared/shared-main'import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'-import { secondsToTime } from '@shared/core-utils'-import { HTMLServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate, VideoPrivacy } from '@shared/models'+import { secondsToTime } from '@peertube/peertube-core-utils'+import { HTMLServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate, VideoPrivacy } from '@peertube/peertube-models'import { VideoPlaylistElement } from './video-playlist-element.model'import { VideoPlaylist } from './video-playlist.model'import { VideoPlaylistService } from './video-playlist.service'diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element.model.tsindex b661378bd8..16b212281a 100644--- a/client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts+++ b/client/src/app/shared/shared-video-playlist/video-playlist-element.model.ts@@ -1,5 +1,5 @@import { Video } from '@app/shared/shared-main'-import { VideoPlaylistElement as ServerVideoPlaylistElement, VideoPlaylistElementType } from '@shared/models'+import { VideoPlaylistElement as ServerVideoPlaylistElement, VideoPlaylistElementType_Type } from '@peertube/peertube-models'export class VideoPlaylistElement implements ServerVideoPlaylistElement {id: number@@ -7,7 +7,7 @@ export class VideoPlaylistElement implements ServerVideoPlaylistElement {startTimestamp: numberstopTimestamp: number- type: VideoPlaylistElementType+ type: VideoPlaylistElementType_Typevideo?: Videodiff --git a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts b/client/src/app/shared/shared-video-playlist/video-playlist.model.tsindex 6b38d9ca35..24f1041ce2 100644--- a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts+++ b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts@@ -1,15 +1,15 @@import { getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers'import { Actor } from '@app/shared/shared-main'-import { buildPlaylistWatchPath } from '@shared/core-utils'-import { peertubeTranslate } from '@shared/core-utils/i18n'+import { buildPlaylistWatchPath, peertubeTranslate } from '@peertube/peertube-core-utils'import {AccountSummary,VideoChannelSummary,VideoConstant,VideoPlaylist as ServerVideoPlaylist,- VideoPlaylistPrivacy,- VideoPlaylistType-} from '@shared/models'+ VideoPlaylistPrivacyType,+ VideoPlaylistType,+ VideoPlaylistType_Type+} from '@peertube/peertube-models'export class VideoPlaylist implements ServerVideoPlaylist {id: number@@ -22,11 +22,11 @@ export class VideoPlaylist implements ServerVideoPlaylist {displayName: stringdescription: string- privacy: VideoConstant<VideoPlaylistPrivacy>+ privacy: VideoConstant<VideoPlaylistPrivacyType>videosLength: number- type: VideoConstant<VideoPlaylistType>+ type: VideoConstant<VideoPlaylistType_Type>createdAt: Date | stringupdatedAt: Date | stringdiff --git a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts b/client/src/app/shared/shared-video-playlist/video-playlist.service.tsindex bc9fb0d744..7f0da2be81 100644--- a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts+++ b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts@@ -20,7 +20,7 @@ import {VideoPlaylistReorder,VideoPlaylistUpdate,VideosExistInPlaylists-} from '@shared/models'+} from '@peertube/peertube-models'import { environment } from '../../../environments/environment'import { VideoPlaylistElement } from './video-playlist-element.model'import { VideoPlaylist } from './video-playlist.model'diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.tsindex 69ca1a5667..4da681a086 100644--- a/client/src/assets/player/peertube-player.ts+++ b/client/src/assets/player/peertube-player.ts@@ -30,7 +30,7 @@ import { PluginsManager } from '@root-helpers/plugins-manager'import { copyToClipboard } from '@root-helpers/utils'import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'import { isMobile } from '@root-helpers/web-browser'-import { buildVideoLink, decorateVideoLink, isDefaultLocale, pick } from '@shared/core-utils'+import { buildVideoLink, decorateVideoLink, isDefaultLocale, pick } from '@peertube/peertube-core-utils'import { saveAverageBandwidth } from './peertube-player-local-storage'import { ControlBarOptionsBuilder, HLSOptionsBuilder, WebVideoOptionsBuilder } from './shared/player-options-builder'import { TranslationsManager } from './translations-manager'@@ -51,6 +51,8 @@ if (PlayProgressBar.prototype.options_.children.includes('timeTooltip') !== truePlayProgressBar.prototype.options_.children.push('timeTooltip')}+export { videojs }+export class PeerTubePlayer {private pluginsManager: PluginsManager@@ -516,9 +518,3 @@ export class PeerTubePlayer {return { content }}}--// ############################################################################--export {- videojs-}diff --git a/client/src/assets/player/shared/common/utils.ts b/client/src/assets/player/shared/common/utils.tsindex 609240626c..4a71820211 100644--- a/client/src/assets/player/shared/common/utils.ts+++ b/client/src/assets/player/shared/common/utils.ts@@ -1,4 +1,4 @@-import { VideoFile } from '@shared/models'+import { VideoFile } from '@peertube/peertube-models'function toTitleCase (str: string) {return str.charAt(0).toUpperCase() + str.slice(1)diff --git a/client/src/assets/player/shared/control-bar/peertube-link-button.ts b/client/src/assets/player/shared/control-bar/peertube-link-button.tsindex 8242b9ceaf..f93c265d65 100644--- a/client/src/assets/player/shared/control-bar/peertube-link-button.ts+++ b/client/src/assets/player/shared/control-bar/peertube-link-button.ts@@ -1,5 +1,5 @@import videojs from 'video.js'-import { buildVideoLink, decorateVideoLink } from '@shared/core-utils'+import { buildVideoLink, decorateVideoLink } from '@peertube/peertube-core-utils'import { PeerTubeLinkButtonOptions } from '../../types'const Component = videojs.getComponent('Component')diff --git a/client/src/assets/player/shared/metrics/metrics-plugin.ts b/client/src/assets/player/shared/metrics/metrics-plugin.tsindex 06ca0c2f22..0ad16338c5 100644--- a/client/src/assets/player/shared/metrics/metrics-plugin.ts+++ b/client/src/assets/player/shared/metrics/metrics-plugin.ts@@ -1,7 +1,7 @@import debug from 'debug'import videojs from 'video.js'+import { PlaybackMetricCreate, VideoResolutionType } from '@peertube/peertube-models'import { logger } from '@root-helpers/logger'-import { PlaybackMetricCreate } from '../../../../../../shared/models'import { MetricsPluginOptions, PlayerNetworkInfo } from '../../types'const debugLogger = debug('peertube:player:metrics')@@ -102,7 +102,7 @@ class MetricsPlugin extends Plugin {}const body: PlaybackMetricCreate = {- resolution,+ resolution: resolution as VideoResolutionType,fps,playerMode: this.options_.mode(),diff --git a/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts b/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.tsindex 8c376cd21d..1e47fe4868 100644--- a/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts+++ b/client/src/assets/player/shared/p2p-media-loader/p2p-media-loader-plugin.ts@@ -3,7 +3,7 @@ import videojs from 'video.js'import { Events, Segment } from '@peertube/p2p-media-loader-core'import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from '@peertube/p2p-media-loader-hlsjs'import { logger } from '@root-helpers/logger'-import { addQueryParams } from '@shared/core-utils'+import { addQueryParams } from '@peertube/peertube-core-utils'import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo } from '../../types'import { SettingsButton } from '../settings/settings-menu-button'diff --git a/client/src/assets/player/shared/p2p-media-loader/segment-validator.ts b/client/src/assets/player/shared/p2p-media-loader/segment-validator.tsindex 9cb6344a9c..75d483015a 100644--- a/client/src/assets/player/shared/p2p-media-loader/segment-validator.ts+++ b/client/src/assets/player/shared/p2p-media-loader/segment-validator.ts@@ -2,7 +2,7 @@ import { basename } from 'path'import { Segment } from '@peertube/p2p-media-loader-core'import { logger } from '@root-helpers/logger'import { wait } from '@root-helpers/utils'-import { removeQueryParams } from '@shared/core-utils'+import { removeQueryParams } from '@peertube/peertube-core-utils'import { isSameOrigin } from '../common'type SegmentsJSON = { [filename: string]: string | { [byterange: string]: string } }diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.tsindex f935934152..cf866723c6 100644--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts@@ -1,9 +1,9 @@import debug from 'debug'import videojs from 'video.js'+import { timeToInt } from '@peertube/peertube-core-utils'+import { VideoView, VideoViewEvent } from '@peertube/peertube-models'import { logger } from '@root-helpers/logger'import { isIOS, isMobile, isSafari } from '@root-helpers/web-browser'-import { timeToInt } from '@shared/core-utils'-import { VideoView, VideoViewEvent } from '@shared/models/videos'import {getStoredLastSubtitle,getStoredMute,diff --git a/client/src/assets/player/shared/player-options-builder/hls-options-builder.ts b/client/src/assets/player/shared/player-options-builder/hls-options-builder.tsindex fd632d90d1..41198afbed 100644--- a/client/src/assets/player/shared/player-options-builder/hls-options-builder.ts+++ b/client/src/assets/player/shared/player-options-builder/hls-options-builder.ts@@ -1,7 +1,7 @@import { HybridLoaderSettings } from '@peertube/p2p-media-loader-core'import { HlsJsEngineSettings } from '@peertube/p2p-media-loader-hlsjs'import { logger } from '@root-helpers/logger'-import { LiveVideoLatencyMode } from '@shared/models'+import { LiveVideoLatencyMode } from '@peertube/peertube-models'import { getAverageBandwidthInStore } from '../../peertube-player-local-storage'import { P2PMediaLoader, P2PMediaLoaderPluginOptions, PeerTubePlayerContructorOptions, PeerTubePlayerLoadOptions } from '../../types'import { getRtcConfig, isSameOrigin } from '../common'diff --git a/client/src/assets/player/shared/playlist/playlist-menu-item.ts b/client/src/assets/player/shared/playlist/playlist-menu-item.tsindex f9366332db..66c92d9e5e 100644--- a/client/src/assets/player/shared/playlist/playlist-menu-item.ts+++ b/client/src/assets/player/shared/playlist/playlist-menu-item.ts@@ -1,6 +1,6 @@import videojs from 'video.js'-import { secondsToTime } from '@shared/core-utils'-import { VideoPlaylistElement } from '@shared/models'+import { secondsToTime } from '@peertube/peertube-core-utils'+import { VideoPlaylistElement } from '@peertube/peertube-models'import { PlaylistItemOptions } from '../../types'const Component = videojs.getComponent('Component')diff --git a/client/src/assets/player/shared/playlist/playlist-menu.ts b/client/src/assets/player/shared/playlist/playlist-menu.tsindex 53a5a72744..f6795390cf 100644--- a/client/src/assets/player/shared/playlist/playlist-menu.ts+++ b/client/src/assets/player/shared/playlist/playlist-menu.ts@@ -1,5 +1,5 @@import videojs from 'video.js'-import { VideoPlaylistElement } from '@shared/models'+import { VideoPlaylistElement } from '@peertube/peertube-models'import { PlaylistPluginOptions } from '../../types'import { PlaylistMenuItem } from './playlist-menu-item'diff --git a/client/src/assets/player/shared/stats/stats-card.ts b/client/src/assets/player/shared/stats/stats-card.tsindex 13334d91a6..fefe8483ea 100644--- a/client/src/assets/player/shared/stats/stats-card.ts+++ b/client/src/assets/player/shared/stats/stats-card.ts@@ -1,6 +1,6 @@import videojs from 'video.js'import { logger } from '@root-helpers/logger'-import { secondsToTime } from '@shared/core-utils'+import { secondsToTime } from '@peertube/peertube-core-utils'import { PlayerNetworkInfo as EventPlayerNetworkInfo } from '../../types'import { bytes } from '../common'diff --git a/client/src/assets/player/shared/web-video/web-video-plugin.ts b/client/src/assets/player/shared/web-video/web-video-plugin.tsindex b839062f2a..18d9111083 100644--- a/client/src/assets/player/shared/web-video/web-video-plugin.ts+++ b/client/src/assets/player/shared/web-video/web-video-plugin.ts@@ -1,8 +1,8 @@import debug from 'debug'import videojs from 'video.js'import { logger } from '@root-helpers/logger'-import { addQueryParams } from '@shared/core-utils'-import { VideoFile } from '@shared/models'+import { addQueryParams } from '@peertube/peertube-core-utils'+import { VideoFile } from '@peertube/peertube-models'import { PeerTubeResolution, PlayerNetworkInfo, WebVideoPluginOptions } from '../../types'const debugLogger = debug('peertube:player:web-video-plugin')diff --git a/client/src/assets/player/translations-manager.ts b/client/src/assets/player/translations-manager.tsindex bf9c2d471a..03d5dd91ea 100644--- a/client/src/assets/player/translations-manager.ts+++ b/client/src/assets/player/translations-manager.ts@@ -1,5 +1,5 @@+import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '@peertube/peertube-core-utils'import { logger } from '@root-helpers/logger'-import { getCompleteLocale, getShortLocale, is18nLocale, isDefaultLocale } from '@shared/core-utils/i18n'export class TranslationsManager {private static videojsLocaleCache: { [ path: string ]: any } = {}diff --git a/client/src/assets/player/types/peertube-player-options.ts b/client/src/assets/player/types/peertube-player-options.tsindex e1b8c7fab6..352f7d8ddb 100644--- a/client/src/assets/player/types/peertube-player-options.ts+++ b/client/src/assets/player/types/peertube-player-options.ts@@ -1,5 +1,5 @@+import { LiveVideoLatencyModeType, VideoFile } from '@peertube/peertube-models'import { PluginsManager } from '@root-helpers/plugins-manager'-import { LiveVideoLatencyMode, VideoFile } from '@shared/models'import { PeerTubeDockPluginOptions } from '../shared/dock/peertube-dock-plugin'import { PlaylistPluginOptions, VideoJSCaption, VideoJSStoryboard } from './peertube-videojs-typings'@@ -59,7 +59,7 @@ export type PeerTubePlayerLoadOptions = {isLive: booleanliveOptions?: {- latencyMode: LiveVideoLatencyMode+ latencyMode: LiveVideoLatencyModeType}videoCaptions: VideoJSCaption[]diff --git a/client/src/assets/player/types/peertube-videojs-typings.ts b/client/src/assets/player/types/peertube-videojs-typings.tsindex 73b38d0d35..dae9e14c8a 100644--- a/client/src/assets/player/types/peertube-videojs-typings.ts+++ b/client/src/assets/player/types/peertube-videojs-typings.ts@@ -1,7 +1,7 @@import { HlsConfig, Level } from 'hls.js'import videojs from 'video.js'import { Engine } from '@peertube/p2p-media-loader-hlsjs'-import { VideoFile, VideoPlaylist, VideoPlaylistElement } from '@shared/models'+import { VideoFile, VideoPlaylist, VideoPlaylistElement } from '@peertube/peertube-models'import { BezelsPlugin } from '../shared/bezels/bezels-plugin'import { StoryboardPlugin } from '../shared/control-bar/storyboard-plugin'import { PeerTubeDockPlugin, PeerTubeDockPluginOptions } from '../shared/dock/peertube-dock-plugin'diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.tsindex cc303b80bb..b56e3df8ff 100644--- a/client/src/assets/player/utils.ts+++ b/client/src/assets/player/utils.ts@@ -1,4 +1,4 @@-import { HTMLServerConfig, Video, VideoFile } from '@shared/models'+import { HTMLServerConfig, Video, VideoFile } from '@peertube/peertube-models'function toTitleCase (str: string) {return str.charAt(0).toUpperCase() + str.slice(1)diff --git a/client/src/root-helpers/logger.ts b/client/src/root-helpers/logger.tsindex 8181c13f38..108228d841 100644--- a/client/src/root-helpers/logger.ts+++ b/client/src/root-helpers/logger.ts@@ -1,4 +1,4 @@-import { ClientLogCreate } from '@shared/models/server'+import { ClientLogCreate } from '@peertube/peertube-models'import { peertubeLocalStorage } from './peertube-web-storage'import { OAuthUserTokens } from './users'diff --git a/client/src/root-helpers/plugins-manager.ts b/client/src/root-helpers/plugins-manager.tsindex fd7b5233bc..e987f16d64 100644--- a/client/src/root-helpers/plugins-manager.ts+++ b/client/src/root-helpers/plugins-manager.ts@@ -3,7 +3,7 @@ import * as debug from 'debug'import { firstValueFrom, ReplaySubject } from 'rxjs'import { first, shareReplay } from 'rxjs/operators'import { RegisterClientHelpers } from 'src/types/register-client-option.model'-import { getExternalAuthHref, getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks'+import { getExternalAuthHref, getHookType, internalRunHook } from '@peertube/peertube-core-utils'import {ClientHookName,clientHookObject,@@ -11,13 +11,14 @@ import {HTMLServerConfig,PluginClientScope,PluginType,+ PluginType_Type,RegisterClientFormFieldOptions,RegisterClientHookOptions,RegisterClientRouteOptions,RegisterClientSettingsScriptOptions,RegisterClientVideoFieldOptions,ServerConfigPlugin-} from '@shared/models'+} from '@peertube/peertube-models'import { environment } from '../environments/environment'import { ClientScript } from '../types'import { logger } from './logger'@@ -32,7 +33,7 @@ type Hooks = { [ name: string ]: HookStructValue[] }type PluginInfo = {plugin: ServerConfigPluginclientScript: ClientScriptJSON- pluginType: PluginType+ pluginType: PluginType_TypeisTheme: boolean}diff --git a/client/src/root-helpers/video.ts b/client/src/root-helpers/video.tsindex 4a44615fb2..4ee29df130 100644--- a/client/src/root-helpers/video.ts+++ b/client/src/root-helpers/video.ts@@ -1,4 +1,4 @@-import { HTMLServerConfig, Video, VideoPrivacy } from '@shared/models'+import { HTMLServerConfig, Video, VideoPrivacy, VideoPrivacyType } from '@peertube/peertube-models'function buildVideoOrPlaylistEmbed (options: {embedUrl: string@@ -42,13 +42,13 @@ function isP2PEnabled (video: Video, config: HTMLServerConfig, userP2PEnabled: b}function videoRequiresUserAuth (video: Video, videoPassword?: string) {- return new Set([ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL ]).has(video.privacy.id) ||+ return new Set<VideoPrivacyType>([ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL ]).has(video.privacy.id) ||(video.privacy.id === VideoPrivacy.PASSWORD_PROTECTED && !videoPassword)}-function videoRequiresFileToken (video: Video, videoPassword?: string) {- return new Set([ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL, VideoPrivacy.PASSWORD_PROTECTED ]).has(video.privacy.id)+function videoRequiresFileToken (video: Video) {+ return new Set<VideoPrivacyType>([ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL, VideoPrivacy.PASSWORD_PROTECTED ]).has(video.privacy.id)}export {diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.tsindex 78b812ffd8..e4f7230796 100644--- a/client/src/standalone/videos/embed.ts+++ b/client/src/standalone/videos/embed.ts@@ -11,7 +11,7 @@ import {VideoPlaylist,VideoPlaylistElement,VideoState-} from '../../../../shared/models'+} from '@peertube/peertube-models'import { PeerTubePlayer } from '../../assets/player/peertube-player'import { TranslationsManager } from '../../assets/player/translations-manager'import { getParamString, logger, videoRequiresFileToken } from '../../root-helpers'diff --git a/client/src/standalone/videos/shared/auth-http.ts b/client/src/standalone/videos/shared/auth-http.tsindex c1e9f77505..3dfc47b88c 100644--- a/client/src/standalone/videos/shared/auth-http.ts+++ b/client/src/standalone/videos/shared/auth-http.ts@@ -1,4 +1,4 @@-import { HttpStatusCode, OAuth2ErrorCode, UserRefreshToken } from '../../../../../shared/models'+import { HttpStatusCode, OAuth2ErrorCode, OAuth2ErrorCodeType, UserRefreshToken } from '@peertube/peertube-models'import { OAuthUserTokens, objectToUrlEncoded } from '../../../root-helpers'import { peertubeLocalStorage } from '../../../root-helpers/peertube-web-storage'@@ -66,7 +66,7 @@ export class AuthHTTP {if (res.status === HttpStatusCode.UNAUTHORIZED_401) return undefinedreturn res.json()- }).then((obj: UserRefreshToken & { code?: OAuth2ErrorCode }) => {+ }).then((obj: UserRefreshToken & { code?: OAuth2ErrorCodeType }) => {if (!obj || obj.code === OAuth2ErrorCode.INVALID_GRANT) {OAuthUserTokens.flushLocalStorage(peertubeLocalStorage)this.removeTokensFromHeaders()diff --git a/client/src/standalone/videos/shared/live-manager.ts b/client/src/standalone/videos/shared/live-manager.tsindex 5fac229ba8..274f70d9c7 100644--- a/client/src/standalone/videos/shared/live-manager.ts+++ b/client/src/standalone/videos/shared/live-manager.ts@@ -1,5 +1,5 @@import { Socket } from 'socket.io-client'-import { LiveVideoEventPayload, VideoDetails, VideoState } from '../../../../../shared/models'+import { LiveVideoEventPayload, VideoDetails, VideoState, VideoStateType } from '@peertube/peertube-models'import { PlayerHTML } from './player-html'import { Translations } from './translations'@@ -49,7 +49,7 @@ export class LiveManager {}displayInfo (options: {- state: VideoState+ state: VideoStateTypetranslations: Translations}) {const { state, translations } = optionsdiff --git a/client/src/standalone/videos/shared/peertube-plugin.ts b/client/src/standalone/videos/shared/peertube-plugin.tsindex daf6f2b035..95433299ee 100644--- a/client/src/standalone/videos/shared/peertube-plugin.ts+++ b/client/src/standalone/videos/shared/peertube-plugin.ts@@ -1,5 +1,5 @@-import { peertubeTranslate } from '../../../../../shared/core-utils/i18n'-import { HTMLServerConfig, PublicServerSetting } from '../../../../../shared/models'+import { peertubeTranslate } from '@peertube/peertube-core-utils'+import { HTMLServerConfig, PublicServerSetting } from '@peertube/peertube-models'import { PluginInfo, PluginsManager } from '../../../root-helpers'import { RegisterClientHelpers } from '../../../types'import { AuthHTTP } from './auth-http'diff --git a/client/src/standalone/videos/shared/player-html.ts b/client/src/standalone/videos/shared/player-html.tsindex 0defa0d70b..ada2aaaf7d 100644--- a/client/src/standalone/videos/shared/player-html.ts+++ b/client/src/standalone/videos/shared/player-html.ts@@ -1,4 +1,4 @@-import { peertubeTranslate } from '../../../../../shared/core-utils/i18n'+import { peertubeTranslate } from '@peertube/peertube-core-utils'import { logger } from '../../../root-helpers'import { Translations } from './translations'diff --git a/client/src/standalone/videos/shared/player-options-builder.ts b/client/src/standalone/videos/shared/player-options-builder.tsindex 8a4e324440..3437ef4210 100644--- a/client/src/standalone/videos/shared/player-options-builder.ts+++ b/client/src/standalone/videos/shared/player-options-builder.ts@@ -1,4 +1,4 @@-import { peertubeTranslate } from '../../../../../shared/core-utils/i18n'+import { peertubeTranslate } from '@peertube/peertube-core-utils'import {HTMLServerConfig,LiveVideo,@@ -9,7 +9,7 @@ import {VideoPlaylistElement,VideoState,VideoStreamingPlaylistType-} from '../../../../../shared/models'+} from '@peertube/peertube-models'import { HLSOptions, PeerTubePlayerContructorOptions, PeerTubePlayerLoadOptions, PlayerMode, VideoJSCaption } from '../../../assets/player'import {getBoolOrDefault,diff --git a/client/src/standalone/videos/shared/playlist-fetcher.ts b/client/src/standalone/videos/shared/playlist-fetcher.tsindex 713d82e3af..db38e3d6c9 100644--- a/client/src/standalone/videos/shared/playlist-fetcher.ts+++ b/client/src/standalone/videos/shared/playlist-fetcher.ts@@ -1,4 +1,4 @@-import { HttpStatusCode, ResultList, VideoPlaylistElement } from '../../../../../shared/models'+import { HttpStatusCode, ResultList, VideoPlaylistElement } from '@peertube/peertube-models'import { logger } from '../../../root-helpers'import { AuthHTTP } from './auth-http'diff --git a/client/src/standalone/videos/shared/playlist-tracker.ts b/client/src/standalone/videos/shared/playlist-tracker.tsindex d8708826d1..dc9a084b7a 100644--- a/client/src/standalone/videos/shared/playlist-tracker.ts+++ b/client/src/standalone/videos/shared/playlist-tracker.ts@@ -1,4 +1,4 @@-import { VideoPlaylist, VideoPlaylistElement } from '../../../../../shared/models'+import { VideoPlaylist, VideoPlaylistElement } from '@peertube/peertube-models'import { logger } from '../../../root-helpers'export class PlaylistTracker {diff --git a/client/src/standalone/videos/shared/video-fetcher.ts b/client/src/standalone/videos/shared/video-fetcher.tsindex 7fb94fbf39..9149d946eb 100644--- a/client/src/standalone/videos/shared/video-fetcher.ts+++ b/client/src/standalone/videos/shared/video-fetcher.ts@@ -1,4 +1,4 @@-import { HttpStatusCode, LiveVideo, VideoDetails, VideoToken } from '../../../../../shared/models'+import { HttpStatusCode, LiveVideo, VideoDetails, VideoToken } from '@peertube/peertube-models'import { logger } from '../../../root-helpers'import { PeerTubeServerError } from '../../../types'import { AuthHTTP } from './auth-http'diff --git a/client/src/types/job-state-client.type.ts b/client/src/types/job-state-client.type.tsindex 6123678dff..6697539a37 100644--- a/client/src/types/job-state-client.type.ts+++ b/client/src/types/job-state-client.type.ts@@ -1,3 +1,3 @@-import { JobState } from '@shared/models'+import { JobState } from '@peertube/peertube-models'export type JobStateClient = JobStatediff --git a/client/src/types/job-type-client.type.ts b/client/src/types/job-type-client.type.tsindex 7d51f1db27..9308090811 100644--- a/client/src/types/job-type-client.type.ts+++ b/client/src/types/job-type-client.type.ts@@ -1,3 +1,3 @@-import { JobType } from '@shared/models'+import { JobType } from '@peertube/peertube-models'export type JobTypeClient = 'all' | JobTypediff --git a/client/src/types/register-client-option.model.ts b/client/src/types/register-client-option.model.tsindex 2c09f15a7c..2336119bbd 100644--- a/client/src/types/register-client-option.model.ts+++ b/client/src/types/register-client-option.model.ts@@ -5,7 +5,7 @@ import {RegisterClientSettingsScriptOptions,RegisterClientVideoFieldOptions,ServerConfig, SettingEntries-} from '@shared/models'+} from '@peertube/peertube-models'export type RegisterClientOptions = {registerHook: (options: RegisterClientHookOptions) => voiddiff --git a/client/src/types/server-error.model.ts b/client/src/types/server-error.model.tsindex 4a57287fe9..096deb50b1 100644--- a/client/src/types/server-error.model.ts+++ b/client/src/types/server-error.model.ts@@ -1,9 +1,9 @@-import { ServerErrorCode } from '@shared/models/index'+import { ServerErrorCodeType } from '@peertube/peertube-models'export class PeerTubeServerError extends Error {- serverCode: ServerErrorCode+ serverCode: ServerErrorCodeType- constructor (message: string, serverCode: ServerErrorCode) {+ constructor (message: string, serverCode: ServerErrorCodeType) {super(message)this.name = 'CustomError'this.serverCode = serverCodediff --git a/client/tsconfig.eslint.json b/client/tsconfig.eslint.jsonindex a18c461fe5..91bb53e1d2 100644--- a/client/tsconfig.eslint.json+++ b/client/tsconfig.eslint.json@@ -4,5 +4,10 @@// adjust "includes" to what makes sense for you and your project"src/**/*.ts","e2e/**/*.ts"+ ],+ "references": [+ { "path": "../packages/core-utils" },+ { "path": "../packages/models" },+ { "path": "../packages/typescript-utils" }]}diff --git a/client/tsconfig.json b/client/tsconfig.jsonindex 5dee39362f..48c2ff7f7a 100644--- a/client/tsconfig.json+++ b/client/tsconfig.json@@ -11,6 +11,7 @@"noImplicitAny": true,"noImplicitThis": true,"alwaysStrict": true,+ "allowJs": true,"importHelpers": true,"allowSyntheticDefaultImports": true,"strictBindCallApply": true,@@ -37,24 +38,6 @@"@app/*": ["src/app/*"],- "@shared/models/*": [- "../shared/models/*"- ],- "@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/*"],@@ -70,6 +53,11 @@},"useDefineForClassFields": false},+ "references": [+ { "path": "../packages/core-utils" },+ { "path": "../packages/models" },+ { "path": "../packages/typescript-utils" }+ ],"files": ["src/polyfills.ts"],@@ -78,10 +66,6 @@"src/**/*.d.ts","src/shims/*.ts"],- "exclude": [- "../node_modules",- "../server"- ],"angularCompilerOptions": {"strictInjectionParameters": true,"fullTemplateTypeCheck": true,diff --git a/client/tsconfig.types.json b/client/tsconfig.types.jsonindex 99d96d4138..1481bc9b9e 100644--- a/client/tsconfig.types.json+++ b/client/tsconfig.types.json@@ -4,15 +4,12 @@"stripInternal": true,"removeComments": false,"declaration": true,- "outDir": "../packages/types/dist/client/",+ "outDir": "../packages/types-generator/dist/client/","emitDeclarationOnly": true,"composite": true,"rootDir": "src/",- "tsBuildInfoFile": "../packages/types/dist/tsconfig.client.tsbuildinfo"+ "tsBuildInfoFile": "../packages/types-generator/dist/tsconfig.client.tsbuildinfo"},- "references": [- { "path": "../shared/tsconfig.types.json" }- ],"files": [ "src/types/index.ts" ],"include": ["src/types/**/*"diff --git a/client/webpack/webpack.video-embed.js b/client/webpack/webpack.video-embed.jsindex 47d440c25e..30a8ec27c1 100644--- a/client/webpack/webpack.video-embed.js+++ b/client/webpack/webpack.video-embed.js@@ -29,9 +29,7 @@ module.exports = function () {alias: {'video.js$': path.resolve('node_modules/video.js/core.js'),'hls.js$': path.resolve('node_modules/hls.js/dist/hls.light.js'),- '@root-helpers': path.resolve('src/root-helpers'),- '@shared/models': path.resolve('../shared/models'),- '@shared/core-utils': path.resolve('../shared/core-utils')+ '@root-helpers': path.resolve('src/root-helpers')},fallback: {diff --git a/client/yarn.lock b/client/yarn.lockindex 5c9f4bf425..cc0bd23a67 100644--- a/client/yarn.lock+++ b/client/yarn.lock@@ -1353,6 +1353,13 @@"@babel/helper-validator-identifier" "^7.19.1"to-fast-properties "^2.0.0"+"@cspotcode/source-map-support@^0.8.0":+ version "0.8.1"+ resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1"+ integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==+ dependencies:+ "@jridgewell/trace-mapping" "0.3.9"+"@csstools/css-parser-algorithms@^2.1.1":version "2.1.1"resolved "https://registry.yarnpkg.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.1.1.tgz#7b62e6412a468a2d1096ed267edd1e4a7fd4a119"@@ -1818,6 +1825,11 @@resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==+"@jridgewell/resolve-uri@^3.0.3":+ version "3.1.1"+ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721"+ integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==+"@jridgewell/set-array@^1.0.1":version "1.1.2"resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"@@ -1841,6 +1853,14 @@resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==+"@jridgewell/[email protected]":+ version "0.3.9"+ resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9"+ integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==+ dependencies:+ "@jridgewell/resolve-uri" "^3.0.3"+ "@jridgewell/sourcemap-codec" "^1.4.10"+"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9":version "0.3.18"resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6"@@ -2204,6 +2224,26 @@resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf"integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==+"@tsconfig/node10@^1.0.7":+ version "1.0.9"+ resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2"+ integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==++"@tsconfig/node12@^1.0.7":+ version "1.0.11"+ resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d"+ integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==++"@tsconfig/node14@^1.0.0":+ version "1.0.3"+ resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1"+ integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==++"@tsconfig/node16@^1.0.2":+ version "1.0.4"+ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9"+ integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==+"@tufjs/[email protected]":version "1.0.0"resolved "https://registry.yarnpkg.com/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz#eade9fd1f537993bc1f0949f3aea276ecc4fab31"@@ -3140,7 +3180,7 @@ acorn-jsx@^5.3.2:resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==-acorn-walk@^8.0.0:+acorn-walk@^8.0.0, acorn-walk@^8.1.1:version "8.2.0"resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==@@ -3150,6 +3190,11 @@ acorn@^8.0.4, acorn@^8.5.0, acorn@^8.7.1, acorn@^8.8.0:resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a"integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==+acorn@^8.4.1:+ version "8.10.0"+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5"+ integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==+addr-to-ip-port@^1.0.1:version "1.5.4"resolved "https://registry.yarnpkg.com/addr-to-ip-port/-/addr-to-ip-port-1.5.4.tgz#9542b1c6219fdb8c9ce6cc72c14ee880ab7ddd88"@@ -3392,6 +3437,11 @@ are-we-there-yet@^3.0.0:delegates "^1.0.0"readable-stream "^3.6.0"+arg@^4.1.0:+ version "4.1.3"+ resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"+ integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==+argparse@^1.0.7:version "1.0.10"resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"@@ -3512,7 +3562,7 @@ available-typed-arrays@^1.0.5:resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7"integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==-axios@^1.0.0, axios@^1.2.1:+axios@^1.0.0, axios@^1.4.0:version "1.4.0"resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f"integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==@@ -4088,14 +4138,14 @@ chrome-trace-event@^1.0.2:resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac"integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==-chromedriver@^113.0.0:- version "113.0.0"- resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-113.0.0.tgz#d4855f156ee51cea4282e04aadd29fa154e44dbb"- integrity sha512-UnQlt2kPicYXVNHPzy9HfcWvEbKJjjKAEaatdcnP/lCIRwuSoZFVLH0HVDAGdbraXp3dNVhfE2Qx7gw8TnHnPw==+chromedriver@^115.0.1:+ version "115.0.1"+ resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-115.0.1.tgz#76cbf35f16e0c1f5e29ab821fb3b8b06d22c3e40"+ integrity sha512-faE6WvIhXfhnoZ3nAxUXYzeDCKy612oPwpkUp0mVkA7fZPg2JHSUiYOQhUYgzHQgGvDWD5Fy2+M2xV55GKHBVQ==dependencies:"@testim/chrome-version" "^1.1.3"- axios "^1.2.1"- compare-versions "^5.0.1"+ axios "^1.4.0"+ compare-versions "^6.0.0"extract-zip "^2.0.1"https-proxy-agent "^5.0.1"proxy-from-env "^1.1.0"@@ -4307,10 +4357,10 @@ compact2string@^1.4.1:dependencies:ipaddr.js ">= 0.1.5"-compare-versions@^5.0.1:- version "5.0.3"- resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-5.0.3.tgz#a9b34fea217472650ef4a2651d905f42c28ebfd7"- integrity sha512-4UZlZP8Z99MGEY+Ovg/uJxJuvoXuN4M6B3hKaiackiHrgzQFEe3diJi1mf1PNHbFujM7FvLrK2bpgIaImbtZ1A==+compare-versions@^6.0.0:+ version "6.1.0"+ resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-6.1.0.tgz#3f2131e3ae93577df111dba133e6db876ffe127a"+ integrity sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg==compress-commons@^4.1.0:version "4.1.1"@@ -4453,6 +4503,11 @@ crc32-stream@^4.0.2:crc-32 "^1.2.0"readable-stream "^3.4.0"+create-require@^1.1.0:+ version "1.1.1"+ resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"+ integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==+version "0.0.16"resolved "https://registry.yarnpkg.com/critters/-/critters-0.0.16.tgz#ffa2c5561a65b43c53b940036237ce72dcebfe93"@@ -4799,6 +4854,11 @@ [email protected]:resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b"integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==+diff@^4.0.1:+ version "4.0.2"+ resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"+ integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==+diff@^5.0.0:version "5.1.0"resolved "https://registry.yarnpkg.com/diff/-/diff-5.1.0.tgz#bc52d298c5ea8df9194800224445ed43ffc87e40"@@ -7694,6 +7754,11 @@ make-dir@^3.0.2:dependencies:semver "^6.0.0"+make-error@^1.1.1:+ version "1.3.6"+ resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"+ integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==+make-fetch-happen@^10.0.3:version "10.2.1"resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz#f5e3835c5e9817b617f2770870d9492d28678164"@@ -10802,6 +10867,25 @@ ts-loader@^9.3.0:micromatch "^4.0.0"semver "^7.3.4"+ts-node@^10.9.1:+ version "10.9.1"+ resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"+ integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==+ dependencies:+ "@cspotcode/source-map-support" "^0.8.0"+ "@tsconfig/node10" "^1.0.7"+ "@tsconfig/node12" "^1.0.7"+ "@tsconfig/node14" "^1.0.0"+ "@tsconfig/node16" "^1.0.2"+ acorn "^8.4.1"+ acorn-walk "^8.1.1"+ arg "^4.1.0"+ create-require "^1.1.0"+ diff "^4.0.1"+ make-error "^1.1.1"+ v8-compile-cache-lib "^3.0.1"+ yn "3.1.1"+tsconfig-paths@^3.14.1:version "3.14.2"resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088"@@ -11096,6 +11180,11 @@ uuid@^9.0.0:resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==+v8-compile-cache-lib@^3.0.1:+ version "3.0.1"+ resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"+ integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==+[email protected], v8-compile-cache@^2.3.0:version "2.3.0"resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"@@ -11792,6 +11881,11 @@ yauzl@^2.10.0:buffer-crc32 "~0.2.3"fd-slicer "~1.1.0"+ version "3.1.1"+ resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"+ integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==+yocto-queue@^0.1.0:version "0.1.0"resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"diff --git a/config/default.yaml b/config/default.yamlindex 9d217b56bf..fcd634d1db 100644--- a/config/default.yaml+++ b/config/default.yaml@@ -261,6 +261,7 @@ open_telemetry:port: 9091tracing:+ # If tracing is enabled, you must provide --experimental-loader=@opentelemetry/instrumentation/hook.mjs flag to the node binaryenabled: false# Send traces to a Jaeger compatible endpointdiff --git a/config/production.yaml.example b/config/production.yaml.exampleindex 2afc5f982d..2ec7c3fca5 100644--- a/config/production.yaml.example+++ b/config/production.yaml.example@@ -259,6 +259,7 @@ open_telemetry:port: 9091tracing:+ # If tracing is enabled, you must provide --experimental-loader=@opentelemetry/instrumentation/hook.mjs flag to the node binaryenabled: false# Send traces to a Jaeger compatible endpointdiff --git a/package.json b/package.jsonindex 7573232a1c..89f8fd4ed7 100644--- a/package.json+++ b/package.json@@ -8,9 +8,7 @@"node": ">=16.x","yarn": ">=1.x"},- "bin": {- "peertube": "dist/server/tools/peertube.js"- },+ "type": "module","author": {"name": "Chocobozzz","email": "[email protected]",@@ -21,49 +19,60 @@"url": "git+https://github.com/Chocobozzz/PeerTube.git"},"typings": "*.d.ts",+ "workspaces": [+ "packages/*",+ "server"+ ],"scripts": {"e2e:browserstack": "bash ./scripts/e2e/browserstack.sh","e2e:local": "bash ./scripts/e2e/local.sh",- "setup:cli": "bash ./scripts/setup/cli.sh","build": "bash ./scripts/build/index.sh","build:embed": "bash ./scripts/build/embed.sh","build:server": "bash ./scripts/build/server.sh","build:client": "bash ./scripts/build/client.sh","build:peertube-runner": "bash ./scripts/build/peertube-runner.sh",+ "build:peertube-cli": "bash ./scripts/build/peertube-cli.sh",+ "build:tests": "bash ./scripts/build/tests.sh","clean:client": "bash ./scripts/clean/client/index.sh","clean:server:test": "bash ./scripts/clean/server/test.sh","i18n:update": "bash ./scripts/i18n/update.sh",- "plugin:install": "node ./dist/scripts/plugin/install.js",- "plugin:uninstall": "node ./dist/scripts/plugin/uninstall.js",- "i18n:create-custom-files": "node ./dist/scripts/i18n/create-custom-files.js",- "reset-password": "node ./dist/scripts/reset-password.js","dev": "bash ./scripts/dev/index.sh","dev:server": "bash ./scripts/dev/server.sh","dev:embed": "bash ./scripts/dev/embed.sh","dev:client": "bash ./scripts/dev/client.sh",- "dev:cli": "bash ./scripts/dev/cli.sh",+ "dev:peertube-cli": "bash ./scripts/dev/peertube-cli.sh","dev:peertube-runner": "bash ./scripts/dev/peertube-runner.sh","start": "node dist/server","start:server": "node dist/server --no-client",+ "plugin:install": "node ./dist/scripts/plugin/install.js",+ "plugin:uninstall": "node ./dist/scripts/plugin/uninstall.js",+ "reset-password": "node ./dist/scripts/reset-password.js","update-host": "node ./dist/scripts/update-host.js","regenerate-thumbnails": "node ./dist/scripts/regenerate-thumbnails.js","create-import-video-file-job": "node ./dist/scripts/create-import-video-file-job.js","create-move-video-storage-job": "node ./dist/scripts/create-move-video-storage-job.js","create-generate-storyboard-job": "node ./dist/scripts/create-generate-storyboard-job.js",- "test": "bash ./scripts/test.sh",- "generate-cli-doc": "bash ./scripts/generate-cli-doc.sh",- "generate-types-package": "ts-node ./packages/types/generate-package.ts","parse-log": "node ./dist/scripts/parse-log.js","prune-storage": "node ./dist/scripts/prune-storage.js",+ "test": "bash ./scripts/test.sh",+ "generate-cli-doc": "bash ./scripts/generate-cli-doc.sh",+ "generate-types-package": "tsx --conditions=peertube:tsx ./packages/types-generator/generate-package.ts",+ "i18n:create-custom-files": "tsx --conditions=peertube:tsx ./scripts/i18n/create-custom-files.ts",+ "benchmark-server": "tsx --conditions=peertube:tsx ./scripts/benchmark.ts",+ "client:build-stats": "tsx --conditions=peertube:tsx ./scripts/client-build-stats.ts",+ "generate-code-contributors": "tsx --conditions=peertube:tsx ./scripts/generate-code-contributors.ts",+ "simulate-many-viewers": "tsx --conditions=peertube:tsx ./scripts/simulate-many-viewers.ts","postinstall": "test -n \"$NOCLIENT\" || (cd client && yarn install --pure-lockfile)","tsc": "tsc","commander": "commander","lint": "npm run ci -- lint","ng": "ng",- "ts-node": "ts-node",+ "tsx": "tsx","eslint": "eslint","resolve-tspaths": "resolve-tspaths",- "resolve-tspaths:server": "npm run resolve-tspaths -- --project tsconfig.json --src . --out dist",+ "resolve-tspaths:server": "npm run resolve-tspaths -- --project server/tsconfig.json --src server --out dist",+ "resolve-tspaths:server-lib": "npm run resolve-tspaths -- --project server/tsconfig.lib.json --src server --out server/dist",+ "resolve-tspaths:tests": "npm run resolve-tspaths -- --project packages/tests/tsconfig.json --src packages/tests/src --out packages/tests/dist","concurrently": "concurrently","mocha": "mocha","ci": "bash ./scripts/ci.sh",@@ -80,29 +89,30 @@"@aws-sdk/node-http-handler": "^3.190.0","@aws-sdk/s3-request-presigner": "^3.345.0","@babel/parser": "^7.17.8",+ "@commander-js/extra-typings": "^11.0.0","@node-oauth/oauth2-server": "^4.2.0","@opentelemetry/api": "^1.1.0",- "@opentelemetry/exporter-jaeger": "^1.3.1",- "@opentelemetry/exporter-prometheus": "~0.39.1",- "@opentelemetry/instrumentation": "^0.39.1",- "@opentelemetry/instrumentation-dns": "^0.31.2",- "@opentelemetry/instrumentation-express": "^0.32.1",- "@opentelemetry/instrumentation-fs": "^0.7.0",- "@opentelemetry/instrumentation-http": "^0.39.1",- "@opentelemetry/instrumentation-ioredis": "^0.34.2",- "@opentelemetry/instrumentation-pg": "^0.35.2",- "@opentelemetry/resources": "^1.3.1",- "@opentelemetry/sdk-metrics": "^1.8.0",- "@opentelemetry/sdk-trace-base": "^1.3.1",- "@opentelemetry/sdk-trace-node": "^1.3.1",- "@opentelemetry/semantic-conventions": "^1.3.1",+ "@opentelemetry/exporter-jaeger": "^1.15.1",+ "@opentelemetry/exporter-prometheus": "~0.41.1",+ "@opentelemetry/instrumentation": "^0.41.1",+ "@opentelemetry/instrumentation-dns": "^0.32.0",+ "@opentelemetry/instrumentation-express": "^0.33.0",+ "@opentelemetry/instrumentation-fs": "^0.8.0",+ "@opentelemetry/instrumentation-http": "^0.41.1",+ "@opentelemetry/instrumentation-ioredis": "^0.35.0",+ "@opentelemetry/instrumentation-pg": "^0.36.0",+ "@opentelemetry/resources": "^1.15.1",+ "@opentelemetry/sdk-metrics": "^1.15.1",+ "@opentelemetry/sdk-trace-base": "^1.15.1",+ "@opentelemetry/sdk-trace-node": "^1.15.1",+ "@opentelemetry/semantic-conventions": "^1.15.1","@peertube/feed": "^5.1.0","@peertube/http-signature": "^1.7.0","@uploadx/core": "^6.0.0","async-lru": "^1.1.1","async-mutex": "^0.4.0","bcrypt": "5.1.0",- "bencode": "^2.0.2",+ "bencode": "^3.1.1","bittorrent-tracker": "^9","bluebird": "^3.5.0","bullmq": "^3.6.6",@@ -122,7 +132,7 @@"flat": "^5.0.0","fluent-ffmpeg": "^2.1.0","fs-extra": "^11.1.0",- "got": "^11.8.2",+ "got": "^13.0.0","helmet": "^7.0.0","hpagent": "^1.0.0","http-problem-details": "^0.1.5",@@ -130,11 +140,11 @@"ip-anonymize": "^0.1.0","ipaddr.js": "2.0.1","is-cidr": "^4.0.0",- "iso-639-3": "2.2.0",+ "iso-639-3": "3.0.1","jimp": "^0.22.4","js-yaml": "^4.0.0","jsonld": "~8.2.0",- "lodash": "^4.17.21",+ "lodash-es": "^4.17.21","lru-cache": "^9.1.1","magnet-uri": "^6","markdown-it": "^13.0.1",@@ -145,9 +155,9 @@"multer": "^1.4.5-lts.1","node-media-server": "^2.1.4","nodemailer": "^6.0.0",- "opentelemetry-instrumentation-sequelize": "^0.35.0",+ "opentelemetry-instrumentation-sequelize": "^0.39.1","otpauth": "^9.0.2",- "p-queue": "^6",+ "p-queue": "^7.3.4","parse-torrent": "^9","password-generator": "^2.0.2","pg": "^8.2.1",@@ -164,7 +174,6 @@"socket.io": "^4.5.4","sql-formatter": "^12.0.1","srt-to-vtt": "^1.1.2",- "tsconfig-paths": "^4.0.0","tslib": "^2.0.0","useragent": "^2.3.0","validator": "^13.0.0",@@ -175,6 +184,7 @@},"devDependencies": {"@peertube/maildev": "^1.2.0",+ "@peertube/resolve-tspaths": "^0.8.14","@types/bcrypt": "^5.0.0","@types/bencode": "^2.0.0","@types/bluebird": "^3.5.33",@@ -188,7 +198,8 @@"@types/express": "4.17.9","@types/fluent-ffmpeg": "^2.1.16","@types/fs-extra": "^11.0.1",- "@types/lodash": "^4.14.64",+ "@types/jsonld": "^1.5.9",+ "@types/lodash-es": "^4.17.8","@types/magnet-uri": "^5.1.1","@types/maildev": "^0.0.4","@types/memoizee": "^0.4.2",@@ -200,7 +211,7 @@"@types/oauth2-server": "^3.0.8","@types/request": "^2.0.3","@types/supertest": "^2.0.3",- "@types/validator": "^13.0.0",+ "@types/validator": "^13.9.0","@types/webtorrent": "^0.109.0","@types/ws": "^8.2.0","@typescript-eslint/eslint-plugin": "^5.0.0",@@ -210,6 +221,7 @@"chai-xml": "^0.4.0","concurrently": "^8.0.1","depcheck": "^1.4.2",+ "esbuild": "^0.19.0","eslint": "8.41.0","eslint-config-standard-with-typescript": "34.0.1","eslint-plugin-import": "^2.20.1",@@ -222,12 +234,11 @@"pixelmatch": "^5.3.0","pngjs": "^7.0.0","proxy": "^2.1.1",- "resolve-tspaths": "^0.8.8","socket.io-client": "^4.5.4","supertest": "^6.0.1","swagger-cli": "^4.0.2",- "ts-node": "^10.8.1","tsc-watch": "^6.0.0",+ "tsx": "^3.12.7","typescript": "~5.0.4"},"bundlewatch": {diff --git a/packages/core-utils/package.json b/packages/core-utils/package.jsonnew file mode 100644index 0000000000..d3bf183354--- /dev/null+++ b/packages/core-utils/package.json@@ -0,0 +1,19 @@+{+ "name": "@peertube/peertube-core-utils",+ "private": true,+ "version": "0.0.0",+ "main": "dist/index.js",+ "files": [ "dist" ],+ "exports": {+ "types": "./dist/index.d.ts",+ "peertube:tsx": "./src/index.ts",+ "default": "./dist/index.js"+ },+ "type": "module",+ "devDependencies": {},+ "scripts": {+ "build": "tsc",+ "watch": "tsc -w"+ },+ "dependencies": {}+}diff --git a/shared/core-utils/abuse/abuse-predefined-reasons.ts b/packages/core-utils/src/abuse/abuse-predefined-reasons.tssimilarity index 69%rename from shared/core-utils/abuse/abuse-predefined-reasons.tsrename to packages/core-utils/src/abuse/abuse-predefined-reasons.tsindex 9967e54dd1..68534a1e01 100644--- a/shared/core-utils/abuse/abuse-predefined-reasons.ts+++ b/packages/core-utils/src/abuse/abuse-predefined-reasons.ts@@ -1,7 +1,7 @@-import { AbusePredefinedReasons, AbusePredefinedReasonsString } from '../../models/moderation/abuse/abuse-reason.model'+import { AbusePredefinedReasons, AbusePredefinedReasonsString, AbusePredefinedReasonsType } from '@peertube/peertube-models'export const abusePredefinedReasonsMap: {- [key in AbusePredefinedReasonsString]: AbusePredefinedReasons+ [key in AbusePredefinedReasonsString]: AbusePredefinedReasonsType} = {violentOrRepulsive: AbusePredefinedReasons.VIOLENT_OR_REPULSIVE,hatefulOrAbusive: AbusePredefinedReasons.HATEFUL_OR_ABUSIVE,@@ -11,4 +11,4 @@ export const abusePredefinedReasonsMap: {serverRules: AbusePredefinedReasons.SERVER_RULES,thumbnails: AbusePredefinedReasons.THUMBNAILS,captions: AbusePredefinedReasons.CAPTIONS-}+} as constdiff --git a/packages/core-utils/src/abuse/index.ts b/packages/core-utils/src/abuse/index.tsnew file mode 100644index 0000000000..b79b861556--- /dev/null+++ b/packages/core-utils/src/abuse/index.ts@@ -0,0 +1 @@+export * from './abuse-predefined-reasons.js'diff --git a/shared/core-utils/common/array.ts b/packages/core-utils/src/common/array.tssimilarity index 100%rename from shared/core-utils/common/array.tsrename to packages/core-utils/src/common/array.tsdiff --git a/shared/core-utils/common/date.ts b/packages/core-utils/src/common/date.tssimilarity index 100%rename from shared/core-utils/common/date.tsrename to packages/core-utils/src/common/date.tsdiff --git a/packages/core-utils/src/common/index.ts b/packages/core-utils/src/common/index.tsnew file mode 100644index 0000000000..d7d8599aae--- /dev/null+++ b/packages/core-utils/src/common/index.ts@@ -0,0 +1,10 @@+export * from './array.js'+export * from './random.js'+export * from './date.js'+export * from './number.js'+export * from './object.js'+export * from './regexp.js'+export * from './time.js'+export * from './promises.js'+export * from './url.js'+export * from './version.js'diff --git a/shared/core-utils/common/number.ts b/packages/core-utils/src/common/number.tssimilarity index 100%rename from shared/core-utils/common/number.tsrename to packages/core-utils/src/common/number.tsdiff --git a/shared/core-utils/common/object.ts b/packages/core-utils/src/common/object.tssimilarity index 100%rename from shared/core-utils/common/object.tsrename to packages/core-utils/src/common/object.tsdiff --git a/shared/core-utils/common/promises.ts b/packages/core-utils/src/common/promises.tssimilarity index 100%rename from shared/core-utils/common/promises.tsrename to packages/core-utils/src/common/promises.tsdiff --git a/shared/core-utils/common/random.ts b/packages/core-utils/src/common/random.tssimilarity index 100%rename from shared/core-utils/common/random.tsrename to packages/core-utils/src/common/random.tsdiff --git a/shared/core-utils/common/regexp.ts b/packages/core-utils/src/common/regexp.tssimilarity index 100%rename from shared/core-utils/common/regexp.tsrename to packages/core-utils/src/common/regexp.tsdiff --git a/shared/core-utils/common/time.ts b/packages/core-utils/src/common/time.tssimilarity index 100%rename from shared/core-utils/common/time.tsrename to packages/core-utils/src/common/time.tsdiff --git a/shared/core-utils/common/url.ts b/packages/core-utils/src/common/url.tssimilarity index 97%rename from shared/core-utils/common/url.tsrename to packages/core-utils/src/common/url.tsindex 33fc5ee3a8..449b6c9dc5 100644--- a/shared/core-utils/common/url.ts+++ b/packages/core-utils/src/common/url.ts@@ -1,5 +1,5 @@-import { Video, VideoPlaylist } from '../../models'-import { secondsToTime } from './date'+import { Video, VideoPlaylist } from '@peertube/peertube-models'+import { secondsToTime } from './date.js'function addQueryParams (url: string, params: { [ id: string ]: string }) {const objUrl = new URL(url)diff --git a/shared/core-utils/common/version.ts b/packages/core-utils/src/common/version.tssimilarity index 100%rename from shared/core-utils/common/version.tsrename to packages/core-utils/src/common/version.tsdiff --git a/shared/core-utils/i18n/i18n.ts b/packages/core-utils/src/i18n/i18n.tssimilarity index 100%rename from shared/core-utils/i18n/i18n.tsrename to packages/core-utils/src/i18n/i18n.tsdiff --git a/packages/core-utils/src/i18n/index.ts b/packages/core-utils/src/i18n/index.tsnew file mode 100644index 0000000000..758e54b731--- /dev/null+++ b/packages/core-utils/src/i18n/index.ts@@ -0,0 +1 @@+export * from './i18n.js'diff --git a/packages/core-utils/src/index.ts b/packages/core-utils/src/index.tsnew file mode 100644index 0000000000..3ca5d9d476--- /dev/null+++ b/packages/core-utils/src/index.ts@@ -0,0 +1,7 @@+export * from './abuse/index.js'+export * from './common/index.js'+export * from './i18n/index.js'+export * from './plugins/index.js'+export * from './renderer/index.js'+export * from './users/index.js'+export * from './videos/index.js'diff --git a/shared/core-utils/plugins/hooks.ts b/packages/core-utils/src/plugins/hooks.tssimilarity index 85%rename from shared/core-utils/plugins/hooks.tsrename to packages/core-utils/src/plugins/hooks.tsindex 96bcc945e8..fe7c4a74fd 100644--- a/shared/core-utils/plugins/hooks.ts+++ b/packages/core-utils/src/plugins/hooks.ts@@ -1,6 +1,5 @@-import { RegisteredExternalAuthConfig } from '@shared/models'-import { HookType } from '../../models/plugins/hook-type.enum'-import { isCatchable, isPromise } from '../common/promises'+import { HookType, HookType_Type, RegisteredExternalAuthConfig } from '@peertube/peertube-models'+import { isCatchable, isPromise } from '../common/promises.js'function getHookType (hookName: string) {if (hookName.startsWith('filter:')) return HookType.FILTER@@ -11,7 +10,7 @@ function getHookType (hookName: string) {async function internalRunHook <T> (options: {handler: Function- hookType: HookType+ hookType: HookType_Typeresult: Tparams: anyonError: (err: Error) => voiddiff --git a/packages/core-utils/src/plugins/index.ts b/packages/core-utils/src/plugins/index.tsnew file mode 100644index 0000000000..3462bf41e8--- /dev/null+++ b/packages/core-utils/src/plugins/index.ts@@ -0,0 +1 @@+export * from './hooks.js'diff --git a/shared/core-utils/renderer/html.ts b/packages/core-utils/src/renderer/html.tssimilarity index 100%rename from shared/core-utils/renderer/html.tsrename to packages/core-utils/src/renderer/html.tsdiff --git a/packages/core-utils/src/renderer/index.ts b/packages/core-utils/src/renderer/index.tsnew file mode 100644index 0000000000..0dd0a88085--- /dev/null+++ b/packages/core-utils/src/renderer/index.ts@@ -0,0 +1,2 @@+export * from './markdown.js'+export * from './html.js'diff --git a/shared/core-utils/renderer/markdown.ts b/packages/core-utils/src/renderer/markdown.tssimilarity index 100%rename from shared/core-utils/renderer/markdown.tsrename to packages/core-utils/src/renderer/markdown.tsdiff --git a/packages/core-utils/src/users/index.ts b/packages/core-utils/src/users/index.tsnew file mode 100644index 0000000000..3fd9dc448d--- /dev/null+++ b/packages/core-utils/src/users/index.ts@@ -0,0 +1 @@+export * from './user-role.js'diff --git a/shared/core-utils/users/user-role.ts b/packages/core-utils/src/users/user-role.tssimilarity index 71%rename from shared/core-utils/users/user-role.tsrename to packages/core-utils/src/users/user-role.tsindex 5f3b9a10f1..0add3a0a8c 100644--- a/shared/core-utils/users/user-role.ts+++ b/packages/core-utils/src/users/user-role.ts@@ -1,12 +1,12 @@-import { UserRight, UserRole } from '../../models/users'+import { UserRight, UserRightType, UserRole, UserRoleType } from '@peertube/peertube-models'-export const USER_ROLE_LABELS: { [ id in UserRole ]: string } = {+export const USER_ROLE_LABELS: { [ id in UserRoleType ]: string } = {[UserRole.USER]: 'User',[UserRole.MODERATOR]: 'Moderator',[UserRole.ADMINISTRATOR]: 'Administrator'}-const userRoleRights: { [ id in UserRole ]: UserRight[] } = {+const userRoleRights: { [ id in UserRoleType ]: UserRightType[] } = {[UserRole.ADMINISTRATOR]: [UserRight.ALL],@@ -30,7 +30,7 @@ const userRoleRights: { [ id in UserRole ]: UserRight[] } = {[UserRole.USER]: []}-export function hasUserRight (userRole: UserRole, userRight: UserRight) {+export function hasUserRight (userRole: UserRoleType, userRight: UserRightType) {const userRights = userRoleRights[userRole]return userRights.includes(UserRight.ALL) || userRights.includes(userRight)diff --git a/shared/core-utils/videos/bitrate.ts b/packages/core-utils/src/videos/bitrate.tssimilarity index 92%rename from shared/core-utils/videos/bitrate.tsrename to packages/core-utils/src/videos/bitrate.tsindex 6be0278267..b28eaf4600 100644--- a/shared/core-utils/videos/bitrate.ts+++ b/packages/core-utils/src/videos/bitrate.ts@@ -1,6 +1,6 @@-import { VideoResolution } from '@shared/models'+import { VideoResolution, VideoResolutionType } from '@peertube/peertube-models'-type BitPerPixel = { [ id in VideoResolution ]: number }+type BitPerPixel = { [ id in VideoResolutionType ]: number }// https://bitmovin.com/video-bitrate-streaming-hls-dash/@@ -41,7 +41,7 @@ const maxBitPerPixel: BitPerPixel = {}function getAverageTheoreticalBitrate (options: {- resolution: VideoResolution+ resolution: numberratio: numberfps: number}) {@@ -52,7 +52,7 @@ function getAverageTheoreticalBitrate (options: {}function getMaxTheoreticalBitrate (options: {- resolution: VideoResolution+ resolution: numberratio: numberfps: number}) {@@ -63,7 +63,7 @@ function getMaxTheoreticalBitrate (options: {}function getMinTheoreticalBitrate (options: {- resolution: VideoResolution+ resolution: numberratio: numberfps: number}) {@@ -85,7 +85,7 @@ export {function calculateBitrate (options: {bitPerPixel: BitPerPixel- resolution: VideoResolution+ resolution: numberratio: numberfps: number}) {diff --git a/shared/core-utils/videos/common.ts b/packages/core-utils/src/videos/common.tssimilarity index 75%rename from shared/core-utils/videos/common.tsrename to packages/core-utils/src/videos/common.tsindex 0431edaaf4..47564fb2ab 100644--- a/shared/core-utils/videos/common.ts+++ b/packages/core-utils/src/videos/common.ts@@ -1,6 +1,4 @@-import { VideoStreamingPlaylistType } from '@shared/models'-import { VideoPrivacy } from '../../models/videos/video-privacy.enum'-import { VideoDetails } from '../../models/videos/video.model'+import { VideoDetails, VideoPrivacy, VideoStreamingPlaylistType } from '@peertube/peertube-models'function getAllPrivacies () {return [ VideoPrivacy.PUBLIC, VideoPrivacy.INTERNAL, VideoPrivacy.PRIVATE, VideoPrivacy.UNLISTED, VideoPrivacy.PASSWORD_PROTECTED ]diff --git a/packages/core-utils/src/videos/index.ts b/packages/core-utils/src/videos/index.tsnew file mode 100644index 0000000000..7d3dacdd41--- /dev/null+++ b/packages/core-utils/src/videos/index.ts@@ -0,0 +1,2 @@+export * from './bitrate.js'+export * from './common.js'diff --git a/packages/core-utils/tsconfig.json b/packages/core-utils/tsconfig.jsonnew file mode 100644index 0000000000..56ebffbb3f--- /dev/null+++ b/packages/core-utils/tsconfig.json@@ -0,0 +1,11 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "outDir": "./dist",+ "rootDir": "src",+ "tsBuildInfoFile": "./dist/.tsbuildinfo"+ },+ "references": [+ { "path": "../models" }+ ]+}diff --git a/packages/ffmpeg/package.json b/packages/ffmpeg/package.jsonnew file mode 100644index 0000000000..fca86df25f--- /dev/null+++ b/packages/ffmpeg/package.json@@ -0,0 +1,19 @@+{+ "name": "@peertube/peertube-ffmpeg",+ "private": true,+ "version": "0.0.0",+ "main": "dist/index.js",+ "files": [ "dist" ],+ "exports": {+ "types": "./dist/index.d.ts",+ "peertube:tsx": "./src/index.ts",+ "default": "./dist/index.js"+ },+ "type": "module",+ "devDependencies": {},+ "scripts": {+ "build": "tsc",+ "watch": "tsc -w"+ },+ "dependencies": {}+}diff --git a/shared/ffmpeg/ffmpeg-command-wrapper.ts b/packages/ffmpeg/src/ffmpeg-command-wrapper.tssimilarity index 96%rename from shared/ffmpeg/ffmpeg-command-wrapper.tsrename to packages/ffmpeg/src/ffmpeg-command-wrapper.tsindex efb75c1988..647ee3996b 100644--- a/shared/ffmpeg/ffmpeg-command-wrapper.ts+++ b/packages/ffmpeg/src/ffmpeg-command-wrapper.ts@@ -1,6 +1,6 @@-import ffmpeg, { FfmpegCommand, getAvailableEncoders } from 'fluent-ffmpeg'-import { pick, promisify0 } from '@shared/core-utils'-import { AvailableEncoders, EncoderOptionsBuilder, EncoderOptionsBuilderParams, EncoderProfile } from '@shared/models'+import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'+import { pick, promisify0 } from '@peertube/peertube-core-utils'+import { AvailableEncoders, EncoderOptionsBuilder, EncoderOptionsBuilderParams, EncoderProfile } from '@peertube/peertube-models'type FFmpegLogger = {info: (msg: string, obj?: any) => void@@ -220,7 +220,7 @@ export class FFmpegCommandWrapper {return FFmpegCommandWrapper.supportedEncoders}- const getAvailableEncodersPromise = promisify0(getAvailableEncoders)+ const getAvailableEncodersPromise = promisify0(ffmpeg.getAvailableEncoders)const availableFFmpegEncoders = await getAvailableEncodersPromise()const searchEncoders = new Set<string>()diff --git a/shared/ffmpeg/ffmpeg-default-transcoding-profile.ts b/packages/ffmpeg/src/ffmpeg-default-transcoding-profile.tssimilarity index 96%rename from shared/ffmpeg/ffmpeg-default-transcoding-profile.tsrename to packages/ffmpeg/src/ffmpeg-default-transcoding-profile.tsindex 8a3f320114..0d3538512a 100644--- a/shared/ffmpeg/ffmpeg-default-transcoding-profile.ts+++ b/packages/ffmpeg/src/ffmpeg-default-transcoding-profile.ts@@ -1,5 +1,5 @@import { FfprobeData } from 'fluent-ffmpeg'-import { getAverageTheoreticalBitrate, getMaxTheoreticalBitrate, getMinTheoreticalBitrate } from '@shared/core-utils'+import { getAverageTheoreticalBitrate, getMaxTheoreticalBitrate, getMinTheoreticalBitrate } from '@peertube/peertube-core-utils'import {buildStreamSuffix,ffprobePromise,@@ -9,8 +9,8 @@ import {getVideoStreamBitrate,getVideoStreamDimensionsInfo,getVideoStreamFPS-} from '@shared/ffmpeg'-import { EncoderOptionsBuilder, EncoderOptionsBuilderParams, VideoResolution } from '@shared/models'+} from '@peertube/peertube-ffmpeg'+import { EncoderOptionsBuilder, EncoderOptionsBuilderParams } from '@peertube/peertube-models'const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = (options: EncoderOptionsBuilderParams) => {const { fps, inputRatio, inputBitrate, resolution } = options@@ -152,7 +152,7 @@ export async function canDoQuickVideoTranscode (path: string, probe?: FfprobeDatfunction getTargetBitrate (options: {inputBitrate: number- resolution: VideoResolution+ resolution: numberratio: numberfps: number}) {diff --git a/shared/ffmpeg/ffmpeg-edition.ts b/packages/ffmpeg/src/ffmpeg-edition.tssimilarity index 98%rename from shared/ffmpeg/ffmpeg-edition.tsrename to packages/ffmpeg/src/ffmpeg-edition.tsindex 724ca1ea91..0213429300 100644--- a/shared/ffmpeg/ffmpeg-edition.ts+++ b/packages/ffmpeg/src/ffmpeg-edition.ts@@ -1,7 +1,7 @@import { FilterSpecification } from 'fluent-ffmpeg'-import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper'-import { presetVOD } from './shared/presets'-import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamDuration, getVideoStreamFPS, hasAudioStream } from './ffprobe'+import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper.js'+import { presetVOD } from './shared/presets.js'+import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamDuration, getVideoStreamFPS, hasAudioStream } from './ffprobe.js'export class FFmpegEdition {private readonly commandWrapper: FFmpegCommandWrapperdiff --git a/shared/ffmpeg/ffmpeg-images.ts b/packages/ffmpeg/src/ffmpeg-images.tssimilarity index 96%rename from shared/ffmpeg/ffmpeg-images.tsrename to packages/ffmpeg/src/ffmpeg-images.tsindex 618fac7d13..4cd37aa80d 100644--- a/shared/ffmpeg/ffmpeg-images.ts+++ b/packages/ffmpeg/src/ffmpeg-images.ts@@ -1,5 +1,5 @@-import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper'-import { getVideoStreamDuration } from './ffprobe'+import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper.js'+import { getVideoStreamDuration } from './ffprobe.js'export class FFmpegImage {private readonly commandWrapper: FFmpegCommandWrapperdiff --git a/shared/ffmpeg/ffmpeg-live.ts b/packages/ffmpeg/src/ffmpeg-live.tssimilarity index 97%rename from shared/ffmpeg/ffmpeg-live.tsrename to packages/ffmpeg/src/ffmpeg-live.tsindex cca4c64745..20318f63cc 100644--- a/shared/ffmpeg/ffmpeg-live.ts+++ b/packages/ffmpeg/src/ffmpeg-live.ts@@ -1,9 +1,9 @@import { FilterSpecification } from 'fluent-ffmpeg'import { join } from 'path'-import { pick } from '@shared/core-utils'-import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper'-import { buildStreamSuffix, getScaleFilter, StreamType } from './ffmpeg-utils'-import { addDefaultEncoderGlobalParams, addDefaultEncoderParams, applyEncoderOptions } from './shared'+import { pick } from '@peertube/peertube-core-utils'+import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper.js'+import { buildStreamSuffix, getScaleFilter, StreamType } from './ffmpeg-utils.js'+import { addDefaultEncoderGlobalParams, addDefaultEncoderParams, applyEncoderOptions } from './shared/index.js'export class FFmpegLive {private readonly commandWrapper: FFmpegCommandWrapperdiff --git a/shared/ffmpeg/ffmpeg-utils.ts b/packages/ffmpeg/src/ffmpeg-utils.tssimilarity index 85%rename from shared/ffmpeg/ffmpeg-utils.tsrename to packages/ffmpeg/src/ffmpeg-utils.tsindex 7d09c32ca7..56fd8c0b3b 100644--- a/shared/ffmpeg/ffmpeg-utils.ts+++ b/packages/ffmpeg/src/ffmpeg-utils.ts@@ -1,4 +1,4 @@-import { EncoderOptions } from '@shared/models'+import { EncoderOptions } from '@peertube/peertube-models'export type StreamType = 'audio' | 'video'diff --git a/shared/ffmpeg/ffmpeg-version.ts b/packages/ffmpeg/src/ffmpeg-version.tssimilarity index 100%rename from shared/ffmpeg/ffmpeg-version.tsrename to packages/ffmpeg/src/ffmpeg-version.tsdiff --git a/shared/ffmpeg/ffmpeg-vod.ts b/packages/ffmpeg/src/ffmpeg-vod.tssimilarity index 97%rename from shared/ffmpeg/ffmpeg-vod.tsrename to packages/ffmpeg/src/ffmpeg-vod.tsindex e40ca0a1e7..6dd272b8db 100644--- a/shared/ffmpeg/ffmpeg-vod.ts+++ b/packages/ffmpeg/src/ffmpeg-vod.ts@@ -1,12 +1,12 @@import { MutexInterface } from 'async-mutex'import { FfmpegCommand } from 'fluent-ffmpeg'-import { readFile, writeFile } from 'fs-extra'+import { readFile, writeFile } from 'fs/promises'import { dirname } from 'path'-import { pick } from '@shared/core-utils'-import { VideoResolution } from '@shared/models'-import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper'-import { ffprobePromise, getVideoStreamDimensionsInfo } from './ffprobe'-import { presetCopy, presetOnlyAudio, presetVOD } from './shared/presets'+import { pick } from '@peertube/peertube-core-utils'+import { VideoResolution } from '@peertube/peertube-models'+import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper.js'+import { ffprobePromise, getVideoStreamDimensionsInfo } from './ffprobe.js'+import { presetCopy, presetOnlyAudio, presetVOD } from './shared/presets.js'export type TranscodeVODOptionsType = 'hls' | 'hls-from-ts' | 'quick-transcode' | 'video' | 'merge-audio' | 'only-audio'diff --git a/shared/ffmpeg/ffprobe.ts b/packages/ffmpeg/src/ffprobe.tssimilarity index 96%rename from shared/ffmpeg/ffprobe.tsrename to packages/ffmpeg/src/ffprobe.tsindex fda08c28e7..ed1742ab10 100644--- a/shared/ffmpeg/ffprobe.ts+++ b/packages/ffmpeg/src/ffprobe.ts@@ -1,6 +1,6 @@-import { ffprobe, FfprobeData } from 'fluent-ffmpeg'-import { forceNumber } from '@shared/core-utils'-import { VideoResolution } from '@shared/models/videos'+import ffmpeg, { FfprobeData } from 'fluent-ffmpeg'+import { forceNumber } from '@peertube/peertube-core-utils'+import { VideoResolution } from '@peertube/peertube-models'/***@@ -10,7 +10,7 @@ import { VideoResolution } from '@shared/models/videos'function ffprobePromise (path: string) {return new Promise<FfprobeData>((res, rej) => {- ffprobe(path, (err, data) => {+ ffmpeg.ffprobe(path, (err, data) => {if (err) return rej(err)return res(data)diff --git a/packages/ffmpeg/src/index.ts b/packages/ffmpeg/src/index.tsnew file mode 100644index 0000000000..511409a50e--- /dev/null+++ b/packages/ffmpeg/src/index.ts@@ -0,0 +1,9 @@+export * from './ffmpeg-command-wrapper.js'+export * from './ffmpeg-default-transcoding-profile.js'+export * from './ffmpeg-edition.js'+export * from './ffmpeg-images.js'+export * from './ffmpeg-live.js'+export * from './ffmpeg-utils.js'+export * from './ffmpeg-version.js'+export * from './ffmpeg-vod.js'+export * from './ffprobe.js'diff --git a/shared/ffmpeg/shared/encoder-options.ts b/packages/ffmpeg/src/shared/encoder-options.tssimilarity index 92%rename from shared/ffmpeg/shared/encoder-options.tsrename to packages/ffmpeg/src/shared/encoder-options.tsindex 9692a6b02b..376a19186a 100644--- a/shared/ffmpeg/shared/encoder-options.ts+++ b/packages/ffmpeg/src/shared/encoder-options.ts@@ -1,6 +1,6 @@import { FfmpegCommand } from 'fluent-ffmpeg'-import { EncoderOptions } from '@shared/models'-import { buildStreamSuffix } from '../ffmpeg-utils'+import { EncoderOptions } from '@peertube/peertube-models'+import { buildStreamSuffix } from '../ffmpeg-utils.js'export function addDefaultEncoderGlobalParams (command: FfmpegCommand) {// avoid issues when transcoding some files: https://trac.ffmpeg.org/ticket/6375diff --git a/packages/ffmpeg/src/shared/index.ts b/packages/ffmpeg/src/shared/index.tsnew file mode 100644index 0000000000..81e8ff0b5e--- /dev/null+++ b/packages/ffmpeg/src/shared/index.ts@@ -0,0 +1,2 @@+export * from './encoder-options.js'+export * from './presets.js'diff --git a/shared/ffmpeg/shared/presets.ts b/packages/ffmpeg/src/shared/presets.tssimilarity index 89%rename from shared/ffmpeg/shared/presets.tsrename to packages/ffmpeg/src/shared/presets.tsindex dcebdc1cf2..17bd7b0319 100644--- a/shared/ffmpeg/shared/presets.ts+++ b/packages/ffmpeg/src/shared/presets.ts@@ -1,8 +1,8 @@-import { pick } from '@shared/core-utils'-import { FFmpegCommandWrapper } from '../ffmpeg-command-wrapper'-import { ffprobePromise, getVideoStreamBitrate, getVideoStreamDimensionsInfo, hasAudioStream } from '../ffprobe'-import { addDefaultEncoderGlobalParams, addDefaultEncoderParams, applyEncoderOptions } from './encoder-options'-import { getScaleFilter, StreamType } from '../ffmpeg-utils'+import { pick } from '@peertube/peertube-core-utils'+import { FFmpegCommandWrapper } from '../ffmpeg-command-wrapper.js'+import { getScaleFilter, StreamType } from '../ffmpeg-utils.js'+import { ffprobePromise, getVideoStreamBitrate, getVideoStreamDimensionsInfo, hasAudioStream } from '../ffprobe.js'+import { addDefaultEncoderGlobalParams, addDefaultEncoderParams, applyEncoderOptions } from './encoder-options.js'export async function presetVOD (options: {commandWrapper: FFmpegCommandWrapperdiff --git a/packages/ffmpeg/tsconfig.json b/packages/ffmpeg/tsconfig.jsonnew file mode 100644index 0000000000..c8aeb3c14a--- /dev/null+++ b/packages/ffmpeg/tsconfig.json@@ -0,0 +1,12 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "outDir": "./dist",+ "rootDir": "src",+ "tsBuildInfoFile": "./dist/.tsbuildinfo"+ },+ "references": [+ { "path": "../models" },+ { "path": "../core-utils" }+ ]+}diff --git a/packages/models/package.json b/packages/models/package.jsonnew file mode 100644index 0000000000..58a993add3--- /dev/null+++ b/packages/models/package.json@@ -0,0 +1,19 @@+{+ "name": "@peertube/peertube-models",+ "private": true,+ "version": "0.0.0",+ "main": "dist/index.js",+ "type": "module",+ "files": [ "dist" ],+ "exports": {+ "types": "./dist/index.d.ts",+ "peertube:tsx": "./src/index.ts",+ "default": "./dist/index.js"+ },+ "devDependencies": {},+ "scripts": {+ "build": "tsc",+ "watch": "tsc -w"+ },+ "dependencies": {}+}diff --git a/shared/models/activitypub/activity.ts b/packages/models/src/activitypub/activity.tssimilarity index 94%rename from shared/models/activitypub/activity.tsrename to packages/models/src/activitypub/activity.tsindex 10cf53ead1..78a3ab33bb 100644--- a/shared/models/activitypub/activity.ts+++ b/packages/models/src/activitypub/activity.ts@@ -1,5 +1,5 @@-import { ActivityPubActor } from './activitypub-actor'-import { ActivityPubSignature } from './activitypub-signature'+import { ActivityPubActor } from './activitypub-actor.js'+import { ActivityPubSignature } from './activitypub-signature.js'import {ActivityFlagReasonObject,ActivityObject,@@ -9,7 +9,7 @@ import {VideoCommentObject,VideoObject,WatchActionObject-} from './objects'+} from './objects/index.js'export type ActivityUpdateObject =Extract<ActivityObject, VideoObject | CacheFileObject | PlaylistObject | ActivityPubActor | string> | ActivityPubActordiff --git a/shared/models/activitypub/activitypub-actor.ts b/packages/models/src/activitypub/activitypub-actor.tssimilarity index 96%rename from shared/models/activitypub/activitypub-actor.tsrename to packages/models/src/activitypub/activitypub-actor.tsindex b86bcb7647..85b37c5adb 100644--- a/shared/models/activitypub/activitypub-actor.ts+++ b/packages/models/src/activitypub/activitypub-actor.ts@@ -1,4 +1,4 @@-import { ActivityIconObject, ActivityPubAttributedTo } from './objects/common-objects'+import { ActivityIconObject, ActivityPubAttributedTo } from './objects/common-objects.js'export type ActivityPubActorType = 'Person' | 'Application' | 'Group' | 'Service' | 'Organization'diff --git a/shared/models/activitypub/activitypub-collection.ts b/packages/models/src/activitypub/activitypub-collection.tssimilarity index 80%rename from shared/models/activitypub/activitypub-collection.tsrename to packages/models/src/activitypub/activitypub-collection.tsindex 60a6a6b047..b98ad37c22 100644--- a/shared/models/activitypub/activitypub-collection.ts+++ b/packages/models/src/activitypub/activitypub-collection.ts@@ -1,4 +1,4 @@-import { Activity } from './activity'+import { Activity } from './activity.js'export interface ActivityPubCollection {'@context': string[]diff --git a/shared/models/activitypub/activitypub-ordered-collection.ts b/packages/models/src/activitypub/activitypub-ordered-collection.tssimilarity index 100%rename from shared/models/activitypub/activitypub-ordered-collection.tsrename to packages/models/src/activitypub/activitypub-ordered-collection.tsdiff --git a/shared/models/activitypub/activitypub-root.ts b/packages/models/src/activitypub/activitypub-root.tssimilarity index 56%rename from shared/models/activitypub/activitypub-root.tsrename to packages/models/src/activitypub/activitypub-root.tsindex 22dff83a21..2fa1970c78 100644--- a/shared/models/activitypub/activitypub-root.ts+++ b/packages/models/src/activitypub/activitypub-root.ts@@ -1,5 +1,5 @@-import { Activity } from './activity'-import { ActivityPubCollection } from './activitypub-collection'-import { ActivityPubOrderedCollection } from './activitypub-ordered-collection'+import { Activity } from './activity.js'+import { ActivityPubCollection } from './activitypub-collection.js'+import { ActivityPubOrderedCollection } from './activitypub-ordered-collection.js'export type RootActivity = Activity | ActivityPubCollection | ActivityPubOrderedCollection<Activity>diff --git a/shared/models/activitypub/activitypub-signature.ts b/packages/models/src/activitypub/activitypub-signature.tssimilarity index 100%rename from shared/models/activitypub/activitypub-signature.tsrename to packages/models/src/activitypub/activitypub-signature.tsdiff --git a/shared/models/activitypub/context.ts b/packages/models/src/activitypub/context.tssimilarity index 100%rename from shared/models/activitypub/context.tsrename to packages/models/src/activitypub/context.tsdiff --git a/packages/models/src/activitypub/index.ts b/packages/models/src/activitypub/index.tsnew file mode 100644index 0000000000..f36aa1bc50--- /dev/null+++ b/packages/models/src/activitypub/index.ts@@ -0,0 +1,9 @@+export * from './objects/index.js'+export * from './activity.js'+export * from './activitypub-actor.js'+export * from './activitypub-collection.js'+export * from './activitypub-ordered-collection.js'+export * from './activitypub-root.js'+export * from './activitypub-signature.js'+export * from './context.js'+export * from './webfinger.js'diff --git a/shared/models/activitypub/objects/abuse-object.ts b/packages/models/src/activitypub/objects/abuse-object.tssimilarity index 75%rename from shared/models/activitypub/objects/abuse-object.tsrename to packages/models/src/activitypub/objects/abuse-object.tsindex d938b86933..2c0f2832bc 100644--- a/shared/models/activitypub/objects/abuse-object.ts+++ b/packages/models/src/activitypub/objects/abuse-object.ts@@ -1,4 +1,4 @@-import { ActivityFlagReasonObject } from './common-objects'+import { ActivityFlagReasonObject } from './common-objects.js'export interface AbuseObject {type: 'Flag'diff --git a/packages/models/src/activitypub/objects/activitypub-object.ts b/packages/models/src/activitypub/objects/activitypub-object.tsnew file mode 100644index 0000000000..93c925ae07--- /dev/null+++ b/packages/models/src/activitypub/objects/activitypub-object.ts@@ -0,0 +1,17 @@+import { AbuseObject } from './abuse-object.js'+import { CacheFileObject } from './cache-file-object.js'+import { PlaylistObject } from './playlist-object.js'+import { VideoCommentObject } from './video-comment-object.js'+import { VideoObject } from './video-object.js'+import { WatchActionObject } from './watch-action-object.js'++export type ActivityObject =+ VideoObject |+ AbuseObject |+ VideoCommentObject |+ CacheFileObject |+ PlaylistObject |+ WatchActionObject |+ string++export type APObjectId = string | { id: string }diff --git a/shared/models/activitypub/objects/cache-file-object.ts b/packages/models/src/activitypub/objects/cache-file-object.tssimilarity index 90%rename from shared/models/activitypub/objects/cache-file-object.tsrename to packages/models/src/activitypub/objects/cache-file-object.tsindex 19a8175824..a40ef339c3 100644--- a/shared/models/activitypub/objects/cache-file-object.ts+++ b/packages/models/src/activitypub/objects/cache-file-object.ts@@ -1,4 +1,4 @@-import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-objects'+import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-objects.js'export interface CacheFileObject {id: stringdiff --git a/shared/models/activitypub/objects/common-objects.ts b/packages/models/src/activitypub/objects/common-objects.tssimilarity index 98%rename from shared/models/activitypub/objects/common-objects.tsrename to packages/models/src/activitypub/objects/common-objects.tsindex db9c736583..a332c26f3d 100644--- a/shared/models/activitypub/objects/common-objects.ts+++ b/packages/models/src/activitypub/objects/common-objects.ts@@ -1,4 +1,4 @@-import { AbusePredefinedReasonsString } from '../../moderation/abuse/abuse-reason.model'+import { AbusePredefinedReasonsString } from '../../moderation/abuse/abuse-reason.model.js'export interface ActivityIdentifierObject {identifier: stringdiff --git a/packages/models/src/activitypub/objects/index.ts b/packages/models/src/activitypub/objects/index.tsnew file mode 100644index 0000000000..510f621ea3--- /dev/null+++ b/packages/models/src/activitypub/objects/index.ts@@ -0,0 +1,9 @@+export * from './abuse-object.js'+export * from './activitypub-object.js'+export * from './cache-file-object.js'+export * from './common-objects.js'+export * from './playlist-element-object.js'+export * from './playlist-object.js'+export * from './video-comment-object.js'+export * from './video-object.js'+export * from './watch-action-object.js'diff --git a/shared/models/activitypub/objects/playlist-element-object.ts b/packages/models/src/activitypub/objects/playlist-element-object.tssimilarity index 100%rename from shared/models/activitypub/objects/playlist-element-object.tsrename to packages/models/src/activitypub/objects/playlist-element-object.tsdiff --git a/shared/models/activitypub/objects/playlist-object.ts b/packages/models/src/activitypub/objects/playlist-object.tssimilarity index 96%rename from shared/models/activitypub/objects/playlist-object.tsrename to packages/models/src/activitypub/objects/playlist-object.tsindex 0ccb71828e..c68a28780b 100644--- a/shared/models/activitypub/objects/playlist-object.ts+++ b/packages/models/src/activitypub/objects/playlist-object.ts@@ -1,4 +1,4 @@-import { ActivityIconObject, ActivityPubAttributedTo } from './common-objects'+import { ActivityIconObject, ActivityPubAttributedTo } from './common-objects.js'export interface PlaylistObject {id: stringdiff --git a/shared/models/activitypub/objects/video-comment-object.ts b/packages/models/src/activitypub/objects/video-comment-object.tssimilarity index 94%rename from shared/models/activitypub/objects/video-comment-object.tsrename to packages/models/src/activitypub/objects/video-comment-object.tsindex fb1e6f8dbe..880dd2ee2a 100644--- a/shared/models/activitypub/objects/video-comment-object.ts+++ b/packages/models/src/activitypub/objects/video-comment-object.ts@@ -1,4 +1,4 @@-import { ActivityPubAttributedTo, ActivityTagObject } from './common-objects'+import { ActivityPubAttributedTo, ActivityTagObject } from './common-objects.js'export interface VideoCommentObject {type: 'Note'diff --git a/shared/models/activitypub/objects/video-object.ts b/packages/models/src/activitypub/objects/video-object.tssimilarity index 87%rename from shared/models/activitypub/objects/video-object.tsrename to packages/models/src/activitypub/objects/video-object.tsindex 409504f0fe..14afd85a26 100644--- a/shared/models/activitypub/objects/video-object.ts+++ b/packages/models/src/activitypub/objects/video-object.ts@@ -1,11 +1,11 @@+import { LiveVideoLatencyModeType, VideoStateType } from '../../videos/index.js'import {ActivityIconObject,ActivityIdentifierObject,ActivityPubAttributedTo,ActivityTagObject,ActivityUrlObject-} from './common-objects'-import { LiveVideoLatencyMode, VideoState } from '../../videos'+} from './common-objects.js'export interface VideoObject {type: 'Video'@@ -25,12 +25,12 @@ export interface VideoObject {isLiveBroadcast: booleanliveSaveReplay: booleanpermanentLive: boolean- latencyMode: LiveVideoLatencyMode+ latencyMode: LiveVideoLatencyModeTypecommentsEnabled: booleandownloadEnabled: booleanwaitTranscoding: boolean- state: VideoState+ state: VideoStateTypepublished: stringoriginallyPublishedAt: stringdiff --git a/shared/models/activitypub/objects/watch-action-object.ts b/packages/models/src/activitypub/objects/watch-action-object.tssimilarity index 100%rename from shared/models/activitypub/objects/watch-action-object.tsrename to packages/models/src/activitypub/objects/watch-action-object.tsdiff --git a/shared/models/activitypub/webfinger.ts b/packages/models/src/activitypub/webfinger.tssimilarity index 100%rename from shared/models/activitypub/webfinger.tsrename to packages/models/src/activitypub/webfinger.tsdiff --git a/shared/models/actors/account.model.ts b/packages/models/src/actors/account.model.tssimilarity index 76%rename from shared/models/actors/account.model.tsrename to packages/models/src/actors/account.model.tsindex 9fbec60ba0..370a273cf1 100644--- a/shared/models/actors/account.model.ts+++ b/packages/models/src/actors/account.model.ts@@ -1,5 +1,5 @@-import { ActorImage } from './actor-image.model'-import { Actor } from './actor.model'+import { ActorImage } from './actor-image.model.js'+import { Actor } from './actor.model.js'export interface Account extends Actor {displayName: stringdiff --git a/shared/models/actors/actor-image.model.ts b/packages/models/src/actors/actor-image.model.tssimilarity index 100%rename from shared/models/actors/actor-image.model.tsrename to packages/models/src/actors/actor-image.model.tsdiff --git a/packages/models/src/actors/actor-image.type.ts b/packages/models/src/actors/actor-image.type.tsnew file mode 100644index 0000000000..3a808b110c--- /dev/null+++ b/packages/models/src/actors/actor-image.type.ts@@ -0,0 +1,6 @@+export const ActorImageType = {+ AVATAR: 1,+ BANNER: 2+} as const++export type ActorImageType_Type = typeof ActorImageType[keyof typeof ActorImageType]diff --git a/shared/models/actors/actor.model.ts b/packages/models/src/actors/actor.model.tssimilarity index 78%rename from shared/models/actors/actor.model.tsrename to packages/models/src/actors/actor.model.tsindex ab07602632..d18053b4b9 100644--- a/shared/models/actors/actor.model.ts+++ b/packages/models/src/actors/actor.model.ts@@ -1,4 +1,4 @@-import { ActorImage } from './actor-image.model'+import { ActorImage } from './actor-image.model.js'export interface Actor {id: numberdiff --git a/shared/models/actors/custom-page.model.ts b/packages/models/src/actors/custom-page.model.tssimilarity index 100%rename from shared/models/actors/custom-page.model.tsrename to packages/models/src/actors/custom-page.model.tsdiff --git a/shared/models/actors/follow.model.ts b/packages/models/src/actors/follow.model.tssimilarity index 87%rename from shared/models/actors/follow.model.tsrename to packages/models/src/actors/follow.model.tsindex 244d6d97ea..7f3f52ac5b 100644--- a/shared/models/actors/follow.model.ts+++ b/packages/models/src/actors/follow.model.ts@@ -1,4 +1,4 @@-import { Actor } from './actor.model'+import { Actor } from './actor.model.js'export type FollowState = 'pending' | 'accepted' | 'rejected'diff --git a/packages/models/src/actors/index.ts b/packages/models/src/actors/index.tsnew file mode 100644index 0000000000..c44063c811--- /dev/null+++ b/packages/models/src/actors/index.ts@@ -0,0 +1,6 @@+export * from './account.model.js'+export * from './actor-image.model.js'+export * from './actor-image.type.js'+export * from './actor.model.js'+export * from './custom-page.model.js'+export * from './follow.model.js'diff --git a/shared/models/bulk/bulk-remove-comments-of-body.model.ts b/packages/models/src/bulk/bulk-remove-comments-of-body.model.tssimilarity index 100%rename from shared/models/bulk/bulk-remove-comments-of-body.model.tsrename to packages/models/src/bulk/bulk-remove-comments-of-body.model.tsdiff --git a/packages/models/src/bulk/index.ts b/packages/models/src/bulk/index.tsnew file mode 100644index 0000000000..3597fda364--- /dev/null+++ b/packages/models/src/bulk/index.ts@@ -0,0 +1 @@+export * from './bulk-remove-comments-of-body.model.js'diff --git a/packages/models/src/common/index.ts b/packages/models/src/common/index.tsnew file mode 100644index 0000000000..957851ae41--- /dev/null+++ b/packages/models/src/common/index.ts@@ -0,0 +1 @@+export * from './result-list.model.js'diff --git a/shared/models/common/result-list.model.ts b/packages/models/src/common/result-list.model.tssimilarity index 100%rename from shared/models/common/result-list.model.tsrename to packages/models/src/common/result-list.model.tsdiff --git a/shared/models/custom-markup/custom-markup-data.model.ts b/packages/models/src/custom-markup/custom-markup-data.model.tssimilarity index 100%rename from shared/models/custom-markup/custom-markup-data.model.tsrename to packages/models/src/custom-markup/custom-markup-data.model.tsdiff --git a/packages/models/src/custom-markup/index.ts b/packages/models/src/custom-markup/index.tsnew file mode 100644index 0000000000..1ce10d8e24--- /dev/null+++ b/packages/models/src/custom-markup/index.ts@@ -0,0 +1 @@+export * from './custom-markup-data.model.js'diff --git a/packages/models/src/feeds/feed-format.enum.ts b/packages/models/src/feeds/feed-format.enum.tsnew file mode 100644index 0000000000..71f2f6c15f--- /dev/null+++ b/packages/models/src/feeds/feed-format.enum.ts@@ -0,0 +1,7 @@+export const FeedFormat = {+ RSS: 'xml',+ ATOM: 'atom',+ JSON: 'json'+} as const++export type FeedFormatType = typeof FeedFormat[keyof typeof FeedFormat]diff --git a/packages/models/src/feeds/index.ts b/packages/models/src/feeds/index.tsnew file mode 100644index 0000000000..1eda1d6c39--- /dev/null+++ b/packages/models/src/feeds/index.ts@@ -0,0 +1 @@+export * from './feed-format.enum.js'diff --git a/shared/models/http/http-methods.ts b/packages/models/src/http/http-methods.tssimilarity index 77%rename from shared/models/http/http-methods.tsrename to packages/models/src/http/http-methods.tsindex 3f4adafe2b..ec3c855d87 100644--- a/shared/models/http/http-methods.ts+++ b/packages/models/src/http/http-methods.ts@@ -1,21 +1,23 @@/** HTTP request method to indicate the desired action to be performed for a given resource. */-export const enum HttpMethod {+export const HttpMethod = {/** The CONNECT method establishes a tunnel to the server identified by the target resource. */- CONNECT = 'CONNECT',+ CONNECT: 'CONNECT',/** The DELETE method deletes the specified resource. */- DELETE = 'DELETE',+ DELETE: 'DELETE',/** The GET method requests a representation of the specified resource. Requests using GET should only retrieve data. */- GET = 'GET',+ GET: 'GET',/** The HEAD method asks for a response identical to that of a GET request, but without the response body. */- HEAD = 'HEAD',+ HEAD: 'HEAD',/** The OPTIONS method is used to describe the communication options for the target resource. */- OPTIONS = 'OPTIONS',+ OPTIONS: 'OPTIONS',/** The PATCH method is used to apply partial modifications to a resource. */- PATCH = 'PATCH',+ PATCH: 'PATCH',/** The POST method is used to submit an entity to the specified resource */- POST = 'POST',+ POST: 'POST',/** The PUT method replaces all current representations of the target resource with the request payload. */- PUT = 'PUT',+ PUT: 'PUT',/** The TRACE method performs a message loop-back test along the path to the target resource. */- TRACE = 'TRACE'-}+ TRACE: 'TRACE'+} as const++export type HttpMethodType = typeof HttpMethod[keyof typeof HttpMethod]diff --git a/shared/models/http/http-error-codes.ts b/packages/models/src/http/http-status-codes.tssimilarity index 91%rename from shared/models/http/http-error-codes.tsrename to packages/models/src/http/http-status-codes.tsindex 5ebff1cb59..920b9a2e9a 100644--- a/shared/models/http/http-error-codes.ts+++ b/packages/models/src/http/http-status-codes.ts@@ -4,7 +4,7 @@** WebDAV and other codes useless with regards to PeerTube are not listed.*/-export const enum HttpStatusCode {+export const HttpStatusCode = {/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1@@ -16,14 +16,14 @@ export const enum HttpStatusCode {* and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates* the request should not be continued.*/- CONTINUE_100 = 100,+ CONTINUE_100: 100,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.2** This code is sent in response to an Upgrade request header by the client, and indicates the protocol the server is switching too.*/- SWITCHING_PROTOCOLS_101 = 101,+ SWITCHING_PROTOCOLS_101: 101,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.1@@ -34,20 +34,20 @@ export const enum HttpStatusCode {* POST: The resource describing the result of the action is transmitted in the message body.* TRACE: The message body contains the request message as received by the server*/- OK_200 = 200,+ OK_200: 200,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.2** The request has been fulfilled, resulting in the creation of a new resource, typically after a PUT.*/- CREATED_201 = 201,+ CREATED_201: 201,/*** The request has been accepted for processing, but the processing has not been completed.* The request might or might not be eventually acted upon, and may be disallowed when processing occurs.*/- ACCEPTED_202 = 202,+ ACCEPTED_202: 202,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5@@ -55,32 +55,32 @@ export const enum HttpStatusCode {* There is no content to send for this request, but the headers may be useful.* The user-agent may update its cached headers for this resource with the new ones.*/- NO_CONTENT_204 = 204,+ NO_CONTENT_204: 204,/*** The server successfully processed the request, but is not returning any content.* Unlike a 204 response, this response requires that the requester reset the document view.*/- RESET_CONTENT_205 = 205,+ RESET_CONTENT_205: 205,/*** The server is delivering only part of the resource (byte serving) due to a range header sent by the client.* The range header is used by HTTP clients to enable resuming of interrupted downloads,* or split a download into multiple simultaneous streams.*/- PARTIAL_CONTENT_206 = 206,+ PARTIAL_CONTENT_206: 206,/*** Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).* For example, this code could be used to present multiple video format options,* to list files with different filename extensions, or to suggest word-sense disambiguation.*/- MULTIPLE_CHOICES_300 = 300,+ MULTIPLE_CHOICES_300: 300,/*** This and all future requests should be directed to the given URI.*/- MOVED_PERMANENTLY_301 = 301,+ MOVED_PERMANENTLY_301: 301,/*** This is an example of industry practice contradicting the standard.@@ -90,7 +90,7 @@ export const enum HttpStatusCode {* to distinguish between the two behaviours. However, some Web applications and frameworks* use the 302 status code as if it were the 303.*/- FOUND_302 = 302,+ FOUND_302: 302,/*** SINCE HTTP/1.1@@ -98,7 +98,7 @@ export const enum HttpStatusCode {* When received in response to a POST (or PUT/DELETE), the client should presume that* the server has received the data and should issue a redirect with a separate GET message.*/- SEE_OTHER_303 = 303,+ SEE_OTHER_303: 303,/*** Official Documentation @ https://tools.ietf.org/html/rfc7232#section-4.1@@ -107,7 +107,7 @@ export const enum HttpStatusCode {* `If-Modified-Since` or `If-None-Match`.* In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.*/- NOT_MODIFIED_304 = 304,+ NOT_MODIFIED_304: 304,/*** SINCE HTTP/1.1@@ -116,20 +116,20 @@ export const enum HttpStatusCode {* original request.* For example, a POST request should be repeated using another POST request.*/- TEMPORARY_REDIRECT_307 = 307,+ TEMPORARY_REDIRECT_307: 307,/*** The request and all future requests should be repeated using another URI.* 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.* So, for example, submitting a form to a permanently redirected resource may continue smoothly.*/- PERMANENT_REDIRECT_308 = 308,+ PERMANENT_REDIRECT_308: 308,/*** The server cannot or will not process the request due to an apparent client error* (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).*/- BAD_REQUEST_400 = 400,+ BAD_REQUEST_400: 400,/*** Official Documentation @ https://tools.ietf.org/html/rfc7235#section-3.1@@ -139,7 +139,7 @@ export const enum HttpStatusCode {* requested resource. See Basic access authentication and Digest access authentication. 401 semantically means* "unauthenticated",i.e. the user does not have the necessary credentials.*/- UNAUTHORIZED_401 = 401,+ UNAUTHORIZED_401: 401,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2@@ -148,7 +148,7 @@ export const enum HttpStatusCode {* cash or micro payment scheme, but that has not happened, and this code is not usually used.* Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.*/- PAYMENT_REQUIRED_402 = 402,+ PAYMENT_REQUIRED_402: 402,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.3@@ -156,7 +156,7 @@ export const enum HttpStatusCode {* The client does not have access rights to the content, i.e. they are unauthorized, so server is rejecting to* give proper response. Unlike 401, the client's identity is known to the server.*/- FORBIDDEN_403 = 403,+ FORBIDDEN_403: 403,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2@@ -164,7 +164,7 @@ export const enum HttpStatusCode {* The requested resource could not be found but may be available in the future.* Subsequent requests by the client are permissible.*/- NOT_FOUND_404 = 404,+ NOT_FOUND_404: 404,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.5@@ -172,12 +172,12 @@ export const enum HttpStatusCode {* A request method is not supported for the requested resource;* for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.*/- METHOD_NOT_ALLOWED_405 = 405,+ METHOD_NOT_ALLOWED_405: 405,/*** The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.*/- NOT_ACCEPTABLE_406 = 406,+ NOT_ACCEPTABLE_406: 406,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7@@ -189,7 +189,7 @@ export const enum HttpStatusCode {** @*/- REQUEST_TIMEOUT_408 = 408,+ REQUEST_TIMEOUT_408: 408,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8@@ -199,7 +199,7 @@ export const enum HttpStatusCode {** @see HttpStatusCode.UNPROCESSABLE_ENTITY_422 to denote a disabled feature*/- CONFLICT_409 = 409,+ CONFLICT_409: 409,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.9@@ -210,17 +210,17 @@ export const enum HttpStatusCode {* Clients such as search engines should remove the resource from their indices.* Most use cases do not require clients and search engines to purge the resource, and a "404 Not Found" may be used instead.*/- GONE_410 = 410,+ GONE_410: 410,/*** The request did not specify the length of its content, which is required by the requested resource.*/- LENGTH_REQUIRED_411 = 411,+ LENGTH_REQUIRED_411: 411,/*** The server does not meet one of the preconditions that the requester put on the request.*/- PRECONDITION_FAILED_412 = 412,+ PRECONDITION_FAILED_412: 412,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.11@@ -229,14 +229,14 @@ export const enum HttpStatusCode {* or return an Retry-After header field.* Previously called "Request Entity Too Large".*/- PAYLOAD_TOO_LARGE_413 = 413,+ PAYLOAD_TOO_LARGE_413: 413,/*** The URI provided was too long for the server to process. Often the result of too much data being encoded as a* query-string of a GET request, in which case it should be converted to a POST request.* Called "Request-URI Too Long" previously.*/- URI_TOO_LONG_414 = 414,+ URI_TOO_LONG_414: 414,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.13@@ -244,19 +244,19 @@ export const enum HttpStatusCode {* The request entity has a media type which the server or resource does not support.* For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.*/- UNSUPPORTED_MEDIA_TYPE_415 = 415,+ UNSUPPORTED_MEDIA_TYPE_415: 415,/*** The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.* For example, if the client asked for a part of the file that lies beyond the end of the file.* Called "Requested Range Not Satisfiable" previously.*/- RANGE_NOT_SATISFIABLE_416 = 416,+ RANGE_NOT_SATISFIABLE_416: 416,/*** The server cannot meet the requirements of the `Expect` request-header field.*/- EXPECTATION_FAILED_417 = 417,+ EXPECTATION_FAILED_417: 417,/*** Official Documentation @ https://tools.ietf.org/html/rfc2324@@ -265,7 +265,7 @@ export const enum HttpStatusCode {* and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by* teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including PeerTube instances ;-).*/- I_AM_A_TEAPOT_418 = 418,+ I_AM_A_TEAPOT_418: 418,/*** Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3@@ -281,7 +281,7 @@ export const enum HttpStatusCode {* @see HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415 if the `Content-Type` was not supported.* @see HttpStatusCode.BAD_REQUEST_400 if the request was not parsable (broken JSON, XML)*/- UNPROCESSABLE_ENTITY_422 = 422,+ UNPROCESSABLE_ENTITY_422: 422,/*** Official Documentation @ https://tools.ietf.org/html/rfc4918#section-11.3@@ -291,14 +291,14 @@ export const enum HttpStatusCode {* @deprecated use `If-Match` / `If-None-Match` instead* @see {@link https://evertpot.com/http/423-locked}*/- LOCKED_423 = 423,+ LOCKED_423: 423,/*** Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4** The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.*/- TOO_MANY_REQUESTS_429 = 429,+ TOO_MANY_REQUESTS_429: 429,/*** Official Documentation @ https://tools.ietf.org/html/rfc6585#section-5@@ -306,7 +306,7 @@ export const enum HttpStatusCode {* The server is unwilling to process the request because either an individual header field,* or all the header fields collectively, are too large.*/- REQUEST_HEADER_FIELDS_TOO_LARGE_431 = 431,+ REQUEST_HEADER_FIELDS_TOO_LARGE_431: 431,/*** Official Documentation @ https://tools.ietf.org/html/rfc7725@@ -314,12 +314,12 @@ export const enum HttpStatusCode {* A server operator has received a legal demand to deny access to a resource or to a set of resources* that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.*/- UNAVAILABLE_FOR_LEGAL_REASONS_451 = 451,+ UNAVAILABLE_FOR_LEGAL_REASONS_451: 451,/*** A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.*/- INTERNAL_SERVER_ERROR_500 = 500,+ INTERNAL_SERVER_ERROR_500: 500,/*** Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2@@ -327,28 +327,28 @@ export const enum HttpStatusCode {* The server either does not recognize the request method, or it lacks the ability to fulfill the request.* Usually this implies future availability (e.g., a new feature of a web-service API).*/- NOT_IMPLEMENTED_501 = 501,+ NOT_IMPLEMENTED_501: 501,/*** The server was acting as a gateway or proxy and received an invalid response from the upstream server.*/- BAD_GATEWAY_502 = 502,+ BAD_GATEWAY_502: 502,/*** The server is currently unavailable (because it is overloaded or down for maintenance).* Generally, this is a temporary state.*/- SERVICE_UNAVAILABLE_503 = 503,+ SERVICE_UNAVAILABLE_503: 503,/*** The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.*/- GATEWAY_TIMEOUT_504 = 504,+ GATEWAY_TIMEOUT_504: 504,/*** The server does not support the HTTP protocol version used in the request*/- HTTP_VERSION_NOT_SUPPORTED_505 = 505,+ HTTP_VERSION_NOT_SUPPORTED_505: 505,/*** Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6@@ -360,5 +360,7 @@ export const enum HttpStatusCode {** @see HttpStatusCode.PAYLOAD_TOO_LARGE_413 for quota errors*/- INSUFFICIENT_STORAGE_507 = 507,-}+ INSUFFICIENT_STORAGE_507: 507+} as const++export type HttpStatusCodeType = typeof HttpStatusCode[keyof typeof HttpStatusCode]diff --git a/packages/models/src/http/index.ts b/packages/models/src/http/index.tsnew file mode 100644index 0000000000..f0ad040edb--- /dev/null+++ b/packages/models/src/http/index.ts@@ -0,0 +1,2 @@+export * from './http-status-codes.js'+export * from './http-methods.js'diff --git a/packages/models/src/index.ts b/packages/models/src/index.tsnew file mode 100644index 0000000000..b76703dff1--- /dev/null+++ b/packages/models/src/index.ts@@ -0,0 +1,20 @@+export * from './activitypub/index.js'+export * from './actors/index.js'+export * from './bulk/index.js'+export * from './common/index.js'+export * from './custom-markup/index.js'+export * from './feeds/index.js'+export * from './http/index.js'+export * from './joinpeertube/index.js'+export * from './metrics/index.js'+export * from './moderation/index.js'+export * from './nodeinfo/index.js'+export * from './overviews/index.js'+export * from './plugins/index.js'+export * from './redundancy/index.js'+export * from './runners/index.js'+export * from './search/index.js'+export * from './server/index.js'+export * from './tokens/index.js'+export * from './users/index.js'+export * from './videos/index.js'diff --git a/packages/models/src/joinpeertube/index.ts b/packages/models/src/joinpeertube/index.tsnew file mode 100644index 0000000000..a51d341906--- /dev/null+++ b/packages/models/src/joinpeertube/index.ts@@ -0,0 +1 @@+export * from './versions.model.js'diff --git a/shared/models/joinpeertube/versions.model.ts b/packages/models/src/joinpeertube/versions.model.tssimilarity index 100%rename from shared/models/joinpeertube/versions.model.tsrename to packages/models/src/joinpeertube/versions.model.tsdiff --git a/packages/models/src/metrics/index.ts b/packages/models/src/metrics/index.tsnew file mode 100644index 0000000000..def6f80951--- /dev/null+++ b/packages/models/src/metrics/index.ts@@ -0,0 +1 @@+export * from './playback-metric-create.model.js'diff --git a/shared/models/metrics/playback-metric-create.model.ts b/packages/models/src/metrics/playback-metric-create.model.tssimilarity index 81%rename from shared/models/metrics/playback-metric-create.model.tsrename to packages/models/src/metrics/playback-metric-create.model.tsindex 1d47421c31..3ae91b2953 100644--- a/shared/models/metrics/playback-metric-create.model.ts+++ b/packages/models/src/metrics/playback-metric-create.model.ts@@ -1,9 +1,9 @@-import { VideoResolution } from '../videos'+import { VideoResolutionType } from '../videos/index.js'export interface PlaybackMetricCreate {playerMode: 'p2p-media-loader' | 'webtorrent' | 'web-video' // FIXME: remove webtorrent player mode not used anymore in PeerTube v6- resolution?: VideoResolution+ resolution?: VideoResolutionTypefps?: numberp2pEnabled: booleandiff --git a/shared/models/moderation/abuse/abuse-create.model.ts b/packages/models/src/moderation/abuse/abuse-create.model.tssimilarity index 97%rename from shared/models/moderation/abuse/abuse-create.model.tsrename to packages/models/src/moderation/abuse/abuse-create.model.tsindex 7d35555c31..1c2723b1c7 100644--- a/shared/models/moderation/abuse/abuse-create.model.ts+++ b/packages/models/src/moderation/abuse/abuse-create.model.ts@@ -1,4 +1,4 @@-import { AbusePredefinedReasonsString } from './abuse-reason.model'+import { AbusePredefinedReasonsString } from './abuse-reason.model.js'export interface AbuseCreate {reason: stringdiff --git a/shared/models/moderation/abuse/abuse-filter.type.ts b/packages/models/src/moderation/abuse/abuse-filter.type.tssimilarity index 100%rename from shared/models/moderation/abuse/abuse-filter.type.tsrename to packages/models/src/moderation/abuse/abuse-filter.type.tsdiff --git a/shared/models/moderation/abuse/abuse-message.model.ts b/packages/models/src/moderation/abuse/abuse-message.model.tssimilarity index 69%rename from shared/models/moderation/abuse/abuse-message.model.tsrename to packages/models/src/moderation/abuse/abuse-message.model.tsindex 9edd9daff7..9ba95e7244 100644--- a/shared/models/moderation/abuse/abuse-message.model.ts+++ b/packages/models/src/moderation/abuse/abuse-message.model.ts@@ -1,4 +1,4 @@-import { AccountSummary } from '../../actors/account.model'+import { AccountSummary } from '../../actors/account.model.js'export interface AbuseMessage {id: numberdiff --git a/packages/models/src/moderation/abuse/abuse-reason.model.ts b/packages/models/src/moderation/abuse/abuse-reason.model.tsnew file mode 100644index 0000000000..770b9d47aa--- /dev/null+++ b/packages/models/src/moderation/abuse/abuse-reason.model.ts@@ -0,0 +1,22 @@+export const AbusePredefinedReasons = {+ VIOLENT_OR_REPULSIVE: 1,+ HATEFUL_OR_ABUSIVE: 2,+ SPAM_OR_MISLEADING: 3,+ PRIVACY: 4,+ RIGHTS: 5,+ SERVER_RULES: 6,+ THUMBNAILS: 7,+ CAPTIONS: 8+} as const++export type AbusePredefinedReasonsType = typeof AbusePredefinedReasons[keyof typeof AbusePredefinedReasons]++export type AbusePredefinedReasonsString =+ 'violentOrRepulsive' |+ 'hatefulOrAbusive' |+ 'spamOrMisleading' |+ 'privacy' |+ 'rights' |+ 'serverRules' |+ 'thumbnails' |+ 'captions'diff --git a/packages/models/src/moderation/abuse/abuse-state.model.ts b/packages/models/src/moderation/abuse/abuse-state.model.tsnew file mode 100644index 0000000000..5582d73c4c--- /dev/null+++ b/packages/models/src/moderation/abuse/abuse-state.model.ts@@ -0,0 +1,7 @@+export const AbuseState = {+ PENDING: 1,+ REJECTED: 2,+ ACCEPTED: 3+} as const++export type AbuseStateType = typeof AbuseState[keyof typeof AbuseState]diff --git a/packages/models/src/moderation/abuse/abuse-update.model.ts b/packages/models/src/moderation/abuse/abuse-update.model.tsnew file mode 100644index 0000000000..22a01be894--- /dev/null+++ b/packages/models/src/moderation/abuse/abuse-update.model.ts@@ -0,0 +1,7 @@+import { AbuseStateType } from './abuse-state.model.js'++export interface AbuseUpdate {+ moderationComment?: string++ state?: AbuseStateType+}diff --git a/shared/models/moderation/abuse/abuse-video-is.type.ts b/packages/models/src/moderation/abuse/abuse-video-is.type.tssimilarity index 100%rename from shared/models/moderation/abuse/abuse-video-is.type.tsrename to packages/models/src/moderation/abuse/abuse-video-is.type.tsdiff --git a/shared/models/moderation/abuse/abuse.model.ts b/packages/models/src/moderation/abuse/abuse.model.tssimilarity index 88%rename from shared/models/moderation/abuse/abuse.model.tsrename to packages/models/src/moderation/abuse/abuse.model.tsindex 6048777ffc..253a3f44c3 100644--- a/shared/models/moderation/abuse/abuse.model.ts+++ b/packages/models/src/moderation/abuse/abuse.model.ts@@ -1,8 +1,8 @@-import { Account } from '../../actors/account.model'-import { AbuseState } from './abuse-state.model'-import { AbusePredefinedReasonsString } from './abuse-reason.model'-import { VideoConstant } from '../../videos/video-constant.model'-import { VideoChannel } from '../../videos/channel/video-channel.model'+import { Account } from '../../actors/account.model.js'+import { AbuseStateType } from './abuse-state.model.js'+import { AbusePredefinedReasonsString } from './abuse-reason.model.js'+import { VideoConstant } from '../../videos/video-constant.model.js'+import { VideoChannel } from '../../videos/channel/video-channel.model.js'export interface AdminVideoAbuse {id: number@@ -47,7 +47,7 @@ export interface AdminAbuse {reporterAccount: AccountflaggedAccount: Account- state: VideoConstant<AbuseState>+ state: VideoConstant<AbuseStateType>moderationComment?: stringvideo?: AdminVideoAbusediff --git a/packages/models/src/moderation/abuse/index.ts b/packages/models/src/moderation/abuse/index.tsnew file mode 100644index 0000000000..27fca7076a--- /dev/null+++ b/packages/models/src/moderation/abuse/index.ts@@ -0,0 +1,8 @@+export * from './abuse-create.model.js'+export * from './abuse-filter.type.js'+export * from './abuse-message.model.js'+export * from './abuse-reason.model.js'+export * from './abuse-state.model.js'+export * from './abuse-update.model.js'+export * from './abuse-video-is.type.js'+export * from './abuse.model.js'diff --git a/shared/models/moderation/account-block.model.ts b/packages/models/src/moderation/account-block.model.tssimilarity index 70%rename from shared/models/moderation/account-block.model.tsrename to packages/models/src/moderation/account-block.model.tsindex a942ed614e..2d070da62f 100644--- a/shared/models/moderation/account-block.model.ts+++ b/packages/models/src/moderation/account-block.model.ts@@ -1,4 +1,4 @@-import { Account } from '../actors'+import { Account } from '../actors/index.js'export interface AccountBlock {byAccount: Accountdiff --git a/shared/models/moderation/block-status.model.ts b/packages/models/src/moderation/block-status.model.tssimilarity index 100%rename from shared/models/moderation/block-status.model.tsrename to packages/models/src/moderation/block-status.model.tsdiff --git a/packages/models/src/moderation/index.ts b/packages/models/src/moderation/index.tsnew file mode 100644index 0000000000..52e21e7b39--- /dev/null+++ b/packages/models/src/moderation/index.ts@@ -0,0 +1,4 @@+export * from './abuse/index.js'+export * from './block-status.model.js'+export * from './account-block.model.js'+export * from './server-block.model.js'diff --git a/shared/models/moderation/server-block.model.ts b/packages/models/src/moderation/server-block.model.tssimilarity index 73%rename from shared/models/moderation/server-block.model.tsrename to packages/models/src/moderation/server-block.model.tsindex a8b8af0b7f..b85646fc62 100644--- a/shared/models/moderation/server-block.model.ts+++ b/packages/models/src/moderation/server-block.model.ts@@ -1,4 +1,4 @@-import { Account } from '../actors'+import { Account } from '../actors/index.js'export interface ServerBlock {byAccount: Accountdiff --git a/packages/models/src/nodeinfo/index.ts b/packages/models/src/nodeinfo/index.tsnew file mode 100644index 0000000000..9322887951--- /dev/null+++ b/packages/models/src/nodeinfo/index.ts@@ -0,0 +1 @@+export * from './nodeinfo.model.js'diff --git a/shared/models/nodeinfo/nodeinfo.model.ts b/packages/models/src/nodeinfo/nodeinfo.model.tssimilarity index 100%rename from shared/models/nodeinfo/nodeinfo.model.tsrename to packages/models/src/nodeinfo/nodeinfo.model.tsdiff --git a/packages/models/src/overviews/index.ts b/packages/models/src/overviews/index.tsnew file mode 100644index 0000000000..20dc105e2b--- /dev/null+++ b/packages/models/src/overviews/index.ts@@ -0,0 +1 @@+export * from './videos-overview.model.js'diff --git a/shared/models/overviews/videos-overview.model.ts b/packages/models/src/overviews/videos-overview.model.tssimilarity index 96%rename from shared/models/overviews/videos-overview.model.tsrename to packages/models/src/overviews/videos-overview.model.tsindex 0f3cb4a529..3a1ba1760d 100644--- a/shared/models/overviews/videos-overview.model.ts+++ b/packages/models/src/overviews/videos-overview.model.ts@@ -1,4 +1,4 @@-import { Video, VideoChannelSummary, VideoConstant } from '../videos'+import { Video, VideoChannelSummary, VideoConstant } from '../videos/index.js'export interface ChannelOverview {channel: VideoChannelSummarydiff --git a/shared/models/plugins/client/client-hook.model.ts b/packages/models/src/plugins/client/client-hook.model.tssimilarity index 100%rename from shared/models/plugins/client/client-hook.model.tsrename to packages/models/src/plugins/client/client-hook.model.tsdiff --git a/packages/models/src/plugins/client/index.ts b/packages/models/src/plugins/client/index.tsnew file mode 100644index 0000000000..04fa32d6d4--- /dev/null+++ b/packages/models/src/plugins/client/index.ts@@ -0,0 +1,8 @@+export * from './client-hook.model.js'+export * from './plugin-client-scope.type.js'+export * from './plugin-element-placeholder.type.js'+export * from './plugin-selector-id.type.js'+export * from './register-client-form-field.model.js'+export * from './register-client-hook.model.js'+export * from './register-client-route.model.js'+export * from './register-client-settings-script.model.js'diff --git a/shared/models/plugins/client/plugin-client-scope.type.ts b/packages/models/src/plugins/client/plugin-client-scope.type.tssimilarity index 100%rename from shared/models/plugins/client/plugin-client-scope.type.tsrename to packages/models/src/plugins/client/plugin-client-scope.type.tsdiff --git a/shared/models/plugins/client/plugin-element-placeholder.type.ts b/packages/models/src/plugins/client/plugin-element-placeholder.type.tssimilarity index 100%rename from shared/models/plugins/client/plugin-element-placeholder.type.tsrename to packages/models/src/plugins/client/plugin-element-placeholder.type.tsdiff --git a/shared/models/plugins/client/plugin-selector-id.type.ts b/packages/models/src/plugins/client/plugin-selector-id.type.tssimilarity index 100%rename from shared/models/plugins/client/plugin-selector-id.type.tsrename to packages/models/src/plugins/client/plugin-selector-id.type.tsdiff --git a/shared/models/plugins/client/register-client-form-field.model.ts b/packages/models/src/plugins/client/register-client-form-field.model.tssimilarity index 100%rename from shared/models/plugins/client/register-client-form-field.model.tsrename to packages/models/src/plugins/client/register-client-form-field.model.tsdiff --git a/shared/models/plugins/client/register-client-hook.model.ts b/packages/models/src/plugins/client/register-client-hook.model.tssimilarity index 66%rename from shared/models/plugins/client/register-client-hook.model.tsrename to packages/models/src/plugins/client/register-client-hook.model.tsindex 81047b21d1..19159ed1e3 100644--- a/shared/models/plugins/client/register-client-hook.model.ts+++ b/packages/models/src/plugins/client/register-client-hook.model.ts@@ -1,4 +1,4 @@-import { ClientHookName } from './client-hook.model'+import { ClientHookName } from './client-hook.model.js'export interface RegisterClientHookOptions {target: ClientHookNamediff --git a/shared/models/plugins/client/register-client-route.model.ts b/packages/models/src/plugins/client/register-client-route.model.tssimilarity index 100%rename from shared/models/plugins/client/register-client-route.model.tsrename to packages/models/src/plugins/client/register-client-route.model.tsdiff --git a/shared/models/plugins/client/register-client-settings-script.model.ts b/packages/models/src/plugins/client/register-client-settings-script.model.tssimilarity index 73%rename from shared/models/plugins/client/register-client-settings-script.model.tsrename to packages/models/src/plugins/client/register-client-settings-script.model.tsindex 117ca47396..7de3c1c28b 100644--- a/shared/models/plugins/client/register-client-settings-script.model.ts+++ b/packages/models/src/plugins/client/register-client-settings-script.model.ts@@ -1,4 +1,4 @@-import { RegisterServerSettingOptions } from '../server'+import { RegisterServerSettingOptions } from '../server/index.js'export interface RegisterClientSettingsScriptOptions {isSettingHidden (options: {diff --git a/packages/models/src/plugins/hook-type.enum.ts b/packages/models/src/plugins/hook-type.enum.tsnew file mode 100644index 0000000000..7acc5f48aa--- /dev/null+++ b/packages/models/src/plugins/hook-type.enum.ts@@ -0,0 +1,7 @@+export const HookType = {+ STATIC: 1,+ ACTION: 2,+ FILTER: 3+} as const++export type HookType_Type = typeof HookType[keyof typeof HookType]diff --git a/packages/models/src/plugins/index.ts b/packages/models/src/plugins/index.tsnew file mode 100644index 0000000000..1117a946e3--- /dev/null+++ b/packages/models/src/plugins/index.ts@@ -0,0 +1,6 @@+export * from './client/index.js'+export * from './plugin-index/index.js'+export * from './server/index.js'+export * from './hook-type.enum.js'+export * from './plugin-package-json.model.js'+export * from './plugin.type.js'diff --git a/packages/models/src/plugins/plugin-index/index.ts b/packages/models/src/plugins/plugin-index/index.tsnew file mode 100644index 0000000000..f53b880849--- /dev/null+++ b/packages/models/src/plugins/plugin-index/index.ts@@ -0,0 +1,3 @@+export * from './peertube-plugin-index-list.model.js'+export * from './peertube-plugin-index.model.js'+export * from './peertube-plugin-latest-version.model.js'diff --git a/shared/models/plugins/plugin-index/peertube-plugin-index-list.model.ts b/packages/models/src/plugins/plugin-index/peertube-plugin-index-list.model.tssimilarity index 63%rename from shared/models/plugins/plugin-index/peertube-plugin-index-list.model.tsrename to packages/models/src/plugins/plugin-index/peertube-plugin-index-list.model.tsindex ecb46482ea..98301bbc13 100644--- a/shared/models/plugins/plugin-index/peertube-plugin-index-list.model.ts+++ b/packages/models/src/plugins/plugin-index/peertube-plugin-index-list.model.ts@@ -1,10 +1,10 @@-import { PluginType } from '../plugin.type'+import { PluginType_Type } from '../plugin.type.js'export interface PeertubePluginIndexList {start: numbercount: numbersort: string- pluginType?: PluginType+ pluginType?: PluginType_TypecurrentPeerTubeEngine?: stringsearch?: string}diff --git a/shared/models/plugins/plugin-index/peertube-plugin-index.model.ts b/packages/models/src/plugins/plugin-index/peertube-plugin-index.model.tssimilarity index 100%rename from shared/models/plugins/plugin-index/peertube-plugin-index.model.tsrename to packages/models/src/plugins/plugin-index/peertube-plugin-index.model.tsdiff --git a/shared/models/plugins/plugin-index/peertube-plugin-latest-version.model.ts b/packages/models/src/plugins/plugin-index/peertube-plugin-latest-version.model.tssimilarity index 100%rename from shared/models/plugins/plugin-index/peertube-plugin-latest-version.model.tsrename to packages/models/src/plugins/plugin-index/peertube-plugin-latest-version.model.tsdiff --git a/shared/models/plugins/plugin-package-json.model.ts b/packages/models/src/plugins/plugin-package-json.model.tssimilarity index 98%rename from shared/models/plugins/plugin-package-json.model.tsrename to packages/models/src/plugins/plugin-package-json.model.tsindex 7ce968ff23..5b9ccec560 100644--- a/shared/models/plugins/plugin-package-json.model.ts+++ b/packages/models/src/plugins/plugin-package-json.model.ts@@ -1,4 +1,4 @@-import { PluginClientScope } from './client/plugin-client-scope.type'+import { PluginClientScope } from './client/plugin-client-scope.type.js'export type PluginTranslationPathsJSON = {[ locale: string ]: stringdiff --git a/packages/models/src/plugins/plugin.type.ts b/packages/models/src/plugins/plugin.type.tsnew file mode 100644index 0000000000..7d03012e6d--- /dev/null+++ b/packages/models/src/plugins/plugin.type.ts@@ -0,0 +1,6 @@+export const PluginType = {+ PLUGIN: 1,+ THEME: 2+} as const++export type PluginType_Type = typeof PluginType[keyof typeof PluginType]diff --git a/packages/models/src/plugins/server/api/index.ts b/packages/models/src/plugins/server/api/index.tsnew file mode 100644index 0000000000..1e3842c467--- /dev/null+++ b/packages/models/src/plugins/server/api/index.ts@@ -0,0 +1,3 @@+export * from './install-plugin.model.js'+export * from './manage-plugin.model.js'+export * from './peertube-plugin.model.js'diff --git a/shared/models/plugins/server/api/install-plugin.model.ts b/packages/models/src/plugins/server/api/install-plugin.model.tssimilarity index 100%rename from shared/models/plugins/server/api/install-plugin.model.tsrename to packages/models/src/plugins/server/api/install-plugin.model.tsdiff --git a/shared/models/plugins/server/api/manage-plugin.model.ts b/packages/models/src/plugins/server/api/manage-plugin.model.tssimilarity index 100%rename from shared/models/plugins/server/api/manage-plugin.model.tsrename to packages/models/src/plugins/server/api/manage-plugin.model.tsdiff --git a/shared/models/plugins/server/api/peertube-plugin.model.ts b/packages/models/src/plugins/server/api/peertube-plugin.model.tssimilarity index 77%rename from shared/models/plugins/server/api/peertube-plugin.model.tsrename to packages/models/src/plugins/server/api/peertube-plugin.model.tsindex 54c383f57b..0bc1b095ba 100644--- a/shared/models/plugins/server/api/peertube-plugin.model.ts+++ b/packages/models/src/plugins/server/api/peertube-plugin.model.ts@@ -1,8 +1,8 @@-import { PluginType } from '../../plugin.type'+import { PluginType_Type } from '../../plugin.type.js'export interface PeerTubePlugin {name: string- type: PluginType+ type: PluginType_TypelatestVersion: stringversion: stringenabled: booleandiff --git a/packages/models/src/plugins/server/index.ts b/packages/models/src/plugins/server/index.tsnew file mode 100644index 0000000000..04412318b1--- /dev/null+++ b/packages/models/src/plugins/server/index.ts@@ -0,0 +1,7 @@+export * from './api/index.js'+export * from './managers/index.js'+export * from './settings/index.js'+export * from './plugin-constant-manager.model.js'+export * from './plugin-translation.model.js'+export * from './register-server-hook.model.js'+export * from './server-hook.model.js'diff --git a/packages/models/src/plugins/server/managers/index.ts b/packages/models/src/plugins/server/managers/index.tsnew file mode 100644index 0000000000..2433dd9bfd--- /dev/null+++ b/packages/models/src/plugins/server/managers/index.ts@@ -0,0 +1,9 @@++export * from './plugin-playlist-privacy-manager.model.js'+export * from './plugin-settings-manager.model.js'+export * from './plugin-storage-manager.model.js'+export * from './plugin-transcoding-manager.model.js'+export * from './plugin-video-category-manager.model.js'+export * from './plugin-video-language-manager.model.js'+export * from './plugin-video-licence-manager.model.js'+export * from './plugin-video-privacy-manager.model.js'diff --git a/shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-playlist-privacy-manager.model.tssimilarity index 52%rename from shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.tsrename to packages/models/src/plugins/server/managers/plugin-playlist-privacy-manager.model.tsindex 35247c1e37..212c910c5c 100644--- a/shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.ts+++ b/packages/models/src/plugins/server/managers/plugin-playlist-privacy-manager.model.ts@@ -1,12 +1,12 @@-import { VideoPlaylistPrivacy } from '../../../videos/playlist/video-playlist-privacy.model'-import { ConstantManager } from '../plugin-constant-manager.model'+import { VideoPlaylistPrivacyType } from '../../../videos/playlist/video-playlist-privacy.model.js'+import { ConstantManager } from '../plugin-constant-manager.model.js'-export interface PluginPlaylistPrivacyManager extends ConstantManager<VideoPlaylistPrivacy> {+export interface PluginPlaylistPrivacyManager extends ConstantManager<VideoPlaylistPrivacyType> {/*** PUBLIC = 1,* UNLISTED = 2,* PRIVATE = 3* @deprecated use `deleteConstant` instead*/- deletePlaylistPrivacy: (privacyKey: VideoPlaylistPrivacy) => boolean+ deletePlaylistPrivacy: (privacyKey: VideoPlaylistPrivacyType) => boolean}diff --git a/shared/models/plugins/server/managers/plugin-settings-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-settings-manager.model.tssimilarity index 100%rename from shared/models/plugins/server/managers/plugin-settings-manager.model.tsrename to packages/models/src/plugins/server/managers/plugin-settings-manager.model.tsdiff --git a/shared/models/plugins/server/managers/plugin-storage-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-storage-manager.model.tssimilarity index 100%rename from shared/models/plugins/server/managers/plugin-storage-manager.model.tsrename to packages/models/src/plugins/server/managers/plugin-storage-manager.model.tsdiff --git a/shared/models/plugins/server/managers/plugin-transcoding-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-transcoding-manager.model.tssimilarity index 97%rename from shared/models/plugins/server/managers/plugin-transcoding-manager.model.tsrename to packages/models/src/plugins/server/managers/plugin-transcoding-manager.model.tsindex b6fb46ba01..235f5c65dd 100644--- a/shared/models/plugins/server/managers/plugin-transcoding-manager.model.ts+++ b/packages/models/src/plugins/server/managers/plugin-transcoding-manager.model.ts@@ -1,4 +1,4 @@-import { EncoderOptionsBuilder } from '../../../videos/transcoding'+import { EncoderOptionsBuilder } from '../../../videos/transcoding/index.js'export interface PluginTranscodingManager {addLiveProfile (encoder: string, profile: string, builder: EncoderOptionsBuilder): booleandiff --git a/shared/models/plugins/server/managers/plugin-video-category-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-video-category-manager.model.tssimilarity index 98%rename from shared/models/plugins/server/managers/plugin-video-category-manager.model.tsrename to packages/models/src/plugins/server/managers/plugin-video-category-manager.model.tsindex cf3d828fe3..9da691e11f 100644--- a/shared/models/plugins/server/managers/plugin-video-category-manager.model.ts+++ b/packages/models/src/plugins/server/managers/plugin-video-category-manager.model.ts@@ -1,4 +1,4 @@-import { ConstantManager } from '../plugin-constant-manager.model'+import { ConstantManager } from '../plugin-constant-manager.model.js'export interface PluginVideoCategoryManager extends ConstantManager<number> {/**diff --git a/shared/models/plugins/server/managers/plugin-video-language-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-video-language-manager.model.tssimilarity index 98%rename from shared/models/plugins/server/managers/plugin-video-language-manager.model.tsrename to packages/models/src/plugins/server/managers/plugin-video-language-manager.model.tsindex 69fc8e5034..7124860756 100644--- a/shared/models/plugins/server/managers/plugin-video-language-manager.model.ts+++ b/packages/models/src/plugins/server/managers/plugin-video-language-manager.model.ts@@ -1,4 +1,4 @@-import { ConstantManager } from '../plugin-constant-manager.model'+import { ConstantManager } from '../plugin-constant-manager.model.js'export interface PluginVideoLanguageManager extends ConstantManager<string> {/**diff --git a/shared/models/plugins/server/managers/plugin-video-licence-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-video-licence-manager.model.tssimilarity index 98%rename from shared/models/plugins/server/managers/plugin-video-licence-manager.model.tsrename to packages/models/src/plugins/server/managers/plugin-video-licence-manager.model.tsindex 21b422270a..cebae8d95c 100644--- a/shared/models/plugins/server/managers/plugin-video-licence-manager.model.ts+++ b/packages/models/src/plugins/server/managers/plugin-video-licence-manager.model.ts@@ -1,4 +1,4 @@-import { ConstantManager } from '../plugin-constant-manager.model'+import { ConstantManager } from '../plugin-constant-manager.model.js'export interface PluginVideoLicenceManager extends ConstantManager<number> {/**diff --git a/shared/models/plugins/server/managers/plugin-video-privacy-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-video-privacy-manager.model.tssimilarity index 61%rename from shared/models/plugins/server/managers/plugin-video-privacy-manager.model.tsrename to packages/models/src/plugins/server/managers/plugin-video-privacy-manager.model.tsindex a237037db2..260cee6835 100644--- a/shared/models/plugins/server/managers/plugin-video-privacy-manager.model.ts+++ b/packages/models/src/plugins/server/managers/plugin-video-privacy-manager.model.ts@@ -1,7 +1,7 @@-import { VideoPrivacy } from '../../../videos/video-privacy.enum'-import { ConstantManager } from '../plugin-constant-manager.model'+import { VideoPrivacyType } from '../../../videos/video-privacy.enum.js'+import { ConstantManager } from '../plugin-constant-manager.model.js'-export interface PluginVideoPrivacyManager extends ConstantManager<VideoPrivacy> {+export interface PluginVideoPrivacyManager extends ConstantManager<VideoPrivacyType> {/*** PUBLIC = 1,* UNLISTED = 2,@@ -9,5 +9,5 @@ export interface PluginVideoPrivacyManager extends ConstantManager<VideoPrivacy>* INTERNAL = 4* @deprecated use `deleteConstant` instead*/- deletePrivacy: (privacyKey: VideoPrivacy) => boolean+ deletePrivacy: (privacyKey: VideoPrivacyType) => boolean}diff --git a/shared/models/plugins/server/plugin-constant-manager.model.ts b/packages/models/src/plugins/server/plugin-constant-manager.model.tssimilarity index 100%rename from shared/models/plugins/server/plugin-constant-manager.model.tsrename to packages/models/src/plugins/server/plugin-constant-manager.model.tsdiff --git a/shared/models/plugins/server/plugin-translation.model.ts b/packages/models/src/plugins/server/plugin-translation.model.tssimilarity index 100%rename from shared/models/plugins/server/plugin-translation.model.tsrename to packages/models/src/plugins/server/plugin-translation.model.tsdiff --git a/shared/models/plugins/server/register-server-hook.model.ts b/packages/models/src/plugins/server/register-server-hook.model.tssimilarity index 66%rename from shared/models/plugins/server/register-server-hook.model.tsrename to packages/models/src/plugins/server/register-server-hook.model.tsindex 746fdc3291..05c883f1f7 100644--- a/shared/models/plugins/server/register-server-hook.model.ts+++ b/packages/models/src/plugins/server/register-server-hook.model.ts@@ -1,4 +1,4 @@-import { ServerHookName } from './server-hook.model'+import { ServerHookName } from './server-hook.model.js'export interface RegisterServerHookOptions {target: ServerHookNamediff --git a/shared/models/plugins/server/server-hook.model.ts b/packages/models/src/plugins/server/server-hook.model.tssimilarity index 100%rename from shared/models/plugins/server/server-hook.model.tsrename to packages/models/src/plugins/server/server-hook.model.tsdiff --git a/packages/models/src/plugins/server/settings/index.ts b/packages/models/src/plugins/server/settings/index.tsnew file mode 100644index 0000000000..4bdccaa4aa--- /dev/null+++ b/packages/models/src/plugins/server/settings/index.ts@@ -0,0 +1,2 @@+export * from './public-server.setting.js'+export * from './register-server-setting.model.js'diff --git a/shared/models/plugins/server/settings/public-server.setting.ts b/packages/models/src/plugins/server/settings/public-server.setting.tssimilarity index 90%rename from shared/models/plugins/server/settings/public-server.setting.tsrename to packages/models/src/plugins/server/settings/public-server.setting.tsindex d38e5424ad..0b6251aa33 100644--- a/shared/models/plugins/server/settings/public-server.setting.ts+++ b/packages/models/src/plugins/server/settings/public-server.setting.ts@@ -1,4 +1,4 @@-import { SettingEntries } from '../managers/plugin-settings-manager.model'+import { SettingEntries } from '../managers/plugin-settings-manager.model.js'export interface PublicServerSetting {publicSettings: SettingEntriesdiff --git a/shared/models/plugins/server/settings/register-server-setting.model.ts b/packages/models/src/plugins/server/settings/register-server-setting.model.tssimilarity index 85%rename from shared/models/plugins/server/settings/register-server-setting.model.tsrename to packages/models/src/plugins/server/settings/register-server-setting.model.tsindex d9a798cac0..8cde8eaaab 100644--- a/shared/models/plugins/server/settings/register-server-setting.model.ts+++ b/packages/models/src/plugins/server/settings/register-server-setting.model.ts@@ -1,4 +1,4 @@-import { RegisterClientFormFieldOptions } from '../../client'+import { RegisterClientFormFieldOptions } from '../../client/index.js'export type RegisterServerSettingOptions = RegisterClientFormFieldOptions & {// If the setting is not private, anyone can view its value (client code included)diff --git a/packages/models/src/redundancy/index.ts b/packages/models/src/redundancy/index.tsnew file mode 100644index 0000000000..89e8fe4649--- /dev/null+++ b/packages/models/src/redundancy/index.ts@@ -0,0 +1,4 @@+export * from './video-redundancies-filters.model.js'+export * from './video-redundancy-config-filter.type.js'+export * from './video-redundancy.model.js'+export * from './videos-redundancy-strategy.model.js'diff --git a/shared/models/redundancy/video-redundancies-filters.model.ts b/packages/models/src/redundancy/video-redundancies-filters.model.tssimilarity index 100%rename from shared/models/redundancy/video-redundancies-filters.model.tsrename to packages/models/src/redundancy/video-redundancies-filters.model.tsdiff --git a/shared/models/redundancy/video-redundancy-config-filter.type.ts b/packages/models/src/redundancy/video-redundancy-config-filter.type.tssimilarity index 100%rename from shared/models/redundancy/video-redundancy-config-filter.type.tsrename to packages/models/src/redundancy/video-redundancy-config-filter.type.tsdiff --git a/shared/models/redundancy/video-redundancy.model.ts b/packages/models/src/redundancy/video-redundancy.model.tssimilarity index 100%rename from shared/models/redundancy/video-redundancy.model.tsrename to packages/models/src/redundancy/video-redundancy.model.tsdiff --git a/shared/models/redundancy/videos-redundancy-strategy.model.ts b/packages/models/src/redundancy/videos-redundancy-strategy.model.tssimilarity index 100%rename from shared/models/redundancy/videos-redundancy-strategy.model.tsrename to packages/models/src/redundancy/videos-redundancy-strategy.model.tsdiff --git a/shared/models/runners/abort-runner-job-body.model.ts b/packages/models/src/runners/abort-runner-job-body.model.tssimilarity index 100%rename from shared/models/runners/abort-runner-job-body.model.tsrename to packages/models/src/runners/abort-runner-job-body.model.tsdiff --git a/shared/models/runners/accept-runner-job-body.model.ts b/packages/models/src/runners/accept-runner-job-body.model.tssimilarity index 100%rename from shared/models/runners/accept-runner-job-body.model.tsrename to packages/models/src/runners/accept-runner-job-body.model.tsdiff --git a/shared/models/runners/accept-runner-job-result.model.ts b/packages/models/src/runners/accept-runner-job-result.model.tssimilarity index 54%rename from shared/models/runners/accept-runner-job-result.model.tsrename to packages/models/src/runners/accept-runner-job-result.model.tsindex f2094b9453..ebb6059303 100644--- a/shared/models/runners/accept-runner-job-result.model.ts+++ b/packages/models/src/runners/accept-runner-job-result.model.ts@@ -1,5 +1,5 @@-import { RunnerJobPayload } from './runner-job-payload.model'-import { RunnerJob } from './runner-job.model'+import { RunnerJobPayload } from './runner-job-payload.model.js'+import { RunnerJob } from './runner-job.model.js'export interface AcceptRunnerJobResult <T extends RunnerJobPayload = RunnerJobPayload> {job: RunnerJob<T> & { jobToken: string }diff --git a/shared/models/runners/error-runner-job-body.model.ts b/packages/models/src/runners/error-runner-job-body.model.tssimilarity index 100%rename from shared/models/runners/error-runner-job-body.model.tsrename to packages/models/src/runners/error-runner-job-body.model.tsdiff --git a/packages/models/src/runners/index.ts b/packages/models/src/runners/index.tsnew file mode 100644index 0000000000..cfe997b647--- /dev/null+++ b/packages/models/src/runners/index.ts@@ -0,0 +1,21 @@+export * from './abort-runner-job-body.model.js'+export * from './accept-runner-job-body.model.js'+export * from './accept-runner-job-result.model.js'+export * from './error-runner-job-body.model.js'+export * from './list-runner-jobs-query.model.js'+export * from './list-runner-registration-tokens.model.js'+export * from './list-runners-query.model.js'+export * from './register-runner-body.model.js'+export * from './register-runner-result.model.js'+export * from './request-runner-job-body.model.js'+export * from './request-runner-job-result.model.js'+export * from './runner-job-payload.model.js'+export * from './runner-job-private-payload.model.js'+export * from './runner-job-state.model.js'+export * from './runner-job-success-body.model.js'+export * from './runner-job-type.type.js'+export * from './runner-job-update-body.model.js'+export * from './runner-job.model.js'+export * from './runner-registration-token.js'+export * from './runner.model.js'+export * from './unregister-runner-body.model.js'diff --git a/shared/models/runners/list-runner-jobs-query.model.ts b/packages/models/src/runners/list-runner-jobs-query.model.tssimilarity index 52%rename from shared/models/runners/list-runner-jobs-query.model.tsrename to packages/models/src/runners/list-runner-jobs-query.model.tsindex ef19b31faa..395fe4b926 100644--- a/shared/models/runners/list-runner-jobs-query.model.ts+++ b/packages/models/src/runners/list-runner-jobs-query.model.ts@@ -1,9 +1,9 @@-import { RunnerJobState } from './runner-job-state.model'+import { RunnerJobStateType } from './runner-job-state.model.js'export interface ListRunnerJobsQuery {start?: numbercount?: numbersort?: stringsearch?: string- stateOneOf?: RunnerJobState[]+ stateOneOf?: RunnerJobStateType[]}diff --git a/shared/models/runners/list-runner-registration-tokens.model.ts b/packages/models/src/runners/list-runner-registration-tokens.model.tssimilarity index 100%rename from shared/models/runners/list-runner-registration-tokens.model.tsrename to packages/models/src/runners/list-runner-registration-tokens.model.tsdiff --git a/shared/models/runners/list-runners-query.model.ts b/packages/models/src/runners/list-runners-query.model.tssimilarity index 100%rename from shared/models/runners/list-runners-query.model.tsrename to packages/models/src/runners/list-runners-query.model.tsdiff --git a/shared/models/runners/register-runner-body.model.ts b/packages/models/src/runners/register-runner-body.model.tssimilarity index 100%rename from shared/models/runners/register-runner-body.model.tsrename to packages/models/src/runners/register-runner-body.model.tsdiff --git a/shared/models/runners/register-runner-result.model.ts b/packages/models/src/runners/register-runner-result.model.tssimilarity index 100%rename from shared/models/runners/register-runner-result.model.tsrename to packages/models/src/runners/register-runner-result.model.tsdiff --git a/shared/models/runners/request-runner-job-body.model.ts b/packages/models/src/runners/request-runner-job-body.model.tssimilarity index 100%rename from shared/models/runners/request-runner-job-body.model.tsrename to packages/models/src/runners/request-runner-job-body.model.tsdiff --git a/shared/models/runners/request-runner-job-result.model.ts b/packages/models/src/runners/request-runner-job-result.model.tssimilarity index 58%rename from shared/models/runners/request-runner-job-result.model.tsrename to packages/models/src/runners/request-runner-job-result.model.tsindex 98601c42c2..30c8c640c0 100644--- a/shared/models/runners/request-runner-job-result.model.ts+++ b/packages/models/src/runners/request-runner-job-result.model.ts@@ -1,5 +1,5 @@-import { RunnerJobPayload } from './runner-job-payload.model'-import { RunnerJobType } from './runner-job-type.type'+import { RunnerJobPayload } from './runner-job-payload.model.js'+import { RunnerJobType } from './runner-job-type.type.js'export interface RequestRunnerJobResult <P extends RunnerJobPayload = RunnerJobPayload> {availableJobs: {diff --git a/shared/models/runners/runner-job-payload.model.ts b/packages/models/src/runners/runner-job-payload.model.tssimilarity index 96%rename from shared/models/runners/runner-job-payload.model.tsrename to packages/models/src/runners/runner-job-payload.model.tsindex 3dda6c51fc..19b9d649bb 100644--- a/shared/models/runners/runner-job-payload.model.ts+++ b/packages/models/src/runners/runner-job-payload.model.ts@@ -1,4 +1,4 @@-import { VideoStudioTaskPayload } from '../server'+import { VideoStudioTaskPayload } from '../server/index.js'export type RunnerJobVODPayload =RunnerJobVODWebVideoTranscodingPayload |diff --git a/shared/models/runners/runner-job-private-payload.model.ts b/packages/models/src/runners/runner-job-private-payload.model.tssimilarity index 95%rename from shared/models/runners/runner-job-private-payload.model.tsrename to packages/models/src/runners/runner-job-private-payload.model.tsindex 529034db88..c1205984ee 100644--- a/shared/models/runners/runner-job-private-payload.model.ts+++ b/packages/models/src/runners/runner-job-private-payload.model.ts@@ -1,4 +1,4 @@-import { VideoStudioTaskPayload } from '../server'+import { VideoStudioTaskPayload } from '../server/index.js'export type RunnerJobVODPrivatePayload =RunnerJobVODWebVideoTranscodingPrivatePayload |diff --git a/packages/models/src/runners/runner-job-state.model.ts b/packages/models/src/runners/runner-job-state.model.tsnew file mode 100644index 0000000000..07e1351215--- /dev/null+++ b/packages/models/src/runners/runner-job-state.model.ts@@ -0,0 +1,13 @@+export const RunnerJobState = {+ PENDING: 1,+ PROCESSING: 2,+ COMPLETED: 3,+ ERRORED: 4,+ WAITING_FOR_PARENT_JOB: 5,+ CANCELLED: 6,+ PARENT_ERRORED: 7,+ PARENT_CANCELLED: 8,+ COMPLETING: 9+} as const++export type RunnerJobStateType = typeof RunnerJobState[keyof typeof RunnerJobState]diff --git a/shared/models/runners/runner-job-success-body.model.ts b/packages/models/src/runners/runner-job-success-body.model.tssimilarity index 100%rename from shared/models/runners/runner-job-success-body.model.tsrename to packages/models/src/runners/runner-job-success-body.model.tsdiff --git a/shared/models/runners/runner-job-type.type.ts b/packages/models/src/runners/runner-job-type.type.tssimilarity index 100%rename from shared/models/runners/runner-job-type.type.tsrename to packages/models/src/runners/runner-job-type.type.tsdiff --git a/shared/models/runners/runner-job-update-body.model.ts b/packages/models/src/runners/runner-job-update-body.model.tssimilarity index 100%rename from shared/models/runners/runner-job-update-body.model.tsrename to packages/models/src/runners/runner-job-update-body.model.tsdiff --git a/shared/models/runners/runner-job.model.ts b/packages/models/src/runners/runner-job.model.tssimilarity index 69%rename from shared/models/runners/runner-job.model.tsrename to packages/models/src/runners/runner-job.model.tsindex 080093563e..6d6427396e 100644--- a/shared/models/runners/runner-job.model.ts+++ b/packages/models/src/runners/runner-job.model.ts@@ -1,15 +1,15 @@-import { VideoConstant } from '../videos'-import { RunnerJobPayload } from './runner-job-payload.model'-import { RunnerJobPrivatePayload } from './runner-job-private-payload.model'-import { RunnerJobState } from './runner-job-state.model'-import { RunnerJobType } from './runner-job-type.type'+import { VideoConstant } from '../videos/index.js'+import { RunnerJobPayload } from './runner-job-payload.model.js'+import { RunnerJobPrivatePayload } from './runner-job-private-payload.model.js'+import { RunnerJobStateType } from './runner-job-state.model.js'+import { RunnerJobType } from './runner-job-type.type.js'export interface RunnerJob <T extends RunnerJobPayload = RunnerJobPayload> {uuid: stringtype: RunnerJobType- state: VideoConstant<RunnerJobState>+ state: VideoConstant<RunnerJobStateType>payload: T@@ -26,7 +26,7 @@ export interface RunnerJob <T extends RunnerJobPayload = RunnerJobPayload> {parent?: {type: RunnerJobType- state: VideoConstant<RunnerJobState>+ state: VideoConstant<RunnerJobStateType>uuid: string}diff --git a/shared/models/runners/runner-registration-token.ts b/packages/models/src/runners/runner-registration-token.tssimilarity index 100%rename from shared/models/runners/runner-registration-token.tsrename to packages/models/src/runners/runner-registration-token.tsdiff --git a/shared/models/runners/runner.model.ts b/packages/models/src/runners/runner.model.tssimilarity index 100%rename from shared/models/runners/runner.model.tsrename to packages/models/src/runners/runner.model.tsdiff --git a/shared/models/runners/unregister-runner-body.model.ts b/packages/models/src/runners/unregister-runner-body.model.tssimilarity index 100%rename from shared/models/runners/unregister-runner-body.model.tsrename to packages/models/src/runners/unregister-runner-body.model.tsdiff --git a/shared/models/search/boolean-both-query.model.ts b/packages/models/src/search/boolean-both-query.model.tssimilarity index 100%rename from shared/models/search/boolean-both-query.model.tsrename to packages/models/src/search/boolean-both-query.model.tsdiff --git a/packages/models/src/search/index.ts b/packages/models/src/search/index.tsnew file mode 100644index 0000000000..5c4de1eea8--- /dev/null+++ b/packages/models/src/search/index.ts@@ -0,0 +1,6 @@+export * from './boolean-both-query.model.js'+export * from './search-target-query.model.js'+export * from './videos-common-query.model.js'+export * from './video-channels-search-query.model.js'+export * from './video-playlists-search-query.model.js'+export * from './videos-search-query.model.js'diff --git a/shared/models/search/search-target-query.model.ts b/packages/models/src/search/search-target-query.model.tssimilarity index 100%rename from shared/models/search/search-target-query.model.tsrename to packages/models/src/search/search-target-query.model.tsdiff --git a/shared/models/search/video-channels-search-query.model.ts b/packages/models/src/search/video-channels-search-query.model.tssimilarity index 82%rename from shared/models/search/video-channels-search-query.model.tsrename to packages/models/src/search/video-channels-search-query.model.tsindex b68a1e80b4..7e84359cfb 100644--- a/shared/models/search/video-channels-search-query.model.ts+++ b/packages/models/src/search/video-channels-search-query.model.ts@@ -1,4 +1,4 @@-import { SearchTargetQuery } from './search-target-query.model'+import { SearchTargetQuery } from './search-target-query.model.js'export interface VideoChannelsSearchQuery extends SearchTargetQuery {search?: stringdiff --git a/shared/models/search/video-playlists-search-query.model.ts b/packages/models/src/search/video-playlists-search-query.model.tssimilarity index 83%rename from shared/models/search/video-playlists-search-query.model.tsrename to packages/models/src/search/video-playlists-search-query.model.tsindex d9027eb5bc..65ac7b4d71 100644--- a/shared/models/search/video-playlists-search-query.model.ts+++ b/packages/models/src/search/video-playlists-search-query.model.ts@@ -1,4 +1,4 @@-import { SearchTargetQuery } from './search-target-query.model'+import { SearchTargetQuery } from './search-target-query.model.js'export interface VideoPlaylistsSearchQuery extends SearchTargetQuery {search?: stringdiff --git a/shared/models/search/videos-common-query.model.ts b/packages/models/src/search/videos-common-query.model.tssimilarity index 71%rename from shared/models/search/videos-common-query.model.tsrename to packages/models/src/search/videos-common-query.model.tsindex f783d7534e..45181a7399 100644--- a/shared/models/search/videos-common-query.model.ts+++ b/packages/models/src/search/videos-common-query.model.ts@@ -1,6 +1,6 @@-import { VideoPrivacy } from '@shared/models'-import { VideoInclude } from '../videos/video-include.enum'-import { BooleanBothQuery } from './boolean-both-query.model'+import { VideoIncludeType } from '../videos/video-include.enum.js'+import { VideoPrivacyType } from '../videos/video-privacy.enum.js'+import { BooleanBothQuery } from './boolean-both-query.model.js'// These query parameters can be used with any endpoint that list videosexport interface VideosCommonQuery {@@ -13,7 +13,7 @@ export interface VideosCommonQuery {isLive?: booleanisLocal?: boolean- include?: VideoInclude+ include?: VideoIncludeTypecategoryOneOf?: number[]@@ -21,7 +21,7 @@ export interface VideosCommonQuery {languageOneOf?: string[]- privacyOneOf?: VideoPrivacy[]+ privacyOneOf?: VideoPrivacyType[]tagsOneOf?: string[]tagsAllOf?: string[]diff --git a/shared/models/search/videos-search-query.model.ts b/packages/models/src/search/videos-search-query.model.tssimilarity index 79%rename from shared/models/search/videos-search-query.model.tsrename to packages/models/src/search/videos-search-query.model.tsindex a5436879d5..bbaa8d23fc 100644--- a/shared/models/search/videos-search-query.model.ts+++ b/packages/models/src/search/videos-search-query.model.ts@@ -1,5 +1,5 @@-import { SearchTargetQuery } from './search-target-query.model'-import { VideosCommonQuery } from './videos-common-query.model'+import { SearchTargetQuery } from './search-target-query.model.js'+import { VideosCommonQuery } from './videos-common-query.model.js'export interface VideosSearchQuery extends SearchTargetQuery, VideosCommonQuery {search?: stringdiff --git a/shared/models/server/about.model.ts b/packages/models/src/server/about.model.tssimilarity index 100%rename from shared/models/server/about.model.tsrename to packages/models/src/server/about.model.tsdiff --git a/shared/models/server/broadcast-message-level.type.ts b/packages/models/src/server/broadcast-message-level.type.tssimilarity index 100%rename from shared/models/server/broadcast-message-level.type.tsrename to packages/models/src/server/broadcast-message-level.type.tsdiff --git a/shared/models/server/client-log-create.model.ts b/packages/models/src/server/client-log-create.model.tssimilarity index 71%rename from shared/models/server/client-log-create.model.tsrename to packages/models/src/server/client-log-create.model.tsindex c9dc655687..543af0d3d3 100644--- a/shared/models/server/client-log-create.model.ts+++ b/packages/models/src/server/client-log-create.model.ts@@ -1,4 +1,4 @@-import { ClientLogLevel } from './client-log-level.type'+import { ClientLogLevel } from './client-log-level.type.js'export interface ClientLogCreate {message: stringdiff --git a/shared/models/server/client-log-level.type.ts b/packages/models/src/server/client-log-level.type.tssimilarity index 100%rename from shared/models/server/client-log-level.type.tsrename to packages/models/src/server/client-log-level.type.tsdiff --git a/shared/models/server/contact-form.model.ts b/packages/models/src/server/contact-form.model.tssimilarity index 100%rename from shared/models/server/contact-form.model.tsrename to packages/models/src/server/contact-form.model.tsdiff --git a/shared/models/server/custom-config.model.ts b/packages/models/src/server/custom-config.model.tssimilarity index 98%rename from shared/models/server/custom-config.model.tsrename to packages/models/src/server/custom-config.model.tsindex 0dbb46fa88..df4176ba7f 100644--- a/shared/models/server/custom-config.model.ts+++ b/packages/models/src/server/custom-config.model.ts@@ -1,5 +1,5 @@-import { NSFWPolicyType } from '../videos/nsfw-policy.type'-import { BroadcastMessageLevel } from './broadcast-message-level.type'+import { NSFWPolicyType } from '../videos/nsfw-policy.type.js'+import { BroadcastMessageLevel } from './broadcast-message-level.type.js'export type ConfigResolutions = {'144p': booleandiff --git a/shared/models/server/debug.model.ts b/packages/models/src/server/debug.model.tssimilarity index 100%rename from shared/models/server/debug.model.tsrename to packages/models/src/server/debug.model.tsdiff --git a/shared/models/server/emailer.model.ts b/packages/models/src/server/emailer.model.tssimilarity index 100%rename from shared/models/server/emailer.model.tsrename to packages/models/src/server/emailer.model.tsdiff --git a/packages/models/src/server/index.ts b/packages/models/src/server/index.tsnew file mode 100644index 0000000000..ba6af8f6f0--- /dev/null+++ b/packages/models/src/server/index.ts@@ -0,0 +1,16 @@+export * from './about.model.js'+export * from './broadcast-message-level.type.js'+export * from './client-log-create.model.js'+export * from './client-log-level.type.js'+export * from './contact-form.model.js'+export * from './custom-config.model.js'+export * from './debug.model.js'+export * from './emailer.model.js'+export * from './job.model.js'+export * from './peertube-problem-document.model.js'+export * from './server-config.model.js'+export * from './server-debug.model.js'+export * from './server-error-code.enum.js'+export * from './server-follow-create.model.js'+export * from './server-log-level.type.js'+export * from './server-stats.model.js'diff --git a/shared/models/server/job.model.ts b/packages/models/src/server/job.model.tssimilarity index 94%rename from shared/models/server/job.model.tsrename to packages/models/src/server/job.model.tsindex c14806dabb..f86a20e282 100644--- a/shared/models/server/job.model.ts+++ b/packages/models/src/server/job.model.ts@@ -1,8 +1,7 @@-import { ContextType } from '../activitypub/context'-import { VideoState } from '../videos'-import { VideoResolution } from '../videos/file/video-resolution.enum'-import { VideoStudioTaskCut } from '../videos/studio'-import { SendEmailOptions } from './emailer.model'+import { ContextType } from '../activitypub/context.js'+import { VideoStateType } from '../videos/index.js'+import { VideoStudioTaskCut } from '../videos/studio/index.js'+import { SendEmailOptions } from './emailer.model.js'export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused' | 'waiting-children'@@ -144,7 +143,7 @@ interface BaseTranscodingPayload {export interface HLSTranscodingPayload extends BaseTranscodingPayload {type: 'new-resolution-to-hls'- resolution: VideoResolution+ resolution: numberfps: numbercopyCodecs: boolean@@ -153,14 +152,14 @@ export interface HLSTranscodingPayload extends BaseTranscodingPayload {export interface NewWebVideoResolutionTranscodingPayload extends BaseTranscodingPayload {type: 'new-resolution-to-web-video'- resolution: VideoResolution+ resolution: numberfps: number}export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {type: 'merge-audio-to-web-video'- resolution: VideoResolution+ resolution: numberfps: numberhasChildren: boolean@@ -200,7 +199,7 @@ export interface DeleteResumableUploadMetaFilePayload {export interface MoveObjectStoragePayload {videoUUID: stringisNewVideo: boolean- previousVideoState: VideoState+ previousVideoState: VideoStateType}export type VideoStudioTaskCutPayload = VideoStudioTaskCutdiff --git a/shared/models/server/peertube-problem-document.model.ts b/packages/models/src/server/peertube-problem-document.model.tssimilarity index 59%rename from shared/models/server/peertube-problem-document.model.tsrename to packages/models/src/server/peertube-problem-document.model.tsindex 83d9cea9bf..c717fc1529 100644--- a/shared/models/server/peertube-problem-document.model.ts+++ b/packages/models/src/server/peertube-problem-document.model.ts@@ -1,5 +1,5 @@-import { HttpStatusCode } from '../../models'-import { OAuth2ErrorCode, ServerErrorCode } from './server-error-code.enum'+import { HttpStatusCodeType } from '../http/http-status-codes.js'+import { OAuth2ErrorCodeType, ServerErrorCodeType } from './server-error-code.enum.js'export interface PeerTubeProblemDocumentData {'invalid-params'?: Record<string, object>@@ -22,11 +22,11 @@ export interface PeerTubeProblemDocument extends PeerTubeProblemDocumentData {title: stringdetail: string- // Compat PeerTube <= 3.2+ // FIXME: Compat PeerTube <= 3.2error: string- status: HttpStatusCode+ status: HttpStatusCodeTypedocs?: string- code?: ServerErrorCode | OAuth2ErrorCode+ code?: OAuth2ErrorCodeType | ServerErrorCodeType}diff --git a/shared/models/server/server-config.model.ts b/packages/models/src/server/server-config.model.tssimilarity index 96%rename from shared/models/server/server-config.model.tsrename to packages/models/src/server/server-config.model.tsindex 3f61e93b53..a2a2bd5aa3 100644--- a/shared/models/server/server-config.model.ts+++ b/packages/models/src/server/server-config.model.ts@@ -1,7 +1,7 @@-import { ClientScriptJSON } from '../plugins/plugin-package-json.model'-import { NSFWPolicyType } from '../videos/nsfw-policy.type'-import { VideoPrivacy } from '../videos/video-privacy.enum'-import { BroadcastMessageLevel } from './broadcast-message-level.type'+import { ClientScriptJSON } from '../plugins/plugin-package-json.model.js'+import { NSFWPolicyType } from '../videos/nsfw-policy.type.js'+import { VideoPrivacyType } from '../videos/video-privacy.enum.js'+import { BroadcastMessageLevel } from './broadcast-message-level.type.js'export interface ServerConfigPlugin {name: string@@ -57,7 +57,7 @@ export interface ServerConfig {publish: {downloadEnabled: booleancommentsEnabled: boolean- privacy: VideoPrivacy+ privacy: VideoPrivacyTypelicence: number}diff --git a/shared/models/server/server-debug.model.ts b/packages/models/src/server/server-debug.model.tssimilarity index 100%rename from shared/models/server/server-debug.model.tsrename to packages/models/src/server/server-debug.model.tsdiff --git a/shared/models/server/server-error-code.enum.ts b/packages/models/src/server/server-error-code.enum.tssimilarity index 55%rename from shared/models/server/server-error-code.enum.tsrename to packages/models/src/server/server-error-code.enum.tsindex 583e8245f4..dc200c1ea2 100644--- a/shared/models/server/server-error-code.enum.ts+++ b/packages/models/src/server/server-error-code.enum.ts@@ -1,67 +1,67 @@-export const enum ServerErrorCode {+export const ServerErrorCode = {/*** The simplest form of payload too large: when the file size is over the* global file size limit*/- MAX_FILE_SIZE_REACHED = 'max_file_size_reached',+ MAX_FILE_SIZE_REACHED:'max_file_size_reached',/*** The payload is too large for the user quota set*/- QUOTA_REACHED = 'quota_reached',+ QUOTA_REACHED:'quota_reached',/*** Error yielded upon trying to access a video that is not federated, nor can* be. This may be due to: remote videos on instances that are not followed by* yours, and with your instance disallowing unknown instances being accessed.*/- DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS = 'does_not_respect_follow_constraints',+ DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS:'does_not_respect_follow_constraints',- LIVE_NOT_ENABLED = 'live_not_enabled',- LIVE_NOT_ALLOWING_REPLAY = 'live_not_allowing_replay',- LIVE_CONFLICTING_PERMANENT_AND_SAVE_REPLAY = 'live_conflicting_permanent_and_save_replay',+ LIVE_NOT_ENABLED:'live_not_enabled',+ LIVE_NOT_ALLOWING_REPLAY:'live_not_allowing_replay',+ LIVE_CONFLICTING_PERMANENT_AND_SAVE_REPLAY:'live_conflicting_permanent_and_save_replay',/*** Pretty self-explanatory: the set maximum number of simultaneous lives was* reached, and this error is typically there to inform the user trying to* broadcast one.*/- MAX_INSTANCE_LIVES_LIMIT_REACHED = 'max_instance_lives_limit_reached',+ MAX_INSTANCE_LIVES_LIMIT_REACHED:'max_instance_lives_limit_reached',/*** Pretty self-explanatory: the set maximum number of simultaneous lives FOR* THIS USER was reached, and this error is typically there to inform the user* trying to broadcast one.*/- MAX_USER_LIVES_LIMIT_REACHED = 'max_user_lives_limit_reached',+ MAX_USER_LIVES_LIMIT_REACHED:'max_user_lives_limit_reached',/*** A torrent should have at most one correct video file. Any more and we will* not be able to choose automatically.*/- INCORRECT_FILES_IN_TORRENT = 'incorrect_files_in_torrent',+ INCORRECT_FILES_IN_TORRENT:'incorrect_files_in_torrent',- COMMENT_NOT_ASSOCIATED_TO_VIDEO = 'comment_not_associated_to_video',+ COMMENT_NOT_ASSOCIATED_TO_VIDEO:'comment_not_associated_to_video',- MISSING_TWO_FACTOR = 'missing_two_factor',- INVALID_TWO_FACTOR = 'invalid_two_factor',+ MISSING_TWO_FACTOR:'missing_two_factor',+ INVALID_TWO_FACTOR:'invalid_two_factor',- ACCOUNT_WAITING_FOR_APPROVAL = 'account_waiting_for_approval',- ACCOUNT_APPROVAL_REJECTED = 'account_approval_rejected',+ ACCOUNT_WAITING_FOR_APPROVAL:'account_waiting_for_approval',+ ACCOUNT_APPROVAL_REJECTED:'account_approval_rejected',- RUNNER_JOB_NOT_IN_PROCESSING_STATE = 'runner_job_not_in_processing_state',- RUNNER_JOB_NOT_IN_PENDING_STATE = 'runner_job_not_in_pending_state',- UNKNOWN_RUNNER_TOKEN = 'unknown_runner_token',+ RUNNER_JOB_NOT_IN_PROCESSING_STATE:'runner_job_not_in_processing_state',+ RUNNER_JOB_NOT_IN_PENDING_STATE:'runner_job_not_in_pending_state',+ UNKNOWN_RUNNER_TOKEN:'unknown_runner_token',- VIDEO_REQUIRES_PASSWORD = 'video_requires_password',- INCORRECT_VIDEO_PASSWORD = 'incorrect_video_password',+ VIDEO_REQUIRES_PASSWORD:'video_requires_password',+ INCORRECT_VIDEO_PASSWORD:'incorrect_video_password',- VIDEO_ALREADY_BEING_TRANSCODED = 'video_already_being_transcoded'-}+ VIDEO_ALREADY_BEING_TRANSCODED:'video_already_being_transcoded'+} as const/*** oauthjs/oauth2-server error codes* @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2**/-export const enum OAuth2ErrorCode {+export const OAuth2ErrorCode = {/*** The provided authorization grant (e.g., authorization code, resource owner* credentials) or refresh token is invalid, expired, revoked, does not match@@ -70,7 +70,7 @@ export const enum OAuth2ErrorCode {** @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-grant-error.js*/- INVALID_GRANT = 'invalid_grant',+ INVALID_GRANT: 'invalid_grant',/*** Client authentication failed (e.g., unknown client, no client authentication@@ -78,12 +78,15 @@ export const enum OAuth2ErrorCode {** @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-client-error.js*/- INVALID_CLIENT = 'invalid_client',+ INVALID_CLIENT: 'invalid_client',/*** The access token provided is expired, revoked, malformed, or invalid for other reasons** @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-token-error.js*/- INVALID_TOKEN = 'invalid_token'-}+ INVALID_TOKEN: 'invalid_token'+} as const++export type OAuth2ErrorCodeType = typeof OAuth2ErrorCode[keyof typeof OAuth2ErrorCode]+export type ServerErrorCodeType = typeof ServerErrorCode[keyof typeof ServerErrorCode]diff --git a/shared/models/server/server-follow-create.model.ts b/packages/models/src/server/server-follow-create.model.tssimilarity index 100%rename from shared/models/server/server-follow-create.model.tsrename to packages/models/src/server/server-follow-create.model.tsdiff --git a/shared/models/server/server-log-level.type.ts b/packages/models/src/server/server-log-level.type.tssimilarity index 100%rename from shared/models/server/server-log-level.type.tsrename to packages/models/src/server/server-log-level.type.tsdiff --git a/shared/models/server/server-stats.model.ts b/packages/models/src/server/server-stats.model.tssimilarity index 95%rename from shared/models/server/server-stats.model.tsrename to packages/models/src/server/server-stats.model.tsindex 82f5a737f3..5870ee73dd 100644--- a/shared/models/server/server-stats.model.ts+++ b/packages/models/src/server/server-stats.model.ts@@ -1,5 +1,5 @@-import { ActivityType } from '../activitypub'-import { VideoRedundancyStrategyWithManual } from '../redundancy'+import { ActivityType } from '../activitypub/index.js'+import { VideoRedundancyStrategyWithManual } from '../redundancy/index.js'type ActivityPubMessagesSuccess = Record<`totalActivityPub${ActivityType}MessagesSuccesses`, number>type ActivityPubMessagesErrors = Record<`totalActivityPub${ActivityType}MessagesErrors`, number>diff --git a/packages/models/src/tokens/index.ts b/packages/models/src/tokens/index.tsnew file mode 100644index 0000000000..db2d63d217--- /dev/null+++ b/packages/models/src/tokens/index.ts@@ -0,0 +1 @@+export * from './oauth-client-local.model.js'diff --git a/shared/models/tokens/oauth-client-local.model.ts b/packages/models/src/tokens/oauth-client-local.model.tssimilarity index 100%rename from shared/models/tokens/oauth-client-local.model.tsrename to packages/models/src/tokens/oauth-client-local.model.tsdiff --git a/packages/models/src/users/index.ts b/packages/models/src/users/index.tsnew file mode 100644index 0000000000..6f52182343--- /dev/null+++ b/packages/models/src/users/index.ts@@ -0,0 +1,16 @@+export * from './registration/index.js'+export * from './two-factor-enable-result.model.js'+export * from './user-create-result.model.js'+export * from './user-create.model.js'+export * from './user-flag.model.js'+export * from './user-login.model.js'+export * from './user-notification-setting.model.js'+export * from './user-notification.model.js'+export * from './user-refresh-token.model.js'+export * from './user-right.enum.js'+export * from './user-role.js'+export * from './user-scoped-token.js'+export * from './user-update-me.model.js'+export * from './user-update.model.js'+export * from './user-video-quota.model.js'+export * from './user.model.js'diff --git a/packages/models/src/users/registration/index.ts b/packages/models/src/users/registration/index.tsnew file mode 100644index 0000000000..dcf16ef9da--- /dev/null+++ b/packages/models/src/users/registration/index.ts@@ -0,0 +1,5 @@+export * from './user-register.model.js'+export * from './user-registration-request.model.js'+export * from './user-registration-state.model.js'+export * from './user-registration-update-state.model.js'+export * from './user-registration.model.js'diff --git a/shared/models/users/registration/user-register.model.ts b/packages/models/src/users/registration/user-register.model.tssimilarity index 100%rename from shared/models/users/registration/user-register.model.tsrename to packages/models/src/users/registration/user-register.model.tsdiff --git a/shared/models/users/registration/user-registration-request.model.ts b/packages/models/src/users/registration/user-registration-request.model.tssimilarity index 63%rename from shared/models/users/registration/user-registration-request.model.tsrename to packages/models/src/users/registration/user-registration-request.model.tsindex 6c38817e03..ed369f96ae 100644--- a/shared/models/users/registration/user-registration-request.model.ts+++ b/packages/models/src/users/registration/user-registration-request.model.ts@@ -1,4 +1,4 @@-import { UserRegister } from './user-register.model'+import { UserRegister } from './user-register.model.js'export interface UserRegistrationRequest extends UserRegister {registrationReason: stringdiff --git a/packages/models/src/users/registration/user-registration-state.model.ts b/packages/models/src/users/registration/user-registration-state.model.tsnew file mode 100644index 0000000000..7c51f3f9d7--- /dev/null+++ b/packages/models/src/users/registration/user-registration-state.model.ts@@ -0,0 +1,7 @@+export const UserRegistrationState = {+ PENDING: 1,+ REJECTED: 2,+ ACCEPTED: 3+}++export type UserRegistrationStateType = typeof UserRegistrationState[keyof typeof UserRegistrationState]diff --git a/shared/models/users/registration/user-registration-update-state.model.ts b/packages/models/src/users/registration/user-registration-update-state.model.tssimilarity index 100%rename from shared/models/users/registration/user-registration-update-state.model.tsrename to packages/models/src/users/registration/user-registration-update-state.model.tsdiff --git a/shared/models/users/registration/user-registration.model.ts b/packages/models/src/users/registration/user-registration.model.tssimilarity index 76%rename from shared/models/users/registration/user-registration.model.tsrename to packages/models/src/users/registration/user-registration.model.tsindex 0d74dc28b0..0d01add36d 100644--- a/shared/models/users/registration/user-registration.model.ts+++ b/packages/models/src/users/registration/user-registration.model.ts@@ -1,10 +1,10 @@-import { UserRegistrationState } from './user-registration-state.model'+import { UserRegistrationStateType } from './user-registration-state.model.js'export interface UserRegistration {id: numberstate: {- id: UserRegistrationState+ id: UserRegistrationStateTypelabel: string}diff --git a/shared/models/users/two-factor-enable-result.model.ts b/packages/models/src/users/two-factor-enable-result.model.tssimilarity index 100%rename from shared/models/users/two-factor-enable-result.model.tsrename to packages/models/src/users/two-factor-enable-result.model.tsdiff --git a/shared/models/users/user-create-result.model.ts b/packages/models/src/users/user-create-result.model.tssimilarity index 100%rename from shared/models/users/user-create-result.model.tsrename to packages/models/src/users/user-create-result.model.tsdiff --git a/shared/models/users/user-create.model.ts b/packages/models/src/users/user-create.model.tssimilarity index 50%rename from shared/models/users/user-create.model.tsrename to packages/models/src/users/user-create.model.tsindex ddc71dd598..b62cf692f9 100644--- a/shared/models/users/user-create.model.ts+++ b/packages/models/src/users/user-create.model.ts@@ -1,5 +1,5 @@-import { UserRole } from './user-role'-import { UserAdminFlag } from './user-flag.model'+import { UserAdminFlagType } from './user-flag.model.js'+import { UserRoleType } from './user-role.js'export interface UserCreate {username: string@@ -7,7 +7,7 @@ export interface UserCreate {email: stringvideoQuota: numbervideoQuotaDaily: number- role: UserRole- adminFlags?: UserAdminFlag+ role: UserRoleType+ adminFlags?: UserAdminFlagTypechannelName?: string}diff --git a/packages/models/src/users/user-flag.model.ts b/packages/models/src/users/user-flag.model.tsnew file mode 100644index 0000000000..0ecbacecc5--- /dev/null+++ b/packages/models/src/users/user-flag.model.ts@@ -0,0 +1,6 @@+export const UserAdminFlag = {+ NONE: 0,+ BYPASS_VIDEO_AUTO_BLACKLIST: 1 << 0+} as const++export type UserAdminFlagType = typeof UserAdminFlag[keyof typeof UserAdminFlag]diff --git a/shared/models/users/user-login.model.ts b/packages/models/src/users/user-login.model.tssimilarity index 100%rename from shared/models/users/user-login.model.tsrename to packages/models/src/users/user-login.model.tsdiff --git a/packages/models/src/users/user-notification-setting.model.ts b/packages/models/src/users/user-notification-setting.model.tsnew file mode 100644index 0000000000..fbd94994e5--- /dev/null+++ b/packages/models/src/users/user-notification-setting.model.ts@@ -0,0 +1,34 @@+export const UserNotificationSettingValue = {+ NONE: 0,+ WEB: 1 << 0,+ EMAIL: 1 << 1+} as const++export type UserNotificationSettingValueType = typeof UserNotificationSettingValue[keyof typeof UserNotificationSettingValue]++export interface UserNotificationSetting {+ abuseAsModerator: UserNotificationSettingValueType+ videoAutoBlacklistAsModerator: UserNotificationSettingValueType+ newUserRegistration: UserNotificationSettingValueType++ newVideoFromSubscription: UserNotificationSettingValueType++ blacklistOnMyVideo: UserNotificationSettingValueType+ myVideoPublished: UserNotificationSettingValueType+ myVideoImportFinished: UserNotificationSettingValueType++ commentMention: UserNotificationSettingValueType+ newCommentOnMyVideo: UserNotificationSettingValueType++ newFollow: UserNotificationSettingValueType+ newInstanceFollower: UserNotificationSettingValueType+ autoInstanceFollowing: UserNotificationSettingValueType++ abuseStateChange: UserNotificationSettingValueType+ abuseNewMessage: UserNotificationSettingValueType++ newPeerTubeVersion: UserNotificationSettingValueType+ newPluginVersion: UserNotificationSettingValueType++ myVideoStudioEditionFinished: UserNotificationSettingValueType+}diff --git a/shared/models/users/user-notification.model.ts b/packages/models/src/users/user-notification.model.tssimilarity index 57%rename from shared/models/users/user-notification.model.tsrename to packages/models/src/users/user-notification.model.tsindex 294c921bd7..991fe67284 100644--- a/shared/models/users/user-notification.model.ts+++ b/packages/models/src/users/user-notification.model.ts@@ -1,41 +1,43 @@-import { FollowState } from '../actors'-import { AbuseState } from '../moderation'-import { PluginType } from '../plugins'+import { FollowState } from '../actors/index.js'+import { AbuseStateType } from '../moderation/index.js'+import { PluginType_Type } from '../plugins/index.js'-export const enum UserNotificationType {- NEW_VIDEO_FROM_SUBSCRIPTION = 1,- NEW_COMMENT_ON_MY_VIDEO = 2,- NEW_ABUSE_FOR_MODERATORS = 3,+export const UserNotificationType = {+ NEW_VIDEO_FROM_SUBSCRIPTION: 1,+ NEW_COMMENT_ON_MY_VIDEO: 2,+ NEW_ABUSE_FOR_MODERATORS: 3,- BLACKLIST_ON_MY_VIDEO = 4,- UNBLACKLIST_ON_MY_VIDEO = 5,+ BLACKLIST_ON_MY_VIDEO: 4,+ UNBLACKLIST_ON_MY_VIDEO: 5,- MY_VIDEO_PUBLISHED = 6,+ MY_VIDEO_PUBLISHED: 6,- MY_VIDEO_IMPORT_SUCCESS = 7,- MY_VIDEO_IMPORT_ERROR = 8,+ MY_VIDEO_IMPORT_SUCCESS: 7,+ MY_VIDEO_IMPORT_ERROR: 8,- NEW_USER_REGISTRATION = 9,- NEW_FOLLOW = 10,- COMMENT_MENTION = 11,+ NEW_USER_REGISTRATION: 9,+ NEW_FOLLOW: 10,+ COMMENT_MENTION: 11,- VIDEO_AUTO_BLACKLIST_FOR_MODERATORS = 12,+ VIDEO_AUTO_BLACKLIST_FOR_MODERATORS: 12,- NEW_INSTANCE_FOLLOWER = 13,+ NEW_INSTANCE_FOLLOWER: 13,- AUTO_INSTANCE_FOLLOWING = 14,+ AUTO_INSTANCE_FOLLOWING: 14,- ABUSE_STATE_CHANGE = 15,+ ABUSE_STATE_CHANGE: 15,- ABUSE_NEW_MESSAGE = 16,+ ABUSE_NEW_MESSAGE: 16,- NEW_PLUGIN_VERSION = 17,- NEW_PEERTUBE_VERSION = 18,+ NEW_PLUGIN_VERSION: 17,+ NEW_PEERTUBE_VERSION: 18,- MY_VIDEO_STUDIO_EDITION_FINISHED = 19,+ MY_VIDEO_STUDIO_EDITION_FINISHED: 19,- NEW_USER_REGISTRATION_REQUEST = 20-}+ NEW_USER_REGISTRATION_REQUEST: 20+} as const++export type UserNotificationType_Type = typeof UserNotificationType[keyof typeof UserNotificationType]export interface VideoInfo {id: number@@ -61,7 +63,7 @@ export interface ActorInfo {export interface UserNotification {id: number- type: UserNotificationType+ type: UserNotificationType_Typeread: booleanvideo?: VideoInfo & {@@ -85,7 +87,7 @@ export interface UserNotification {abuse?: {id: number- state: AbuseState+ state: AbuseStateTypevideo?: VideoInfo@@ -120,7 +122,7 @@ export interface UserNotification {plugin?: {name: string- type: PluginType+ type: PluginType_TypelatestVersion: string}diff --git a/shared/models/users/user-refresh-token.model.ts b/packages/models/src/users/user-refresh-token.model.tssimilarity index 100%rename from shared/models/users/user-refresh-token.model.tsrename to packages/models/src/users/user-refresh-token.model.tsdiff --git a/packages/models/src/users/user-right.enum.ts b/packages/models/src/users/user-right.enum.tsnew file mode 100644index 0000000000..534b9feb05--- /dev/null+++ b/packages/models/src/users/user-right.enum.ts@@ -0,0 +1,53 @@+export const UserRight = {+ ALL: 0,++ MANAGE_USERS: 1,++ MANAGE_SERVER_FOLLOW: 2,++ MANAGE_LOGS: 3,++ MANAGE_DEBUG: 4,++ MANAGE_SERVER_REDUNDANCY: 5,++ MANAGE_ABUSES: 6,++ MANAGE_JOBS: 7,++ MANAGE_CONFIGURATION: 8,+ MANAGE_INSTANCE_CUSTOM_PAGE: 9,++ MANAGE_ACCOUNTS_BLOCKLIST: 10,+ MANAGE_SERVERS_BLOCKLIST: 11,++ MANAGE_VIDEO_BLACKLIST: 12,+ MANAGE_ANY_VIDEO_CHANNEL: 13,++ REMOVE_ANY_VIDEO: 14,+ REMOVE_ANY_VIDEO_PLAYLIST: 15,+ REMOVE_ANY_VIDEO_COMMENT: 16,++ UPDATE_ANY_VIDEO: 17,+ UPDATE_ANY_VIDEO_PLAYLIST: 18,++ GET_ANY_LIVE: 19,+ SEE_ALL_VIDEOS: 20,+ SEE_ALL_COMMENTS: 21,+ CHANGE_VIDEO_OWNERSHIP: 22,++ MANAGE_PLUGINS: 23,++ MANAGE_VIDEOS_REDUNDANCIES: 24,++ MANAGE_VIDEO_FILES: 25,+ RUN_VIDEO_TRANSCODING: 26,++ MANAGE_VIDEO_IMPORTS: 27,++ MANAGE_REGISTRATIONS: 28,++ MANAGE_RUNNERS: 29+} as const++export type UserRightType = typeof UserRight[keyof typeof UserRight]diff --git a/packages/models/src/users/user-role.ts b/packages/models/src/users/user-role.tsnew file mode 100644index 0000000000..b496f8153c--- /dev/null+++ b/packages/models/src/users/user-role.ts@@ -0,0 +1,8 @@+// Always keep this order to prevent security issue since we store these values in the database+export const UserRole = {+ ADMINISTRATOR: 0,+ MODERATOR: 1,+ USER: 2+} as const++export type UserRoleType = typeof UserRole[keyof typeof UserRole]diff --git a/shared/models/users/user-scoped-token.ts b/packages/models/src/users/user-scoped-token.tssimilarity index 100%rename from shared/models/users/user-scoped-token.tsrename to packages/models/src/users/user-scoped-token.tsdiff --git a/shared/models/users/user-update-me.model.ts b/packages/models/src/users/user-update-me.model.tssimilarity index 88%rename from shared/models/users/user-update-me.model.tsrename to packages/models/src/users/user-update-me.model.tsindex c1d5ffba4e..ba96721364 100644--- a/shared/models/users/user-update-me.model.ts+++ b/packages/models/src/users/user-update-me.model.ts@@ -1,4 +1,4 @@-import { NSFWPolicyType } from '../videos/nsfw-policy.type'+import { NSFWPolicyType } from '../videos/nsfw-policy.type.js'export interface UserUpdateMe {displayName?: stringdiff --git a/shared/models/users/user-update.model.ts b/packages/models/src/users/user-update.model.tssimilarity index 51%rename from shared/models/users/user-update.model.tsrename to packages/models/src/users/user-update.model.tsindex 1587385453..2832556292 100644--- a/shared/models/users/user-update.model.ts+++ b/packages/models/src/users/user-update.model.ts@@ -1,5 +1,5 @@-import { UserRole } from './user-role'-import { UserAdminFlag } from './user-flag.model'+import { UserAdminFlagType } from './user-flag.model.js'+import { UserRoleType } from './user-role.js'export interface UserUpdate {password?: string@@ -7,7 +7,7 @@ export interface UserUpdate {emailVerified?: booleanvideoQuota?: numbervideoQuotaDaily?: number- role?: UserRole- adminFlags?: UserAdminFlag+ role?: UserRoleType+ adminFlags?: UserAdminFlagTypepluginAuth?: string}diff --git a/shared/models/users/user-video-quota.model.ts b/packages/models/src/users/user-video-quota.model.tssimilarity index 100%rename from shared/models/users/user-video-quota.model.tsrename to packages/models/src/users/user-video-quota.model.tsdiff --git a/shared/models/users/user.model.ts b/packages/models/src/users/user.model.tssimilarity index 76%rename from shared/models/users/user.model.tsrename to packages/models/src/users/user.model.tsindex 9de4118b42..57b4c1aab4 100644--- a/shared/models/users/user.model.ts+++ b/packages/models/src/users/user.model.ts@@ -1,10 +1,10 @@-import { Account } from '../actors'-import { VideoChannel } from '../videos/channel/video-channel.model'-import { UserRole } from './user-role'-import { NSFWPolicyType } from '../videos/nsfw-policy.type'-import { UserNotificationSetting } from './user-notification-setting.model'-import { UserAdminFlag } from './user-flag.model'-import { VideoPlaylistType } from '../videos/playlist/video-playlist-type.model'+import { Account } from '../actors/index.js'+import { VideoChannel } from '../videos/channel/video-channel.model.js'+import { NSFWPolicyType } from '../videos/nsfw-policy.type.js'+import { VideoPlaylistType_Type } from '../videos/playlist/video-playlist-type.model.js'+import { UserAdminFlagType } from './user-flag.model.js'+import { UserNotificationSetting } from './user-notification-setting.model.js'+import { UserRoleType } from './user-role.js'export interface User {id: number@@ -16,7 +16,7 @@ export interface User {emailPublic: booleannsfwPolicy: NSFWPolicyType- adminFlags?: UserAdminFlag+ adminFlags?: UserAdminFlagTypeautoPlayVideo: booleanautoPlayNextVideo: boolean@@ -28,7 +28,7 @@ export interface User {videoLanguages: string[]role: {- id: UserRole+ id: UserRoleTypelabel: string}@@ -70,7 +70,7 @@ export interface User {export interface MyUserSpecialPlaylist {id: numbername: string- type: VideoPlaylistType+ type: VideoPlaylistType_Type}export interface MyUser extends User {diff --git a/packages/models/src/videos/blacklist/index.ts b/packages/models/src/videos/blacklist/index.tsnew file mode 100644index 0000000000..5eb36ad486--- /dev/null+++ b/packages/models/src/videos/blacklist/index.ts@@ -0,0 +1,3 @@+export * from './video-blacklist.model.js'+export * from './video-blacklist-create.model.js'+export * from './video-blacklist-update.model.js'diff --git a/shared/models/videos/blacklist/video-blacklist-create.model.ts b/packages/models/src/videos/blacklist/video-blacklist-create.model.tssimilarity index 100%rename from shared/models/videos/blacklist/video-blacklist-create.model.tsrename to packages/models/src/videos/blacklist/video-blacklist-create.model.tsdiff --git a/shared/models/videos/blacklist/video-blacklist-update.model.ts b/packages/models/src/videos/blacklist/video-blacklist-update.model.tssimilarity index 100%rename from shared/models/videos/blacklist/video-blacklist-update.model.tsrename to packages/models/src/videos/blacklist/video-blacklist-update.model.tsdiff --git a/packages/models/src/videos/blacklist/video-blacklist.model.ts b/packages/models/src/videos/blacklist/video-blacklist.model.tsnew file mode 100644index 0000000000..1ca5bbbb75--- /dev/null+++ b/packages/models/src/videos/blacklist/video-blacklist.model.ts@@ -0,0 +1,20 @@+import { Video } from '../video.model.js'++export const VideoBlacklistType = {+ MANUAL: 1,+ AUTO_BEFORE_PUBLISHED: 2+} as const++export type VideoBlacklistType_Type = typeof VideoBlacklistType[keyof typeof VideoBlacklistType]++export interface VideoBlacklist {+ id: number+ unfederated: boolean+ reason?: string+ type: VideoBlacklistType_Type++ video: Video++ createdAt: Date+ updatedAt: Date+}diff --git a/packages/models/src/videos/caption/index.ts b/packages/models/src/videos/caption/index.tsnew file mode 100644index 0000000000..a175768ce1--- /dev/null+++ b/packages/models/src/videos/caption/index.ts@@ -0,0 +1,2 @@+export * from './video-caption.model.js'+export * from './video-caption-update.model.js'diff --git a/shared/models/videos/caption/video-caption-update.model.ts b/packages/models/src/videos/caption/video-caption-update.model.tssimilarity index 100%rename from shared/models/videos/caption/video-caption-update.model.tsrename to packages/models/src/videos/caption/video-caption-update.model.tsdiff --git a/shared/models/videos/caption/video-caption.model.ts b/packages/models/src/videos/caption/video-caption.model.tssimilarity index 65%rename from shared/models/videos/caption/video-caption.model.tsrename to packages/models/src/videos/caption/video-caption.model.tsindex 6d56650063..d6d625ff7e 100644--- a/shared/models/videos/caption/video-caption.model.ts+++ b/packages/models/src/videos/caption/video-caption.model.ts@@ -1,4 +1,4 @@-import { VideoConstant } from '../video-constant.model'+import { VideoConstant } from '../video-constant.model.js'export interface VideoCaption {language: VideoConstant<string>diff --git a/packages/models/src/videos/change-ownership/index.ts b/packages/models/src/videos/change-ownership/index.tsnew file mode 100644index 0000000000..6cf568f4ef--- /dev/null+++ b/packages/models/src/videos/change-ownership/index.ts@@ -0,0 +1,3 @@+export * from './video-change-ownership-accept.model.js'+export * from './video-change-ownership-create.model.js'+export * from './video-change-ownership.model.js'diff --git a/shared/models/videos/change-ownership/video-change-ownership-accept.model.ts b/packages/models/src/videos/change-ownership/video-change-ownership-accept.model.tssimilarity index 100%rename from shared/models/videos/change-ownership/video-change-ownership-accept.model.tsrename to packages/models/src/videos/change-ownership/video-change-ownership-accept.model.tsdiff --git a/shared/models/videos/change-ownership/video-change-ownership-create.model.ts b/packages/models/src/videos/change-ownership/video-change-ownership-create.model.tssimilarity index 100%rename from shared/models/videos/change-ownership/video-change-ownership-create.model.tsrename to packages/models/src/videos/change-ownership/video-change-ownership-create.model.tsdiff --git a/packages/models/src/videos/change-ownership/video-change-ownership.model.ts b/packages/models/src/videos/change-ownership/video-change-ownership.model.tsnew file mode 100644index 0000000000..353db37f04--- /dev/null+++ b/packages/models/src/videos/change-ownership/video-change-ownership.model.ts@@ -0,0 +1,19 @@+import { Account } from '../../actors/index.js'+import { Video } from '../video.model.js'++export interface VideoChangeOwnership {+ id: number+ status: VideoChangeOwnershipStatusType+ initiatorAccount: Account+ nextOwnerAccount: Account+ video: Video+ createdAt: Date+}++export const VideoChangeOwnershipStatus = {+ WAITING: 'WAITING',+ ACCEPTED: 'ACCEPTED',+ REFUSED: 'REFUSED'+} as const++export type VideoChangeOwnershipStatusType = typeof VideoChangeOwnershipStatus[keyof typeof VideoChangeOwnershipStatus]diff --git a/packages/models/src/videos/channel-sync/index.ts b/packages/models/src/videos/channel-sync/index.tsnew file mode 100644index 0000000000..206cbe1b63--- /dev/null+++ b/packages/models/src/videos/channel-sync/index.ts@@ -0,0 +1,3 @@+export * from './video-channel-sync-state.enum.js'+export * from './video-channel-sync.model.js'+export * from './video-channel-sync-create.model.js'diff --git a/shared/models/videos/channel-sync/video-channel-sync-create.model.ts b/packages/models/src/videos/channel-sync/video-channel-sync-create.model.tssimilarity index 100%rename from shared/models/videos/channel-sync/video-channel-sync-create.model.tsrename to packages/models/src/videos/channel-sync/video-channel-sync-create.model.tsdiff --git a/packages/models/src/videos/channel-sync/video-channel-sync-state.enum.ts b/packages/models/src/videos/channel-sync/video-channel-sync-state.enum.tsnew file mode 100644index 0000000000..047444bbc3--- /dev/null+++ b/packages/models/src/videos/channel-sync/video-channel-sync-state.enum.ts@@ -0,0 +1,8 @@+export const VideoChannelSyncState = {+ WAITING_FIRST_RUN: 1,+ PROCESSING: 2,+ SYNCED: 3,+ FAILED: 4+} as const++export type VideoChannelSyncStateType = typeof VideoChannelSyncState[keyof typeof VideoChannelSyncState]diff --git a/shared/models/videos/channel-sync/video-channel-sync.model.ts b/packages/models/src/videos/channel-sync/video-channel-sync.model.tssimilarity index 52%rename from shared/models/videos/channel-sync/video-channel-sync.model.tsrename to packages/models/src/videos/channel-sync/video-channel-sync.model.tsindex 73ac0615bc..38ac99668f 100644--- a/shared/models/videos/channel-sync/video-channel-sync.model.ts+++ b/packages/models/src/videos/channel-sync/video-channel-sync.model.ts@@ -1,6 +1,6 @@-import { VideoChannelSummary } from '../channel/video-channel.model'-import { VideoConstant } from '../video-constant.model'-import { VideoChannelSyncState } from './video-channel-sync-state.enum'+import { VideoChannelSummary } from '../channel/video-channel.model.js'+import { VideoConstant } from '../video-constant.model.js'+import { VideoChannelSyncStateType } from './video-channel-sync-state.enum.js'export interface VideoChannelSync {id: number@@ -9,6 +9,6 @@ export interface VideoChannelSync {createdAt: stringchannel: VideoChannelSummary- state: VideoConstant<VideoChannelSyncState>+ state: VideoConstant<VideoChannelSyncStateType>lastSyncAt: string}diff --git a/packages/models/src/videos/channel/index.ts b/packages/models/src/videos/channel/index.tsnew file mode 100644index 0000000000..3c96e80f00--- /dev/null+++ b/packages/models/src/videos/channel/index.ts@@ -0,0 +1,4 @@+export * from './video-channel-create-result.model.js'+export * from './video-channel-create.model.js'+export * from './video-channel-update.model.js'+export * from './video-channel.model.js'diff --git a/shared/models/videos/channel/video-channel-create-result.model.ts b/packages/models/src/videos/channel/video-channel-create-result.model.tssimilarity index 100%rename from shared/models/videos/channel/video-channel-create-result.model.tsrename to packages/models/src/videos/channel/video-channel-create-result.model.tsdiff --git a/shared/models/videos/channel/video-channel-create.model.ts b/packages/models/src/videos/channel/video-channel-create.model.tssimilarity index 100%rename from shared/models/videos/channel/video-channel-create.model.tsrename to packages/models/src/videos/channel/video-channel-create.model.tsdiff --git a/shared/models/videos/channel/video-channel-update.model.ts b/packages/models/src/videos/channel/video-channel-update.model.tssimilarity index 100%rename from shared/models/videos/channel/video-channel-update.model.tsrename to packages/models/src/videos/channel/video-channel-update.model.tsdiff --git a/shared/models/videos/channel/video-channel.model.ts b/packages/models/src/videos/channel/video-channel.model.tssimilarity index 82%rename from shared/models/videos/channel/video-channel.model.tsrename to packages/models/src/videos/channel/video-channel.model.tsindex ce5fc0e8d0..bb10f6da58 100644--- a/shared/models/videos/channel/video-channel.model.ts+++ b/packages/models/src/videos/channel/video-channel.model.ts@@ -1,5 +1,5 @@-import { Account, ActorImage } from '../../actors'-import { Actor } from '../../actors/actor.model'+import { Account, ActorImage } from '../../actors/index.js'+import { Actor } from '../../actors/actor.model.js'export type ViewsPerDate = {date: Datediff --git a/packages/models/src/videos/comment/index.ts b/packages/models/src/videos/comment/index.tsnew file mode 100644index 0000000000..bd26c652d7--- /dev/null+++ b/packages/models/src/videos/comment/index.ts@@ -0,0 +1,2 @@+export * from './video-comment-create.model.js'+export * from './video-comment.model.js'diff --git a/shared/models/videos/comment/video-comment-create.model.ts b/packages/models/src/videos/comment/video-comment-create.model.tssimilarity index 100%rename from shared/models/videos/comment/video-comment-create.model.tsrename to packages/models/src/videos/comment/video-comment-create.model.tsdiff --git a/shared/models/videos/comment/video-comment.model.ts b/packages/models/src/videos/comment/video-comment.model.tssimilarity index 88%rename from shared/models/videos/comment/video-comment.model.tsrename to packages/models/src/videos/comment/video-comment.model.tsindex 737cfe0984..e2266545ab 100644--- a/shared/models/videos/comment/video-comment.model.ts+++ b/packages/models/src/videos/comment/video-comment.model.ts@@ -1,5 +1,5 @@-import { ResultList } from '../../common'-import { Account } from '../../actors'+import { ResultList } from '../../common/index.js'+import { Account } from '../../actors/index.js'export interface VideoComment {id: numberdiff --git a/packages/models/src/videos/file/index.ts b/packages/models/src/videos/file/index.tsnew file mode 100644index 0000000000..ee06f4e206--- /dev/null+++ b/packages/models/src/videos/file/index.ts@@ -0,0 +1,3 @@+export * from './video-file-metadata.model.js'+export * from './video-file.model.js'+export * from './video-resolution.enum.js'diff --git a/shared/models/videos/file/video-file-metadata.model.ts b/packages/models/src/videos/file/video-file-metadata.model.tssimilarity index 100%rename from shared/models/videos/file/video-file-metadata.model.tsrename to packages/models/src/videos/file/video-file-metadata.model.tsdiff --git a/shared/models/videos/file/video-file.model.ts b/packages/models/src/videos/file/video-file.model.tssimilarity index 54%rename from shared/models/videos/file/video-file.model.tsrename to packages/models/src/videos/file/video-file.model.tsindex 2bbff48eb6..2ed1ac4bee 100644--- a/shared/models/videos/file/video-file.model.ts+++ b/packages/models/src/videos/file/video-file.model.ts@@ -1,11 +1,10 @@-import { VideoConstant } from '../video-constant.model'-import { VideoFileMetadata } from './video-file-metadata.model'-import { VideoResolution } from './video-resolution.enum'+import { VideoConstant } from '../video-constant.model.js'+import { VideoFileMetadata } from './video-file-metadata.model.js'export interface VideoFile {id: number- resolution: VideoConstant<VideoResolution>+ resolution: VideoConstant<number>size: number // BytestorrentUrl: stringdiff --git a/packages/models/src/videos/file/video-resolution.enum.ts b/packages/models/src/videos/file/video-resolution.enum.tsnew file mode 100644index 0000000000..434e8c36d5--- /dev/null+++ b/packages/models/src/videos/file/video-resolution.enum.ts@@ -0,0 +1,13 @@+export const VideoResolution = {+ H_NOVIDEO: 0,+ H_144P: 144,+ H_240P: 240,+ H_360P: 360,+ H_480P: 480,+ H_720P: 720,+ H_1080P: 1080,+ H_1440P: 1440,+ H_4K: 2160+} as const++export type VideoResolutionType = typeof VideoResolution[keyof typeof VideoResolution]diff --git a/packages/models/src/videos/import/index.ts b/packages/models/src/videos/import/index.tsnew file mode 100644index 0000000000..6701674c50--- /dev/null+++ b/packages/models/src/videos/import/index.ts@@ -0,0 +1,4 @@+export * from './video-import-create.model.js'+export * from './video-import-state.enum.js'+export * from './video-import.model.js'+export * from './videos-import-in-channel-create.model.js'diff --git a/shared/models/videos/import/video-import-create.model.ts b/packages/models/src/videos/import/video-import-create.model.tssimilarity index 73%rename from shared/models/videos/import/video-import-create.model.tsrename to packages/models/src/videos/import/video-import-create.model.tsindex 4254773899..3ec0d22f36 100644--- a/shared/models/videos/import/video-import-create.model.ts+++ b/packages/models/src/videos/import/video-import-create.model.ts@@ -1,4 +1,4 @@-import { VideoUpdate } from '../video-update.model'+import { VideoUpdate } from '../video-update.model.js'export interface VideoImportCreate extends VideoUpdate {targetUrl?: stringdiff --git a/packages/models/src/videos/import/video-import-state.enum.ts b/packages/models/src/videos/import/video-import-state.enum.tsnew file mode 100644index 0000000000..475fdbe66c--- /dev/null+++ b/packages/models/src/videos/import/video-import-state.enum.ts@@ -0,0 +1,10 @@+export const VideoImportState = {+ PENDING: 1,+ SUCCESS: 2,+ FAILED: 3,+ REJECTED: 4,+ CANCELLED: 5,+ PROCESSING: 6+} as const++export type VideoImportStateType = typeof VideoImportState[keyof typeof VideoImportState]diff --git a/shared/models/videos/import/video-import.model.ts b/packages/models/src/videos/import/video-import.model.tssimilarity index 59%rename from shared/models/videos/import/video-import.model.tsrename to packages/models/src/videos/import/video-import.model.tsindex 6aed7a91a1..eef23f401d 100644--- a/shared/models/videos/import/video-import.model.ts+++ b/packages/models/src/videos/import/video-import.model.ts@@ -1,6 +1,6 @@-import { Video } from '../video.model'-import { VideoConstant } from '../video-constant.model'-import { VideoImportState } from './video-import-state.enum'+import { VideoConstant } from '../video-constant.model.js'+import { Video } from '../video.model.js'+import { VideoImportStateType } from './video-import-state.enum.js'export interface VideoImport {id: number@@ -12,7 +12,7 @@ export interface VideoImport {createdAt: stringupdatedAt: stringoriginallyPublishedAt?: string- state: VideoConstant<VideoImportState>+ state: VideoConstant<VideoImportStateType>error?: stringvideo?: Video & { tags: string[] }diff --git a/shared/models/videos/import/videos-import-in-channel-create.model.ts b/packages/models/src/videos/import/videos-import-in-channel-create.model.tssimilarity index 100%rename from shared/models/videos/import/videos-import-in-channel-create.model.tsrename to packages/models/src/videos/import/videos-import-in-channel-create.model.tsdiff --git a/packages/models/src/videos/index.ts b/packages/models/src/videos/index.tsnew file mode 100644index 0000000000..d131212c96--- /dev/null+++ b/packages/models/src/videos/index.ts@@ -0,0 +1,43 @@+export * from './blacklist/index.js'+export * from './caption/index.js'+export * from './change-ownership/index.js'+export * from './channel/index.js'+export * from './comment/index.js'+export * from './studio/index.js'+export * from './live/index.js'+export * from './file/index.js'+export * from './import/index.js'+export * from './playlist/index.js'+export * from './rate/index.js'+export * from './stats/index.js'+export * from './transcoding/index.js'+export * from './channel-sync/index.js'++export * from './nsfw-policy.type.js'++export * from './storyboard.model.js'+export * from './thumbnail.type.js'++export * from './video-constant.model.js'+export * from './video-create.model.js'++export * from './video-privacy.enum.js'+export * from './video-include.enum.js'+export * from './video-rate.type.js'++export * from './video-schedule-update.model.js'+export * from './video-sort-field.type.js'+export * from './video-state.enum.js'+export * from './video-storage.enum.js'+export * from './video-source.model.js'++export * from './video-streaming-playlist.model.js'+export * from './video-streaming-playlist.type.js'++export * from './video-token.model.js'++export * from './video-update.model.js'+export * from './video-view.model.js'+export * from './video.model.js'+export * from './video-create-result.model.js'+export * from './video-password.model.js'diff --git a/packages/models/src/videos/live/index.ts b/packages/models/src/videos/live/index.tsnew file mode 100644index 0000000000..1763eb5746--- /dev/null+++ b/packages/models/src/videos/live/index.ts@@ -0,0 +1,8 @@+export * from './live-video-create.model.js'+export * from './live-video-error.enum.js'+export * from './live-video-event-payload.model.js'+export * from './live-video-event.type.js'+export * from './live-video-latency-mode.enum.js'+export * from './live-video-session.model.js'+export * from './live-video-update.model.js'+export * from './live-video.model.js'diff --git a/packages/models/src/videos/live/live-video-create.model.ts b/packages/models/src/videos/live/live-video-create.model.tsnew file mode 100644index 0000000000..e4e39518c4--- /dev/null+++ b/packages/models/src/videos/live/live-video-create.model.ts@@ -0,0 +1,11 @@+import { VideoCreate } from '../video-create.model.js'+import { VideoPrivacyType } from '../video-privacy.enum.js'+import { LiveVideoLatencyModeType } from './live-video-latency-mode.enum.js'++export interface LiveVideoCreate extends VideoCreate {+ permanentLive?: boolean+ latencyMode?: LiveVideoLatencyModeType++ saveReplay?: boolean+ replaySettings?: { privacy: VideoPrivacyType }+}diff --git a/packages/models/src/videos/live/live-video-error.enum.ts b/packages/models/src/videos/live/live-video-error.enum.tsnew file mode 100644index 0000000000..cd92a1cfff--- /dev/null+++ b/packages/models/src/videos/live/live-video-error.enum.ts@@ -0,0 +1,11 @@+export const LiveVideoError = {+ BAD_SOCKET_HEALTH: 1,+ DURATION_EXCEEDED: 2,+ QUOTA_EXCEEDED: 3,+ FFMPEG_ERROR: 4,+ BLACKLISTED: 5,+ RUNNER_JOB_ERROR: 6,+ RUNNER_JOB_CANCEL: 7+} as const++export type LiveVideoErrorType = typeof LiveVideoError[keyof typeof LiveVideoError]diff --git a/packages/models/src/videos/live/live-video-event-payload.model.ts b/packages/models/src/videos/live/live-video-event-payload.model.tsnew file mode 100644index 0000000000..507f8d1532--- /dev/null+++ b/packages/models/src/videos/live/live-video-event-payload.model.ts@@ -0,0 +1,7 @@+import { VideoStateType } from '../video-state.enum.js'++export interface LiveVideoEventPayload {+ state?: VideoStateType++ viewers?: number+}diff --git a/shared/models/videos/live/live-video-event.type.ts b/packages/models/src/videos/live/live-video-event.type.tssimilarity index 100%rename from shared/models/videos/live/live-video-event.type.tsrename to packages/models/src/videos/live/live-video-event.type.tsdiff --git a/packages/models/src/videos/live/live-video-latency-mode.enum.ts b/packages/models/src/videos/live/live-video-latency-mode.enum.tsnew file mode 100644index 0000000000..6fd8fe8e90--- /dev/null+++ b/packages/models/src/videos/live/live-video-latency-mode.enum.ts@@ -0,0 +1,7 @@+export const LiveVideoLatencyMode = {+ DEFAULT: 1,+ HIGH_LATENCY: 2,+ SMALL_LATENCY: 3+} as const++export type LiveVideoLatencyModeType = typeof LiveVideoLatencyMode[keyof typeof LiveVideoLatencyMode]diff --git a/shared/models/videos/live/live-video-session.model.ts b/packages/models/src/videos/live/live-video-session.model.tssimilarity index 52%rename from shared/models/videos/live/live-video-session.model.tsrename to packages/models/src/videos/live/live-video-session.model.tsindex 888c20a8a1..8d45bc86a7 100644--- a/shared/models/videos/live/live-video-session.model.ts+++ b/packages/models/src/videos/live/live-video-session.model.ts@@ -1,5 +1,5 @@-import { VideoPrivacy } from '../video-privacy.enum'-import { LiveVideoError } from './live-video-error.enum'+import { VideoPrivacyType } from '../video-privacy.enum.js'+import { LiveVideoErrorType } from './live-video-error.enum.js'export interface LiveVideoSession {id: number@@ -7,12 +7,12 @@ export interface LiveVideoSession {startDate: stringendDate: string- error: LiveVideoError+ error: LiveVideoErrorTypesaveReplay: booleanendingProcessed: boolean- replaySettings?: { privacy: VideoPrivacy }+ replaySettings?: { privacy: VideoPrivacyType }replayVideo: {id: numberdiff --git a/packages/models/src/videos/live/live-video-update.model.ts b/packages/models/src/videos/live/live-video-update.model.tsnew file mode 100644index 0000000000..b4d91e4478--- /dev/null+++ b/packages/models/src/videos/live/live-video-update.model.ts@@ -0,0 +1,9 @@+import { VideoPrivacyType } from '../video-privacy.enum.js'+import { LiveVideoLatencyModeType } from './live-video-latency-mode.enum.js'++export interface LiveVideoUpdate {+ permanentLive?: boolean+ saveReplay?: boolean+ replaySettings?: { privacy: VideoPrivacyType }+ latencyMode?: LiveVideoLatencyModeType+}diff --git a/packages/models/src/videos/live/live-video.model.ts b/packages/models/src/videos/live/live-video.model.tsnew file mode 100644index 0000000000..3e91f677c4--- /dev/null+++ b/packages/models/src/videos/live/live-video.model.ts@@ -0,0 +1,14 @@+import { VideoPrivacyType } from '../video-privacy.enum.js'+import { LiveVideoLatencyModeType } from './live-video-latency-mode.enum.js'++export interface LiveVideo {+ // If owner+ rtmpUrl?: string+ rtmpsUrl?: string+ streamKey?: string++ saveReplay: boolean+ replaySettings?: { privacy: VideoPrivacyType }+ permanentLive: boolean+ latencyMode: LiveVideoLatencyModeType+}diff --git a/shared/models/videos/nsfw-policy.type.ts b/packages/models/src/videos/nsfw-policy.type.tssimilarity index 100%rename from shared/models/videos/nsfw-policy.type.tsrename to packages/models/src/videos/nsfw-policy.type.tsdiff --git a/packages/models/src/videos/playlist/index.ts b/packages/models/src/videos/playlist/index.tsnew file mode 100644index 0000000000..0e139657ac--- /dev/null+++ b/packages/models/src/videos/playlist/index.ts@@ -0,0 +1,12 @@+export * from './video-exist-in-playlist.model.js'+export * from './video-playlist-create-result.model.js'+export * from './video-playlist-create.model.js'+export * from './video-playlist-element-create-result.model.js'+export * from './video-playlist-element-create.model.js'+export * from './video-playlist-element-update.model.js'+export * from './video-playlist-element.model.js'+export * from './video-playlist-privacy.model.js'+export * from './video-playlist-reorder.model.js'+export * from './video-playlist-type.model.js'+export * from './video-playlist-update.model.js'+export * from './video-playlist.model.js'diff --git a/shared/models/videos/playlist/video-exist-in-playlist.model.ts b/packages/models/src/videos/playlist/video-exist-in-playlist.model.tssimilarity index 100%rename from shared/models/videos/playlist/video-exist-in-playlist.model.tsrename to packages/models/src/videos/playlist/video-exist-in-playlist.model.tsdiff --git a/shared/models/videos/playlist/video-playlist-create-result.model.ts b/packages/models/src/videos/playlist/video-playlist-create-result.model.tssimilarity index 100%rename from shared/models/videos/playlist/video-playlist-create-result.model.tsrename to packages/models/src/videos/playlist/video-playlist-create-result.model.tsdiff --git a/shared/models/videos/playlist/video-playlist-create.model.ts b/packages/models/src/videos/playlist/video-playlist-create.model.tssimilarity index 54%rename from shared/models/videos/playlist/video-playlist-create.model.tsrename to packages/models/src/videos/playlist/video-playlist-create.model.tsindex 67a33fa359..f9dd1e0d14 100644--- a/shared/models/videos/playlist/video-playlist-create.model.ts+++ b/packages/models/src/videos/playlist/video-playlist-create.model.ts@@ -1,8 +1,8 @@-import { VideoPlaylistPrivacy } from './video-playlist-privacy.model'+import { VideoPlaylistPrivacyType } from './video-playlist-privacy.model.js'export interface VideoPlaylistCreate {displayName: string- privacy: VideoPlaylistPrivacy+ privacy: VideoPlaylistPrivacyTypedescription?: stringvideoChannelId?: numberdiff --git a/shared/models/videos/playlist/video-playlist-element-create-result.model.ts b/packages/models/src/videos/playlist/video-playlist-element-create-result.model.tssimilarity index 100%rename from shared/models/videos/playlist/video-playlist-element-create-result.model.tsrename to packages/models/src/videos/playlist/video-playlist-element-create-result.model.tsdiff --git a/shared/models/videos/playlist/video-playlist-element-create.model.ts b/packages/models/src/videos/playlist/video-playlist-element-create.model.tssimilarity index 100%rename from shared/models/videos/playlist/video-playlist-element-create.model.tsrename to packages/models/src/videos/playlist/video-playlist-element-create.model.tsdiff --git a/shared/models/videos/playlist/video-playlist-element-update.model.ts b/packages/models/src/videos/playlist/video-playlist-element-update.model.tssimilarity index 100%rename from shared/models/videos/playlist/video-playlist-element-update.model.tsrename to packages/models/src/videos/playlist/video-playlist-element-update.model.tsdiff --git a/packages/models/src/videos/playlist/video-playlist-element.model.ts b/packages/models/src/videos/playlist/video-playlist-element.model.tsnew file mode 100644index 0000000000..a4711f9194--- /dev/null+++ b/packages/models/src/videos/playlist/video-playlist-element.model.ts@@ -0,0 +1,21 @@+import { Video } from '../video.model.js'++export const VideoPlaylistElementType = {+ REGULAR: 0,+ DELETED: 1,+ PRIVATE: 2,+ UNAVAILABLE: 3 // Blacklisted, blocked by the user/instance, NSFW...+} as const++export type VideoPlaylistElementType_Type = typeof VideoPlaylistElementType[keyof typeof VideoPlaylistElementType]++export interface VideoPlaylistElement {+ id: number+ position: number+ startTimestamp: number+ stopTimestamp: number++ type: VideoPlaylistElementType_Type++ video?: Video+}diff --git a/packages/models/src/videos/playlist/video-playlist-privacy.model.ts b/packages/models/src/videos/playlist/video-playlist-privacy.model.tsnew file mode 100644index 0000000000..23f6a1a16f--- /dev/null+++ b/packages/models/src/videos/playlist/video-playlist-privacy.model.ts@@ -0,0 +1,7 @@+export const VideoPlaylistPrivacy = {+ PUBLIC: 1,+ UNLISTED: 2,+ PRIVATE: 3+} as const++export type VideoPlaylistPrivacyType = typeof VideoPlaylistPrivacy[keyof typeof VideoPlaylistPrivacy]diff --git a/shared/models/videos/playlist/video-playlist-reorder.model.ts b/packages/models/src/videos/playlist/video-playlist-reorder.model.tssimilarity index 100%rename from shared/models/videos/playlist/video-playlist-reorder.model.tsrename to packages/models/src/videos/playlist/video-playlist-reorder.model.tsdiff --git a/packages/models/src/videos/playlist/video-playlist-type.model.ts b/packages/models/src/videos/playlist/video-playlist-type.model.tsnew file mode 100644index 0000000000..183439f988--- /dev/null+++ b/packages/models/src/videos/playlist/video-playlist-type.model.ts@@ -0,0 +1,6 @@+export const VideoPlaylistType = {+ REGULAR: 1,+ WATCH_LATER: 2+} as const++export type VideoPlaylistType_Type = typeof VideoPlaylistType[keyof typeof VideoPlaylistType]diff --git a/shared/models/videos/playlist/video-playlist-update.model.ts b/packages/models/src/videos/playlist/video-playlist-update.model.tssimilarity index 54%rename from shared/models/videos/playlist/video-playlist-update.model.tsrename to packages/models/src/videos/playlist/video-playlist-update.model.tsindex a6a3f74d96..ed536367e3 100644--- a/shared/models/videos/playlist/video-playlist-update.model.ts+++ b/packages/models/src/videos/playlist/video-playlist-update.model.ts@@ -1,8 +1,8 @@-import { VideoPlaylistPrivacy } from './video-playlist-privacy.model'+import { VideoPlaylistPrivacyType } from './video-playlist-privacy.model.js'export interface VideoPlaylistUpdate {displayName?: string- privacy?: VideoPlaylistPrivacy+ privacy?: VideoPlaylistPrivacyTypedescription?: stringvideoChannelId?: numberdiff --git a/packages/models/src/videos/playlist/video-playlist.model.ts b/packages/models/src/videos/playlist/video-playlist.model.tsnew file mode 100644index 0000000000..4261aac256--- /dev/null+++ b/packages/models/src/videos/playlist/video-playlist.model.ts@@ -0,0 +1,35 @@+import { AccountSummary } from '../../actors/index.js'+import { VideoChannelSummary } from '../channel/index.js'+import { VideoConstant } from '../video-constant.model.js'+import { VideoPlaylistPrivacyType } from './video-playlist-privacy.model.js'+import { VideoPlaylistType_Type } from './video-playlist-type.model.js'++export interface VideoPlaylist {+ id: number+ uuid: string+ shortUUID: string++ isLocal: boolean++ url: string++ displayName: string+ description: string+ privacy: VideoConstant<VideoPlaylistPrivacyType>++ thumbnailPath: string+ thumbnailUrl?: string++ videosLength: number++ type: VideoConstant<VideoPlaylistType_Type>++ embedPath: string+ embedUrl?: string++ createdAt: Date | string+ updatedAt: Date | string++ ownerAccount: AccountSummary+ videoChannel?: VideoChannelSummary+}diff --git a/packages/models/src/videos/rate/account-video-rate.model.ts b/packages/models/src/videos/rate/account-video-rate.model.tsnew file mode 100644index 0000000000..d19ccdbdd5--- /dev/null+++ b/packages/models/src/videos/rate/account-video-rate.model.ts@@ -0,0 +1,7 @@+import { UserVideoRateType } from './user-video-rate.type.js'+import { Video } from '../video.model.js'++export interface AccountVideoRate {+ video: Video+ rating: UserVideoRateType+}diff --git a/packages/models/src/videos/rate/index.ts b/packages/models/src/videos/rate/index.tsnew file mode 100644index 0000000000..ecbe3523d5--- /dev/null+++ b/packages/models/src/videos/rate/index.ts@@ -0,0 +1,5 @@++export * from './user-video-rate-update.model.js'+export * from './user-video-rate.model.js'+export * from './account-video-rate.model.js'+export * from './user-video-rate.type.js'diff --git a/shared/models/videos/rate/user-video-rate-update.model.ts b/packages/models/src/videos/rate/user-video-rate-update.model.tssimilarity index 53%rename from shared/models/videos/rate/user-video-rate-update.model.tsrename to packages/models/src/videos/rate/user-video-rate-update.model.tsindex 85e89271a4..8ee1e78ca0 100644--- a/shared/models/videos/rate/user-video-rate-update.model.ts+++ b/packages/models/src/videos/rate/user-video-rate-update.model.ts@@ -1,4 +1,4 @@-import { UserVideoRateType } from './user-video-rate.type'+import { UserVideoRateType } from './user-video-rate.type.js'export interface UserVideoRateUpdate {rating: UserVideoRateTypediff --git a/shared/models/videos/rate/user-video-rate.model.ts b/packages/models/src/videos/rate/user-video-rate.model.tssimilarity index 56%rename from shared/models/videos/rate/user-video-rate.model.tsrename to packages/models/src/videos/rate/user-video-rate.model.tsindex d39a1c3d54..344cf9a683 100644--- a/shared/models/videos/rate/user-video-rate.model.ts+++ b/packages/models/src/videos/rate/user-video-rate.model.ts@@ -1,4 +1,4 @@-import { UserVideoRateType } from './user-video-rate.type'+import { UserVideoRateType } from './user-video-rate.type.js'export interface UserVideoRate {videoId: numberdiff --git a/shared/models/videos/rate/user-video-rate.type.ts b/packages/models/src/videos/rate/user-video-rate.type.tssimilarity index 100%rename from shared/models/videos/rate/user-video-rate.type.tsrename to packages/models/src/videos/rate/user-video-rate.type.tsdiff --git a/packages/models/src/videos/stats/index.ts b/packages/models/src/videos/stats/index.tsnew file mode 100644index 0000000000..7187cac26a--- /dev/null+++ b/packages/models/src/videos/stats/index.ts@@ -0,0 +1,6 @@+export * from './video-stats-overall-query.model.js'+export * from './video-stats-overall.model.js'+export * from './video-stats-retention.model.js'+export * from './video-stats-timeserie-query.model.js'+export * from './video-stats-timeserie-metric.type.js'+export * from './video-stats-timeserie.model.js'diff --git a/shared/models/videos/stats/video-stats-overall-query.model.ts b/packages/models/src/videos/stats/video-stats-overall-query.model.tssimilarity index 100%rename from shared/models/videos/stats/video-stats-overall-query.model.tsrename to packages/models/src/videos/stats/video-stats-overall-query.model.tsdiff --git a/shared/models/videos/stats/video-stats-overall.model.ts b/packages/models/src/videos/stats/video-stats-overall.model.tssimilarity index 100%rename from shared/models/videos/stats/video-stats-overall.model.tsrename to packages/models/src/videos/stats/video-stats-overall.model.tsdiff --git a/shared/models/videos/stats/video-stats-retention.model.ts b/packages/models/src/videos/stats/video-stats-retention.model.tssimilarity index 100%rename from shared/models/videos/stats/video-stats-retention.model.tsrename to packages/models/src/videos/stats/video-stats-retention.model.tsdiff --git a/shared/models/videos/stats/video-stats-timeserie-metric.type.ts b/packages/models/src/videos/stats/video-stats-timeserie-metric.type.tssimilarity index 100%rename from shared/models/videos/stats/video-stats-timeserie-metric.type.tsrename to packages/models/src/videos/stats/video-stats-timeserie-metric.type.tsdiff --git a/shared/models/videos/stats/video-stats-timeserie-query.model.ts b/packages/models/src/videos/stats/video-stats-timeserie-query.model.tssimilarity index 100%rename from shared/models/videos/stats/video-stats-timeserie-query.model.tsrename to packages/models/src/videos/stats/video-stats-timeserie-query.model.tsdiff --git a/shared/models/videos/stats/video-stats-timeserie.model.ts b/packages/models/src/videos/stats/video-stats-timeserie.model.tssimilarity index 100%rename from shared/models/videos/stats/video-stats-timeserie.model.tsrename to packages/models/src/videos/stats/video-stats-timeserie.model.tsdiff --git a/shared/models/videos/storyboard.model.ts b/packages/models/src/videos/storyboard.model.tssimilarity index 100%rename from shared/models/videos/storyboard.model.tsrename to packages/models/src/videos/storyboard.model.tsdiff --git a/packages/models/src/videos/studio/index.ts b/packages/models/src/videos/studio/index.tsnew file mode 100644index 0000000000..0d8ad32276--- /dev/null+++ b/packages/models/src/videos/studio/index.ts@@ -0,0 +1 @@+export * from './video-studio-create-edit.model.js'diff --git a/shared/models/videos/studio/video-studio-create-edit.model.ts b/packages/models/src/videos/studio/video-studio-create-edit.model.tssimilarity index 100%rename from shared/models/videos/studio/video-studio-create-edit.model.tsrename to packages/models/src/videos/studio/video-studio-create-edit.model.tsdiff --git a/packages/models/src/videos/thumbnail.type.ts b/packages/models/src/videos/thumbnail.type.tsnew file mode 100644index 0000000000..0cb7483ec9--- /dev/null+++ b/packages/models/src/videos/thumbnail.type.ts@@ -0,0 +1,6 @@+export const ThumbnailType = {+ MINIATURE: 1,+ PREVIEW: 2+} as const++export type ThumbnailType_Type = typeof ThumbnailType[keyof typeof ThumbnailType]diff --git a/packages/models/src/videos/transcoding/index.ts b/packages/models/src/videos/transcoding/index.tsnew file mode 100644index 0000000000..e1d931bd54--- /dev/null+++ b/packages/models/src/videos/transcoding/index.ts@@ -0,0 +1,3 @@+export * from './video-transcoding-create.model.js'+export * from './video-transcoding-fps.model.js'+export * from './video-transcoding.model.js'diff --git a/shared/models/videos/transcoding/video-transcoding-create.model.ts b/packages/models/src/videos/transcoding/video-transcoding-create.model.tssimilarity index 100%rename from shared/models/videos/transcoding/video-transcoding-create.model.tsrename to packages/models/src/videos/transcoding/video-transcoding-create.model.tsdiff --git a/shared/models/videos/transcoding/video-transcoding-fps.model.ts b/packages/models/src/videos/transcoding/video-transcoding-fps.model.tssimilarity index 100%rename from shared/models/videos/transcoding/video-transcoding-fps.model.tsrename to packages/models/src/videos/transcoding/video-transcoding-fps.model.tsdiff --git a/shared/models/videos/transcoding/video-transcoding.model.ts b/packages/models/src/videos/transcoding/video-transcoding.model.tssimilarity index 92%rename from shared/models/videos/transcoding/video-transcoding.model.tsrename to packages/models/src/videos/transcoding/video-transcoding.model.tsindex 91eacf8dcb..e2c2a56e55 100644--- a/shared/models/videos/transcoding/video-transcoding.model.ts+++ b/packages/models/src/videos/transcoding/video-transcoding.model.ts@@ -1,11 +1,9 @@-import { VideoResolution } from '../file/video-resolution.enum'-// Types used by plugins and ffmpeg-utilsexport type EncoderOptionsBuilderParams = {input: string- resolution: VideoResolution+ resolution: number// If PeerTube applies a filter, transcoding profile must not copy input streamcanCopyAudio: booleandiff --git a/shared/models/videos/video-constant.model.ts b/packages/models/src/videos/video-constant.model.tssimilarity index 100%rename from shared/models/videos/video-constant.model.tsrename to packages/models/src/videos/video-constant.model.tsdiff --git a/shared/models/videos/video-create-result.model.ts b/packages/models/src/videos/video-create-result.model.tssimilarity index 100%rename from shared/models/videos/video-create-result.model.tsrename to packages/models/src/videos/video-create-result.model.tsdiff --git a/shared/models/videos/video-create.model.ts b/packages/models/src/videos/video-create.model.tssimilarity index 84%rename from shared/models/videos/video-create.model.tsrename to packages/models/src/videos/video-create.model.tsindex 7a34b5afef..472201211a 100644--- a/shared/models/videos/video-create.model.ts+++ b/packages/models/src/videos/video-create.model.ts@@ -1,5 +1,5 @@-import { VideoPrivacy } from './video-privacy.enum'-import { VideoScheduleUpdate } from './video-schedule-update.model'+import { VideoPrivacyType } from './video-privacy.enum.js'+import { VideoScheduleUpdate } from './video-schedule-update.model.js'export interface VideoCreate {name: string@@ -15,7 +15,7 @@ export interface VideoCreate {tags?: string[]commentsEnabled?: booleandownloadEnabled?: boolean- privacy: VideoPrivacy+ privacy: VideoPrivacyTypescheduleUpdate?: VideoScheduleUpdateoriginallyPublishedAt?: Date | stringvideoPasswords?: string[]diff --git a/packages/models/src/videos/video-include.enum.ts b/packages/models/src/videos/video-include.enum.tsnew file mode 100644index 0000000000..7d88a68901--- /dev/null+++ b/packages/models/src/videos/video-include.enum.ts@@ -0,0 +1,10 @@+export const VideoInclude = {+ NONE: 0,+ NOT_PUBLISHED_STATE: 1 << 0,+ BLACKLISTED: 1 << 1,+ BLOCKED_OWNER: 1 << 2,+ FILES: 1 << 3,+ CAPTIONS: 1 << 4+} as const++export type VideoIncludeType = typeof VideoInclude[keyof typeof VideoInclude]diff --git a/shared/models/videos/video-password.model.ts b/packages/models/src/videos/video-password.model.tssimilarity index 100%rename from shared/models/videos/video-password.model.tsrename to packages/models/src/videos/video-password.model.tsdiff --git a/packages/models/src/videos/video-privacy.enum.ts b/packages/models/src/videos/video-privacy.enum.tsnew file mode 100644index 0000000000..cbcc91b3fe--- /dev/null+++ b/packages/models/src/videos/video-privacy.enum.ts@@ -0,0 +1,9 @@+export const VideoPrivacy = {+ PUBLIC: 1,+ UNLISTED: 2,+ PRIVATE: 3,+ INTERNAL: 4,+ PASSWORD_PROTECTED: 5+} as const++export type VideoPrivacyType = typeof VideoPrivacy[keyof typeof VideoPrivacy]diff --git a/shared/models/videos/video-rate.type.ts b/packages/models/src/videos/video-rate.type.tssimilarity index 100%rename from shared/models/videos/video-rate.type.tsrename to packages/models/src/videos/video-rate.type.tsdiff --git a/packages/models/src/videos/video-schedule-update.model.ts b/packages/models/src/videos/video-schedule-update.model.tsnew file mode 100644index 0000000000..2e6a5551d3--- /dev/null+++ b/packages/models/src/videos/video-schedule-update.model.ts@@ -0,0 +1,7 @@+import { VideoPrivacy } from './video-privacy.enum.js'++export interface VideoScheduleUpdate {+ updateAt: Date | string+ // Cannot schedule an update to PRIVATE+ privacy?: typeof VideoPrivacy.PUBLIC | typeof VideoPrivacy.UNLISTED | typeof VideoPrivacy.INTERNAL+}diff --git a/shared/models/videos/video-sort-field.type.ts b/packages/models/src/videos/video-sort-field.type.tssimilarity index 100%rename from shared/models/videos/video-sort-field.type.tsrename to packages/models/src/videos/video-sort-field.type.tsdiff --git a/shared/models/videos/video-source.ts b/packages/models/src/videos/video-source.model.tssimilarity index 100%rename from shared/models/videos/video-source.tsrename to packages/models/src/videos/video-source.model.tsdiff --git a/packages/models/src/videos/video-state.enum.ts b/packages/models/src/videos/video-state.enum.tsnew file mode 100644index 0000000000..ae7c6a0c4f--- /dev/null+++ b/packages/models/src/videos/video-state.enum.ts@@ -0,0 +1,13 @@+export const VideoState = {+ PUBLISHED: 1,+ TO_TRANSCODE: 2,+ TO_IMPORT: 3,+ WAITING_FOR_LIVE: 4,+ LIVE_ENDED: 5,+ TO_MOVE_TO_EXTERNAL_STORAGE: 6,+ TRANSCODING_FAILED: 7,+ TO_MOVE_TO_EXTERNAL_STORAGE_FAILED: 8,+ TO_EDIT: 9+} as const++export type VideoStateType = typeof VideoState[keyof typeof VideoState]diff --git a/packages/models/src/videos/video-storage.enum.ts b/packages/models/src/videos/video-storage.enum.tsnew file mode 100644index 0000000000..de5c92e0d0--- /dev/null+++ b/packages/models/src/videos/video-storage.enum.ts@@ -0,0 +1,6 @@+export const VideoStorage = {+ FILE_SYSTEM: 0,+ OBJECT_STORAGE: 1+} as const++export type VideoStorageType = typeof VideoStorage[keyof typeof VideoStorage]diff --git a/shared/models/videos/video-streaming-playlist.model.ts b/packages/models/src/videos/video-streaming-playlist.model.tssimilarity index 50%rename from shared/models/videos/video-streaming-playlist.model.tsrename to packages/models/src/videos/video-streaming-playlist.model.tsindex 11919a4eec..80aa70e3c0 100644--- a/shared/models/videos/video-streaming-playlist.model.ts+++ b/packages/models/src/videos/video-streaming-playlist.model.ts@@ -1,9 +1,9 @@-import { VideoStreamingPlaylistType } from './video-streaming-playlist.type'-import { VideoFile } from './file'+import { VideoFile } from './file/index.js'+import { VideoStreamingPlaylistType_Type } from './video-streaming-playlist.type.js'export interface VideoStreamingPlaylist {id: number- type: VideoStreamingPlaylistType+ type: VideoStreamingPlaylistType_TypeplaylistUrl: stringsegmentsSha256Url: stringdiff --git a/packages/models/src/videos/video-streaming-playlist.type.ts b/packages/models/src/videos/video-streaming-playlist.type.tsnew file mode 100644index 0000000000..07a2c207ff--- /dev/null+++ b/packages/models/src/videos/video-streaming-playlist.type.ts@@ -0,0 +1,5 @@+export const VideoStreamingPlaylistType = {+ HLS: 1+} as const++export type VideoStreamingPlaylistType_Type = typeof VideoStreamingPlaylistType[keyof typeof VideoStreamingPlaylistType]diff --git a/shared/models/videos/video-token.model.ts b/packages/models/src/videos/video-token.model.tssimilarity index 100%rename from shared/models/videos/video-token.model.tsrename to packages/models/src/videos/video-token.model.tsdiff --git a/shared/models/videos/video-update.model.ts b/packages/models/src/videos/video-update.model.tssimilarity index 84%rename from shared/models/videos/video-update.model.tsrename to packages/models/src/videos/video-update.model.tsindex 43537b5afc..8af2981606 100644--- a/shared/models/videos/video-update.model.ts+++ b/packages/models/src/videos/video-update.model.ts@@ -1,5 +1,5 @@-import { VideoPrivacy } from './video-privacy.enum'-import { VideoScheduleUpdate } from './video-schedule-update.model'+import { VideoPrivacyType } from './video-privacy.enum.js'+import { VideoScheduleUpdate } from './video-schedule-update.model.js'export interface VideoUpdate {name?: string@@ -8,7 +8,7 @@ export interface VideoUpdate {language?: stringdescription?: stringsupport?: string- privacy?: VideoPrivacy+ privacy?: VideoPrivacyTypetags?: string[]commentsEnabled?: booleandownloadEnabled?: booleandiff --git a/shared/models/videos/video-view.model.ts b/packages/models/src/videos/video-view.model.tssimilarity index 100%rename from shared/models/videos/video-view.model.tsrename to packages/models/src/videos/video-view.model.tsdiff --git a/shared/models/videos/video.model.ts b/packages/models/src/videos/video.model.tssimilarity index 80%rename from shared/models/videos/video.model.tsrename to packages/models/src/videos/video.model.tsindex 7e5930067c..a750e220d1 100644--- a/shared/models/videos/video.model.ts+++ b/packages/models/src/videos/video.model.ts@@ -1,11 +1,11 @@-import { Account, AccountSummary } from '../actors'-import { VideoChannel, VideoChannelSummary } from './channel/video-channel.model'-import { VideoFile } from './file'-import { VideoConstant } from './video-constant.model'-import { VideoPrivacy } from './video-privacy.enum'-import { VideoScheduleUpdate } from './video-schedule-update.model'-import { VideoState } from './video-state.enum'-import { VideoStreamingPlaylist } from './video-streaming-playlist.model'+import { Account, AccountSummary } from '../actors/index.js'+import { VideoChannel, VideoChannelSummary } from './channel/video-channel.model.js'+import { VideoFile } from './file/index.js'+import { VideoConstant } from './video-constant.model.js'+import { VideoPrivacyType } from './video-privacy.enum.js'+import { VideoScheduleUpdate } from './video-schedule-update.model.js'+import { VideoStateType } from './video-state.enum.js'+import { VideoStreamingPlaylist } from './video-streaming-playlist.model.js'export interface Video extends Partial<VideoAdditionalAttributes> {id: number@@ -19,7 +19,7 @@ export interface Video extends Partial<VideoAdditionalAttributes> {category: VideoConstant<number>licence: VideoConstant<number>language: VideoConstant<string>- privacy: VideoConstant<VideoPrivacy>+ privacy: VideoConstant<VideoPrivacyType>// Deprecated in 5.0 in favour of truncatedDescriptiondescription: string@@ -62,7 +62,7 @@ export interface Video extends Partial<VideoAdditionalAttributes> {// Not included by default, needs query paramsexport interface VideoAdditionalAttributes {waitTranscoding: boolean- state: VideoConstant<VideoState>+ state: VideoConstant<VideoStateType>scheduledUpdate: VideoScheduleUpdateblacklisted: boolean@@ -88,7 +88,7 @@ export interface VideoDetails extends Video {// Not optional in details (unlike in parent Video)waitTranscoding: boolean- state: VideoConstant<VideoState>+ state: VideoConstant<VideoStateType>trackerUrls: string[]diff --git a/packages/models/tsconfig.json b/packages/models/tsconfig.jsonnew file mode 100644index 0000000000..58fa2330ba--- /dev/null+++ b/packages/models/tsconfig.json@@ -0,0 +1,8 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "outDir": "./dist",+ "rootDir": "src",+ "tsBuildInfoFile": "./dist/.tsbuildinfo"+ }+}diff --git a/shared/tsconfig.types.json b/packages/models/tsconfig.types.jsonsimilarity index 51%rename from shared/tsconfig.types.jsonrename to packages/models/tsconfig.types.jsonindex 6acfc05e15..997161c21f 100644--- a/shared/tsconfig.types.json+++ b/packages/models/tsconfig.types.json@@ -1,12 +1,10 @@{"extends": "./tsconfig.json","compilerOptions": {- "outDir": "../packages/types/dist/shared",+ "outDir": "../types-generator/dist/peertube-models",+ "tsBuildInfoFile": "../types-generator/dist/peertube-models/.tsbuildinfo","stripInternal": true,"removeComments": false,"emitDeclarationOnly": true- },- "exclude": [- "server-commands/"- ]+ }}diff --git a/packages/node-utils/package.json b/packages/node-utils/package.jsonnew file mode 100644index 0000000000..cd7d8ac804--- /dev/null+++ b/packages/node-utils/package.json@@ -0,0 +1,19 @@+{+ "name": "@peertube/peertube-node-utils",+ "private": true,+ "version": "0.0.0",+ "main": "dist/index.js",+ "files": [ "dist" ],+ "exports": {+ "types": "./dist/index.d.ts",+ "peertube:tsx": "./src/index.ts",+ "default": "./dist/index.js"+ },+ "type": "module",+ "devDependencies": {},+ "scripts": {+ "build": "tsc",+ "watch": "tsc -w"+ },+ "dependencies": {}+}diff --git a/shared/extra-utils/crypto.ts b/packages/node-utils/src/crypto.tssimilarity index 100%rename from shared/extra-utils/crypto.tsrename to packages/node-utils/src/crypto.tsdiff --git a/shared/core-utils/common/env.ts b/packages/node-utils/src/env.tssimilarity index 58%rename from shared/core-utils/common/env.tsrename to packages/node-utils/src/env.tsindex 973f895d4e..1a28f509e6 100644--- a/shared/core-utils/common/env.ts+++ b/packages/node-utils/src/env.ts@@ -1,12 +1,12 @@-function parallelTests () {+export function parallelTests () {return process.env.MOCHA_PARALLEL === 'true'}-function isGithubCI () {+export function isGithubCI () {return !!process.env.GITHUB_WORKSPACE}-function areHttpImportTestsDisabled () {+export function areHttpImportTestsDisabled () {const disabled = process.env.DISABLE_HTTP_IMPORT_TESTS === 'true'if (disabled) console.log('DISABLE_HTTP_IMPORT_TESTS env set to "true" so import tests are disabled')@@ -14,7 +14,7 @@ function areHttpImportTestsDisabled () {return disabled}-function areMockObjectStorageTestsDisabled () {+export function areMockObjectStorageTestsDisabled () {const disabled = process.env.ENABLE_OBJECT_STORAGE_TESTS !== 'true'if (disabled) console.log('ENABLE_OBJECT_STORAGE_TESTS env is not set to "true" so object storage tests are disabled')@@ -22,7 +22,7 @@ function areMockObjectStorageTestsDisabled () {return disabled}-function areScalewayObjectStorageTestsDisabled () {+export function areScalewayObjectStorageTestsDisabled () {if (areMockObjectStorageTestsDisabled()) return trueconst enabled = process.env.OBJECT_STORAGE_SCALEWAY_KEY_ID && process.env.OBJECT_STORAGE_SCALEWAY_ACCESS_KEY@@ -37,10 +37,22 @@ function areScalewayObjectStorageTestsDisabled () {return false}-export {- parallelTests,- isGithubCI,- areHttpImportTestsDisabled,- areMockObjectStorageTestsDisabled,- areScalewayObjectStorageTestsDisabled+export function isTestInstance () {+ return process.env.NODE_ENV === 'test'+}++export function isDevInstance () {+ return process.env.NODE_ENV === 'dev'+}++export function isTestOrDevInstance () {+ return isTestInstance() || isDevInstance()+}++export function isProdInstance () {+ return process.env.NODE_ENV === 'production'+}++export function getAppNumber () {+ return process.env.NODE_APP_INSTANCE || ''}diff --git a/shared/extra-utils/file.ts b/packages/node-utils/src/file.tssimilarity index 78%rename from shared/extra-utils/file.tsrename to packages/node-utils/src/file.tsindex 8060ab5209..89cf5fe0fc 100644--- a/shared/extra-utils/file.ts+++ b/packages/node-utils/src/file.ts@@ -1,4 +1,4 @@-import { stat } from 'fs-extra'+import { stat } from 'fs/promises'async function getFileSize (path: string) {const stats = await stat(path)diff --git a/packages/node-utils/src/index.ts b/packages/node-utils/src/index.tsnew file mode 100644index 0000000000..89f22e7d3c--- /dev/null+++ b/packages/node-utils/src/index.ts@@ -0,0 +1,5 @@+export * from './crypto.js'+export * from './env.js'+export * from './file.js'+export * from './path.js'+export * from './uuid.js'diff --git a/packages/node-utils/src/path.ts b/packages/node-utils/src/path.tsnew file mode 100644index 0000000000..1d569833ef--- /dev/null+++ b/packages/node-utils/src/path.ts@@ -0,0 +1,50 @@+import { basename, extname, isAbsolute, join, resolve } from 'path'+import { fileURLToPath } from 'url'++let rootPath: string++export function currentDir (metaUrl: string) {+ return resolve(fileURLToPath(metaUrl), '..')+}++export function root (metaUrl?: string) {+ if (rootPath) return rootPath++ if (!metaUrl) {+ metaUrl = import.meta.url++ const filename = basename(metaUrl) === 'path.js' || basename(metaUrl) === 'path.ts'+ if (!filename) throw new Error('meta url must be specified as this file has been bundled in another one')+ }++ rootPath = currentDir(metaUrl)++ if (basename(rootPath) === 'src' || basename(rootPath) === 'dist') rootPath = resolve(rootPath, '..')+ if ([ 'node-utils', 'peertube-cli', 'peertube-runner' ].includes(basename(rootPath))) rootPath = resolve(rootPath, '..')+ if ([ 'packages', 'apps' ].includes(basename(rootPath))) rootPath = resolve(rootPath, '..')+ if (basename(rootPath) === 'dist') rootPath = resolve(rootPath, '..')++ return rootPath+}++export function buildPath (path: string) {+ if (isAbsolute(path)) return path++ return join(root(), path)+}++export function getLowercaseExtension (filename: string) {+ const ext = extname(filename) || ''++ return ext.toLowerCase()+}++export function buildAbsoluteFixturePath (path: string, customCIPath = false) {+ if (isAbsolute(path)) return path++ if (customCIPath && process.env.GITHUB_WORKSPACE) {+ return join(process.env.GITHUB_WORKSPACE, 'fixtures', path)+ }++ return join(root(), 'packages', 'tests', 'fixtures', path)+}diff --git a/shared/extra-utils/uuid.ts b/packages/node-utils/src/uuid.tssimilarity index 89%rename from shared/extra-utils/uuid.tsrename to packages/node-utils/src/uuid.tsindex f3c80e046f..f158ec4878 100644--- a/shared/extra-utils/uuid.ts+++ b/packages/node-utils/src/uuid.ts@@ -1,9 +1,9 @@-import short, { uuid } from 'short-uuid'+import short from 'short-uuid'const translator = short()function buildUUID () {- return uuid()+ return short.uuid()}function uuidToShort (uuid: string) {diff --git a/packages/node-utils/tsconfig.json b/packages/node-utils/tsconfig.jsonnew file mode 100644index 0000000000..58fa2330ba--- /dev/null+++ b/packages/node-utils/tsconfig.json@@ -0,0 +1,8 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "outDir": "./dist",+ "rootDir": "src",+ "tsBuildInfoFile": "./dist/.tsbuildinfo"+ }+}diff --git a/packages/peertube-runner/.npmignore b/packages/peertube-runner/.npmignoredeleted file mode 100644index f38d9947c8..0000000000--- a/packages/peertube-runner/.npmignore+++ /dev/null@@ -1,6 +0,0 @@-register-server-shared-meta.json-peertube-runner.ts-tsconfig.jsondiff --git a/packages/peertube-runner/README.md b/packages/peertube-runner/README.mddeleted file mode 100644index 84974bb805..0000000000--- a/packages/peertube-runner/README.md+++ /dev/null@@ -1,29 +0,0 @@-# PeerTube runner--Runner program to execute jobs (transcoding...) of remote PeerTube instances.--Commands below has to be run at the root of PeerTube git repository.--## Develop--```bash-npm run dev:peertube-runner-```--## Build--```bash-npm run build:peertube-runner-```--## Run--```bash-node packages/peertube-runner/dist/peertube-runner.js --help-```--## Publish on NPM--```bash-(cd packages/peertube-runner && npm version patch) && npm run build:peertube-runner && (cd packages/peertube-runner && npm publish --access=public)-```diff --git a/packages/peertube-runner/register/index.ts b/packages/peertube-runner/register/index.tsdeleted file mode 100644index 3d4273ef87..0000000000--- a/packages/peertube-runner/register/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './register'diff --git a/packages/peertube-runner/server/index.ts b/packages/peertube-runner/server/index.tsdeleted file mode 100644index 3718365154..0000000000--- a/packages/peertube-runner/server/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './server'diff --git a/packages/peertube-runner/server/process/index.ts b/packages/peertube-runner/server/process/index.tsdeleted file mode 100644index 6caedbdaf3..0000000000--- a/packages/peertube-runner/server/process/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './shared'-export * from './process'diff --git a/packages/peertube-runner/server/process/shared/index.ts b/packages/peertube-runner/server/process/shared/index.tsdeleted file mode 100644index 556c51365a..0000000000--- a/packages/peertube-runner/server/process/shared/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './common'-export * from './process-vod'-export * from './transcoding-logger'diff --git a/packages/peertube-runner/server/shared/index.ts b/packages/peertube-runner/server/shared/index.tsdeleted file mode 100644index 5c86bafc0f..0000000000--- a/packages/peertube-runner/server/shared/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './supported-job'diff --git a/packages/peertube-runner/shared/index.ts b/packages/peertube-runner/shared/index.tsdeleted file mode 100644index d0b5a2e3ec..0000000000--- a/packages/peertube-runner/shared/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './config-manager'-export * from './http'-export * from './logger'diff --git a/packages/peertube-runner/shared/ipc/index.ts b/packages/peertube-runner/shared/ipc/index.tsdeleted file mode 100644index ad4590281c..0000000000--- a/packages/peertube-runner/shared/ipc/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './ipc-client'-export * from './ipc-server'diff --git a/packages/peertube-runner/shared/ipc/shared/index.ts b/packages/peertube-runner/shared/ipc/shared/index.tsdeleted file mode 100644index deaaa152ec..0000000000--- a/packages/peertube-runner/shared/ipc/shared/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './ipc-request.model'-export * from './ipc-response.model'diff --git a/packages/peertube-runner/tsconfig.json b/packages/peertube-runner/tsconfig.jsondeleted file mode 100644index b6c62bc34b..0000000000--- a/packages/peertube-runner/tsconfig.json+++ /dev/null@@ -1,9 +0,0 @@-{- "extends": "../../tsconfig.base.json",- "compilerOptions": {- "outDir": "./dist"- },- "references": [- { "path": "../../shared" }- ]-}diff --git a/packages/server-commands/package.json b/packages/server-commands/package.jsonnew file mode 100644index 0000000000..df97781986--- /dev/null+++ b/packages/server-commands/package.json@@ -0,0 +1,19 @@+{+ "name": "@peertube/peertube-server-commands",+ "private": true,+ "version": "0.0.0",+ "main": "dist/index.js",+ "files": [ "dist" ],+ "exports": {+ "types": "./dist/index.d.ts",+ "peertube:tsx": "./src/index.ts",+ "default": "./dist/index.js"+ },+ "type": "module",+ "devDependencies": {},+ "scripts": {+ "build": "tsc",+ "watch": "tsc -w"+ },+ "dependencies": {}+}diff --git a/shared/server-commands/bulk/bulk-command.ts b/packages/server-commands/src/bulk/bulk-command.tssimilarity index 83%rename from shared/server-commands/bulk/bulk-command.tsrename to packages/server-commands/src/bulk/bulk-command.tsindex b5c5673ce6..784836e196 100644--- a/shared/server-commands/bulk/bulk-command.ts+++ b/packages/server-commands/src/bulk/bulk-command.ts@@ -1,5 +1,5 @@-import { BulkRemoveCommentsOfBody, HttpStatusCode } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { BulkRemoveCommentsOfBody, HttpStatusCode } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class BulkCommand extends AbstractCommand {diff --git a/packages/server-commands/src/bulk/index.ts b/packages/server-commands/src/bulk/index.tsnew file mode 100644index 0000000000..903f7a282e--- /dev/null+++ b/packages/server-commands/src/bulk/index.ts@@ -0,0 +1 @@+export * from './bulk-command.js'diff --git a/shared/server-commands/cli/cli-command.ts b/packages/server-commands/src/cli/cli-command.tssimilarity index 92%rename from shared/server-commands/cli/cli-command.tsrename to packages/server-commands/src/cli/cli-command.tsindex ab9738174f..8b9400c857 100644--- a/shared/server-commands/cli/cli-command.ts+++ b/packages/server-commands/src/cli/cli-command.ts@@ -1,5 +1,5 @@import { exec } from 'child_process'-import { AbstractCommand } from '../shared'+import { AbstractCommand } from '../shared/index.js'export class CLICommand extends AbstractCommand {diff --git a/packages/server-commands/src/cli/index.ts b/packages/server-commands/src/cli/index.tsnew file mode 100644index 0000000000..d79b13a764--- /dev/null+++ b/packages/server-commands/src/cli/index.ts@@ -0,0 +1 @@+export * from './cli-command.js'diff --git a/shared/server-commands/custom-pages/custom-pages-command.ts b/packages/server-commands/src/custom-pages/custom-pages-command.tssimilarity index 90%rename from shared/server-commands/custom-pages/custom-pages-command.tsrename to packages/server-commands/src/custom-pages/custom-pages-command.tsindex cd869a8de6..412f3f7638 100644--- a/shared/server-commands/custom-pages/custom-pages-command.ts+++ b/packages/server-commands/src/custom-pages/custom-pages-command.ts@@ -1,5 +1,5 @@-import { CustomPage, HttpStatusCode } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { CustomPage, HttpStatusCode } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class CustomPagesCommand extends AbstractCommand {diff --git a/packages/server-commands/src/custom-pages/index.ts b/packages/server-commands/src/custom-pages/index.tsnew file mode 100644index 0000000000..67f537f074--- /dev/null+++ b/packages/server-commands/src/custom-pages/index.ts@@ -0,0 +1 @@+export * from './custom-pages-command.js'diff --git a/shared/server-commands/feeds/feeds-command.ts b/packages/server-commands/src/feeds/feeds-command.tssimilarity index 93%rename from shared/server-commands/feeds/feeds-command.tsrename to packages/server-commands/src/feeds/feeds-command.tsindex 26763b43e7..51bc45b7f0 100644--- a/shared/server-commands/feeds/feeds-command.ts+++ b/packages/server-commands/src/feeds/feeds-command.ts@@ -1,6 +1,6 @@-import { buildUUID } from '@shared/extra-utils'-import { HttpStatusCode } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { buildUUID } from '@peertube/peertube-node-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'type FeedType = 'videos' | 'video-comments' | 'subscriptions'diff --git a/packages/server-commands/src/feeds/index.ts b/packages/server-commands/src/feeds/index.tsnew file mode 100644index 0000000000..316ebb974d--- /dev/null+++ b/packages/server-commands/src/feeds/index.ts@@ -0,0 +1 @@+export * from './feeds-command.js'diff --git a/packages/server-commands/src/index.ts b/packages/server-commands/src/index.tsnew file mode 100644index 0000000000..382fe966ef--- /dev/null+++ b/packages/server-commands/src/index.ts@@ -0,0 +1,14 @@+export * from './bulk/index.js'+export * from './cli/index.js'+export * from './custom-pages/index.js'+export * from './feeds/index.js'+export * from './logs/index.js'+export * from './moderation/index.js'+export * from './overviews/index.js'+export * from './requests/index.js'+export * from './runners/index.js'+export * from './search/index.js'+export * from './server/index.js'+export * from './socket/index.js'+export * from './users/index.js'+export * from './videos/index.js'diff --git a/packages/server-commands/src/logs/index.ts b/packages/server-commands/src/logs/index.tsnew file mode 100644index 0000000000..37e77901cb--- /dev/null+++ b/packages/server-commands/src/logs/index.ts@@ -0,0 +1 @@+export * from './logs-command.js'diff --git a/shared/server-commands/logs/logs-command.ts b/packages/server-commands/src/logs/logs-command.tssimilarity index 97%rename from shared/server-commands/logs/logs-command.tsrename to packages/server-commands/src/logs/logs-command.tsindex 1c5de7f593..d5d11b9977 100644--- a/shared/server-commands/logs/logs-command.ts+++ b/packages/server-commands/src/logs/logs-command.ts@@ -1,5 +1,5 @@-import { ClientLogCreate, HttpStatusCode, ServerLogLevel } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { ClientLogCreate, HttpStatusCode, ServerLogLevel } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class LogsCommand extends AbstractCommand {diff --git a/shared/server-commands/moderation/abuses-command.ts b/packages/server-commands/src/moderation/abuses-command.tssimilarity index 95%rename from shared/server-commands/moderation/abuses-command.tsrename to packages/server-commands/src/moderation/abuses-command.tsindex 0db32ba467..e267709e24 100644--- a/shared/server-commands/moderation/abuses-command.ts+++ b/packages/server-commands/src/moderation/abuses-command.ts@@ -1,18 +1,18 @@-import { pick } from '@shared/core-utils'+import { pick } from '@peertube/peertube-core-utils'import {AbuseFilter,AbuseMessage,AbusePredefinedReasonsString,- AbuseState,+ AbuseStateType,AbuseUpdate,AbuseVideoIs,AdminAbuse,HttpStatusCode,ResultList,UserAbuse-} from '@shared/models'-import { unwrapBody } from '../requests/requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+} from '@peertube/peertube-models'+import { unwrapBody } from '../requests/requests.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class AbusesCommand extends AbstractCommand {@@ -74,7 +74,7 @@ export class AbusesCommand extends AbstractCommand {predefinedReason?: AbusePredefinedReasonsStringsearch?: stringfilter?: AbuseFilter- state?: AbuseState+ state?: AbuseStateTypevideoIs?: AbuseVideoIssearchReporter?: stringsearchReportee?: string@@ -119,7 +119,7 @@ export class AbusesCommand extends AbstractCommand {id?: numbersearch?: string- state?: AbuseState+ state?: AbuseStateType}) {const toPick: (keyof typeof options)[] = ['id',diff --git a/packages/server-commands/src/moderation/index.ts b/packages/server-commands/src/moderation/index.tsnew file mode 100644index 0000000000..8164afd7c0--- /dev/null+++ b/packages/server-commands/src/moderation/index.ts@@ -0,0 +1 @@+export * from './abuses-command.js'diff --git a/packages/server-commands/src/overviews/index.ts b/packages/server-commands/src/overviews/index.tsnew file mode 100644index 0000000000..54c90705a3--- /dev/null+++ b/packages/server-commands/src/overviews/index.ts@@ -0,0 +1 @@+export * from './overviews-command.js'diff --git a/shared/server-commands/overviews/overviews-command.ts b/packages/server-commands/src/overviews/overviews-command.tssimilarity index 84%rename from shared/server-commands/overviews/overviews-command.tsrename to packages/server-commands/src/overviews/overviews-command.tsindex 06b4892d2f..decd2fd8e6 100644--- a/shared/server-commands/overviews/overviews-command.ts+++ b/packages/server-commands/src/overviews/overviews-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode, VideosOverview } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, VideosOverview } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class OverviewsCommand extends AbstractCommand {diff --git a/packages/server-commands/src/requests/index.ts b/packages/server-commands/src/requests/index.tsnew file mode 100644index 0000000000..4c818659e1--- /dev/null+++ b/packages/server-commands/src/requests/index.ts@@ -0,0 +1 @@+export * from './requests.js'diff --git a/shared/server-commands/requests/requests.ts b/packages/server-commands/src/requests/requests.tssimilarity index 94%rename from shared/server-commands/requests/requests.tsrename to packages/server-commands/src/requests/requests.tsindex 8227017ebe..ac143ea5df 100644--- a/shared/server-commands/requests/requests.ts+++ b/packages/server-commands/src/requests/requests.ts@@ -3,8 +3,9 @@import { decode } from 'querystring'import request from 'supertest'import { URL } from 'url'-import { buildAbsoluteFixturePath, pick } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { pick } from '@peertube/peertube-core-utils'+import { HttpStatusCode, HttpStatusCodeType } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'export type CommonRequestParams = {url: string@@ -19,13 +20,13 @@ export type CommonRequestParams = {headers?: { [ name: string ]: string }type?: stringxForwardedFor?: string- expectedStatus?: HttpStatusCode+ expectedStatus?: HttpStatusCodeType}function makeRawRequest (options: {url: stringtoken?: string- expectedStatus?: HttpStatusCode+ expectedStatus?: HttpStatusCodeTyperange?: stringquery?: { [ id: string ]: string }method?: 'GET' | 'POST'@@ -69,7 +70,7 @@ function makeHTMLRequest (url: string, path: string) {})}-function makeActivityPubGetRequest (url: string, path: string, expectedStatus = HttpStatusCode.OK_200) {+function makeActivityPubGetRequest (url: string, path: string, expectedStatus: HttpStatusCodeType = HttpStatusCode.OK_200) {return makeGetRequest({url,path,@@ -132,7 +133,7 @@ function makePutBodyRequest (options: {path: stringtoken?: stringfields: { [ fieldName: string ]: any }- expectedStatus?: HttpStatusCode+ expectedStatus?: HttpStatusCodeTypeheaders?: { [name: string]: string }}) {const req = request(options.url).put(options.path)diff --git a/packages/server-commands/src/runners/index.ts b/packages/server-commands/src/runners/index.tsnew file mode 100644index 0000000000..c868fa78e5--- /dev/null+++ b/packages/server-commands/src/runners/index.ts@@ -0,0 +1,3 @@+export * from './runner-jobs-command.js'+export * from './runner-registration-tokens-command.js'+export * from './runners-command.js'diff --git a/shared/server-commands/runners/runner-jobs-command.ts b/packages/server-commands/src/runners/runner-jobs-command.tssimilarity index 91%rename from shared/server-commands/runners/runner-jobs-command.tsrename to packages/server-commands/src/runners/runner-jobs-command.tsindex 0a0ffb5d32..4e702199f4 100644--- a/shared/server-commands/runners/runner-jobs-command.ts+++ b/packages/server-commands/src/runners/runner-jobs-command.ts@@ -1,4 +1,4 @@-import { omit, pick, wait } from '@shared/core-utils'+import { omit, pick, wait } from '@peertube/peertube-core-utils'import {AbortRunnerJobBody,AcceptRunnerJobBody,@@ -16,15 +16,18 @@ import {RunnerJobLiveRTMPHLSTranscodingPayload,RunnerJobPayload,RunnerJobState,+ RunnerJobStateType,RunnerJobSuccessBody,RunnerJobSuccessPayload,RunnerJobType,RunnerJobUpdateBody,- RunnerJobVODPayload-} from '@shared/models'-import { unwrapBody } from '../requests'-import { waitJobs } from '../server'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+ RunnerJobVODPayload,+ VODHLSTranscodingSuccess,+ VODWebVideoTranscodingSuccess+} from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { waitJobs } from '../server/jobs.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class RunnerJobsCommand extends AbstractCommand {@@ -143,7 +146,7 @@ export class RunnerJobsCommand extends AbstractCommand {attaches[`payload[resolutionPlaylistFile]`] = payload.resolutionPlaylistFileattaches[`payload[videoChunkFile]`] = payload.videoChunkFile- payloadWithoutFiles = omit(payloadWithoutFiles as any, [ 'masterPlaylistFile', 'resolutionPlaylistFile', 'videoChunkFile' ])+ payloadWithoutFiles = omit(payloadWithoutFiles, [ 'masterPlaylistFile', 'resolutionPlaylistFile', 'videoChunkFile' ])}return this.postUploadRequest({@@ -184,13 +187,13 @@ export class RunnerJobsCommand extends AbstractCommand {if ((isWebVideoOrAudioMergeTranscodingPayloadSuccess(payload) || isHLSTranscodingPayloadSuccess(payload)) && payload.videoFile) {attaches[`payload[videoFile]`] = payload.videoFile- payloadWithoutFiles = omit(payloadWithoutFiles as any, [ 'videoFile' ])+ payloadWithoutFiles = omit(payloadWithoutFiles as VODWebVideoTranscodingSuccess, [ 'videoFile' ])}if (isHLSTranscodingPayloadSuccess(payload) && payload.resolutionPlaylistFile) {attaches[`payload[resolutionPlaylistFile]`] = payload.resolutionPlaylistFile- payloadWithoutFiles = omit(payloadWithoutFiles as any, [ 'resolutionPlaylistFile' ])+ payloadWithoutFiles = omit(payloadWithoutFiles as VODHLSTranscodingSuccess, [ 'resolutionPlaylistFile' ])}return this.postUploadRequest({@@ -252,12 +255,12 @@ export class RunnerJobsCommand extends AbstractCommand {return job}- async cancelAllJobs (options: { state?: RunnerJobState } = {}) {+ async cancelAllJobs (options: { state?: RunnerJobStateType } = {}) {const { state } = optionsconst { data } = await this.list({ count: 100 })- const allowedStates = new Set<RunnerJobState>([+ const allowedStates = new Set<RunnerJobStateType>([RunnerJobState.PENDING,RunnerJobState.PROCESSING,RunnerJobState.WAITING_FOR_PARENT_JOBdiff --git a/shared/server-commands/runners/runner-registration-tokens-command.ts b/packages/server-commands/src/runners/runner-registration-tokens-command.tssimilarity index 93%rename from shared/server-commands/runners/runner-registration-tokens-command.tsrename to packages/server-commands/src/runners/runner-registration-tokens-command.tsindex e4f2e3d95e..86b6e5f935 100644--- a/shared/server-commands/runners/runner-registration-tokens-command.ts+++ b/packages/server-commands/src/runners/runner-registration-tokens-command.ts@@ -1,6 +1,6 @@-import { pick } from '@shared/core-utils'-import { HttpStatusCode, ResultList, RunnerRegistrationToken } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { pick } from '@peertube/peertube-core-utils'+import { HttpStatusCode, ResultList, RunnerRegistrationToken } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class RunnerRegistrationTokensCommand extends AbstractCommand {diff --git a/shared/server-commands/runners/runners-command.ts b/packages/server-commands/src/runners/runners-command.tssimilarity index 85%rename from shared/server-commands/runners/runners-command.tsrename to packages/server-commands/src/runners/runners-command.tsindex b0083e841d..376a1dff98 100644--- a/shared/server-commands/runners/runners-command.ts+++ b/packages/server-commands/src/runners/runners-command.ts@@ -1,8 +1,15 @@-import { pick } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { HttpStatusCode, RegisterRunnerBody, RegisterRunnerResult, ResultList, Runner, UnregisterRunnerBody } from '@shared/models'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { pick } from '@peertube/peertube-core-utils'+import {+ HttpStatusCode,+ RegisterRunnerBody,+ RegisterRunnerResult,+ ResultList,+ Runner,+ UnregisterRunnerBody+} from '@peertube/peertube-models'+import { buildUUID } from '@peertube/peertube-node-utils'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class RunnersCommand extends AbstractCommand {diff --git a/packages/server-commands/src/search/index.ts b/packages/server-commands/src/search/index.tsnew file mode 100644index 0000000000..ca56fc6697--- /dev/null+++ b/packages/server-commands/src/search/index.ts@@ -0,0 +1 @@+export * from './search-command.js'diff --git a/shared/server-commands/search/search-command.ts b/packages/server-commands/src/search/search-command.tssimilarity index 97%rename from shared/server-commands/search/search-command.tsrename to packages/server-commands/src/search/search-command.tsindex a5b498b664..e766a2861a 100644--- a/shared/server-commands/search/search-command.ts+++ b/packages/server-commands/src/search/search-command.ts@@ -7,8 +7,8 @@ import {VideoPlaylist,VideoPlaylistsSearchQuery,VideosSearchQuery-} from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+} from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class SearchCommand extends AbstractCommand {diff --git a/shared/server-commands/server/config-command.ts b/packages/server-commands/src/server/config-command.tssimilarity index 98%rename from shared/server-commands/server/config-command.tsrename to packages/server-commands/src/server/config-command.tsindex 5ee2fe021c..8fcf0bd516 100644--- a/shared/server-commands/server/config-command.ts+++ b/packages/server-commands/src/server/config-command.ts@@ -1,7 +1,7 @@-import { merge } from 'lodash'-import { About, CustomConfig, HttpStatusCode, ServerConfig } from '@shared/models'-import { DeepPartial } from '@shared/typescript-utils'-import { AbstractCommand, OverrideCommandOptions } from '../shared/abstract-command'+import merge from 'lodash-es/merge.js'+import { About, CustomConfig, HttpStatusCode, ServerConfig } from '@peertube/peertube-models'+import { DeepPartial } from '@peertube/peertube-typescript-utils'+import { AbstractCommand, OverrideCommandOptions } from '../shared/abstract-command.js'export class ConfigCommand extends AbstractCommand {diff --git a/shared/server-commands/server/contact-form-command.ts b/packages/server-commands/src/server/contact-form-command.tssimilarity index 86%rename from shared/server-commands/server/contact-form-command.tsrename to packages/server-commands/src/server/contact-form-command.tsindex 0e8fd6d840..399e06d2fd 100644--- a/shared/server-commands/server/contact-form-command.ts+++ b/packages/server-commands/src/server/contact-form-command.ts@@ -1,6 +1,5 @@-import { HttpStatusCode } from '@shared/models'-import { ContactForm } from '../../models/server'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { ContactForm, HttpStatusCode } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class ContactFormCommand extends AbstractCommand {diff --git a/shared/server-commands/server/debug-command.ts b/packages/server-commands/src/server/debug-command.tssimilarity index 88%rename from shared/server-commands/server/debug-command.tsrename to packages/server-commands/src/server/debug-command.tsindex 3c5a785bbf..9bb7fda10b 100644--- a/shared/server-commands/server/debug-command.ts+++ b/packages/server-commands/src/server/debug-command.ts@@ -1,5 +1,5 @@-import { Debug, HttpStatusCode, SendDebugCommand } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { Debug, HttpStatusCode, SendDebugCommand } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class DebugCommand extends AbstractCommand {diff --git a/shared/server-commands/server/follows-command.ts b/packages/server-commands/src/server/follows-command.tssimilarity index 94%rename from shared/server-commands/server/follows-command.tsrename to packages/server-commands/src/server/follows-command.tsindex 496e11df17..cdc263982d 100644--- a/shared/server-commands/server/follows-command.ts+++ b/packages/server-commands/src/server/follows-command.ts@@ -1,7 +1,7 @@-import { pick } from '@shared/core-utils'-import { ActivityPubActorType, ActorFollow, FollowState, HttpStatusCode, ResultList, ServerFollowCreate } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'-import { PeerTubeServer } from './server'+import { pick } from '@peertube/peertube-core-utils'+import { ActivityPubActorType, ActorFollow, FollowState, HttpStatusCode, ResultList, ServerFollowCreate } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'+import { PeerTubeServer } from './server.js'export class FollowsCommand extends AbstractCommand {diff --git a/shared/server-commands/server/follows.ts b/packages/server-commands/src/server/follows.tssimilarity index 83%rename from shared/server-commands/server/follows.tsrename to packages/server-commands/src/server/follows.tsindex 698238f29e..32304495aa 100644--- a/shared/server-commands/server/follows.ts+++ b/packages/server-commands/src/server/follows.ts@@ -1,5 +1,5 @@-import { waitJobs } from './jobs'-import { PeerTubeServer } from './server'+import { waitJobs } from './jobs.js'+import { PeerTubeServer } from './server.js'async function doubleFollow (server1: PeerTubeServer, server2: PeerTubeServer) {await Promise.all([diff --git a/packages/server-commands/src/server/index.ts b/packages/server-commands/src/server/index.tsnew file mode 100644index 0000000000..c13972eca7--- /dev/null+++ b/packages/server-commands/src/server/index.ts@@ -0,0 +1,15 @@+export * from './config-command.js'+export * from './contact-form-command.js'+export * from './debug-command.js'+export * from './follows-command.js'+export * from './follows.js'+export * from './jobs.js'+export * from './jobs-command.js'+export * from './metrics-command.js'+export * from './object-storage-command.js'+export * from './plugins-command.js'+export * from './redundancy-command.js'+export * from './server.js'+export * from './servers-command.js'+export * from './servers.js'+export * from './stats-command.js'diff --git a/shared/server-commands/server/jobs-command.ts b/packages/server-commands/src/server/jobs-command.tssimilarity index 95%rename from shared/server-commands/server/jobs-command.tsrename to packages/server-commands/src/server/jobs-command.tsindex b8790ea00d..18aa0cd95a 100644--- a/shared/server-commands/server/jobs-command.ts+++ b/packages/server-commands/src/server/jobs-command.ts@@ -1,6 +1,6 @@-import { pick } from '@shared/core-utils'-import { HttpStatusCode, Job, JobState, JobType, ResultList } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { pick } from '@peertube/peertube-core-utils'+import { HttpStatusCode, Job, JobState, JobType, ResultList } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class JobsCommand extends AbstractCommand {diff --git a/shared/server-commands/server/jobs.ts b/packages/server-commands/src/server/jobs.tssimilarity index 94%rename from shared/server-commands/server/jobs.tsrename to packages/server-commands/src/server/jobs.tsindex 8f131fba4d..1f3b1f7457 100644--- a/shared/server-commands/server/jobs.ts+++ b/packages/server-commands/src/server/jobs.ts@@ -1,8 +1,7 @@-import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { JobState, JobType, RunnerJobState } from '../../models'-import { PeerTubeServer } from './server'+import { wait } from '@peertube/peertube-core-utils'+import { JobState, JobType, RunnerJobState } from '@peertube/peertube-models'+import { PeerTubeServer } from './server.js'async function waitJobs (serversArg: PeerTubeServer[] | PeerTubeServer,diff --git a/shared/server-commands/server/metrics-command.ts b/packages/server-commands/src/server/metrics-command.tssimilarity index 82%rename from shared/server-commands/server/metrics-command.tsrename to packages/server-commands/src/server/metrics-command.tsindex d22b4833db..1f969a024f 100644--- a/shared/server-commands/server/metrics-command.ts+++ b/packages/server-commands/src/server/metrics-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, PlaybackMetricCreate } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class MetricsCommand extends AbstractCommand {diff --git a/shared/server-commands/server/object-storage-command.ts b/packages/server-commands/src/server/object-storage-command.tssimilarity index 97%rename from shared/server-commands/server/object-storage-command.tsrename to packages/server-commands/src/server/object-storage-command.tsindex 6bb232c36b..ff8d5d75c3 100644--- a/shared/server-commands/server/object-storage-command.ts+++ b/packages/server-commands/src/server/object-storage-command.ts@@ -1,6 +1,6 @@import { randomInt } from 'crypto'-import { HttpStatusCode } from '@shared/models'-import { makePostBodyRequest } from '../requests'+import { HttpStatusCode } from '@peertube/peertube-models'+import { makePostBodyRequest } from '../requests/index.js'export class ObjectStorageCommand {static readonly DEFAULT_SCALEWAY_BUCKET = 'peertube-ci-test'diff --git a/shared/server-commands/server/plugins-command.ts b/packages/server-commands/src/server/plugins-command.tssimilarity index 93%rename from shared/server-commands/server/plugins-command.tsrename to packages/server-commands/src/server/plugins-command.tsindex bb1277a7c0..f85ef0330d 100644--- a/shared/server-commands/server/plugins-command.ts+++ b/packages/server-commands/src/server/plugins-command.ts@@ -1,33 +1,34 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { readJSON, writeJSON } from 'fs-extra'+import { readJSON, writeJSON } from 'fs-extra/esm'import { join } from 'path'-import { root } from '@shared/core-utils'import {HttpStatusCode,+ HttpStatusCodeType,PeerTubePlugin,PeerTubePluginIndex,PeertubePluginIndexList,PluginPackageJSON,PluginTranslation,- PluginType,+ PluginType_Type,PublicServerSetting,RegisteredServerSettings,ResultList-} from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+} from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class PluginsCommand extends AbstractCommand {static getPluginTestPath (suffix = '') {- return join(root(), 'server', 'tests', 'fixtures', 'peertube-plugin-test' + suffix)+ return buildAbsoluteFixturePath('peertube-plugin-test' + suffix)}list (options: OverrideCommandOptions & {start?: numbercount?: numbersort?: string- pluginType?: PluginType+ pluginType?: PluginType_Typeuninstalled?: boolean}) {const { start, count, sort, pluginType, uninstalled } = options@@ -53,10 +54,10 @@ export class PluginsCommand extends AbstractCommand {start?: numbercount?: numbersort?: string- pluginType?: PluginType+ pluginType?: PluginType_TypecurrentPeerTubeEngine?: stringsearch?: string- expectedStatus?: HttpStatusCode+ expectedStatus?: HttpStatusCodeType}) {const { start, count, sort, pluginType, search, currentPeerTubeEngine } = optionsconst path = '/api/v1/plugins/available'diff --git a/shared/server-commands/server/redundancy-command.ts b/packages/server-commands/src/server/redundancy-command.tssimilarity index 96%rename from shared/server-commands/server/redundancy-command.tsrename to packages/server-commands/src/server/redundancy-command.tsindex e7a8b3c29e..a0ec3e80ed 100644--- a/shared/server-commands/server/redundancy-command.ts+++ b/packages/server-commands/src/server/redundancy-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode, ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class RedundancyCommand extends AbstractCommand {diff --git a/shared/server-commands/server/server.ts b/packages/server-commands/src/server/server.tssimilarity index 90%rename from shared/server-commands/server/server.tsrename to packages/server-commands/src/server/server.tsindex 38568a8909..57a897c170 100644--- a/shared/server-commands/server/server.ts+++ b/packages/server-commands/src/server/server.ts@@ -1,18 +1,19 @@import { ChildProcess, fork } from 'child_process'-import { copy } from 'fs-extra'+import { copy } from 'fs-extra/esm'import { join } from 'path'-import { parallelTests, randomInt, root } from '@shared/core-utils'-import { Video, VideoChannel, VideoChannelSync, VideoCreateResult, VideoDetails } from '@shared/models'-import { BulkCommand } from '../bulk'-import { CLICommand } from '../cli'-import { CustomPagesCommand } from '../custom-pages'-import { FeedCommand } from '../feeds'-import { LogsCommand } from '../logs'-import { AbusesCommand } from '../moderation'-import { OverviewsCommand } from '../overviews'-import { RunnerJobsCommand, RunnerRegistrationTokensCommand, RunnersCommand } from '../runners'-import { SearchCommand } from '../search'-import { SocketIOCommand } from '../socket'+import { randomInt } from '@peertube/peertube-core-utils'+import { Video, VideoChannel, VideoChannelSync, VideoCreateResult, VideoDetails } from '@peertube/peertube-models'+import { parallelTests, root } from '@peertube/peertube-node-utils'+import { BulkCommand } from '../bulk/index.js'+import { CLICommand } from '../cli/index.js'+import { CustomPagesCommand } from '../custom-pages/index.js'+import { FeedCommand } from '../feeds/index.js'+import { LogsCommand } from '../logs/index.js'+import { AbusesCommand } from '../moderation/index.js'+import { OverviewsCommand } from '../overviews/index.js'+import { RunnerJobsCommand, RunnerRegistrationTokensCommand, RunnersCommand } from '../runners/index.js'+import { SearchCommand } from '../search/index.js'+import { SocketIOCommand } from '../socket/index.js'import {AccountsCommand,BlocklistCommand,@@ -22,38 +23,38 @@ import {SubscriptionsCommand,TwoFactorCommand,UsersCommand-} from '../users'+} from '../users/index.js'import {BlacklistCommand,CaptionsCommand,ChangeOwnershipCommand,ChannelsCommand,ChannelSyncsCommand,+ CommentsCommand,HistoryCommand,ImportsCommand,LiveCommand,- VideoPasswordsCommand,PlaylistsCommand,ServicesCommand,StoryboardCommand,StreamingPlaylistsCommand,+ VideoPasswordsCommand,VideosCommand,+ VideoStatsCommand,VideoStudioCommand,VideoTokenCommand,ViewsCommand-} from '../videos'-import { CommentsCommand } from '../videos/comments-command'-import { VideoStatsCommand } from '../videos/video-stats-command'-import { ConfigCommand } from './config-command'-import { ContactFormCommand } from './contact-form-command'-import { DebugCommand } from './debug-command'-import { FollowsCommand } from './follows-command'-import { JobsCommand } from './jobs-command'-import { MetricsCommand } from './metrics-command'-import { PluginsCommand } from './plugins-command'-import { RedundancyCommand } from './redundancy-command'-import { ServersCommand } from './servers-command'-import { StatsCommand } from './stats-command'+} from '../videos/index.js'+import { ConfigCommand } from './config-command.js'+import { ContactFormCommand } from './contact-form-command.js'+import { DebugCommand } from './debug-command.js'+import { FollowsCommand } from './follows-command.js'+import { JobsCommand } from './jobs-command.js'+import { MetricsCommand } from './metrics-command.js'+import { PluginsCommand } from './plugins-command.js'+import { RedundancyCommand } from './redundancy-command.js'+import { ServersCommand } from './servers-command.js'+import { StatsCommand } from './stats-command.js'export type RunServerOptions = {hideLogs?: booleandiff --git a/shared/server-commands/server/servers-command.ts b/packages/server-commands/src/server/servers-command.tssimilarity index 89%rename from shared/server-commands/server/servers-command.tsrename to packages/server-commands/src/server/servers-command.tsindex 54e586a184..0b722b62f3 100644--- a/shared/server-commands/server/servers-command.ts+++ b/packages/server-commands/src/server/servers-command.ts@@ -1,10 +1,11 @@import { exec } from 'child_process'-import { copy, ensureDir, readFile, readdir, remove } from 'fs-extra'+import { copy, ensureDir, remove } from 'fs-extra/esm'+import { readdir, readFile } from 'fs/promises'import { basename, join } from 'path'-import { isGithubCI, root, wait } from '@shared/core-utils'-import { getFileSize } from '@shared/extra-utils'-import { HttpStatusCode } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { getFileSize, isGithubCI, root } from '@peertube/peertube-node-utils'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class ServersCommand extends AbstractCommand {diff --git a/shared/server-commands/server/servers.ts b/packages/server-commands/src/server/servers.tssimilarity index 90%rename from shared/server-commands/server/servers.tsrename to packages/server-commands/src/server/servers.tsindex fe9da9e63d..caf9866e1a 100644--- a/shared/server-commands/server/servers.ts+++ b/packages/server-commands/src/server/servers.ts@@ -1,6 +1,6 @@-import { ensureDir } from 'fs-extra'-import { isGithubCI } from '@shared/core-utils'-import { PeerTubeServer, RunServerOptions } from './server'+import { ensureDir } from 'fs-extra/esm'+import { isGithubCI } from '@peertube/peertube-node-utils'+import { PeerTubeServer, RunServerOptions } from './server.js'async function createSingleServer (serverNumber: number, configOverride?: object, options: RunServerOptions = {}) {const server = new PeerTubeServer({ serverNumber })diff --git a/shared/server-commands/server/stats-command.ts b/packages/server-commands/src/server/stats-command.tssimilarity index 86%rename from shared/server-commands/server/stats-command.tsrename to packages/server-commands/src/server/stats-command.tsindex 64a4523063..80acd7bdc6 100644--- a/shared/server-commands/server/stats-command.ts+++ b/packages/server-commands/src/server/stats-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode, ServerStats } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ServerStats } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class StatsCommand extends AbstractCommand {diff --git a/shared/server-commands/shared/abstract-command.ts b/packages/server-commands/src/shared/abstract-command.tssimilarity index 92%rename from shared/server-commands/shared/abstract-command.tsrename to packages/server-commands/src/shared/abstract-command.tsindex 463acc26bd..bb6522e078 100644--- a/shared/server-commands/shared/abstract-command.ts+++ b/packages/server-commands/src/shared/abstract-command.ts@@ -1,5 +1,6 @@-import { isAbsolute, join } from 'path'-import { root } from '@shared/core-utils'+import { isAbsolute } from 'path'+import { HttpStatusCodeType } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {makeDeleteRequest,makeGetRequest,@@ -8,12 +9,13 @@ import {makeUploadRequest,unwrapBody,unwrapText-} from '../requests/requests'-import { PeerTubeServer } from '../server/server'+} from '../requests/requests.js'++import type { PeerTubeServer } from '../server/server.js'export interface OverrideCommandOptions {token?: string- expectedStatus?: number+ expectedStatus?: HttpStatusCodeType}interface InternalCommonCommandOptions extends OverrideCommandOptions {@@ -23,7 +25,7 @@ interface InternalCommonCommandOptions extends OverrideCommandOptions {path: string// If we automatically send the server token if the token is not providedimplicitToken: boolean- defaultExpectedStatus: number+ defaultExpectedStatus: HttpStatusCodeType// Common optional request parameterscontentType?: string@@ -163,7 +165,7 @@ abstract class AbstractCommand {}) {const filePath = isAbsolute(options.fixture)? options.fixture- : join(root(), 'server', 'tests', 'fixtures', options.fixture)+ : buildAbsoluteFixturePath(options.fixture)return this.postUploadRequest({...options,diff --git a/packages/server-commands/src/shared/index.ts b/packages/server-commands/src/shared/index.tsnew file mode 100644index 0000000000..795db3d55a--- /dev/null+++ b/packages/server-commands/src/shared/index.ts@@ -0,0 +1 @@+export * from './abstract-command.js'diff --git a/packages/server-commands/src/socket/index.ts b/packages/server-commands/src/socket/index.tsnew file mode 100644index 0000000000..24b8f4b467--- /dev/null+++ b/packages/server-commands/src/socket/index.ts@@ -0,0 +1 @@+export * from './socket-io-command.js'diff --git a/shared/server-commands/socket/socket-io-command.ts b/packages/server-commands/src/socket/socket-io-command.tssimilarity index 98%rename from shared/server-commands/socket/socket-io-command.tsrename to packages/server-commands/src/socket/socket-io-command.tsindex c28a86366f..9c18c2a1fb 100644--- a/shared/server-commands/socket/socket-io-command.ts+++ b/packages/server-commands/src/socket/socket-io-command.ts@@ -1,5 +1,5 @@import { io } from 'socket.io-client'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class SocketIOCommand extends AbstractCommand {diff --git a/shared/server-commands/users/accounts-command.ts b/packages/server-commands/src/users/accounts-command.tssimilarity index 96%rename from shared/server-commands/users/accounts-command.tsrename to packages/server-commands/src/users/accounts-command.tsindex 5844b330b9..fd98b7eea8 100644--- a/shared/server-commands/users/accounts-command.ts+++ b/packages/server-commands/src/users/accounts-command.ts@@ -1,5 +1,5 @@-import { Account, AccountVideoRate, ActorFollow, HttpStatusCode, ResultList, VideoRateType } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { Account, AccountVideoRate, ActorFollow, HttpStatusCode, ResultList, VideoRateType } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class AccountsCommand extends AbstractCommand {diff --git a/shared/server-commands/users/accounts.ts b/packages/server-commands/src/users/accounts.tssimilarity index 86%rename from shared/server-commands/users/accounts.tsrename to packages/server-commands/src/users/accounts.tsindex 6387891f41..3b8b9d36a4 100644--- a/shared/server-commands/users/accounts.ts+++ b/packages/server-commands/src/users/accounts.ts@@ -1,4 +1,4 @@-import { PeerTubeServer } from '../server/server'+import { PeerTubeServer } from '../server/server.js'async function setDefaultAccountAvatar (serversArg: PeerTubeServer | PeerTubeServer[], token?: string) {const servers = Array.isArray(serversArg)diff --git a/shared/server-commands/users/blocklist-command.ts b/packages/server-commands/src/users/blocklist-command.tssimilarity index 98%rename from shared/server-commands/users/blocklist-command.tsrename to packages/server-commands/src/users/blocklist-command.tsindex 862d8945ed..c77c561319 100644--- a/shared/server-commands/users/blocklist-command.ts+++ b/packages/server-commands/src/users/blocklist-command.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { AccountBlock, BlockStatus, HttpStatusCode, ResultList, ServerBlock } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { AccountBlock, BlockStatus, HttpStatusCode, ResultList, ServerBlock } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'type ListBlocklistOptions = OverrideCommandOptions & {start: numberdiff --git a/packages/server-commands/src/users/index.ts b/packages/server-commands/src/users/index.tsnew file mode 100644index 0000000000..baa048a431--- /dev/null+++ b/packages/server-commands/src/users/index.ts@@ -0,0 +1,10 @@+export * from './accounts-command.js'+export * from './accounts.js'+export * from './blocklist-command.js'+export * from './login.js'+export * from './login-command.js'+export * from './notifications-command.js'+export * from './registrations-command.js'+export * from './subscriptions-command.js'+export * from './two-factor-command.js'+export * from './users-command.js'diff --git a/shared/server-commands/users/login-command.ts b/packages/server-commands/src/users/login-command.tssimilarity index 96%rename from shared/server-commands/users/login-command.tsrename to packages/server-commands/src/users/login-command.tsindex f2fc6d1c51..92d123dfc0 100644--- a/shared/server-commands/users/login-command.ts+++ b/packages/server-commands/src/users/login-command.ts@@ -1,6 +1,6 @@-import { HttpStatusCode, PeerTubeProblemDocument } from '@shared/models'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, PeerTubeProblemDocument } from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'type LoginOptions = OverrideCommandOptions & {client?: { id?: string, secret?: string }diff --git a/shared/server-commands/users/login.ts b/packages/server-commands/src/users/login.tssimilarity index 88%rename from shared/server-commands/users/login.tsrename to packages/server-commands/src/users/login.tsindex f1df027d32..c48c42c720 100644--- a/shared/server-commands/users/login.ts+++ b/packages/server-commands/src/users/login.ts@@ -1,4 +1,4 @@-import { PeerTubeServer } from '../server/server'+import { PeerTubeServer } from '../server/server.js'function setAccessTokensToServers (servers: PeerTubeServer[]) {const tasks: Promise<any>[] = []diff --git a/shared/server-commands/users/notifications-command.ts b/packages/server-commands/src/users/notifications-command.tssimilarity index 96%rename from shared/server-commands/users/notifications-command.tsrename to packages/server-commands/src/users/notifications-command.tsindex 6bd815daa2..d90d569005 100644--- a/shared/server-commands/users/notifications-command.ts+++ b/packages/server-commands/src/users/notifications-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode, ResultList, UserNotification, UserNotificationSetting } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, UserNotification, UserNotificationSetting } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class NotificationsCommand extends AbstractCommand {diff --git a/shared/server-commands/users/registrations-command.ts b/packages/server-commands/src/users/registrations-command.tssimilarity index 93%rename from shared/server-commands/users/registrations-command.tsrename to packages/server-commands/src/users/registrations-command.tsindex f57f54b34f..2111fbd39b 100644--- a/shared/server-commands/users/registrations-command.ts+++ b/packages/server-commands/src/users/registrations-command.ts@@ -1,7 +1,13 @@-import { pick } from '@shared/core-utils'-import { HttpStatusCode, ResultList, UserRegistration, UserRegistrationRequest, UserRegistrationUpdateState } from '@shared/models'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { pick } from '@peertube/peertube-core-utils'+import {+ HttpStatusCode,+ ResultList,+ UserRegistration,+ UserRegistrationRequest,+ UserRegistrationUpdateState+} from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class RegistrationsCommand extends AbstractCommand {diff --git a/shared/server-commands/users/subscriptions-command.ts b/packages/server-commands/src/users/subscriptions-command.tssimilarity index 94%rename from shared/server-commands/users/subscriptions-command.tsrename to packages/server-commands/src/users/subscriptions-command.tsindex b92f037f88..52a1f0e519 100644--- a/shared/server-commands/users/subscriptions-command.ts+++ b/packages/server-commands/src/users/subscriptions-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode, ResultList, VideoChannel } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, VideoChannel } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class SubscriptionsCommand extends AbstractCommand {diff --git a/shared/server-commands/users/two-factor-command.ts b/packages/server-commands/src/users/two-factor-command.tssimilarity index 93%rename from shared/server-commands/users/two-factor-command.tsrename to packages/server-commands/src/users/two-factor-command.tsindex 5542acfdad..cf3d6cb68a 100644--- a/shared/server-commands/users/two-factor-command.ts+++ b/packages/server-commands/src/users/two-factor-command.ts@@ -1,7 +1,7 @@import { TOTP } from 'otpauth'-import { HttpStatusCode, TwoFactorEnableResult } from '@shared/models'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, TwoFactorEnableResult } from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class TwoFactorCommand extends AbstractCommand {diff --git a/shared/server-commands/users/users-command.ts b/packages/server-commands/src/users/users-command.tssimilarity index 95%rename from shared/server-commands/users/users-command.tsrename to packages/server-commands/src/users/users-command.tsindex 5b39d34887..d3b11939e5 100644--- a/shared/server-commands/users/users-command.ts+++ b/packages/server-commands/src/users/users-command.ts@@ -1,20 +1,21 @@-import { omit, pick } from '@shared/core-utils'+import { omit, pick } from '@peertube/peertube-core-utils'import {HttpStatusCode,MyUser,ResultList,ScopedToken,User,- UserAdminFlag,+ UserAdminFlagType,UserCreateResult,UserRole,+ UserRoleType,UserUpdate,UserUpdateMe,UserVideoQuota,UserVideoRate-} from '@shared/models'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+} from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class UsersCommand extends AbstractCommand {@@ -158,8 +159,8 @@ export class UsersCommand extends AbstractCommand {password?: stringvideoQuota?: numbervideoQuotaDaily?: number- role?: UserRole- adminFlags?: UserAdminFlag+ role?: UserRoleType+ adminFlags?: UserAdminFlagType}) {const {username,@@ -190,7 +191,7 @@ export class UsersCommand extends AbstractCommand {})).then(res => res.user)}- async generate (username: string, role?: UserRole) {+ async generate (username: string, role?: UserRoleType) {const password = 'password'const user = await this.create({ username, password, role })@@ -207,7 +208,7 @@ export class UsersCommand extends AbstractCommand {}}- async generateUserAndToken (username: string, role?: UserRole) {+ async generateUserAndToken (username: string, role?: UserRoleType) {const password = 'password'await this.create({ username, password, role })@@ -360,9 +361,9 @@ export class UsersCommand extends AbstractCommand {videoQuota?: numbervideoQuotaDaily?: numberpassword?: string- adminFlags?: UserAdminFlag+ adminFlags?: UserAdminFlagTypepluginAuth?: string- role?: UserRole+ role?: UserRoleType}) {const path = '/api/v1/users/' + options.userIddiff --git a/shared/server-commands/videos/blacklist-command.ts b/packages/server-commands/src/videos/blacklist-command.tssimilarity index 94%rename from shared/server-commands/videos/blacklist-command.tsrename to packages/server-commands/src/videos/blacklist-command.tsindex 47e23ebc8e..d41001e268 100644--- a/shared/server-commands/videos/blacklist-command.ts+++ b/packages/server-commands/src/videos/blacklist-command.ts@@ -1,6 +1,5 @@--import { HttpStatusCode, ResultList, VideoBlacklist, VideoBlacklistType } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, VideoBlacklist, VideoBlacklistType_Type } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class BlacklistCommand extends AbstractCommand {@@ -56,7 +55,7 @@ export class BlacklistCommand extends AbstractCommand {list (options: OverrideCommandOptions & {sort?: string- type?: VideoBlacklistType+ type?: VideoBlacklistType_Type} = {}) {const { sort, type } = optionsconst path = '/api/v1/videos/blacklist/'diff --git a/shared/server-commands/videos/captions-command.ts b/packages/server-commands/src/videos/captions-command.tssimilarity index 90%rename from shared/server-commands/videos/captions-command.tsrename to packages/server-commands/src/videos/captions-command.tsindex a26fcb57d0..a8336aa278 100644--- a/shared/server-commands/videos/captions-command.ts+++ b/packages/server-commands/src/videos/captions-command.ts@@ -1,6 +1,6 @@-import { buildAbsoluteFixturePath } from '@shared/core-utils'-import { HttpStatusCode, ResultList, VideoCaption } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, VideoCaption } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class CaptionsCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/change-ownership-command.ts b/packages/server-commands/src/videos/change-ownership-command.tssimilarity index 97%rename from shared/server-commands/videos/change-ownership-command.tsrename to packages/server-commands/src/videos/change-ownership-command.tsindex ad4c726efa..1dc7c2c0fb 100644--- a/shared/server-commands/videos/change-ownership-command.ts+++ b/packages/server-commands/src/videos/change-ownership-command.ts@@ -1,6 +1,5 @@--import { HttpStatusCode, ResultList, VideoChangeOwnership } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, VideoChangeOwnership } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class ChangeOwnershipCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/channel-syncs-command.ts b/packages/server-commands/src/videos/channel-syncs-command.tssimilarity index 89%rename from shared/server-commands/videos/channel-syncs-command.tsrename to packages/server-commands/src/videos/channel-syncs-command.tsindex de4a160ec1..718000c8a0 100644--- a/shared/server-commands/videos/channel-syncs-command.ts+++ b/packages/server-commands/src/videos/channel-syncs-command.ts@@ -1,7 +1,7 @@-import { HttpStatusCode, ResultList, VideoChannelSync, VideoChannelSyncCreate } from '@shared/models'-import { pick } from '@shared/core-utils'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, VideoChannelSync, VideoChannelSyncCreate } from '@peertube/peertube-models'+import { pick } from '@peertube/peertube-core-utils'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class ChannelSyncsCommand extends AbstractCommand {private static readonly API_PATH = '/api/v1/video-channel-syncs'diff --git a/shared/server-commands/videos/channels-command.ts b/packages/server-commands/src/videos/channels-command.tssimilarity index 97%rename from shared/server-commands/videos/channels-command.tsrename to packages/server-commands/src/videos/channels-command.tsindex 385d0fe73e..772677d39c 100644--- a/shared/server-commands/videos/channels-command.ts+++ b/packages/server-commands/src/videos/channels-command.ts@@ -1,4 +1,4 @@-import { pick } from '@shared/core-utils'+import { pick } from '@peertube/peertube-core-utils'import {ActorFollow,HttpStatusCode,@@ -8,9 +8,9 @@ import {VideoChannelCreateResult,VideoChannelUpdate,VideosImportInChannelCreate-} from '@shared/models'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+} from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class ChannelsCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/channels.ts b/packages/server-commands/src/videos/channels.tssimilarity index 93%rename from shared/server-commands/videos/channels.tsrename to packages/server-commands/src/videos/channels.tsindex 3c0d4b7238..e3487d0248 100644--- a/shared/server-commands/videos/channels.ts+++ b/packages/server-commands/src/videos/channels.ts@@ -1,4 +1,4 @@-import { PeerTubeServer } from '../server/server'+import { PeerTubeServer } from '../server/server.js'function setDefaultVideoChannel (servers: PeerTubeServer[]) {const tasks: Promise<any>[] = []diff --git a/shared/server-commands/videos/comments-command.ts b/packages/server-commands/src/videos/comments-command.tssimilarity index 95%rename from shared/server-commands/videos/comments-command.tsrename to packages/server-commands/src/videos/comments-command.tsindex 0dab1b66a8..4835ae1fba 100644--- a/shared/server-commands/videos/comments-command.ts+++ b/packages/server-commands/src/videos/comments-command.ts@@ -1,7 +1,7 @@-import { pick } from '@shared/core-utils'-import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { pick } from '@peertube/peertube-core-utils'+import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class CommentsCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/history-command.ts b/packages/server-commands/src/videos/history-command.tssimilarity index 92%rename from shared/server-commands/videos/history-command.tsrename to packages/server-commands/src/videos/history-command.tsindex d27afcff23..fd032504a8 100644--- a/shared/server-commands/videos/history-command.ts+++ b/packages/server-commands/src/videos/history-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode, ResultList, Video } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, Video } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class HistoryCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/imports-command.ts b/packages/server-commands/src/videos/imports-command.tssimilarity index 92%rename from shared/server-commands/videos/imports-command.tsrename to packages/server-commands/src/videos/imports-command.tsindex e307a79be8..1a1931d649 100644--- a/shared/server-commands/videos/imports-command.ts+++ b/packages/server-commands/src/videos/imports-command.ts@@ -1,8 +1,7 @@-import { HttpStatusCode, ResultList } from '@shared/models'-import { VideoImport, VideoImportCreate } from '../../models/videos'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, VideoImport, VideoImportCreate } from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class ImportsCommand extends AbstractCommand {diff --git a/packages/server-commands/src/videos/index.ts b/packages/server-commands/src/videos/index.tsnew file mode 100644index 0000000000..970026d51d--- /dev/null+++ b/packages/server-commands/src/videos/index.ts@@ -0,0 +1,22 @@+export * from './blacklist-command.js'+export * from './captions-command.js'+export * from './change-ownership-command.js'+export * from './channels.js'+export * from './channels-command.js'+export * from './channel-syncs-command.js'+export * from './comments-command.js'+export * from './history-command.js'+export * from './imports-command.js'+export * from './live-command.js'+export * from './live.js'+export * from './playlists-command.js'+export * from './services-command.js'+export * from './storyboard-command.js'+export * from './streaming-playlists-command.js'+export * from './comments-command.js'+export * from './video-studio-command.js'+export * from './video-token-command.js'+export * from './views-command.js'+export * from './videos-command.js'+export * from './video-passwords-command.js'+export * from './video-stats-command.js'diff --git a/shared/server-commands/videos/live-command.ts b/packages/server-commands/src/videos/live-command.tssimilarity index 95%rename from shared/server-commands/videos/live-command.tsrename to packages/server-commands/src/videos/live-command.tsindex 6006d9fe99..793b64f406 100644--- a/shared/server-commands/videos/live-command.ts+++ b/packages/server-commands/src/videos/live-command.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { readdir } from 'fs-extra'+import { readdir } from 'fs/promises'import { join } from 'path'-import { omit, wait } from '@shared/core-utils'+import { omit, wait } from '@peertube/peertube-core-utils'import {HttpStatusCode,LiveVideo,@@ -13,12 +13,14 @@ import {VideoCreateResult,VideoDetails,VideoPrivacy,- VideoState-} from '@shared/models'-import { unwrapBody } from '../requests'-import { ObjectStorageCommand, PeerTubeServer } from '../server'-import { AbstractCommand, OverrideCommandOptions } from '../shared'-import { sendRTMPStream, testFfmpegStreamError } from './live'+ VideoPrivacyType,+ VideoState,+ VideoStateType+} from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { ObjectStorageCommand, PeerTubeServer } from '../server/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'+import { sendRTMPStream, testFfmpegStreamError } from './live.js'export class LiveCommand extends AbstractCommand {@@ -119,7 +121,7 @@ export class LiveCommand extends AbstractCommand {async quickCreate (options: OverrideCommandOptions & {saveReplay: booleanpermanentLive: boolean- privacy?: VideoPrivacy+ privacy?: VideoPrivacyTypevideoPasswords?: string[]}) {const { saveReplay, permanentLive, privacy = VideoPrivacy.PUBLIC, videoPasswords } = options@@ -324,7 +326,7 @@ export class LiveCommand extends AbstractCommand {private async waitUntilState (options: OverrideCommandOptions & {videoId: number | string- state: VideoState+ state: VideoStateType}) {let video: VideoDetailsdiff --git a/shared/server-commands/videos/live.ts b/packages/server-commands/src/videos/live.tssimilarity index 91%rename from shared/server-commands/videos/live.tsrename to packages/server-commands/src/videos/live.tsindex cebadb1dbb..05bfa1113b 100644--- a/shared/server-commands/videos/live.ts+++ b/packages/server-commands/src/videos/live.ts@@ -1,8 +1,9 @@+import { wait } from '@peertube/peertube-core-utils'+import { VideoDetails, VideoInclude, VideoPrivacy } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'-import { truncate } from 'lodash'-import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'-import { VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models'-import { PeerTubeServer } from '../server/server'+import truncate from 'lodash-es/truncate.js'+import { PeerTubeServer } from '../server/server.js'function sendRTMPStream (options: {rtmpBaseUrl: stringdiff --git a/shared/server-commands/videos/playlists-command.ts b/packages/server-commands/src/videos/playlists-command.tssimilarity index 95%rename from shared/server-commands/videos/playlists-command.tsrename to packages/server-commands/src/videos/playlists-command.tsindex da3bef7b09..2e483f318f 100644--- a/shared/server-commands/videos/playlists-command.ts+++ b/packages/server-commands/src/videos/playlists-command.ts@@ -1,4 +1,4 @@-import { omit, pick } from '@shared/core-utils'+import { omit, pick } from '@peertube/peertube-core-utils'import {BooleanBothQuery,HttpStatusCode,@@ -12,11 +12,11 @@ import {VideoPlaylistElementCreateResult,VideoPlaylistElementUpdate,VideoPlaylistReorder,- VideoPlaylistType,+ VideoPlaylistType_Type,VideoPlaylistUpdate-} from '@shared/models'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+} from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class PlaylistsCommand extends AbstractCommand {@@ -24,7 +24,7 @@ export class PlaylistsCommand extends AbstractCommand {start?: numbercount?: numbersort?: string- playlistType?: VideoPlaylistType+ playlistType?: VideoPlaylistType_Type}) {const path = '/api/v1/video-playlists'const query = pick(options, [ 'start', 'count', 'sort', 'playlistType' ])@@ -44,7 +44,7 @@ export class PlaylistsCommand extends AbstractCommand {start?: numbercount?: numbersort?: string- playlistType?: VideoPlaylistType+ playlistType?: VideoPlaylistType_Type}) {const path = '/api/v1/video-channels/' + options.handle + '/video-playlists'const query = pick(options, [ 'start', 'count', 'sort', 'playlistType' ])@@ -65,7 +65,7 @@ export class PlaylistsCommand extends AbstractCommand {count?: numbersort?: stringsearch?: string- playlistType?: VideoPlaylistType+ playlistType?: VideoPlaylistType_Type}) {const path = '/api/v1/accounts/' + options.handle + '/video-playlists'const query = pick(options, [ 'start', 'count', 'sort', 'search', 'playlistType' ])diff --git a/shared/server-commands/videos/services-command.ts b/packages/server-commands/src/videos/services-command.tssimilarity index 89%rename from shared/server-commands/videos/services-command.tsrename to packages/server-commands/src/videos/services-command.tsindex 06760df424..ade10cd3af 100644--- a/shared/server-commands/videos/services-command.ts+++ b/packages/server-commands/src/videos/services-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class ServicesCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/storyboard-command.ts b/packages/server-commands/src/videos/storyboard-command.tssimilarity index 84%rename from shared/server-commands/videos/storyboard-command.tsrename to packages/server-commands/src/videos/storyboard-command.tsindex 06d90fc12c..a692ad6123 100644--- a/shared/server-commands/videos/storyboard-command.ts+++ b/packages/server-commands/src/videos/storyboard-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode, Storyboard } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, Storyboard } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class StoryboardCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/streaming-playlists-command.ts b/packages/server-commands/src/videos/streaming-playlists-command.tssimilarity index 94%rename from shared/server-commands/videos/streaming-playlists-command.tsrename to packages/server-commands/src/videos/streaming-playlists-command.tsindex b988ac4b2f..2406dd0234 100644--- a/shared/server-commands/videos/streaming-playlists-command.ts+++ b/packages/server-commands/src/videos/streaming-playlists-command.ts@@ -1,7 +1,7 @@-import { wait } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'-import { unwrapBody, unwrapBodyOrDecodeToJSON, unwrapTextOrDecode } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { unwrapBody, unwrapBodyOrDecodeToJSON, unwrapTextOrDecode } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class StreamingPlaylistsCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/video-passwords-command.ts b/packages/server-commands/src/videos/video-passwords-command.tssimilarity index 93%rename from shared/server-commands/videos/video-passwords-command.tsrename to packages/server-commands/src/videos/video-passwords-command.tsindex bf10335b47..7a56311ca2 100644--- a/shared/server-commands/videos/video-passwords-command.ts+++ b/packages/server-commands/src/videos/video-passwords-command.ts@@ -1,5 +1,6 @@-import { HttpStatusCode, ResultList, VideoPassword } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, ResultList, VideoPassword } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'+export class VideoPasswordsCommand extends AbstractCommand {list (options: OverrideCommandOptions & {diff --git a/shared/server-commands/videos/video-stats-command.ts b/packages/server-commands/src/videos/video-stats-command.tssimilarity index 86%rename from shared/server-commands/videos/video-stats-command.tsrename to packages/server-commands/src/videos/video-stats-command.tsindex b9b99bfb57..1b7a9b592f 100644--- a/shared/server-commands/videos/video-stats-command.ts+++ b/packages/server-commands/src/videos/video-stats-command.ts@@ -1,6 +1,12 @@-import { pick } from '@shared/core-utils'-import { HttpStatusCode, VideoStatsOverall, VideoStatsRetention, VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { pick } from '@peertube/peertube-core-utils'+import {+ HttpStatusCode,+ VideoStatsOverall,+ VideoStatsRetention,+ VideoStatsTimeserie,+ VideoStatsTimeserieMetric+} from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class VideoStatsCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/video-studio-command.ts b/packages/server-commands/src/videos/video-studio-command.tssimilarity index 94%rename from shared/server-commands/videos/video-studio-command.tsrename to packages/server-commands/src/videos/video-studio-command.tsindex 675cd84b77..8c5ff169ad 100644--- a/shared/server-commands/videos/video-studio-command.ts+++ b/packages/server-commands/src/videos/video-studio-command.ts@@ -1,5 +1,5 @@-import { HttpStatusCode, VideoStudioTask } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, VideoStudioTask } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class VideoStudioCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/video-token-command.ts b/packages/server-commands/src/videos/video-token-command.tssimilarity index 86%rename from shared/server-commands/videos/video-token-command.tsrename to packages/server-commands/src/videos/video-token-command.tsindex c4ed29a8c2..5812e484af 100644--- a/shared/server-commands/videos/video-token-command.ts+++ b/packages/server-commands/src/videos/video-token-command.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */-import { HttpStatusCode, VideoToken } from '@shared/models'-import { unwrapBody } from '../requests'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, VideoToken } from '@peertube/peertube-models'+import { unwrapBody } from '../requests/index.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class VideoTokenCommand extends AbstractCommand {diff --git a/shared/server-commands/videos/videos-command.ts b/packages/server-commands/src/videos/videos-command.tssimilarity index 96%rename from shared/server-commands/videos/videos-command.tsrename to packages/server-commands/src/videos/videos-command.tsindex 4c3513ed4c..72dc58a4b1 100644--- a/shared/server-commands/videos/videos-command.ts+++ b/packages/server-commands/src/videos/videos-command.ts@@ -1,13 +1,14 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */import { expect } from 'chai'-import { createReadStream, stat } from 'fs-extra'+import { createReadStream } from 'fs'+import { stat } from 'fs/promises'import got, { Response as GotResponse } from 'got'import validator from 'validator'-import { buildAbsoluteFixturePath, getAllPrivacies, omit, pick, wait } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'+import { getAllPrivacies, omit, pick, wait } from '@peertube/peertube-core-utils'import {HttpStatusCode,+ HttpStatusCodeType,ResultList,UserVideoRateType,Video,@@ -17,13 +18,15 @@ import {VideoFileMetadata,VideoInclude,VideoPrivacy,+ VideoPrivacyType,VideosCommonQuery,+ VideoSource,VideoTranscodingCreate-} from '@shared/models'-import { VideoSource } from '@shared/models/videos/video-source'-import { unwrapBody } from '../requests'-import { waitJobs } from '../server'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+} from '@peertube/peertube-models'+import { buildAbsoluteFixturePath, buildUUID } from '@peertube/peertube-node-utils'+import { unwrapBody } from '../requests/index.js'+import { waitJobs } from '../server/jobs.js'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & {fixture?: string@@ -72,7 +75,7 @@ export class VideosCommand extends AbstractCommand {getPrivacies (options: OverrideCommandOptions = {}) {const path = '/api/v1/videos/privacies'- return this.getRequestBody<{ [id in VideoPrivacy]: string }>({+ return this.getRequestBody<{ [id in VideoPrivacyType]: string }>({...options,path,@@ -190,7 +193,7 @@ export class VideosCommand extends AbstractCommand {}) {const { uuid } = options- if (validator.isUUID('' + uuid) === false) return uuid as number+ if (validator.default.isUUID('' + uuid) === false) return uuid as numberconst { id } = await this.get({ ...options, id: uuid })@@ -394,7 +397,7 @@ export class VideosCommand extends AbstractCommand {attributes?: VideoEditmode?: 'legacy' | 'resumable' // default legacywaitTorrentGeneration?: boolean // default true- completedExpectedStatus?: HttpStatusCode+ completedExpectedStatus?: HttpStatusCodeType} = {}) {const { mode = 'legacy', waitTorrentGeneration = true } = optionslet defaultChannelId = 1@@ -462,7 +465,7 @@ export class VideosCommand extends AbstractCommand {async buildResumeUpload (options: OverrideCommandOptions & {path: stringattributes: { fixture?: string } & { [id: string]: any }- completedExpectedStatus?: HttpStatusCode // When the upload is finished+ completedExpectedStatus?: HttpStatusCodeType // When the upload is finished}): Promise<VideoCreateResult> {const { path, attributes, expectedStatus = HttpStatusCode.OK_200, completedExpectedStatus } = options@@ -595,9 +598,9 @@ export class VideosCommand extends AbstractCommand {let start = 0const token = this.buildCommonRequestToken({ ...options, implicitToken: true })- const url = this.server.urlconst readable = createReadStream(videoFilePath, { highWaterMark: 8 * 1024 })+ const server = this.serverreturn new Promise<GotResponse<{ video: VideoCreateResult }>>((resolve, reject) => {readable.on('data', async function onData (chunk) {try {@@ -619,10 +622,9 @@ export class VideosCommand extends AbstractCommand {}const res = await got<{ video: VideoCreateResult }>({- url,+ url: new URL(path + '?' + pathUploadId, server.url).toString(),method: 'put',headers,- path: path + '?' + pathUploadId,body: chunk,responseType: 'json',throwHttpErrors: false@@ -670,7 +672,7 @@ export class VideosCommand extends AbstractCommand {quickUpload (options: OverrideCommandOptions & {name: stringnsfw?: boolean- privacy?: VideoPrivacy+ privacy?: VideoPrivacyTypefixture?: stringvideoPasswords?: string[]}) {@@ -705,7 +707,7 @@ export class VideosCommand extends AbstractCommand {replaceSourceFile (options: OverrideCommandOptions & {videoId: number | stringfixture: string- completedExpectedStatus?: HttpStatusCode+ completedExpectedStatus?: HttpStatusCodeType}) {return this.buildResumeUpload({...options,diff --git a/shared/server-commands/videos/views-command.ts b/packages/server-commands/src/videos/views-command.tssimilarity index 93%rename from shared/server-commands/videos/views-command.tsrename to packages/server-commands/src/videos/views-command.tsindex bdb8daaa4d..048bd3fda0 100644--- a/shared/server-commands/videos/views-command.ts+++ b/packages/server-commands/src/videos/views-command.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */-import { HttpStatusCode, VideoViewEvent } from '@shared/models'-import { AbstractCommand, OverrideCommandOptions } from '../shared'+import { HttpStatusCode, VideoViewEvent } from '@peertube/peertube-models'+import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'export class ViewsCommand extends AbstractCommand {diff --git a/packages/server-commands/tsconfig.json b/packages/server-commands/tsconfig.jsonnew file mode 100644index 0000000000..eb942f2954--- /dev/null+++ b/packages/server-commands/tsconfig.json@@ -0,0 +1,14 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "baseUrl": "./",+ "outDir": "./dist",+ "rootDir": "src",+ "tsBuildInfoFile": "./dist/.tsbuildinfo"+ },+ "references": [+ { "path": "../models" },+ { "path": "../core-utils" },+ { "path": "../typescript-utils" }+ ]+}diff --git a/server/tests/fixtures/60fps_720p_small.mp4 b/packages/tests/fixtures/60fps_720p_small.mp4similarity index 100%rename from server/tests/fixtures/60fps_720p_small.mp4rename to packages/tests/fixtures/60fps_720p_small.mp4diff --git a/server/tests/fixtures/ap-json/mastodon/bad-body-http-signature.json b/packages/tests/fixtures/ap-json/mastodon/bad-body-http-signature.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/mastodon/bad-body-http-signature.jsonrename to packages/tests/fixtures/ap-json/mastodon/bad-body-http-signature.jsondiff --git a/server/tests/fixtures/ap-json/mastodon/bad-http-signature.json b/packages/tests/fixtures/ap-json/mastodon/bad-http-signature.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/mastodon/bad-http-signature.jsonrename to packages/tests/fixtures/ap-json/mastodon/bad-http-signature.jsondiff --git a/server/tests/fixtures/ap-json/mastodon/bad-public-key.json b/packages/tests/fixtures/ap-json/mastodon/bad-public-key.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/mastodon/bad-public-key.jsonrename to packages/tests/fixtures/ap-json/mastodon/bad-public-key.jsondiff --git a/server/tests/fixtures/ap-json/mastodon/create-bad-signature.json b/packages/tests/fixtures/ap-json/mastodon/create-bad-signature.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/mastodon/create-bad-signature.jsonrename to packages/tests/fixtures/ap-json/mastodon/create-bad-signature.jsondiff --git a/server/tests/fixtures/ap-json/mastodon/create.json b/packages/tests/fixtures/ap-json/mastodon/create.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/mastodon/create.jsonrename to packages/tests/fixtures/ap-json/mastodon/create.jsondiff --git a/server/tests/fixtures/ap-json/mastodon/http-signature.json b/packages/tests/fixtures/ap-json/mastodon/http-signature.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/mastodon/http-signature.jsonrename to packages/tests/fixtures/ap-json/mastodon/http-signature.jsondiff --git a/server/tests/fixtures/ap-json/mastodon/public-key.json b/packages/tests/fixtures/ap-json/mastodon/public-key.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/mastodon/public-key.jsonrename to packages/tests/fixtures/ap-json/mastodon/public-key.jsondiff --git a/server/tests/fixtures/ap-json/peertube/announce-without-context.json b/packages/tests/fixtures/ap-json/peertube/announce-without-context.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/peertube/announce-without-context.jsonrename to packages/tests/fixtures/ap-json/peertube/announce-without-context.jsondiff --git a/server/tests/fixtures/ap-json/peertube/invalid-keys.json b/packages/tests/fixtures/ap-json/peertube/invalid-keys.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/peertube/invalid-keys.jsonrename to packages/tests/fixtures/ap-json/peertube/invalid-keys.jsondiff --git a/server/tests/fixtures/ap-json/peertube/keys.json b/packages/tests/fixtures/ap-json/peertube/keys.jsonsimilarity index 100%rename from server/tests/fixtures/ap-json/peertube/keys.jsonrename to packages/tests/fixtures/ap-json/peertube/keys.jsondiff --git a/server/tests/fixtures/avatar-big.png b/packages/tests/fixtures/avatar-big.pngsimilarity index 100%rename from server/tests/fixtures/avatar-big.pngrename to packages/tests/fixtures/avatar-big.pngdiff --git a/server/tests/fixtures/avatar-resized-120x120.gif b/packages/tests/fixtures/avatar-resized-120x120.gifsimilarity index 100%rename from server/tests/fixtures/avatar-resized-120x120.gifrename to packages/tests/fixtures/avatar-resized-120x120.gifdiff --git a/server/tests/fixtures/avatar-resized-120x120.png b/packages/tests/fixtures/avatar-resized-120x120.pngsimilarity index 100%rename from server/tests/fixtures/avatar-resized-120x120.pngrename to packages/tests/fixtures/avatar-resized-120x120.pngdiff --git a/server/tests/fixtures/avatar-resized-48x48.gif b/packages/tests/fixtures/avatar-resized-48x48.gifsimilarity index 100%rename from server/tests/fixtures/avatar-resized-48x48.gifrename to packages/tests/fixtures/avatar-resized-48x48.gifdiff --git a/server/tests/fixtures/avatar-resized-48x48.png b/packages/tests/fixtures/avatar-resized-48x48.pngsimilarity index 100%rename from server/tests/fixtures/avatar-resized-48x48.pngrename to packages/tests/fixtures/avatar-resized-48x48.pngdiff --git a/server/tests/fixtures/avatar.gif b/packages/tests/fixtures/avatar.gifsimilarity index 100%rename from server/tests/fixtures/avatar.gifrename to packages/tests/fixtures/avatar.gifdiff --git a/server/tests/fixtures/avatar.png b/packages/tests/fixtures/avatar.pngsimilarity index 100%rename from server/tests/fixtures/avatar.pngrename to packages/tests/fixtures/avatar.pngdiff --git a/server/tests/fixtures/avatar2-resized-120x120.png b/packages/tests/fixtures/avatar2-resized-120x120.pngsimilarity index 100%rename from server/tests/fixtures/avatar2-resized-120x120.pngrename to packages/tests/fixtures/avatar2-resized-120x120.pngdiff --git a/server/tests/fixtures/avatar2-resized-48x48.png b/packages/tests/fixtures/avatar2-resized-48x48.pngsimilarity index 100%rename from server/tests/fixtures/avatar2-resized-48x48.pngrename to packages/tests/fixtures/avatar2-resized-48x48.pngdiff --git a/server/tests/fixtures/avatar2.png b/packages/tests/fixtures/avatar2.pngsimilarity index 100%rename from server/tests/fixtures/avatar2.pngrename to packages/tests/fixtures/avatar2.pngdiff --git a/server/tests/fixtures/banner-resized.jpg b/packages/tests/fixtures/banner-resized.jpgsimilarity index 100%rename from server/tests/fixtures/banner-resized.jpgrename to packages/tests/fixtures/banner-resized.jpgdiff --git a/server/tests/fixtures/banner.jpg b/packages/tests/fixtures/banner.jpgsimilarity index 100%rename from server/tests/fixtures/banner.jpgrename to packages/tests/fixtures/banner.jpgdiff --git a/server/tests/fixtures/custom-preview-big.png b/packages/tests/fixtures/custom-preview-big.pngsimilarity index 100%rename from server/tests/fixtures/custom-preview-big.pngrename to packages/tests/fixtures/custom-preview-big.pngdiff --git a/server/tests/fixtures/custom-preview.jpg b/packages/tests/fixtures/custom-preview.jpgsimilarity index 100%rename from server/tests/fixtures/custom-preview.jpgrename to packages/tests/fixtures/custom-preview.jpgdiff --git a/server/tests/fixtures/custom-thumbnail-big.jpg b/packages/tests/fixtures/custom-thumbnail-big.jpgsimilarity index 100%rename from server/tests/fixtures/custom-thumbnail-big.jpgrename to packages/tests/fixtures/custom-thumbnail-big.jpgdiff --git a/server/tests/fixtures/custom-thumbnail.jpg b/packages/tests/fixtures/custom-thumbnail.jpgsimilarity index 100%rename from server/tests/fixtures/custom-thumbnail.jpgrename to packages/tests/fixtures/custom-thumbnail.jpgdiff --git a/server/tests/fixtures/custom-thumbnail.png b/packages/tests/fixtures/custom-thumbnail.pngsimilarity index 100%rename from server/tests/fixtures/custom-thumbnail.pngrename to packages/tests/fixtures/custom-thumbnail.pngdiff --git a/server/tests/fixtures/exif.jpg b/packages/tests/fixtures/exif.jpgsimilarity index 100%rename from server/tests/fixtures/exif.jpgrename to packages/tests/fixtures/exif.jpgdiff --git a/server/tests/fixtures/exif.png b/packages/tests/fixtures/exif.pngsimilarity index 100%rename from server/tests/fixtures/exif.pngrename to packages/tests/fixtures/exif.pngdiff --git a/server/tests/fixtures/live/0-000067.ts b/packages/tests/fixtures/live/0-000067.tssimilarity index 100%rename from server/tests/fixtures/live/0-000067.tsrename to packages/tests/fixtures/live/0-000067.tsdiff --git a/server/tests/fixtures/live/0-000068.ts b/packages/tests/fixtures/live/0-000068.tssimilarity index 100%rename from server/tests/fixtures/live/0-000068.tsrename to packages/tests/fixtures/live/0-000068.tsdiff --git a/server/tests/fixtures/live/0-000069.ts b/packages/tests/fixtures/live/0-000069.tssimilarity index 100%rename from server/tests/fixtures/live/0-000069.tsrename to packages/tests/fixtures/live/0-000069.tsdiff --git a/server/tests/fixtures/live/0-000070.ts b/packages/tests/fixtures/live/0-000070.tssimilarity index 100%rename from server/tests/fixtures/live/0-000070.tsrename to packages/tests/fixtures/live/0-000070.tsdiff --git a/server/tests/fixtures/live/0.m3u8 b/packages/tests/fixtures/live/0.m3u8similarity index 100%rename from server/tests/fixtures/live/0.m3u8rename to packages/tests/fixtures/live/0.m3u8diff --git a/server/tests/fixtures/live/1-000067.ts b/packages/tests/fixtures/live/1-000067.tssimilarity index 100%rename from server/tests/fixtures/live/1-000067.tsrename to packages/tests/fixtures/live/1-000067.tsdiff --git a/server/tests/fixtures/live/1-000068.ts b/packages/tests/fixtures/live/1-000068.tssimilarity index 100%rename from server/tests/fixtures/live/1-000068.tsrename to packages/tests/fixtures/live/1-000068.tsdiff --git a/server/tests/fixtures/live/1-000069.ts b/packages/tests/fixtures/live/1-000069.tssimilarity index 100%rename from server/tests/fixtures/live/1-000069.tsrename to packages/tests/fixtures/live/1-000069.tsdiff --git a/server/tests/fixtures/live/1-000070.ts b/packages/tests/fixtures/live/1-000070.tssimilarity index 100%rename from server/tests/fixtures/live/1-000070.tsrename to packages/tests/fixtures/live/1-000070.tsdiff --git a/server/tests/fixtures/live/1.m3u8 b/packages/tests/fixtures/live/1.m3u8similarity index 100%rename from server/tests/fixtures/live/1.m3u8rename to packages/tests/fixtures/live/1.m3u8diff --git a/server/tests/fixtures/live/master.m3u8 b/packages/tests/fixtures/live/master.m3u8similarity index 100%rename from server/tests/fixtures/live/master.m3u8rename to packages/tests/fixtures/live/master.m3u8diff --git a/server/tests/fixtures/low-bitrate.mp4 b/packages/tests/fixtures/low-bitrate.mp4similarity index 100%rename from server/tests/fixtures/low-bitrate.mp4rename to packages/tests/fixtures/low-bitrate.mp4diff --git a/server/tests/fixtures/peertube-plugin-test-broken/main.js b/packages/tests/fixtures/peertube-plugin-test-broken/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-broken/main.jsrename to packages/tests/fixtures/peertube-plugin-test-broken/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-broken/package.json b/packages/tests/fixtures/peertube-plugin-test-broken/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-broken/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-broken/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-one/main.js b/packages/tests/fixtures/peertube-plugin-test-external-auth-one/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-external-auth-one/main.jsrename to packages/tests/fixtures/peertube-plugin-test-external-auth-one/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-one/package.json b/packages/tests/fixtures/peertube-plugin-test-external-auth-one/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-external-auth-one/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-external-auth-one/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-three/main.js b/packages/tests/fixtures/peertube-plugin-test-external-auth-three/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-external-auth-three/main.jsrename to packages/tests/fixtures/peertube-plugin-test-external-auth-three/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-three/package.json b/packages/tests/fixtures/peertube-plugin-test-external-auth-three/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-external-auth-three/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-external-auth-three/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-two/main.js b/packages/tests/fixtures/peertube-plugin-test-external-auth-two/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-external-auth-two/main.jsrename to packages/tests/fixtures/peertube-plugin-test-external-auth-two/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-two/package.json b/packages/tests/fixtures/peertube-plugin-test-external-auth-two/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-external-auth-two/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-external-auth-two/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-filter-translations/languages/fr.json b/packages/tests/fixtures/peertube-plugin-test-filter-translations/languages/fr.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-filter-translations/languages/fr.jsonrename to packages/tests/fixtures/peertube-plugin-test-filter-translations/languages/fr.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-filter-translations/languages/it.json b/packages/tests/fixtures/peertube-plugin-test-filter-translations/languages/it.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-filter-translations/languages/it.jsonrename to packages/tests/fixtures/peertube-plugin-test-filter-translations/languages/it.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-filter-translations/main.js b/packages/tests/fixtures/peertube-plugin-test-filter-translations/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-filter-translations/main.jsrename to packages/tests/fixtures/peertube-plugin-test-filter-translations/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-filter-translations/package.json b/packages/tests/fixtures/peertube-plugin-test-filter-translations/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-filter-translations/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-filter-translations/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-five/main.js b/packages/tests/fixtures/peertube-plugin-test-five/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-five/main.jsrename to packages/tests/fixtures/peertube-plugin-test-five/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-five/package.json b/packages/tests/fixtures/peertube-plugin-test-five/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-five/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-five/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-four/main.js b/packages/tests/fixtures/peertube-plugin-test-four/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-four/main.jsrename to packages/tests/fixtures/peertube-plugin-test-four/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-four/package.json b/packages/tests/fixtures/peertube-plugin-test-four/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-four/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-four/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/main.js b/packages/tests/fixtures/peertube-plugin-test-id-pass-auth-one/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/main.jsrename to packages/tests/fixtures/peertube-plugin-test-id-pass-auth-one/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/package.json b/packages/tests/fixtures/peertube-plugin-test-id-pass-auth-one/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-id-pass-auth-one/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-id-pass-auth-one/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/main.js b/packages/tests/fixtures/peertube-plugin-test-id-pass-auth-three/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/main.jsrename to packages/tests/fixtures/peertube-plugin-test-id-pass-auth-three/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/package.json b/packages/tests/fixtures/peertube-plugin-test-id-pass-auth-three/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-id-pass-auth-three/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-id-pass-auth-three/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js b/packages/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.jsrename to packages/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/package.json b/packages/tests/fixtures/peertube-plugin-test-id-pass-auth-two/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-id-pass-auth-two/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-native/main.js b/packages/tests/fixtures/peertube-plugin-test-native/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-native/main.jsrename to packages/tests/fixtures/peertube-plugin-test-native/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-native/package.json b/packages/tests/fixtures/peertube-plugin-test-native/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-native/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-native/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-podcast-custom-tags/main.js b/packages/tests/fixtures/peertube-plugin-test-podcast-custom-tags/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-podcast-custom-tags/main.jsrename to packages/tests/fixtures/peertube-plugin-test-podcast-custom-tags/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-podcast-custom-tags/package.json b/packages/tests/fixtures/peertube-plugin-test-podcast-custom-tags/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-podcast-custom-tags/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-podcast-custom-tags/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-six/main.js b/packages/tests/fixtures/peertube-plugin-test-six/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-six/main.jsrename to packages/tests/fixtures/peertube-plugin-test-six/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-six/package.json b/packages/tests/fixtures/peertube-plugin-test-six/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-six/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-six/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js b/packages/tests/fixtures/peertube-plugin-test-transcoding-one/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-transcoding-one/main.jsrename to packages/tests/fixtures/peertube-plugin-test-transcoding-one/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-transcoding-one/package.json b/packages/tests/fixtures/peertube-plugin-test-transcoding-one/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-transcoding-one/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-transcoding-one/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-transcoding-two/main.js b/packages/tests/fixtures/peertube-plugin-test-transcoding-two/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-transcoding-two/main.jsrename to packages/tests/fixtures/peertube-plugin-test-transcoding-two/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-transcoding-two/package.json b/packages/tests/fixtures/peertube-plugin-test-transcoding-two/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-transcoding-two/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-transcoding-two/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-unloading/lib.js b/packages/tests/fixtures/peertube-plugin-test-unloading/lib.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-unloading/lib.jsrename to packages/tests/fixtures/peertube-plugin-test-unloading/lib.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-unloading/main.js b/packages/tests/fixtures/peertube-plugin-test-unloading/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-unloading/main.jsrename to packages/tests/fixtures/peertube-plugin-test-unloading/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-unloading/package.json b/packages/tests/fixtures/peertube-plugin-test-unloading/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-unloading/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-unloading/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-video-constants/main.js b/packages/tests/fixtures/peertube-plugin-test-video-constants/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-video-constants/main.jsrename to packages/tests/fixtures/peertube-plugin-test-video-constants/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-video-constants/package.json b/packages/tests/fixtures/peertube-plugin-test-video-constants/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-video-constants/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-video-constants/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test-websocket/main.js b/packages/tests/fixtures/peertube-plugin-test-websocket/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-websocket/main.jsrename to packages/tests/fixtures/peertube-plugin-test-websocket/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test-websocket/package.json b/packages/tests/fixtures/peertube-plugin-test-websocket/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test-websocket/package.jsonrename to packages/tests/fixtures/peertube-plugin-test-websocket/package.jsondiff --git a/server/tests/fixtures/peertube-plugin-test/languages/fr.json b/packages/tests/fixtures/peertube-plugin-test/languages/fr.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test/languages/fr.jsonrename to packages/tests/fixtures/peertube-plugin-test/languages/fr.jsondiff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/packages/tests/fixtures/peertube-plugin-test/main.jssimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test/main.jsrename to packages/tests/fixtures/peertube-plugin-test/main.jsdiff --git a/server/tests/fixtures/peertube-plugin-test/package.json b/packages/tests/fixtures/peertube-plugin-test/package.jsonsimilarity index 100%rename from server/tests/fixtures/peertube-plugin-test/package.jsonrename to packages/tests/fixtures/peertube-plugin-test/package.jsondiff --git a/server/tests/fixtures/rtmps.cert b/packages/tests/fixtures/rtmps.certsimilarity index 100%rename from server/tests/fixtures/rtmps.certrename to packages/tests/fixtures/rtmps.certdiff --git a/server/tests/fixtures/rtmps.key b/packages/tests/fixtures/rtmps.keysimilarity index 100%rename from server/tests/fixtures/rtmps.keyrename to packages/tests/fixtures/rtmps.keydiff --git a/server/tests/fixtures/sample.ogg b/packages/tests/fixtures/sample.oggsimilarity index 100%rename from server/tests/fixtures/sample.oggrename to packages/tests/fixtures/sample.oggdiff --git a/server/tests/fixtures/subtitle-bad.txt b/packages/tests/fixtures/subtitle-bad.txtsimilarity index 100%rename from server/tests/fixtures/subtitle-bad.txtrename to packages/tests/fixtures/subtitle-bad.txtdiff --git a/server/tests/fixtures/subtitle-good.srt b/packages/tests/fixtures/subtitle-good.srtsimilarity index 100%rename from server/tests/fixtures/subtitle-good.srtrename to packages/tests/fixtures/subtitle-good.srtdiff --git a/server/tests/fixtures/subtitle-good1.vtt b/packages/tests/fixtures/subtitle-good1.vttsimilarity index 100%rename from server/tests/fixtures/subtitle-good1.vttrename to packages/tests/fixtures/subtitle-good1.vttdiff --git a/server/tests/fixtures/subtitle-good2.vtt b/packages/tests/fixtures/subtitle-good2.vttsimilarity index 100%rename from server/tests/fixtures/subtitle-good2.vttrename to packages/tests/fixtures/subtitle-good2.vttdiff --git a/server/tests/fixtures/thumbnail-playlist.jpg b/packages/tests/fixtures/thumbnail-playlist.jpgsimilarity index 100%rename from server/tests/fixtures/thumbnail-playlist.jpgrename to packages/tests/fixtures/thumbnail-playlist.jpgdiff --git a/server/tests/fixtures/video-720p.torrent b/packages/tests/fixtures/video-720p.torrentsimilarity index 100%rename from server/tests/fixtures/video-720p.torrentrename to packages/tests/fixtures/video-720p.torrentdiff --git a/server/tests/fixtures/video_import_preview.jpg b/packages/tests/fixtures/video_import_preview.jpgsimilarity index 100%rename from server/tests/fixtures/video_import_preview.jpgrename to packages/tests/fixtures/video_import_preview.jpgdiff --git a/server/tests/fixtures/video_import_preview_yt_dlp.jpg b/packages/tests/fixtures/video_import_preview_yt_dlp.jpgsimilarity index 100%rename from server/tests/fixtures/video_import_preview_yt_dlp.jpgrename to packages/tests/fixtures/video_import_preview_yt_dlp.jpgdiff --git a/server/tests/fixtures/video_import_thumbnail.jpg b/packages/tests/fixtures/video_import_thumbnail.jpgsimilarity index 100%rename from server/tests/fixtures/video_import_thumbnail.jpgrename to packages/tests/fixtures/video_import_thumbnail.jpgdiff --git a/server/tests/fixtures/video_import_thumbnail_yt_dlp.jpg b/packages/tests/fixtures/video_import_thumbnail_yt_dlp.jpgsimilarity index 100%rename from server/tests/fixtures/video_import_thumbnail_yt_dlp.jpgrename to packages/tests/fixtures/video_import_thumbnail_yt_dlp.jpgdiff --git a/server/tests/fixtures/video_short.avi b/packages/tests/fixtures/video_short.avisimilarity index 100%rename from server/tests/fixtures/video_short.avirename to packages/tests/fixtures/video_short.avidiff --git a/server/tests/fixtures/video_short.mkv b/packages/tests/fixtures/video_short.mkvsimilarity index 100%rename from server/tests/fixtures/video_short.mkvrename to packages/tests/fixtures/video_short.mkvdiff --git a/server/tests/fixtures/video_short.mp4 b/packages/tests/fixtures/video_short.mp4similarity index 100%rename from server/tests/fixtures/video_short.mp4rename to packages/tests/fixtures/video_short.mp4diff --git a/server/tests/fixtures/video_short.mp4.jpg b/packages/tests/fixtures/video_short.mp4.jpgsimilarity index 100%rename from server/tests/fixtures/video_short.mp4.jpgrename to packages/tests/fixtures/video_short.mp4.jpgdiff --git a/server/tests/fixtures/video_short.ogv b/packages/tests/fixtures/video_short.ogvsimilarity index 100%rename from server/tests/fixtures/video_short.ogvrename to packages/tests/fixtures/video_short.ogvdiff --git a/server/tests/fixtures/video_short.ogv.jpg b/packages/tests/fixtures/video_short.ogv.jpgsimilarity index 100%rename from server/tests/fixtures/video_short.ogv.jpgrename to packages/tests/fixtures/video_short.ogv.jpgdiff --git a/server/tests/fixtures/video_short.webm b/packages/tests/fixtures/video_short.webmsimilarity index 100%rename from server/tests/fixtures/video_short.webmrename to packages/tests/fixtures/video_short.webmdiff --git a/server/tests/fixtures/video_short.webm.jpg b/packages/tests/fixtures/video_short.webm.jpgsimilarity index 100%rename from server/tests/fixtures/video_short.webm.jpgrename to packages/tests/fixtures/video_short.webm.jpgdiff --git a/server/tests/fixtures/video_short1-preview.webm.jpg b/packages/tests/fixtures/video_short1-preview.webm.jpgsimilarity index 100%rename from server/tests/fixtures/video_short1-preview.webm.jpgrename to packages/tests/fixtures/video_short1-preview.webm.jpgdiff --git a/server/tests/fixtures/video_short1.webm b/packages/tests/fixtures/video_short1.webmsimilarity index 100%rename from server/tests/fixtures/video_short1.webmrename to packages/tests/fixtures/video_short1.webmdiff --git a/server/tests/fixtures/video_short1.webm.jpg b/packages/tests/fixtures/video_short1.webm.jpgsimilarity index 100%rename from server/tests/fixtures/video_short1.webm.jpgrename to packages/tests/fixtures/video_short1.webm.jpgdiff --git a/server/tests/fixtures/video_short2.webm b/packages/tests/fixtures/video_short2.webmsimilarity index 100%rename from server/tests/fixtures/video_short2.webmrename to packages/tests/fixtures/video_short2.webmdiff --git a/server/tests/fixtures/video_short2.webm.jpg b/packages/tests/fixtures/video_short2.webm.jpgsimilarity index 100%rename from server/tests/fixtures/video_short2.webm.jpgrename to packages/tests/fixtures/video_short2.webm.jpgdiff --git a/server/tests/fixtures/video_short3.webm b/packages/tests/fixtures/video_short3.webmsimilarity index 100%rename from server/tests/fixtures/video_short3.webmrename to packages/tests/fixtures/video_short3.webmdiff --git a/server/tests/fixtures/video_short3.webm.jpg b/packages/tests/fixtures/video_short3.webm.jpgsimilarity index 100%rename from server/tests/fixtures/video_short3.webm.jpgrename to packages/tests/fixtures/video_short3.webm.jpgdiff --git a/server/tests/fixtures/video_short_0p.mp4 b/packages/tests/fixtures/video_short_0p.mp4similarity index 100%rename from server/tests/fixtures/video_short_0p.mp4rename to packages/tests/fixtures/video_short_0p.mp4diff --git a/server/tests/fixtures/video_short_144p.m3u8 b/packages/tests/fixtures/video_short_144p.m3u8similarity index 100%rename from server/tests/fixtures/video_short_144p.m3u8rename to packages/tests/fixtures/video_short_144p.m3u8diff --git a/server/tests/fixtures/video_short_144p.mp4 b/packages/tests/fixtures/video_short_144p.mp4similarity index 100%rename from server/tests/fixtures/video_short_144p.mp4rename to packages/tests/fixtures/video_short_144p.mp4diff --git a/server/tests/fixtures/video_short_240p.m3u8 b/packages/tests/fixtures/video_short_240p.m3u8similarity index 100%rename from server/tests/fixtures/video_short_240p.m3u8rename to packages/tests/fixtures/video_short_240p.m3u8diff --git a/server/tests/fixtures/video_short_240p.mp4 b/packages/tests/fixtures/video_short_240p.mp4similarity index 100%rename from server/tests/fixtures/video_short_240p.mp4rename to packages/tests/fixtures/video_short_240p.mp4diff --git a/server/tests/fixtures/video_short_360p.m3u8 b/packages/tests/fixtures/video_short_360p.m3u8similarity index 100%rename from server/tests/fixtures/video_short_360p.m3u8rename to packages/tests/fixtures/video_short_360p.m3u8diff --git a/server/tests/fixtures/video_short_360p.mp4 b/packages/tests/fixtures/video_short_360p.mp4similarity index 100%rename from server/tests/fixtures/video_short_360p.mp4rename to packages/tests/fixtures/video_short_360p.mp4diff --git a/server/tests/fixtures/video_short_480.webm b/packages/tests/fixtures/video_short_480.webmsimilarity index 100%rename from server/tests/fixtures/video_short_480.webmrename to packages/tests/fixtures/video_short_480.webmdiff --git a/server/tests/fixtures/video_short_480p.m3u8 b/packages/tests/fixtures/video_short_480p.m3u8similarity index 100%rename from server/tests/fixtures/video_short_480p.m3u8rename to packages/tests/fixtures/video_short_480p.m3u8diff --git a/server/tests/fixtures/video_short_480p.mp4 b/packages/tests/fixtures/video_short_480p.mp4similarity index 100%rename from server/tests/fixtures/video_short_480p.mp4rename to packages/tests/fixtures/video_short_480p.mp4diff --git a/server/tests/fixtures/video_short_4k.mp4 b/packages/tests/fixtures/video_short_4k.mp4similarity index 100%rename from server/tests/fixtures/video_short_4k.mp4rename to packages/tests/fixtures/video_short_4k.mp4diff --git a/server/tests/fixtures/video_short_720p.m3u8 b/packages/tests/fixtures/video_short_720p.m3u8similarity index 100%rename from server/tests/fixtures/video_short_720p.m3u8rename to packages/tests/fixtures/video_short_720p.m3u8diff --git a/server/tests/fixtures/video_short_720p.mp4 b/packages/tests/fixtures/video_short_720p.mp4similarity index 100%rename from server/tests/fixtures/video_short_720p.mp4rename to packages/tests/fixtures/video_short_720p.mp4diff --git a/server/tests/fixtures/video_short_fake.webm b/packages/tests/fixtures/video_short_fake.webmsimilarity index 100%rename from server/tests/fixtures/video_short_fake.webmrename to packages/tests/fixtures/video_short_fake.webmdiff --git a/server/tests/fixtures/video_short_mp3_256k.mp4 b/packages/tests/fixtures/video_short_mp3_256k.mp4similarity index 100%rename from server/tests/fixtures/video_short_mp3_256k.mp4rename to packages/tests/fixtures/video_short_mp3_256k.mp4diff --git a/server/tests/fixtures/video_short_no_audio.mp4 b/packages/tests/fixtures/video_short_no_audio.mp4similarity index 100%rename from server/tests/fixtures/video_short_no_audio.mp4rename to packages/tests/fixtures/video_short_no_audio.mp4diff --git a/server/tests/fixtures/video_very_long_10p.mp4 b/packages/tests/fixtures/video_very_long_10p.mp4similarity index 100%rename from server/tests/fixtures/video_very_long_10p.mp4rename to packages/tests/fixtures/video_very_long_10p.mp4diff --git a/server/tests/fixtures/video_very_short_240p.mp4 b/packages/tests/fixtures/video_very_short_240p.mp4similarity index 100%rename from server/tests/fixtures/video_very_short_240p.mp4rename to packages/tests/fixtures/video_very_short_240p.mp4diff --git a/packages/tests/package.json b/packages/tests/package.jsonnew file mode 100644index 0000000000..02882ebc72--- /dev/null+++ b/packages/tests/package.json@@ -0,0 +1,12 @@+{+ "name": "@peertube/tests",+ "private": true,+ "version": "0.0.0",+ "type": "module",+ "devDependencies": {},+ "scripts": {+ "build": "tsc",+ "watch": "tsc -w"+ },+ "dependencies": {}+}diff --git a/server/tests/api/activitypub/cleaner.ts b/packages/tests/src/api/activitypub/cleaner.tssimilarity index 98%rename from server/tests/api/activitypub/cleaner.tsrename to packages/tests/src/api/activitypub/cleaner.tsindex d67175e20b..4476aea850 100644--- a/server/tests/api/activitypub/cleaner.ts+++ b/packages/tests/src/api/activitypub/cleaner.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { SQLCommand } from '@server/tests/shared'-import { wait } from '@shared/core-utils'+import { SQLCommand } from '@tests/shared/sql-command.js'+import { wait } from '@peertube/peertube-core-utils'import {cleanupTests,createMultipleServers,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test AP cleaner', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/activitypub/client.ts b/packages/tests/src/api/activitypub/client.tssimilarity index 97%rename from server/tests/api/activitypub/client.tsrename to packages/tests/src/api/activitypub/client.tsindex 572a358a04..fb9575d31d 100644--- a/server/tests/api/activitypub/client.ts+++ b/packages/tests/src/api/activitypub/client.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { processViewersStats } from '@server/tests/shared'-import { HttpStatusCode, VideoPlaylistPrivacy, WatchActionObject } from '@shared/models'+import { processViewersStats } from '@tests/shared/views.js'+import { HttpStatusCode, VideoPlaylistPrivacy, WatchActionObject } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -11,7 +11,7 @@ import {PeerTubeServer,setAccessTokensToServers,setDefaultVideoChannel-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test activitypub', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/activitypub/fetch.ts b/packages/tests/src/api/activitypub/fetch.tssimilarity index 95%rename from server/tests/api/activitypub/fetch.tsrename to packages/tests/src/api/activitypub/fetch.tsindex 3899a6a49c..c7f5288cc7 100644--- a/server/tests/api/activitypub/fetch.ts+++ b/packages/tests/src/api/activitypub/fetch.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { SQLCommand } from '@server/tests/shared'+import { SQLCommand } from '@tests/shared/sql-command.js'import {cleanupTests,createMultipleServers,@@ -9,7 +9,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test ActivityPub fetcher', function () {let servers: PeerTubeServer[]diff --git a/packages/tests/src/api/activitypub/index.ts b/packages/tests/src/api/activitypub/index.tsnew file mode 100644index 0000000000..ef4f1aafb2--- /dev/null+++ b/packages/tests/src/api/activitypub/index.ts@@ -0,0 +1,5 @@+import './cleaner.js'+import './client.js'+import './fetch.js'+import './refresher.js'+import './security.js'diff --git a/server/tests/api/activitypub/refresher.ts b/packages/tests/src/api/activitypub/refresher.tssimilarity index 94%rename from server/tests/api/activitypub/refresher.tsrename to packages/tests/src/api/activitypub/refresher.tsindex 4ea7929ec5..90aa1a5ade 100644--- a/server/tests/api/activitypub/refresher.ts+++ b/packages/tests/src/api/activitypub/refresher.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { SQLCommand } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'+import { SQLCommand } from '@tests/shared/sql-command.js'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoPlaylistPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -12,7 +12,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test AP refresher', function () {let servers: PeerTubeServer[] = []@@ -24,7 +24,7 @@ describe('Test AP refresher', function () {let playlistUUID2: stringbefore(async function () {- this.timeout(60000)+ this.timeout(240000)servers = await createMultipleServers(2)diff --git a/server/tests/api/activitypub/security.ts b/packages/tests/src/api/activitypub/security.tssimilarity index 82%rename from server/tests/api/activitypub/security.tsrename to packages/tests/src/api/activitypub/security.tsindex 8e87361a97..d9649de50f 100644--- a/server/tests/api/activitypub/security.ts+++ b/packages/tests/src/api/activitypub/security.ts@@ -1,14 +1,24 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'+import { PeerTubeServer, cleanupTests, createMultipleServers, killallServers } from '@peertube/peertube-server-commands'+import {+ activityPubContextify,+ buildGlobalHTTPHeaders,+ signAndContextify+} from '@peertube/peertube-server/server/helpers/activity-pub-utils.js'+import { buildDigest } from '@peertube/peertube-server/server/helpers/peertube-crypto.js'+import { ACTIVITY_PUB, HTTP_SIGNATURE } from '@peertube/peertube-server/server/initializers/constants.js'+import { makePOSTAPRequest } from '@tests/shared/requests.js'+import { SQLCommand } from '@tests/shared/sql-command.js'import { expect } from 'chai'-import { buildDigest } from '@server/helpers/peertube-crypto'-import { ACTIVITY_PUB, HTTP_SIGNATURE } from '@server/initializers/constants'-import { activityPubContextify } from '@server/lib/activitypub/context'-import { buildGlobalHeaders, signAndContextify } from '@server/lib/activitypub/send'-import { makePOSTAPRequest, SQLCommand } from '@server/tests/shared'-import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'-import { cleanupTests, createMultipleServers, killallServers, PeerTubeServer } from '@shared/server-commands'+import { readJsonSync } from 'fs-extra/esm'++function fakeFilter () {+ return (data: any) => Promise.resolve(data)+}function setKeysOfServer (onServer: SQLCommand, ofServerUrl: string, publicKey: string, privateKey: string) {const url = ofServerUrl + '/accounts/peertube'@@ -29,7 +39,7 @@ function setUpdatedAtOfServer (onServer: SQLCommand, ofServerUrl: string, update}function getAnnounceWithoutContext (server: PeerTubeServer) {- const json = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))+ const json = readJsonSync(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))const result: typeof json = {}for (const key of Object.keys(json)) {@@ -51,7 +61,7 @@ async function makeFollowRequest (to: { url: string }, by: { url: string, privatobject: to.url}- const body = await activityPubContextify(follow, 'Follow')+ const body = await activityPubContextify(follow, 'Follow', fakeFilter())const httpSignature = {algorithm: HTTP_SIGNATURE.ALGORITHM,@@ -75,8 +85,8 @@ describe('Test ActivityPub security', function () {let url: string- const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json'))- const invalidKeys = require(buildAbsoluteFixturePath('./ap-json/peertube/invalid-keys.json'))+ const keys = readJsonSync(buildAbsoluteFixturePath('./ap-json/peertube/keys.json'))+ const invalidKeys = readJsonSync(buildAbsoluteFixturePath('./ap-json/peertube/invalid-keys.json'))const baseHttpSignature = () => ({algorithm: HTTP_SIGNATURE.ALGORITHM,authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME,@@ -107,7 +117,7 @@ describe('Test ActivityPub security', function () {describe('When checking HTTP signature', function () {it('Should fail with an invalid digest', async function () {- const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce')+ const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce', fakeFilter())const headers = {Digest: buildDigest({ hello: 'coucou' })}@@ -121,8 +131,8 @@ describe('Test ActivityPub security', function () {})it('Should fail with an invalid date', async function () {- const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce')- const headers = buildGlobalHeaders(body)+ const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce', fakeFilter())+ const headers = buildGlobalHTTPHeaders(body)headers['date'] = 'Wed, 21 Oct 2015 07:28:00 GMT'try {@@ -137,8 +147,8 @@ describe('Test ActivityPub security', function () {await setKeysOfServer(sqlCommands[0], servers[1].url, invalidKeys.publicKey, invalidKeys.privateKey)await setKeysOfServer(sqlCommands[1], servers[1].url, invalidKeys.publicKey, invalidKeys.privateKey)- const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce')- const headers = buildGlobalHeaders(body)+ const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce', fakeFilter())+ const headers = buildGlobalHTTPHeaders(body)try {await makePOSTAPRequest(url, body, baseHttpSignature(), headers)@@ -152,8 +162,8 @@ describe('Test ActivityPub security', function () {await setKeysOfServer(sqlCommands[0], servers[1].url, keys.publicKey, keys.privateKey)await setKeysOfServer(sqlCommands[1], servers[1].url, keys.publicKey, keys.privateKey)- const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce')- const headers = buildGlobalHeaders(body)+ const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce', fakeFilter())+ const headers = buildGlobalHTTPHeaders(body)const signatureOptions = baseHttpSignature()const badHeadersMatrix = [@@ -175,8 +185,8 @@ describe('Test ActivityPub security', function () {})it('Should succeed with a valid HTTP signature draft 11 (without date but with (created))', async function () {- const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce')- const headers = buildGlobalHeaders(body)+ const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce', fakeFilter())+ const headers = buildGlobalHTTPHeaders(body)const signatureOptions = baseHttpSignature()signatureOptions.headers = [ '(request-target)', '(created)', 'host', 'digest' ]@@ -186,8 +196,8 @@ describe('Test ActivityPub security', function () {})it('Should succeed with a valid HTTP signature', async function () {- const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce')- const headers = buildGlobalHeaders(body)+ const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce', fakeFilter())+ const headers = buildGlobalHTTPHeaders(body)const { statusCode } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers)expect(statusCode).to.equal(HttpStatusCode.NO_CONTENT_204)@@ -205,8 +215,8 @@ describe('Test ActivityPub security', function () {await killallServers([ servers[1] ])await servers[1].run()- const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce')- const headers = buildGlobalHeaders(body)+ const body = await activityPubContextify(getAnnounceWithoutContext(servers[1]), 'Announce', fakeFilter())+ const headers = buildGlobalHTTPHeaders(body)try {await makePOSTAPRequest(url, body, baseHttpSignature(), headers)@@ -237,9 +247,9 @@ describe('Test ActivityPub security', function () {body.actor = servers[2].url + '/accounts/peertube'const signer: any = { privateKey: invalidKeys.privateKey, url: servers[2].url + '/accounts/peertube' }- const signedBody = await signAndContextify(signer, body, 'Announce')+ const signedBody = await signAndContextify(signer, body, 'Announce', fakeFilter())- const headers = buildGlobalHeaders(signedBody)+ const headers = buildGlobalHTTPHeaders(signedBody)try {await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers)@@ -257,11 +267,11 @@ describe('Test ActivityPub security', function () {body.actor = servers[2].url + '/accounts/peertube'const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' }- const signedBody = await signAndContextify(signer, body, 'Announce')+ const signedBody = await signAndContextify(signer, body, 'Announce', fakeFilter())signedBody.actor = servers[2].url + '/account/peertube'- const headers = buildGlobalHeaders(signedBody)+ const headers = buildGlobalHTTPHeaders(signedBody)try {await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers)@@ -276,9 +286,9 @@ describe('Test ActivityPub security', function () {body.actor = servers[2].url + '/accounts/peertube'const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' }- const signedBody = await signAndContextify(signer, body, 'Announce')+ const signedBody = await signAndContextify(signer, body, 'Announce', fakeFilter())- const headers = buildGlobalHeaders(signedBody)+ const headers = buildGlobalHTTPHeaders(signedBody)const { statusCode } = await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers)expect(statusCode).to.equal(HttpStatusCode.NO_CONTENT_204)@@ -298,9 +308,9 @@ describe('Test ActivityPub security', function () {body.actor = servers[2].url + '/accounts/peertube'const signer: any = { privateKey: keys.privateKey, url: servers[2].url + '/accounts/peertube' }- const signedBody = await signAndContextify(signer, body, 'Announce')+ const signedBody = await signAndContextify(signer, body, 'Announce', fakeFilter())- const headers = buildGlobalHeaders(signedBody)+ const headers = buildGlobalHTTPHeaders(signedBody)try {await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers)diff --git a/server/tests/api/check-params/abuses.ts b/packages/tests/src/api/check-params/abuses.tssimilarity index 98%rename from server/tests/api/check-params/abuses.tsrename to packages/tests/src/api/check-params/abuses.tsindex 331d3f8f77..1effc82b1b 100644--- a/server/tests/api/check-params/abuses.ts+++ b/packages/tests/src/api/check-params/abuses.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { AbuseCreate, AbuseState, HttpStatusCode } from '@peertube/peertube-models'import {AbusesCommand,cleanupTests,@@ -12,7 +12,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test abuses API validators', function () {const basePath = '/api/v1/abuses/'@@ -298,7 +298,7 @@ describe('Test abuses API validators', function () {})it('Should fail with a bad state', async function () {- const body = { state: 5 }+ const body = { state: 5 as any }await command.update({ abuseId, body, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })})diff --git a/server/tests/api/check-params/accounts.ts b/packages/tests/src/api/check-params/accounts.tssimilarity index 90%rename from server/tests/api/check-params/accounts.tsrename to packages/tests/src/api/check-params/accounts.tsindex afc0049ff9..87810bbd32 100644--- a/server/tests/api/check-params/accounts.ts+++ b/packages/tests/src/api/check-params/accounts.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/server-commands'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { cleanupTests, createSingleServer, PeerTubeServer } from '@peertube/peertube-server-commands'describe('Test accounts API validators', function () {const path = '/api/v1/accounts/'diff --git a/server/tests/api/check-params/blocklist.ts b/packages/tests/src/api/check-params/blocklist.tssimilarity index 99%rename from server/tests/api/check-params/blocklist.tsrename to packages/tests/src/api/check-params/blocklist.tsindex 169b591a35..fcd6d08f8c 100644--- a/server/tests/api/check-params/blocklist.ts+++ b/packages/tests/src/api/check-params/blocklist.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -11,7 +11,7 @@ import {makePostBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test blocklist API validators', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/check-params/bulk.ts b/packages/tests/src/api/check-params/bulk.tssimilarity index 91%rename from server/tests/api/check-params/bulk.tsrename to packages/tests/src/api/check-params/bulk.tsindex f03264b4f6..def0c38eb5 100644--- a/server/tests/api/check-params/bulk.ts+++ b/packages/tests/src/api/check-params/bulk.ts@@ -1,7 +1,13 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ makePostBodyRequest,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test bulk API validators', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/channel-import-videos.ts b/packages/tests/src/api/check-params/channel-import-videos.tssimilarity index 96%rename from server/tests/api/check-params/channel-import-videos.tsrename to packages/tests/src/api/check-params/channel-import-videos.tsindex 2de13b629d..0e897dad77 100644--- a/server/tests/api/check-params/channel-import-videos.ts+++ b/packages/tests/src/api/check-params/channel-import-videos.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { FIXTURE_URLS } from '@server/tests/shared'-import { areHttpImportTestsDisabled } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { areHttpImportTestsDisabled } from '@peertube/peertube-node-utils'+import { HttpStatusCode } from '@peertube/peertube-models'import {ChannelsCommand,cleanupTests,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,setDefaultVideoChannel-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test videos import in a channel API validator', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/config.ts b/packages/tests/src/api/check-params/config.tssimilarity index 97%rename from server/tests/api/check-params/config.tsrename to packages/tests/src/api/check-params/config.tsindex 2f523d4ce9..8179a8815c 100644--- a/server/tests/api/check-params/config.ts+++ b/packages/tests/src/api/check-params/config.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { merge } from 'lodash'-import { omit } from '@shared/core-utils'-import { CustomConfig, HttpStatusCode } from '@shared/models'+import merge from 'lodash-es/merge.js'+import { omit } from '@peertube/peertube-core-utils'+import { CustomConfig, HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -10,7 +10,7 @@ import {makePutBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test config API validators', function () {const path = '/api/v1/config/custom'diff --git a/server/tests/api/check-params/contact-form.ts b/packages/tests/src/api/check-params/contact-form.tssimilarity index 94%rename from server/tests/api/check-params/contact-form.tsrename to packages/tests/src/api/check-params/contact-form.tsindex f0f8819b92..009cb2ad9a 100644--- a/server/tests/api/check-params/contact-form.ts+++ b/packages/tests/src/api/check-params/contact-form.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { MockSmtpServer } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'+import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,ConfigCommand,@@ -9,7 +9,7 @@ import {createSingleServer,killallServers,PeerTubeServer-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test contact form API validators', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/custom-pages.ts b/packages/tests/src/api/check-params/custom-pages.tssimilarity index 95%rename from server/tests/api/check-params/custom-pages.tsrename to packages/tests/src/api/check-params/custom-pages.tsindex 63e3da3d53..180a5e406a 100644--- a/server/tests/api/check-params/custom-pages.ts+++ b/packages/tests/src/api/check-params/custom-pages.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -8,7 +8,7 @@ import {makePutBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test custom pages validators', function () {const path = '/api/v1/custom-pages/homepage/instance'diff --git a/server/tests/api/check-params/debug.ts b/packages/tests/src/api/check-params/debug.tssimilarity index 88%rename from server/tests/api/check-params/debug.tsrename to packages/tests/src/api/check-params/debug.tsindex d7b68f163a..4a7c18a62e 100644--- a/server/tests/api/check-params/debug.ts+++ b/packages/tests/src/api/check-params/debug.ts@@ -1,7 +1,13 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ makeGetRequest,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test debug API validators', function () {const path = '/api/v1/server/debug'diff --git a/server/tests/api/check-params/follows.ts b/packages/tests/src/api/check-params/follows.tssimilarity index 98%rename from server/tests/api/check-params/follows.tsrename to packages/tests/src/api/check-params/follows.tsindex 3c911dcee8..e92a3acd6e 100644--- a/server/tests/api/check-params/follows.ts+++ b/packages/tests/src/api/check-params/follows.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -10,7 +10,7 @@ import {makePostBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test server follows API validators', function () {let server: PeerTubeServerdiff --git a/packages/tests/src/api/check-params/index.ts b/packages/tests/src/api/check-params/index.tsnew file mode 100644index 0000000000..ed5fe6b064--- /dev/null+++ b/packages/tests/src/api/check-params/index.ts@@ -0,0 +1,45 @@+import './abuses.js'+import './accounts.js'+import './blocklist.js'+import './bulk.js'+import './channel-import-videos.js'+import './config.js'+import './contact-form.js'+import './custom-pages.js'+import './debug.js'+import './follows.js'+import './jobs.js'+import './live.js'+import './logs.js'+import './metrics.js'+import './my-user.js'+import './plugins.js'+import './redundancy.js'+import './registrations.js'+import './runners.js'+import './search.js'+import './services.js'+import './transcoding.js'+import './two-factor.js'+import './upload-quota.js'+import './user-notifications.js'+import './user-subscriptions.js'+import './users-admin.js'+import './users-emails.js'+import './video-blacklist.js'+import './video-captions.js'+import './video-channel-syncs.js'+import './video-channels.js'+import './video-comments.js'+import './video-files.js'+import './video-imports.js'+import './video-playlists.js'+import './video-storyboards.js'+import './video-source.js'+import './video-studio.js'+import './video-token.js'+import './videos-common-filters.js'+import './videos-history.js'+import './videos-overviews.js'+import './videos.js'+import './views.js'diff --git a/server/tests/api/check-params/jobs.ts b/packages/tests/src/api/check-params/jobs.tssimilarity index 95%rename from server/tests/api/check-params/jobs.tsrename to packages/tests/src/api/check-params/jobs.tsindex 873da39550..331d58c6a6 100644--- a/server/tests/api/check-params/jobs.ts+++ b/packages/tests/src/api/check-params/jobs.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -9,7 +9,7 @@ import {makePostBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test jobs API validators', function () {const path = '/api/v1/jobs/failed'diff --git a/server/tests/api/check-params/live.ts b/packages/tests/src/api/check-params/live.tssimilarity index 98%rename from server/tests/api/check-params/live.tsrename to packages/tests/src/api/check-params/live.tsindex 5021db516b..5900823eac 100644--- a/server/tests/api/check-params/live.ts+++ b/packages/tests/src/api/check-params/live.ts@@ -1,8 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { buildAbsoluteFixturePath, omit } from '@shared/core-utils'-import { HttpStatusCode, LiveVideoLatencyMode, VideoCreateResult, VideoPrivacy } from '@shared/models'+import { omit } from '@peertube/peertube-core-utils'+import { HttpStatusCode, LiveVideoLatencyMode, VideoCreateResult, VideoPrivacy } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {cleanupTests,createSingleServer,@@ -13,7 +14,7 @@ import {sendRTMPStream,setAccessTokensToServers,stopFfmpeg-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video lives API validator', function () {const path = '/api/v1/videos/live'@@ -466,13 +467,13 @@ describe('Test video lives API validator', function () {})it('Should fail with bad latency setting', async function () {- const fields = { latencyMode: 42 }+ const fields = { latencyMode: 42 as any }await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })})it('Should fail with a bad privacy for replay settings', async function () {- const fields = { saveReplay: true, replaySettings: { privacy: 999 } }+ const fields = { saveReplay: true, replaySettings: { privacy: 999 as any } }await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })})diff --git a/server/tests/api/check-params/logs.ts b/packages/tests/src/api/check-params/logs.tssimilarity index 95%rename from server/tests/api/check-params/logs.tsrename to packages/tests/src/api/check-params/logs.tsindex 2496cee311..629530e306 100644--- a/server/tests/api/check-params/logs.ts+++ b/packages/tests/src/api/check-params/logs.ts@@ -1,8 +1,14 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { HttpStatusCode } from '@shared/models'-import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { HttpStatusCode } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ makeGetRequest,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test logs API validators', function () {const path = '/api/v1/server/logs'diff --git a/server/tests/api/check-params/metrics.ts b/packages/tests/src/api/check-params/metrics.tssimilarity index 95%rename from server/tests/api/check-params/metrics.tsrename to packages/tests/src/api/check-params/metrics.tsindex 302bef4f5f..cda8545548 100644--- a/server/tests/api/check-params/metrics.ts+++ b/packages/tests/src/api/check-params/metrics.ts@@ -1,8 +1,14 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { omit } from '@shared/core-utils'-import { HttpStatusCode, PlaybackMetricCreate, VideoResolution } from '@shared/models'-import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { omit } from '@peertube/peertube-core-utils'+import { HttpStatusCode, PlaybackMetricCreate, VideoResolution } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ makePostBodyRequest,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test metrics API validators', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/my-user.ts b/packages/tests/src/api/check-params/my-user.tssimilarity index 97%rename from server/tests/api/check-params/my-user.tsrename to packages/tests/src/api/check-params/my-user.tsindex 18f32d46bf..2ef2e242a2 100644--- a/server/tests/api/check-params/my-user.ts+++ b/packages/tests/src/api/check-params/my-user.ts@@ -1,8 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, MockSmtpServer } from '@server/tests/shared'-import { buildAbsoluteFixturePath } from '@shared/core-utils'-import { HttpStatusCode, UserRole, VideoCreateResult } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'+import { HttpStatusCode, UserRole, VideoCreateResult } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -12,7 +13,7 @@ import {PeerTubeServer,setAccessTokensToServers,UsersCommand-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test my user API validators', function () {const path = '/api/v1/users/'diff --git a/server/tests/api/check-params/plugins.ts b/packages/tests/src/api/check-params/plugins.tssimilarity index 98%rename from server/tests/api/check-params/plugins.tsrename to packages/tests/src/api/check-params/plugins.tsindex e08cd7ab88..ab2a426fe8 100644--- a/server/tests/api/check-params/plugins.ts+++ b/packages/tests/src/api/check-params/plugins.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { HttpStatusCode, PeerTubePlugin, PluginType } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -10,7 +10,7 @@ import {makePutBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test server plugins API validators', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/redundancy.ts b/packages/tests/src/api/check-params/redundancy.tssimilarity index 97%rename from server/tests/api/check-params/redundancy.tsrename to packages/tests/src/api/check-params/redundancy.tsindex 73dfd489d4..16a5d0a3d1 100644--- a/server/tests/api/check-params/redundancy.ts+++ b/packages/tests/src/api/check-params/redundancy.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode, VideoCreateResult } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { HttpStatusCode, VideoCreateResult } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -13,7 +13,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test server redundancy API validators', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/check-params/registrations.ts b/packages/tests/src/api/check-params/registrations.tssimilarity index 97%rename from server/tests/api/check-params/registrations.tsrename to packages/tests/src/api/check-params/registrations.tsindex 8cbecdd077..e4e46da2a6 100644--- a/server/tests/api/check-params/registrations.ts+++ b/packages/tests/src/api/check-params/registrations.ts@@ -1,6 +1,6 @@-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { omit } from '@shared/core-utils'-import { HttpStatusCode, UserRole } from '@shared/models'+import { omit } from '@peertube/peertube-core-utils'+import { HttpStatusCode, HttpStatusCodeType, UserRole } from '@peertube/peertube-models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'import {cleanupTests,createSingleServer,@@ -9,7 +9,7 @@ import {setAccessTokensToServers,setDefaultAccountAvatar,setDefaultChannelAvatar-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test registrations API validators', function () {let server: PeerTubeServer@@ -47,7 +47,7 @@ describe('Test registrations API validators', function () {describe('When registering a new user or requesting user registration', function () {- async function check (fields: any, expectedStatus = HttpStatusCode.BAD_REQUEST_400) {+ async function check (fields: any, expectedStatus: HttpStatusCodeType = HttpStatusCode.BAD_REQUEST_400) {await server.config.enableSignup(false)await makePostBodyRequest({ url: server.url, path: registrationPath, fields, expectedStatus })diff --git a/server/tests/api/check-params/runners.ts b/packages/tests/src/api/check-params/runners.tssimilarity index 99%rename from server/tests/api/check-params/runners.tsrename to packages/tests/src/api/check-params/runners.tsindex 0e5012da57..dd2d2f0a1e 100644--- a/server/tests/api/check-params/runners.ts+++ b/packages/tests/src/api/check-params/runners.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { basename } from 'path'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'import {HttpStatusCode,+ HttpStatusCodeType,isVideoStudioTaskIntro,RunnerJob,RunnerJobState,@@ -11,7 +11,8 @@ import {RunnerJobUpdatePayload,VideoPrivacy,VideoStudioTaskIntro-} from '@shared/models'+} from '@peertube/peertube-models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'import {cleanupTests,createSingleServer,@@ -23,7 +24,7 @@ import {stopFfmpeg,VideoStudioCommand,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'const badUUID = '910ec12a-d9e6-458b-a274-0abb655f9464'@@ -381,7 +382,7 @@ describe('Test managing runners', function () {videoUUID: stringrunnerToken: stringjobToken: string- expectedStatus: HttpStatusCode+ expectedStatus: HttpStatusCodeType}) {const { jobUUID, expectedStatus, videoUUID, runnerToken, jobToken } = options@@ -399,7 +400,7 @@ describe('Test managing runners', function () {runnerToken: stringjobToken: stringstudioFile?: string- expectedStatus: HttpStatusCode+ expectedStatus: HttpStatusCodeType}) {const { jobUUID, expectedStatus, videoUUID, runnerToken, jobToken, studioFile } = options@@ -494,7 +495,7 @@ describe('Test managing runners', function () {jobUUID: stringrunnerToken: stringjobToken: string- expectedStatus: HttpStatusCode+ expectedStatus: HttpStatusCodeType}) {await server.runnerJobs.abort({ ...options, reason: 'reason' })await server.runnerJobs.update({ ...options })@@ -844,7 +845,7 @@ describe('Test managing runners', function () {async function fetchFiles (options: {videoUUID?: string- expectedStatus: HttpStatusCode+ expectedStatus: HttpStatusCodeType}) {await fetchVideoInputFiles({ videoUUID, ...options, jobToken, jobUUID, runnerToken })diff --git a/server/tests/api/check-params/search.ts b/packages/tests/src/api/check-params/search.tssimilarity index 97%rename from server/tests/api/check-params/search.tsrename to packages/tests/src/api/check-params/search.tsindex b04d30b7fc..b886cbc82b 100644--- a/server/tests/api/check-params/search.ts+++ b/packages/tests/src/api/check-params/search.ts@@ -1,8 +1,14 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'-import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { HttpStatusCode } from '@peertube/peertube-models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import {+ cleanupTests,+ createSingleServer,+ makeGetRequest,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) {return server.config.updateCustomSubConfig({diff --git a/server/tests/api/check-params/services.ts b/packages/tests/src/api/check-params/services.tssimilarity index 94%rename from server/tests/api/check-params/services.tsrename to packages/tests/src/api/check-params/services.tsindex d45868f36f..0b0466d848 100644--- a/server/tests/api/check-params/services.ts+++ b/packages/tests/src/api/check-params/services.ts@@ -1,6 +1,13 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode, VideoCreateResult, VideoPlaylistCreateResult, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'+import {+ HttpStatusCode,+ HttpStatusCodeType,+ VideoCreateResult,+ VideoPlaylistCreateResult,+ VideoPlaylistPrivacy,+ VideoPrivacy+} from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -8,7 +15,7 @@ import {PeerTubeServer,setAccessTokensToServers,setDefaultVideoChannel-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test services API validators', function () {let server: PeerTubeServer@@ -183,7 +190,12 @@ describe('Test services API validators', function () {})})-function checkParamEmbed (server: PeerTubeServer, embedUrl: string, expectedStatus = HttpStatusCode.BAD_REQUEST_400, query = {}) {+function checkParamEmbed (+ server: PeerTubeServer,+ embedUrl: string,+ expectedStatus: HttpStatusCodeType = HttpStatusCode.BAD_REQUEST_400,+ query = {}+) {const path = '/services/oembed'return makeGetRequest({diff --git a/server/tests/api/check-params/transcoding.ts b/packages/tests/src/api/check-params/transcoding.tssimilarity index 97%rename from server/tests/api/check-params/transcoding.tsrename to packages/tests/src/api/check-params/transcoding.tsindex d5899e11ba..50935c59ee 100644--- a/server/tests/api/check-params/transcoding.ts+++ b/packages/tests/src/api/check-params/transcoding.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode, UserRole } from '@shared/models'+import { HttpStatusCode, UserRole } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -8,7 +8,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test transcoding API validators', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/check-params/two-factor.ts b/packages/tests/src/api/check-params/two-factor.tssimilarity index 97%rename from server/tests/api/check-params/two-factor.tsrename to packages/tests/src/api/check-params/two-factor.tsindex f8365f1b56..0b1766eca2 100644--- a/server/tests/api/check-params/two-factor.ts+++ b/packages/tests/src/api/check-params/two-factor.ts@@ -1,7 +1,13 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, TwoFactorCommand } from '@shared/server-commands'+import { HttpStatusCode } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ setAccessTokensToServers,+ TwoFactorCommand+} from '@peertube/peertube-server-commands'describe('Test two factor API validators', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/upload-quota.ts b/packages/tests/src/api/check-params/upload-quota.tssimilarity index 96%rename from server/tests/api/check-params/upload-quota.tsrename to packages/tests/src/api/check-params/upload-quota.tsindex 06698c056c..a777928221 100644--- a/server/tests/api/check-params/upload-quota.ts+++ b/packages/tests/src/api/check-params/upload-quota.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { FIXTURE_URLS } from '@server/tests/shared'-import { randomInt } from '@shared/core-utils'-import { HttpStatusCode, VideoImportState, VideoPrivacy } from '@shared/models'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { randomInt } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoImportState, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -12,7 +12,7 @@ import {setDefaultVideoChannel,VideosCommand,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test upload quota', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/user-notifications.ts b/packages/tests/src/api/check-params/user-notifications.tssimilarity index 97%rename from server/tests/api/check-params/user-notifications.tsrename to packages/tests/src/api/check-params/user-notifications.tsindex 6a588e4460..cf20324a1f 100644--- a/server/tests/api/check-params/user-notifications.ts+++ b/packages/tests/src/api/check-params/user-notifications.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { io } from 'socket.io-client'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -12,7 +12,7 @@ import {makePutBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test user notifications API validators', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/user-subscriptions.ts b/packages/tests/src/api/check-params/user-subscriptions.tssimilarity index 98%rename from server/tests/api/check-params/user-subscriptions.tsrename to packages/tests/src/api/check-params/user-subscriptions.tsindex c4922c7a2d..e97f513a0b 100644--- a/server/tests/api/check-params/user-subscriptions.ts+++ b/packages/tests/src/api/check-params/user-subscriptions.ts@@ -9,9 +9,9 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'-import { HttpStatusCode } from '@shared/models'-import { checkBadStartPagination, checkBadCountPagination, checkBadSortPagination } from '@server/tests/shared'+} from '@peertube/peertube-server-commands'+import { HttpStatusCode } from '@peertube/peertube-models'+import { checkBadStartPagination, checkBadCountPagination, checkBadSortPagination } from '@tests/shared/checks.js'describe('Test user subscriptions API validators', function () {const path = '/api/v1/users/me/subscriptions'diff --git a/server/tests/api/check-params/users-admin.ts b/packages/tests/src/api/check-params/users-admin.tssimilarity index 97%rename from server/tests/api/check-params/users-admin.tsrename to packages/tests/src/api/check-params/users-admin.tsindex 819da0bb2d..1ad222ddc8 100644--- a/server/tests/api/check-params/users-admin.ts+++ b/packages/tests/src/api/check-params/users-admin.ts@@ -1,8 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, MockSmtpServer } from '@server/tests/shared'-import { omit } from '@shared/core-utils'-import { HttpStatusCode, UserAdminFlag, UserRole } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'+import { omit } from '@peertube/peertube-core-utils'+import { HttpStatusCode, UserAdminFlag, UserRole } from '@peertube/peertube-models'import {cleanupTests,ConfigCommand,@@ -13,7 +14,7 @@ import {makePutBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test users admin API validators', function () {const path = '/api/v1/users/'diff --git a/server/tests/api/check-params/users-emails.ts b/packages/tests/src/api/check-params/users-emails.tssimilarity index 93%rename from server/tests/api/check-params/users-emails.tsrename to packages/tests/src/api/check-params/users-emails.tsindex 6ebcc8ffe1..e382190ec8 100644--- a/server/tests/api/check-params/users-emails.ts+++ b/packages/tests/src/api/check-params/users-emails.ts@@ -1,6 +1,12 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode, UserRole } from '@shared/models'-import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { HttpStatusCode, UserRole } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ makePostBodyRequest,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test users API validators', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/video-blacklist.ts b/packages/tests/src/api/check-params/video-blacklist.tssimilarity index 98%rename from server/tests/api/check-params/video-blacklist.tsrename to packages/tests/src/api/check-params/video-blacklist.tsindex 8e9f615965..6ec070b9b8 100644--- a/server/tests/api/check-params/video-blacklist.ts+++ b/packages/tests/src/api/check-params/video-blacklist.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode, VideoBlacklistType } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { HttpStatusCode, VideoBlacklistType } from '@peertube/peertube-models'import {BlacklistCommand,cleanupTests,@@ -13,7 +13,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video blacklist API validators', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/check-params/video-captions.ts b/packages/tests/src/api/check-params/video-captions.tssimilarity index 98%rename from server/tests/api/check-params/video-captions.tsrename to packages/tests/src/api/check-params/video-captions.tsindex 532dab1c49..4150b095f0 100644--- a/server/tests/api/check-params/video-captions.ts+++ b/packages/tests/src/api/check-params/video-captions.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { buildAbsoluteFixturePath } from '@shared/core-utils'-import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'+import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -10,7 +10,7 @@ import {makeUploadRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video captions API validator', function () {const path = '/api/v1/videos/'diff --git a/server/tests/api/check-params/video-channel-syncs.ts b/packages/tests/src/api/check-params/video-channel-syncs.tssimilarity index 97%rename from server/tests/api/check-params/video-channel-syncs.tsrename to packages/tests/src/api/check-params/video-channel-syncs.tsindex bcd8984df4..d95f3319ad 100644--- a/server/tests/api/check-params/video-channel-syncs.ts+++ b/packages/tests/src/api/check-params/video-channel-syncs.ts@@ -1,5 +1,6 @@-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, FIXTURE_URLS } from '@server/tests/shared'-import { HttpStatusCode, VideoChannelSyncCreate } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { HttpStatusCode, VideoChannelSyncCreate } from '@peertube/peertube-models'import {ChannelSyncsCommand,createSingleServer,@@ -7,7 +8,7 @@ import {PeerTubeServer,setAccessTokensToServers,setDefaultVideoChannel-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video channel sync API validator', () => {const path = '/api/v1/video-channel-syncs'diff --git a/server/tests/api/check-params/video-channels.ts b/packages/tests/src/api/check-params/video-channels.tssimilarity index 97%rename from server/tests/api/check-params/video-channels.tsrename to packages/tests/src/api/check-params/video-channels.tsindex 1782474fd7..84b962b19f 100644--- a/server/tests/api/check-params/video-channels.ts+++ b/packages/tests/src/api/check-params/video-channels.ts@@ -1,9 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { buildAbsoluteFixturePath, omit } from '@shared/core-utils'-import { HttpStatusCode, VideoChannelUpdate } from '@shared/models'+import { omit } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoChannelUpdate } from '@peertube/peertube-models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {ChannelsCommand,cleanupTests,@@ -14,7 +15,7 @@ import {makeUploadRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video channels API validator', function () {const videoChannelPath = '/api/v1/video-channels'diff --git a/server/tests/api/check-params/video-comments.ts b/packages/tests/src/api/check-params/video-comments.tssimilarity index 99%rename from server/tests/api/check-params/video-comments.tsrename to packages/tests/src/api/check-params/video-comments.tsindex 9f497c0cfe..1773616065 100644--- a/server/tests/api/check-params/video-comments.ts+++ b/packages/tests/src/api/check-params/video-comments.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -11,7 +11,7 @@ import {makePostBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video comments API validator', function () {let pathThread: stringdiff --git a/server/tests/api/check-params/video-files.ts b/packages/tests/src/api/check-params/video-files.tssimilarity index 98%rename from server/tests/api/check-params/video-files.tsrename to packages/tests/src/api/check-params/video-files.tsindex 01d6a912b5..b5819ff194 100644--- a/server/tests/api/check-params/video-files.ts+++ b/packages/tests/src/api/check-params/video-files.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { getAllFiles } from '@shared/core-utils'-import { HttpStatusCode, UserRole, VideoDetails, VideoPrivacy } from '@shared/models'+import { getAllFiles } from '@peertube/peertube-core-utils'+import { HttpStatusCode, UserRole, VideoDetails, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test videos files', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/check-params/video-imports.ts b/packages/tests/src/api/check-params/video-imports.tssimilarity index 97%rename from server/tests/api/check-params/video-imports.tsrename to packages/tests/src/api/check-params/video-imports.tsindex 8c6f43c12c..e078cedd6d 100644--- a/server/tests/api/check-params/video-imports.ts+++ b/packages/tests/src/api/check-params/video-imports.ts@@ -1,8 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, FIXTURE_URLS } from '@server/tests/shared'-import { buildAbsoluteFixturePath, omit } from '@shared/core-utils'-import { HttpStatusCode, VideoPrivacy } from '@shared/models'+import { omit } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {cleanupTests,createSingleServer,@@ -13,7 +15,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video imports API validator', function () {const path = '/api/v1/videos/imports'diff --git a/server/tests/api/check-params/video-passwords.ts b/packages/tests/src/api/check-params/video-passwords.tssimilarity index 97%rename from server/tests/api/check-params/video-passwords.tsrename to packages/tests/src/api/check-params/video-passwords.tsindex 50b0bacb36..3f57ebe748 100644--- a/server/tests/api/check-params/video-passwords.ts+++ b/packages/tests/src/api/check-params/video-passwords.ts@@ -1,28 +1,23 @@-/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import {- FIXTURE_URLS,- checkBadCountPagination,- checkBadSortPagination,- checkBadStartPagination,- checkUploadVideoParam-} from '@server/tests/shared'-import { root } from '@shared/core-utils'+import { expect } from 'chai'import {HttpStatusCode,+ HttpStatusCodeType,PeerTubeProblemDocument,ServerErrorCode,VideoCreateResult,VideoPrivacy-} from '@shared/models'+} from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {cleanupTests,createSingleServer,makePostBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'-import { expect } from 'chai'-import { join } from 'path'+} from '@peertube/peertube-server-commands'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { checkUploadVideoParam } from '@tests/shared/videos.js'describe('Test video passwords validator', function () {let path: string@@ -81,12 +76,12 @@ describe('Test video passwords validator', function () {server: PeerTubeServertoken: stringvideoPasswords: string[]- expectedStatus: HttpStatusCode+ expectedStatus: HttpStatusCodeTypemode: 'uploadLegacy' | 'uploadResumable' | 'import' | 'updateVideo' | 'updatePasswords' | 'live'}) {const { server, token, videoPasswords, expectedStatus = HttpStatusCode.OK_200, mode } = optionsconst attaches = {- fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.webm')+ fixture: buildAbsoluteFixturePath('video_short.webm')}const baseCorrectParams = {name: 'my super name',@@ -271,7 +266,7 @@ describe('Test video passwords validator', function () {server: PeerTubeServertoken?: stringvideoPassword?: string- expectedStatus: HttpStatusCode+ expectedStatus: HttpStatusCodeTypemode: 'get' | 'getWithPassword' | 'getWithToken' | 'listCaptions' | 'createThread' | 'listThreads' | 'replyThread' | 'rate' | 'token'}) {const { server, token = null, videoPassword, expectedStatus, mode } = optionsdiff --git a/server/tests/api/check-params/video-playlists.ts b/packages/tests/src/api/check-params/video-playlists.tssimilarity index 99%rename from server/tests/api/check-params/video-playlists.tsrename to packages/tests/src/api/check-params/video-playlists.tsindex 8c3233e0bb..7f5be18d4a 100644--- a/server/tests/api/check-params/video-playlists.ts+++ b/packages/tests/src/api/check-params/video-playlists.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'import {HttpStatusCode,VideoPlaylistCreate,@@ -10,7 +10,7 @@ import {VideoPlaylistPrivacy,VideoPlaylistReorder,VideoPlaylistType-} from '@shared/models'+} from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -19,7 +19,7 @@ import {PlaylistsCommand,setAccessTokensToServers,setDefaultVideoChannel-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video playlists API validator', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/video-source.ts b/packages/tests/src/api/check-params/video-source.tssimilarity index 97%rename from server/tests/api/check-params/video-source.tsrename to packages/tests/src/api/check-params/video-source.tsindex 767590d5ec..918182b8da 100644--- a/server/tests/api/check-params/video-source.ts+++ b/packages/tests/src/api/check-params/video-source.ts@@ -1,4 +1,4 @@-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -6,7 +6,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video sources API validator', function () {let server: PeerTubeServer = nulldiff --git a/server/tests/api/check-params/video-storyboards.ts b/packages/tests/src/api/check-params/video-storyboards.tssimilarity index 92%rename from server/tests/api/check-params/video-storyboards.tsrename to packages/tests/src/api/check-params/video-storyboards.tsindex c038e73709..f83b541d87 100644--- a/server/tests/api/check-params/video-storyboards.ts+++ b/packages/tests/src/api/check-params/video-storyboards.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode, VideoPrivacy } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'+import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@peertube/peertube-server-commands'describe('Test video storyboards API validator', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/video-studio.ts b/packages/tests/src/api/check-params/video-studio.tssimilarity index 95%rename from server/tests/api/check-params/video-studio.tsrename to packages/tests/src/api/check-params/video-studio.tsindex 4ac0d93ede..ae83f3590f 100644--- a/server/tests/api/check-params/video-studio.ts+++ b/packages/tests/src/api/check-params/video-studio.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode, VideoStudioTask } from '@shared/models'+import { HttpStatusCode, HttpStatusCodeType, VideoStudioTask } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -8,7 +8,7 @@ import {setAccessTokensToServers,VideoStudioCommand,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video studio API validator', function () {let server: PeerTubeServer@@ -215,7 +215,7 @@ describe('Test video studio API validator', function () {describe('Cut task', function () {- async function cut (start: number, end: number, expectedStatus = HttpStatusCode.BAD_REQUEST_400) {+ async function cut (start: number, end: number, expectedStatus: HttpStatusCodeType = HttpStatusCode.BAD_REQUEST_400) {await command.createEditionTasks({videoId: videoUUID,tasks: [@@ -267,7 +267,7 @@ describe('Test video studio API validator', function () {describe('Watermark task', function () {- async function addWatermark (file: string, expectedStatus = HttpStatusCode.BAD_REQUEST_400) {+ async function addWatermark (file: string, expectedStatus: HttpStatusCodeType = HttpStatusCode.BAD_REQUEST_400) {await command.createEditionTasks({videoId: videoUUID,tasks: [@@ -301,7 +301,11 @@ describe('Test video studio API validator', function () {describe('Intro/Outro task', function () {- async function addIntroOutro (type: 'add-intro' | 'add-outro', file: string, expectedStatus = HttpStatusCode.BAD_REQUEST_400) {+ async function addIntroOutro (+ type: 'add-intro' | 'add-outro',+ file: string,+ expectedStatus: HttpStatusCodeType = HttpStatusCode.BAD_REQUEST_400+ ) {await command.createEditionTasks({videoId: videoUUID,tasks: [@@ -349,7 +353,7 @@ describe('Test video studio API validator', function () {const token = await server.login.getAccessToken('user_quota_1')const { uuid } = await server.videos.quickUpload({ token, name: 'video_quota_1', fixture: 'video_short.mp4' })- const addIntroOutroByUser = (type: 'add-intro' | 'add-outro', expectedStatus: HttpStatusCode) => {+ const addIntroOutroByUser = (type: 'add-intro' | 'add-outro', expectedStatus: HttpStatusCodeType) => {return command.createEditionTasks({token,videoId: uuid,diff --git a/server/tests/api/check-params/video-token.ts b/packages/tests/src/api/check-params/video-token.tssimilarity index 94%rename from server/tests/api/check-params/video-token.tsrename to packages/tests/src/api/check-params/video-token.tsindex 7cb3e84a28..5f838102d3 100644--- a/server/tests/api/check-params/video-token.ts+++ b/packages/tests/src/api/check-params/video-token.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode, VideoPrivacy } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'+import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@peertube/peertube-server-commands'describe('Test video tokens', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/videos-common-filters.ts b/packages/tests/src/api/check-params/videos-common-filters.tssimilarity index 94%rename from server/tests/api/check-params/videos-common-filters.tsrename to packages/tests/src/api/check-params/videos-common-filters.tsindex 603f7f7776..dbae3010c3 100644--- a/server/tests/api/check-params/videos-common-filters.ts+++ b/packages/tests/src/api/check-params/videos-common-filters.ts@@ -1,6 +1,14 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode, UserRole, VideoInclude, VideoPrivacy } from '@shared/models'+import {+ HttpStatusCode,+ HttpStatusCodeType,+ UserRole,+ VideoInclude,+ VideoIncludeType,+ VideoPrivacy,+ VideoPrivacyType+} from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -8,7 +16,7 @@ import {PeerTubeServer,setAccessTokensToServers,setDefaultVideoChannel-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video filters validators', function () {let server: PeerTubeServer@@ -46,9 +54,9 @@ describe('Test video filters validators', function () {async function testEndpoints (options: {token?: stringisLocal?: boolean- include?: VideoInclude- privacyOneOf?: VideoPrivacy[]- expectedStatus: HttpStatusCode+ include?: VideoIncludeType+ privacyOneOf?: VideoPrivacyType[]+ expectedStatus: HttpStatusCodeTypeexcludeAlreadyWatched?: booleanunauthenticatedUser?: boolean}) {diff --git a/server/tests/api/check-params/videos-history.ts b/packages/tests/src/api/check-params/videos-history.tssimilarity index 97%rename from server/tests/api/check-params/videos-history.tsrename to packages/tests/src/api/check-params/videos-history.tsindex d96fe7ca9c..65d1e9fac4 100644--- a/server/tests/api/check-params/videos-history.ts+++ b/packages/tests/src/api/check-params/videos-history.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadStartPagination } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'+import { checkBadCountPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -11,7 +11,7 @@ import {makePutBodyRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test videos history API validator', function () {const myHistoryPath = '/api/v1/users/me/history/videos'diff --git a/server/tests/api/check-params/videos-overviews.ts b/packages/tests/src/api/check-params/videos-overviews.tssimilarity index 95%rename from server/tests/api/check-params/videos-overviews.tsrename to packages/tests/src/api/check-params/videos-overviews.tsindex ae7de24ddf..ba6f6ac694 100644--- a/server/tests/api/check-params/videos-overviews.ts+++ b/packages/tests/src/api/check-params/videos-overviews.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/server-commands'+import { cleanupTests, createSingleServer, PeerTubeServer } from '@peertube/peertube-server-commands'describe('Test videos overview API validator', function () {let server: PeerTubeServerdiff --git a/server/tests/api/check-params/videos.ts b/packages/tests/src/api/check-params/videos.tssimilarity index 94%rename from server/tests/api/check-params/videos.tsrename to packages/tests/src/api/check-params/videos.tsindex f00698fe34..c349ed9fe0 100644--- a/server/tests/api/check-params/videos.ts+++ b/packages/tests/src/api/check-params/videos.ts@@ -2,9 +2,9 @@import { expect } from 'chai'import { join } from 'path'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, checkUploadVideoParam } from '@server/tests/shared'-import { omit, randomInt, root } from '@shared/core-utils'-import { HttpStatusCode, PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models'+import { omit, randomInt } from '@peertube/peertube-core-utils'+import { HttpStatusCode, PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {cleanupTests,createSingleServer,@@ -14,7 +14,9 @@ import {makeUploadRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { checkBadStartPagination, checkBadCountPagination, checkBadSortPagination } from '@tests/shared/checks.js'+import { checkUploadVideoParam } from '@tests/shared/videos.js'describe('Test videos API validator', function () {const path = '/api/v1/videos/'@@ -183,7 +185,7 @@ describe('Test videos API validator', function () {describe('When adding a video', function () {let baseCorrectParamsconst baseCorrectAttaches = {- fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.webm')+ fixture: buildAbsoluteFixturePath('video_short.webm')}before(function () {@@ -364,7 +366,7 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect input file', async function () {const fields = baseCorrectParams- let attaches = { fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm') }+ let attaches = { fixture: buildAbsoluteFixturePath('video_short_fake.webm') }await checkUploadVideoParam({...baseOptions(),@@ -374,7 +376,7 @@ describe('Test videos API validator', function () {completedExpectedStatus: HttpStatusCode.UNPROCESSABLE_ENTITY_422})- attaches = { fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv') }+ attaches = { fixture: buildAbsoluteFixturePath('video_short.mkv') }await checkUploadVideoParam({...baseOptions(),attributes: { ...fields, ...attaches },@@ -385,8 +387,8 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'),- fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ thumbnailfile: buildAbsoluteFixturePath('video_short.mp4'),+ fixture: buildAbsoluteFixturePath('video_short.mp4')}await checkUploadVideoParam({ ...baseOptions(), attributes: { ...fields, ...attaches } })@@ -395,8 +397,8 @@ describe('Test videos API validator', function () {it('Should fail with a big thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'custom-preview-big.png'),- fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ thumbnailfile: buildAbsoluteFixturePath('custom-preview-big.png'),+ fixture: buildAbsoluteFixturePath('video_short.mp4')}await checkUploadVideoParam({ ...baseOptions(), attributes: { ...fields, ...attaches } })@@ -405,8 +407,8 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect preview file', async function () {const fields = baseCorrectParamsconst attaches = {- previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4'),- fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ previewfile: buildAbsoluteFixturePath('video_short.mp4'),+ fixture: buildAbsoluteFixturePath('video_short.mp4')}await checkUploadVideoParam({ ...baseOptions(), attributes: { ...fields, ...attaches } })@@ -415,8 +417,8 @@ describe('Test videos API validator', function () {it('Should fail with a big preview file', async function () {const fields = baseCorrectParamsconst attaches = {- previewfile: join(root(), 'server', 'tests', 'fixtures', 'custom-preview-big.png'),- fixture: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ previewfile: buildAbsoluteFixturePath('custom-preview-big.png'),+ fixture: buildAbsoluteFixturePath('video_short.mp4')}await checkUploadVideoParam({ ...baseOptions(), attributes: { ...fields, ...attaches } })@@ -465,7 +467,7 @@ describe('Test videos API validator', function () {const attaches = {...baseCorrectAttaches,- videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ videofile: buildAbsoluteFixturePath('video_short.mp4')}await checkUploadVideoParam({@@ -479,7 +481,7 @@ describe('Test videos API validator', function () {const attaches = {...baseCorrectAttaches,- videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.ogv')+ videofile: buildAbsoluteFixturePath('video_short.ogv')}await checkUploadVideoParam({@@ -622,7 +624,7 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ thumbnailfile: buildAbsoluteFixturePath('video_short.mp4')}await makeUploadRequest({@@ -638,7 +640,7 @@ describe('Test videos API validator', function () {it('Should fail with a big thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'custom-preview-big.png')+ thumbnailfile: buildAbsoluteFixturePath('custom-preview-big.png')}await makeUploadRequest({@@ -654,7 +656,7 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect preview file', async function () {const fields = baseCorrectParamsconst attaches = {- previewfile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ previewfile: buildAbsoluteFixturePath('video_short.mp4')}await makeUploadRequest({@@ -670,7 +672,7 @@ describe('Test videos API validator', function () {it('Should fail with a big preview file', async function () {const fields = baseCorrectParamsconst attaches = {- previewfile: join(root(), 'server', 'tests', 'fixtures', 'custom-preview-big.png')+ previewfile: buildAbsoluteFixturePath('custom-preview-big.png')}await makeUploadRequest({diff --git a/server/tests/api/check-params/views.ts b/packages/tests/src/api/check-params/views.tssimilarity index 98%rename from server/tests/api/check-params/views.tsrename to packages/tests/src/api/check-params/views.tsindex 11416ccb8c..c454d4b804 100644--- a/server/tests/api/check-params/views.ts+++ b/packages/tests/src/api/check-params/views.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { HttpStatusCode, VideoPrivacy } from '@shared/models'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -8,7 +8,7 @@ import {PeerTubeServer,setAccessTokensToServers,setDefaultVideoChannel-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test videos views', function () {let servers: PeerTubeServer[]diff --git a/packages/tests/src/api/live/index.ts b/packages/tests/src/api/live/index.tsnew file mode 100644index 0000000000..e61e6c6111--- /dev/null+++ b/packages/tests/src/api/live/index.ts@@ -0,0 +1,7 @@+import './live-constraints.js'+import './live-fast-restream.js'+import './live-socket-messages.js'+import './live-permanent.js'+import './live-rtmps.js'+import './live-save-replay.js'+import './live.js'diff --git a/server/tests/api/live/live-constraints.ts b/packages/tests/src/api/live/live-constraints.tssimilarity index 97%rename from server/tests/api/live/live-constraints.tsrename to packages/tests/src/api/live/live-constraints.tsindex 697d808d50..f62994cbda 100644--- a/server/tests/api/live/live-constraints.ts+++ b/packages/tests/src/api/live/live-constraints.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { LiveVideoError, UserVideoQuota, VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { LiveVideoError, UserVideoQuota, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,ConfigCommand,@@ -15,8 +15,8 @@ import {waitJobs,waitUntilLiveReplacedByReplayOnAllServers,waitUntilLiveWaitingOnAllServers-} from '@shared/server-commands'-import { checkLiveCleanup } from '../../shared'+} from '@peertube/peertube-server-commands'+import { checkLiveCleanup } from '../../shared/live.js'describe('Test live constraints', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/live/live-fast-restream.ts b/packages/tests/src/api/live/live-fast-restream.tssimilarity index 96%rename from server/tests/api/live/live-fast-restream.tsrename to packages/tests/src/api/live/live-fast-restream.tsindex 1b7fddd8b4..d34b00cbe0 100644--- a/server/tests/api/live/live-fast-restream.ts+++ b/packages/tests/src/api/live/live-fast-restream.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { LiveVideoCreate, VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { LiveVideoCreate, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -11,7 +11,7 @@ import {setDefaultVideoChannel,stopFfmpeg,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Fast restream in live', function () {let server: PeerTubeServerdiff --git a/server/tests/api/live/live-permanent.ts b/packages/tests/src/api/live/live-permanent.tssimilarity index 95%rename from server/tests/api/live/live-permanent.tsrename to packages/tests/src/api/live/live-permanent.tsindex 4203b1bfcf..4ffcc7ed46 100644--- a/server/tests/api/live/live-permanent.ts+++ b/packages/tests/src/api/live/live-permanent.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { checkLiveCleanup } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { LiveVideoCreate, VideoPrivacy, VideoState, VideoStateType } from '@peertube/peertube-models'+import { checkLiveCleanup } from '@tests/shared/live.js'import {cleanupTests,ConfigCommand,@@ -14,7 +14,7 @@ import {setDefaultVideoChannel,stopFfmpeg,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Permanent live', function () {let servers: PeerTubeServer[] = []@@ -33,7 +33,7 @@ describe('Permanent live', function () {return uuid}- async function checkVideoState (videoId: string, state: VideoState) {+ async function checkVideoState (videoId: string, state: VideoStateType) {for (const server of servers) {const video = await server.videos.get({ id: videoId })expect(video.state.id).to.equal(state)diff --git a/server/tests/api/live/live-rtmps.ts b/packages/tests/src/api/live/live-rtmps.tssimilarity index 95%rename from server/tests/api/live/live-rtmps.tsrename to packages/tests/src/api/live/live-rtmps.tsindex dcaee90cf8..4ab59ed4c6 100644--- a/server/tests/api/live/live-rtmps.ts+++ b/packages/tests/src/api/live/live-rtmps.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { buildAbsoluteFixturePath } from '@shared/core-utils'-import { VideoPrivacy } from '@shared/models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'+import { VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -13,7 +13,7 @@ import {stopFfmpeg,testFfmpegStreamError,waitUntilLivePublishedOnAllServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test live RTMPS', function () {let server: PeerTubeServerdiff --git a/server/tests/api/live/live-save-replay.ts b/packages/tests/src/api/live/live-save-replay.tssimilarity index 96%rename from server/tests/api/live/live-save-replay.tsrename to packages/tests/src/api/live/live-save-replay.tsindex d554cf2084..84135365b8 100644--- a/server/tests/api/live/live-save-replay.ts+++ b/packages/tests/src/api/live/live-save-replay.ts@@ -2,9 +2,18 @@import { expect } from 'chai'import { FfmpegCommand } from 'fluent-ffmpeg'-import { checkLiveCleanup } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { HttpStatusCode, LiveVideoCreate, LiveVideoError, VideoPrivacy, VideoState } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import {+ HttpStatusCode,+ HttpStatusCodeType,+ LiveVideoCreate,+ LiveVideoError,+ VideoPrivacy,+ VideoPrivacyType,+ VideoState,+ VideoStateType+} from '@peertube/peertube-models'+import { checkLiveCleanup } from '@tests/shared/live.js'import {cleanupTests,ConfigCommand,@@ -20,14 +29,14 @@ import {waitUntilLivePublishedOnAllServers,waitUntilLiveReplacedByReplayOnAllServers,waitUntilLiveWaitingOnAllServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Save replay setting', function () {let servers: PeerTubeServer[] = []let liveVideoUUID: stringlet ffmpegCommand: FfmpegCommand- async function createLiveWrapper (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacy } }) {+ async function createLiveWrapper (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacyType } }) {if (liveVideoUUID) {try {await servers[0].videos.remove({ id: liveVideoUUID })@@ -48,7 +57,7 @@ describe('Save replay setting', function () {return uuid}- async function publishLive (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacy } }) {+ async function publishLive (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacyType } }) {liveVideoUUID = await createLiveWrapper(options)const ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })@@ -62,7 +71,7 @@ describe('Save replay setting', function () {return { ffmpegCommand, liveDetails }}- async function publishLiveAndDelete (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacy } }) {+ async function publishLiveAndDelete (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacyType } }) {const { ffmpegCommand, liveDetails } = await publishLive(options)await Promise.all([@@ -77,7 +86,11 @@ describe('Save replay setting', function () {return { liveDetails }}- async function publishLiveAndBlacklist (options: { permanent: boolean, replay: boolean, replaySettings?: { privacy: VideoPrivacy } }) {+ async function publishLiveAndBlacklist (options: {+ permanent: boolean+ replay: boolean+ replaySettings?: { privacy: VideoPrivacyType }+ }) {const { ffmpegCommand, liveDetails } = await publishLive(options)await Promise.all([@@ -92,7 +105,7 @@ describe('Save replay setting', function () {return { liveDetails }}- async function checkVideosExist (videoId: string, existsInList: boolean, expectedStatus?: number) {+ async function checkVideosExist (videoId: string, existsInList: boolean, expectedStatus?: HttpStatusCodeType) {for (const server of servers) {const length = existsInList ? 1 : 0@@ -106,14 +119,14 @@ describe('Save replay setting', function () {}}- async function checkVideoState (videoId: string, state: VideoState) {+ async function checkVideoState (videoId: string, state: VideoStateType) {for (const server of servers) {const video = await server.videos.get({ id: videoId })expect(video.state.id).to.equal(state)}}- async function checkVideoPrivacy (videoId: string, privacy: VideoPrivacy) {+ async function checkVideoPrivacy (videoId: string, privacy: VideoPrivacyType) {for (const server of servers) {const video = await server.videos.get({ id: videoId })expect(video.privacy.id).to.equal(privacy)diff --git a/server/tests/api/live/live-socket-messages.ts b/packages/tests/src/api/live/live-socket-messages.tssimilarity index 93%rename from server/tests/api/live/live-socket-messages.tsrename to packages/tests/src/api/live/live-socket-messages.tsindex 0cccd1594c..80bae154c5 100644--- a/server/tests/api/live/live-socket-messages.ts+++ b/packages/tests/src/api/live/live-socket-messages.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { LiveVideoEventPayload, VideoPrivacy, VideoState } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { LiveVideoEventPayload, VideoPrivacy, VideoState, VideoStateType } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -13,7 +13,7 @@ import {stopFfmpeg,waitJobs,waitUntilLivePublishedOnAllServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test live socket messages', function () {let servers: PeerTubeServer[] = []@@ -59,8 +59,8 @@ describe('Test live socket messages', function () {it('Should correctly send a message when the live starts and ends', async function () {this.timeout(60000)- const localStateChanges: VideoState[] = []- const remoteStateChanges: VideoState[] = []+ const localStateChanges: VideoStateType[] = []+ const remoteStateChanges: VideoStateType[] = []const liveVideoUUID = await createLiveWrapper()await waitJobs(servers)@@ -151,7 +151,7 @@ describe('Test live socket messages', function () {it('Should not receive a notification after unsubscribe', async function () {this.timeout(120000)- const stateChanges: VideoState[] = []+ const stateChanges: VideoStateType[] = []const liveVideoUUID = await createLiveWrapper()await waitJobs(servers)diff --git a/server/tests/api/live/live.ts b/packages/tests/src/api/live/live.tssimilarity index 98%rename from server/tests/api/live/live.tsrename to packages/tests/src/api/live/live.tsindex 2b302a8a2c..20804f889f 100644--- a/server/tests/api/live/live.ts+++ b/packages/tests/src/api/live/live.ts@@ -2,9 +2,8 @@import { expect } from 'chai'import { basename, join } from 'path'-import { SQLCommand, testImageGeneratedByFFmpeg, testLiveVideoResolutions } from '@server/tests/shared'-import { getAllFiles, wait } from '@shared/core-utils'-import { ffprobePromise, getVideoStream } from '@shared/ffmpeg'+import { getAllFiles, wait } from '@peertube/peertube-core-utils'+import { ffprobePromise, getVideoStream } from '@peertube/peertube-ffmpeg'import {HttpStatusCode,LiveVideo,@@ -14,7 +13,7 @@ import {VideoPrivacy,VideoState,VideoStreamingPlaylistType-} from '@shared/models'+} from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -31,7 +30,10 @@ import {testFfmpegStreamError,waitJobs,waitUntilLivePublishedOnAllServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { testImageGeneratedByFFmpeg } from '@tests/shared/checks.js'+import { testLiveVideoResolutions } from '@tests/shared/live.js'+import { SQLCommand } from '@tests/shared/sql-command.js'describe('Test live', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/moderation/abuses.ts b/packages/tests/src/api/moderation/abuses.tssimilarity index 99%rename from server/tests/api/moderation/abuses.tsrename to packages/tests/src/api/moderation/abuses.tsindex 9fc296ea89..649de224e7 100644--- a/server/tests/api/moderation/abuses.ts+++ b/packages/tests/src/api/moderation/abuses.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, UserAbuse } from '@shared/models'+import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, UserAbuse } from '@peertube/peertube-models'import {AbusesCommand,cleanupTests,@@ -12,7 +12,7 @@ import {setDefaultAccountAvatar,setDefaultChannelAvatar,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test abuses', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/moderation/blocklist-notification.ts b/packages/tests/src/api/moderation/blocklist-notification.tssimilarity index 97%rename from server/tests/api/moderation/blocklist-notification.tsrename to packages/tests/src/api/moderation/blocklist-notification.tsindex 9c2863a58b..abf36313be 100644--- a/server/tests/api/moderation/blocklist-notification.ts+++ b/packages/tests/src/api/moderation/blocklist-notification.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { UserNotificationType } from '@shared/models'+import { UserNotificationType, UserNotificationType_Type } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -9,9 +9,9 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'-async function checkNotifications (server: PeerTubeServer, token: string, expected: UserNotificationType[]) {+async function checkNotifications (server: PeerTubeServer, token: string, expected: UserNotificationType_Type[]) {const { data } = await server.notifications.list({ token, start: 0, count: 10, unread: true })expect(data).to.have.lengthOf(expected.length)diff --git a/server/tests/api/moderation/blocklist.ts b/packages/tests/src/api/moderation/blocklist.tssimilarity index 99%rename from server/tests/api/moderation/blocklist.tsrename to packages/tests/src/api/moderation/blocklist.tsindex b90d8c16c0..a845152417 100644--- a/server/tests/api/moderation/blocklist.ts+++ b/packages/tests/src/api/moderation/blocklist.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { UserNotificationType } from '@shared/models'+import { UserNotificationType } from '@peertube/peertube-models'import {BlocklistCommand,cleanupTests,@@ -12,7 +12,7 @@ import {setAccessTokensToServers,setDefaultAccountAvatar,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function checkAllVideos (server: PeerTubeServer, token: string) {{diff --git a/packages/tests/src/api/moderation/index.ts b/packages/tests/src/api/moderation/index.tsnew file mode 100644index 0000000000..e3794d01ef--- /dev/null+++ b/packages/tests/src/api/moderation/index.ts@@ -0,0 +1,4 @@+export * from './abuses.js'+export * from './blocklist-notification.js'+export * from './blocklist.js'+export * from './video-blacklist.js'diff --git a/server/tests/api/moderation/video-blacklist.ts b/packages/tests/src/api/moderation/video-blacklist.tssimilarity index 98%rename from server/tests/api/moderation/video-blacklist.tsrename to packages/tests/src/api/moderation/video-blacklist.tsindex ef087a93b8..341dadad06 100644--- a/server/tests/api/moderation/video-blacklist.ts+++ b/packages/tests/src/api/moderation/video-blacklist.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { FIXTURE_URLS } from '@server/tests/shared'-import { sortObjectComparator } from '@shared/core-utils'-import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { sortObjectComparator } from '@peertube/peertube-core-utils'+import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@peertube/peertube-models'import {BlacklistCommand,cleanupTests,@@ -14,7 +14,7 @@ import {setAccessTokensToServers,setDefaultChannelAvatar,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video blacklist', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/notifications/admin-notifications.ts b/packages/tests/src/api/notifications/admin-notifications.tssimilarity index 90%rename from server/tests/api/notifications/admin-notifications.tsrename to packages/tests/src/api/notifications/admin-notifications.tsindex 4824542c97..2186dc55a0 100644--- a/server/tests/api/notifications/admin-notifications.ts+++ b/packages/tests/src/api/notifications/admin-notifications.ts@@ -1,18 +1,13 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import {- CheckerBaseParams,- checkNewPeerTubeVersion,- checkNewPluginVersion,- MockJoinPeerTubeVersions,- MockSmtpServer,- prepareNotificationsTest,- SQLCommand-} from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { PluginType, UserNotification, UserNotificationType } from '@shared/models'-import { cleanupTests, PeerTubeServer } from '@shared/server-commands'+import { wait } from '@peertube/peertube-core-utils'+import { PluginType, UserNotification, UserNotificationType } from '@peertube/peertube-models'+import { cleanupTests, PeerTubeServer } from '@peertube/peertube-server-commands'+import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'+import { MockJoinPeerTubeVersions } from '@tests/shared/mock-servers/mock-joinpeertube-versions.js'+import { CheckerBaseParams, prepareNotificationsTest, checkNewPeerTubeVersion, checkNewPluginVersion } from '@tests/shared/notifications.js'+import { SQLCommand } from '@tests/shared/sql-command.js'describe('Test admin notifications', function () {let server: PeerTubeServerdiff --git a/server/tests/api/notifications/comments-notifications.ts b/packages/tests/src/api/notifications/comments-notifications.tssimilarity index 97%rename from server/tests/api/notifications/comments-notifications.tsrename to packages/tests/src/api/notifications/comments-notifications.tsindex 0a4bfc5e4d..5647d12864 100644--- a/server/tests/api/notifications/comments-notifications.ts+++ b/packages/tests/src/api/notifications/comments-notifications.ts@@ -1,15 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import {- checkCommentMention,- CheckerBaseParams,- checkNewCommentOnMyVideo,- MockSmtpServer,- prepareNotificationsTest-} from '@server/tests/shared'-import { UserNotification } from '@shared/models'-import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'+import { UserNotification } from '@peertube/peertube-models'+import { cleanupTests, PeerTubeServer, waitJobs } from '@peertube/peertube-server-commands'+import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'+import { prepareNotificationsTest, CheckerBaseParams, checkNewCommentOnMyVideo, checkCommentMention } from '@tests/shared/notifications.js'describe('Test comments notifications', function () {let servers: PeerTubeServer[] = []diff --git a/packages/tests/src/api/notifications/index.ts b/packages/tests/src/api/notifications/index.tsnew file mode 100644index 0000000000..d63d941828--- /dev/null+++ b/packages/tests/src/api/notifications/index.ts@@ -0,0 +1,6 @@+import './admin-notifications.js'+import './comments-notifications.js'+import './moderation-notifications.js'+import './notifications-api.js'+import './registrations-notifications.js'+import './user-notifications.js'diff --git a/server/tests/api/notifications/moderation-notifications.ts b/packages/tests/src/api/notifications/moderation-notifications.tssimilarity index 97%rename from server/tests/api/notifications/moderation-notifications.tsrename to packages/tests/src/api/notifications/moderation-notifications.tsindex e7a5c47e95..4937648825 100644--- a/server/tests/api/notifications/moderation-notifications.ts+++ b/packages/tests/src/api/notifications/moderation-notifications.ts@@ -1,26 +1,26 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */+import { wait } from '@peertube/peertube-core-utils'+import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@peertube/peertube-models'+import { buildUUID } from '@peertube/peertube-node-utils'+import { cleanupTests, PeerTubeServer, waitJobs } from '@peertube/peertube-server-commands'+import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'+import { MockInstancesIndex } from '@tests/shared/mock-servers/mock-instances-index.js'import {- checkAbuseStateChange,- checkAutoInstanceFollowing,+ prepareNotificationsTest,CheckerBaseParams,- checkNewAbuseMessage,+ checkNewVideoAbuseForModerators,+ checkNewCommentAbuseForModerators,checkNewAccountAbuseForModerators,+ checkAbuseStateChange,+ checkNewAbuseMessage,checkNewBlacklistOnMyVideo,- checkNewCommentAbuseForModerators,checkNewInstanceFollower,- checkNewVideoAbuseForModerators,- checkNewVideoFromSubscription,+ checkAutoInstanceFollowing,checkVideoAutoBlacklistForModerators,checkVideoIsPublished,- MockInstancesIndex,- MockSmtpServer,- prepareNotificationsTest-} from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@shared/models'-import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'+ checkNewVideoFromSubscription+} from '@tests/shared/notifications.js'describe('Test moderation notifications', function () {let servers: PeerTubeServer[] = []@@ -537,7 +537,7 @@ describe('Test moderation notifications', function () {privacy: VideoPrivacy.PRIVATE,scheduleUpdate: {updateAt: updateAt.toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}@@ -569,7 +569,7 @@ describe('Test moderation notifications', function () {privacy: VideoPrivacy.PRIVATE,scheduleUpdate: {updateAt: updateAt.toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}diff --git a/server/tests/api/notifications/notifications-api.ts b/packages/tests/src/api/notifications/notifications-api.tssimilarity index 95%rename from server/tests/api/notifications/notifications-api.tsrename to packages/tests/src/api/notifications/notifications-api.tsindex 1fc8611604..1c74615537 100644--- a/server/tests/api/notifications/notifications-api.ts+++ b/packages/tests/src/api/notifications/notifications-api.ts@@ -1,15 +1,15 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'+import { UserNotification, UserNotificationSettingValue } from '@peertube/peertube-models'+import { cleanupTests, PeerTubeServer, waitJobs } from '@peertube/peertube-server-commands'+import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'import {+ prepareNotificationsTest,CheckerBaseParams,- checkNewVideoFromSubscription,getAllNotificationsSettings,- MockSmtpServer,- prepareNotificationsTest-} from '@server/tests/shared'-import { UserNotification, UserNotificationSettingValue } from '@shared/models'-import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'+ checkNewVideoFromSubscription+} from '@tests/shared/notifications.js'describe('Test notifications API', function () {let server: PeerTubeServer@@ -104,7 +104,7 @@ describe('Test notifications API', function () {})it('Should not have notifications', async function () {- this.timeout(20000)+ this.timeout(40000)await server.notifications.updateMySettings({token: userToken,diff --git a/server/tests/api/notifications/registrations-notifications.ts b/packages/tests/src/api/notifications/registrations-notifications.tssimilarity index 87%rename from server/tests/api/notifications/registrations-notifications.tsrename to packages/tests/src/api/notifications/registrations-notifications.tsindex d20fc8df36..1f166cb368 100644--- a/server/tests/api/notifications/registrations-notifications.ts+++ b/packages/tests/src/api/notifications/registrations-notifications.ts@@ -1,14 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import {- CheckerBaseParams,- checkRegistrationRequest,- checkUserRegistered,- MockSmtpServer,- prepareNotificationsTest-} from '@server/tests/shared'-import { UserNotification } from '@shared/models'-import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'+import { UserNotification } from '@peertube/peertube-models'+import { cleanupTests, PeerTubeServer, waitJobs } from '@peertube/peertube-server-commands'+import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'+import { CheckerBaseParams, prepareNotificationsTest, checkUserRegistered, checkRegistrationRequest } from '@tests/shared/notifications.js'describe('Test registrations notifications', function () {let server: PeerTubeServerdiff --git a/server/tests/api/notifications/user-notifications.ts b/packages/tests/src/api/notifications/user-notifications.tssimilarity index 96%rename from server/tests/api/notifications/user-notifications.tsrename to packages/tests/src/api/notifications/user-notifications.tsindex 55da102659..4c03cdb473 100644--- a/server/tests/api/notifications/user-notifications.ts+++ b/packages/tests/src/api/notifications/user-notifications.ts@@ -1,22 +1,22 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'+import { wait } from '@peertube/peertube-core-utils'+import { UserNotification, UserNotificationType, VideoPrivacy, VideoStudioTask } from '@peertube/peertube-models'+import { buildUUID } from '@peertube/peertube-node-utils'+import { cleanupTests, findExternalSavedVideo, PeerTubeServer, stopFfmpeg, waitJobs } from '@peertube/peertube-server-commands'+import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'import {+ prepareNotificationsTest,CheckerBaseParams,- checkMyVideoImportIsFinished,- checkNewActorFollow,checkNewVideoFromSubscription,checkVideoIsPublished,checkVideoStudioEditionIsFinished,- FIXTURE_URLS,- MockSmtpServer,- prepareNotificationsTest,- uploadRandomVideoOnServers-} from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { UserNotification, UserNotificationType, VideoPrivacy, VideoStudioTask } from '@shared/models'-import { cleanupTests, findExternalSavedVideo, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands'+ checkMyVideoImportIsFinished,+ checkNewActorFollow+} from '@tests/shared/notifications.js'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { uploadRandomVideoOnServers } from '@tests/shared/videos.js'describe('Test user notifications', function () {let servers: PeerTubeServer[] = []@@ -96,7 +96,7 @@ describe('Test user notifications', function () {privacy: VideoPrivacy.PRIVATE,scheduleUpdate: {updateAt: updateAt.toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)@@ -115,7 +115,7 @@ describe('Test user notifications', function () {privacy: VideoPrivacy.PRIVATE,scheduleUpdate: {updateAt: updateAt.toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)@@ -134,7 +134,7 @@ describe('Test user notifications', function () {privacy: VideoPrivacy.PRIVATE,scheduleUpdate: {updateAt: updateAt.toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)@@ -292,7 +292,7 @@ describe('Test user notifications', function () {privacy: VideoPrivacy.PRIVATE,scheduleUpdate: {updateAt: updateAt.toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)@@ -310,7 +310,7 @@ describe('Test user notifications', function () {privacy: VideoPrivacy.PRIVATE,scheduleUpdate: {updateAt: updateAt.toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)diff --git a/packages/tests/src/api/object-storage/index.ts b/packages/tests/src/api/object-storage/index.tsnew file mode 100644index 0000000000..51d2a29a06--- /dev/null+++ b/packages/tests/src/api/object-storage/index.ts@@ -0,0 +1,4 @@+export * from './live.js'+export * from './video-imports.js'+export * from './video-static-file-privacy.js'+export * from './videos.js'diff --git a/server/tests/api/object-storage/live.ts b/packages/tests/src/api/object-storage/live.tssimilarity index 95%rename from server/tests/api/object-storage/live.tsrename to packages/tests/src/api/object-storage/live.tsindex 07ff4763b9..c8c214af52 100644--- a/server/tests/api/object-storage/live.ts+++ b/packages/tests/src/api/object-storage/live.ts@@ -1,9 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { expectStartWith, MockObjectStorageProxy, SQLCommand, testLiveVideoResolutions } from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'-import { HttpStatusCode, LiveVideoCreate, VideoPrivacy } from '@shared/models'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'+import { HttpStatusCode, LiveVideoCreate, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -19,7 +18,11 @@ import {waitUntilLivePublishedOnAllServers,waitUntilLiveReplacedByReplayOnAllServers,waitUntilLiveWaitingOnAllServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { expectStartWith } from '@tests/shared/checks.js'+import { testLiveVideoResolutions } from '@tests/shared/live.js'+import { MockObjectStorageProxy } from '@tests/shared/mock-servers/mock-object-storage.js'+import { SQLCommand } from '@tests/shared/sql-command.js'async function createLive (server: PeerTubeServer, permanent: boolean) {const attributes: LiveVideoCreate = {diff --git a/server/tests/api/object-storage/video-imports.ts b/packages/tests/src/api/object-storage/video-imports.tssimilarity index 90%rename from server/tests/api/object-storage/video-imports.tsrename to packages/tests/src/api/object-storage/video-imports.tsindex 57150e5a6c..43f7698421 100644--- a/server/tests/api/object-storage/video-imports.ts+++ b/packages/tests/src/api/object-storage/video-imports.ts@@ -1,9 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { expectStartWith, FIXTURE_URLS } from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'-import { HttpStatusCode, VideoPrivacy } from '@shared/models'+import { expectStartWith } from '@tests/shared/checks.js'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -13,7 +14,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function importVideo (server: PeerTubeServer) {const attributes = {diff --git a/server/tests/api/object-storage/video-static-file-privacy.ts b/packages/tests/src/api/object-storage/video-static-file-privacy.tssimilarity index 98%rename from server/tests/api/object-storage/video-static-file-privacy.tsrename to packages/tests/src/api/object-storage/video-static-file-privacy.tsindex 64ab542a53..cf6e9b4b96 100644--- a/server/tests/api/object-storage/video-static-file-privacy.ts+++ b/packages/tests/src/api/object-storage/video-static-file-privacy.ts@@ -2,9 +2,9 @@import { expect } from 'chai'import { basename } from 'path'-import { checkVideoFileTokenReinjection, expectStartWith, SQLCommand } from '@server/tests/shared'-import { areScalewayObjectStorageTestsDisabled, getAllFiles, getHLS } from '@shared/core-utils'-import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@shared/models'+import { getAllFiles, getHLS } from '@peertube/peertube-core-utils'+import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@peertube/peertube-models'+import { areScalewayObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'import {cleanupTests,createSingleServer,@@ -17,7 +17,10 @@ import {setDefaultVideoChannel,stopFfmpeg,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { expectStartWith } from '@tests/shared/checks.js'+import { SQLCommand } from '@tests/shared/sql-command.js'+import { checkVideoFileTokenReinjection } from '@tests/shared/streaming-playlists.js'function extractFilenameFromUrl (url: string) {const parts = basename(url).split(':')diff --git a/server/tests/api/object-storage/videos.ts b/packages/tests/src/api/object-storage/videos.tssimilarity index 94%rename from server/tests/api/object-storage/videos.tsrename to packages/tests/src/api/object-storage/videos.tsindex dcc52ef06b..66bca5cc88 100644--- a/server/tests/api/object-storage/videos.ts+++ b/packages/tests/src/api/object-storage/videos.ts@@ -2,20 +2,10 @@import bytes from 'bytes'import { expect } from 'chai'-import { stat } from 'fs-extra'-import { merge } from 'lodash'-import {- checkTmpIsEmpty,- checkWebTorrentWorks,- expectLogDoesNotContain,- expectStartWith,- generateHighBitrateVideo,- MockObjectStorageProxy,- SQLCommand-} from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'-import { sha1 } from '@shared/extra-utils'-import { HttpStatusCode, VideoDetails } from '@shared/models'+import { stat } from 'fs/promises'+import merge from 'lodash-es/merge.js'+import { HttpStatusCode, VideoDetails } from '@peertube/peertube-models'+import { areMockObjectStorageTestsDisabled, sha1 } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -27,7 +17,13 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { expectStartWith, expectLogDoesNotContain } from '@tests/shared/checks.js'+import { checkTmpIsEmpty } from '@tests/shared/directories.js'+import { generateHighBitrateVideo } from '@tests/shared/generate.js'+import { MockObjectStorageProxy } from '@tests/shared/mock-servers/mock-object-storage.js'+import { SQLCommand } from '@tests/shared/sql-command.js'+import { checkWebTorrentWorks } from '@tests/shared/webtorrent.js'async function checkFiles (options: {server: PeerTubeServerdiff --git a/packages/tests/src/api/redundancy/index.ts b/packages/tests/src/api/redundancy/index.tsnew file mode 100644index 0000000000..f6b70c8af3--- /dev/null+++ b/packages/tests/src/api/redundancy/index.ts@@ -0,0 +1,3 @@+import './redundancy-constraints.js'+import './redundancy.js'+import './manage-redundancy.js'diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/packages/tests/src/api/redundancy/manage-redundancy.tssimilarity index 98%rename from server/tests/api/redundancy/manage-redundancy.tsrename to packages/tests/src/api/redundancy/manage-redundancy.tsindex 404b65a99d..14556e26c6 100644--- a/server/tests/api/redundancy/manage-redundancy.ts+++ b/packages/tests/src/api/redundancy/manage-redundancy.ts@@ -9,8 +9,8 @@ import {RedundancyCommand,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'-import { VideoPrivacy, VideoRedundanciesTarget } from '@shared/models'+} from '@peertube/peertube-server-commands'+import { VideoPrivacy, VideoRedundanciesTarget } from '@peertube/peertube-models'describe('Test manage videos redundancy', function () {const targets: VideoRedundanciesTarget[] = [ 'my-videos', 'remote-videos' ]diff --git a/server/tests/api/redundancy/redundancy-constraints.ts b/packages/tests/src/api/redundancy/redundancy-constraints.tssimilarity index 97%rename from server/tests/api/redundancy/redundancy-constraints.tsrename to packages/tests/src/api/redundancy/redundancy-constraints.tsindex c86573168d..24966b2700 100644--- a/server/tests/api/redundancy/redundancy-constraints.ts+++ b/packages/tests/src/api/redundancy/redundancy-constraints.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { VideoPrivacy } from '@shared/models'+import { VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -9,7 +9,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test redundancy constraints', function () {let remoteServer: PeerTubeServerdiff --git a/server/tests/api/redundancy/redundancy.ts b/packages/tests/src/api/redundancy/redundancy.tssimilarity index 98%rename from server/tests/api/redundancy/redundancy.tsrename to packages/tests/src/api/redundancy/redundancy.tsindex 0c5c272254..69afae0379 100644--- a/server/tests/api/redundancy/redundancy.ts+++ b/packages/tests/src/api/redundancy/redundancy.ts@@ -1,11 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { readdir } from 'fs-extra'+import { readdir } from 'fs/promises'import { decode as magnetUriDecode } from 'magnet-uri'import { basename, join } from 'path'-import { checkSegmentHash, checkVideoFilesWereRemoved, saveVideoInServers } from '@server/tests/shared'-import { wait } from '@shared/core-utils'+import { wait } from '@peertube/peertube-core-utils'import {HttpStatusCode,VideoDetails,@@ -13,7 +12,7 @@ import {VideoPrivacy,VideoRedundancyStrategy,VideoRedundancyStrategyWithManual-} from '@shared/models'+} from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -23,7 +22,9 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { checkSegmentHash } from '@tests/shared/streaming-playlists.js'+import { checkVideoFilesWereRemoved, saveVideoInServers } from '@tests/shared/videos.js'let servers: PeerTubeServer[] = []let video1Server2: VideoDetailsdiff --git a/packages/tests/src/api/runners/index.ts b/packages/tests/src/api/runners/index.tsnew file mode 100644index 0000000000..441ddc8746--- /dev/null+++ b/packages/tests/src/api/runners/index.ts@@ -0,0 +1,5 @@+export * from './runner-common.js'+export * from './runner-live-transcoding.js'+export * from './runner-socket.js'+export * from './runner-studio-transcoding.js'+export * from './runner-vod-transcoding.js'diff --git a/server/tests/api/runners/runner-common.ts b/packages/tests/src/api/runners/runner-common.tssimilarity index 98%rename from server/tests/api/runners/runner-common.tsrename to packages/tests/src/api/runners/runner-common.tsindex 9b2eb8b27e..53ea321d06 100644--- a/server/tests/api/runners/runner-common.ts+++ b/packages/tests/src/api/runners/runner-common.ts@@ -1,24 +1,25 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { expect } from 'chai'-import { wait } from '@shared/core-utils'+import { wait } from '@peertube/peertube-core-utils'import {HttpStatusCode,Runner,RunnerJob,RunnerJobAdmin,RunnerJobState,+ RunnerJobStateType,RunnerJobVODWebVideoTranscodingPayload,RunnerRegistrationToken-} from '@shared/models'+} from '@peertube/peertube-models'import {+ PeerTubeServer,cleanupTests,createSingleServer,- PeerTubeServer,setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { expect } from 'chai'describe('Test runner common actions', function () {let server: PeerTubeServer@@ -224,8 +225,8 @@ describe('Test runner common actions', function () {let failedJob: RunnerJobasync function checkMainJobState (- mainJobState: RunnerJobState,- otherJobStates: RunnerJobState[] = [ RunnerJobState.PENDING, RunnerJobState.WAITING_FOR_PARENT_JOB ]+ mainJobState: RunnerJobStateType,+ otherJobStates: RunnerJobStateType[] = [ RunnerJobState.PENDING, RunnerJobState.WAITING_FOR_PARENT_JOB ]) {const { data } = await server.runnerJobs.list({ count: 10, sort: '-updatedAt' })diff --git a/server/tests/api/runners/runner-live-transcoding.ts b/packages/tests/src/api/runners/runner-live-transcoding.tssimilarity index 96%rename from server/tests/api/runners/runner-live-transcoding.tsrename to packages/tests/src/api/runners/runner-live-transcoding.tsindex b11d540399..20c1e5c2a1 100644--- a/server/tests/api/runners/runner-live-transcoding.ts+++ b/packages/tests/src/api/runners/runner-live-transcoding.ts@@ -2,19 +2,21 @@import { expect } from 'chai'import { FfmpegCommand } from 'fluent-ffmpeg'-import { readFile } from 'fs-extra'-import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'+import { readFile } from 'fs/promises'+import { wait } from '@peertube/peertube-core-utils'import {HttpStatusCode,LiveRTMPHLSTranscodingUpdatePayload,LiveVideo,LiveVideoError,+ LiveVideoErrorType,RunnerJob,RunnerJobLiveRTMPHLSTranscodingPayload,Video,VideoPrivacy,VideoState-} from '@shared/models'+} from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {cleanupTests,createSingleServer,@@ -26,7 +28,7 @@ import {stopFfmpeg,testFfmpegStreamError,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test runner live transcoding', function () {let server: PeerTubeServer@@ -263,7 +265,7 @@ describe('Test runner live transcoding', function () {return job}- async function checkSessionError (error: LiveVideoError) {+ async function checkSessionError (error: LiveVideoErrorType) {await wait(1500)await waitJobs([ server ])diff --git a/server/tests/api/runners/runner-socket.ts b/packages/tests/src/api/runners/runner-socket.tssimilarity index 97%rename from server/tests/api/runners/runner-socket.tsrename to packages/tests/src/api/runners/runner-socket.tsindex 215164e484..726ef084fb 100644--- a/server/tests/api/runners/runner-socket.ts+++ b/packages/tests/src/api/runners/runner-socket.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'+import { wait } from '@peertube/peertube-core-utils'import {cleanupTests,createSingleServer,@@ -9,7 +9,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test runner socket', function () {let server: PeerTubeServerdiff --git a/server/tests/api/runners/runner-studio-transcoding.ts b/packages/tests/src/api/runners/runner-studio-transcoding.tssimilarity index 93%rename from server/tests/api/runners/runner-studio-transcoding.tsrename to packages/tests/src/api/runners/runner-studio-transcoding.tsindex f5cea6cea6..adf6941c35 100644--- a/server/tests/api/runners/runner-studio-transcoding.ts+++ b/packages/tests/src/api/runners/runner-studio-transcoding.ts@@ -1,16 +1,15 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { readFile } from 'fs-extra'-import { checkPersistentTmpIsEmpty, checkVideoDuration } from '@server/tests/shared'-import { buildAbsoluteFixturePath } from '@shared/core-utils'+import { readFile } from 'fs/promises'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {RunnerJobStudioTranscodingPayload,VideoStudioTranscodingSuccess,VideoState,VideoStudioTask,VideoStudioTaskIntro-} from '@shared/models'+} from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -20,7 +19,9 @@ import {setDefaultVideoChannel,VideoStudioCommand,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { checkVideoDuration } from '@tests/shared/checks.js'+import { checkPersistentTmpIsEmpty } from '@tests/shared/directories.js'describe('Test runner video studio transcoding', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/runners/runner-vod-transcoding.ts b/packages/tests/src/api/runners/runner-vod-transcoding.tssimilarity index 98%rename from server/tests/api/runners/runner-vod-transcoding.tsrename to packages/tests/src/api/runners/runner-vod-transcoding.tsindex ee6be4ee97..fe1c8f0b26 100644--- a/server/tests/api/runners/runner-vod-transcoding.ts+++ b/packages/tests/src/api/runners/runner-vod-transcoding.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { readFile } from 'fs-extra'-import { completeCheckHlsPlaylist } from '@server/tests/shared'-import { buildAbsoluteFixturePath } from '@shared/core-utils'+import { readFile } from 'fs/promises'+import { completeCheckHlsPlaylist } from '@tests/shared/streaming-playlists.js'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {HttpStatusCode,RunnerJobSuccessPayload,@@ -15,7 +15,7 @@ import {VODAudioMergeTranscodingSuccess,VODHLSTranscodingSuccess,VODWebVideoTranscodingSuccess-} from '@shared/models'+} from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -26,7 +26,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function processAllJobs (server: PeerTubeServer, runnerToken: string) {do {diff --git a/packages/tests/src/api/search/index.ts b/packages/tests/src/api/search/index.tsnew file mode 100644index 0000000000..f4420261db--- /dev/null+++ b/packages/tests/src/api/search/index.ts@@ -0,0 +1,7 @@+import './search-activitypub-video-playlists.js'+import './search-activitypub-video-channels.js'+import './search-activitypub-videos.js'+import './search-channels.js'+import './search-index.js'+import './search-playlists.js'+import './search-videos.js'diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/packages/tests/src/api/search/search-activitypub-video-channels.tssimilarity index 98%rename from server/tests/api/search/search-activitypub-video-channels.tsrename to packages/tests/src/api/search/search-activitypub-video-channels.tsindex 003bd34d03..b63f45b187 100644--- a/server/tests/api/search/search-activitypub-video-channels.ts+++ b/packages/tests/src/api/search/search-activitypub-video-channels.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { VideoChannel } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { VideoChannel } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -12,7 +12,7 @@ import {setDefaultAccountAvatar,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test ActivityPub video channels search', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/packages/tests/src/api/search/search-activitypub-video-playlists.tssimilarity index 97%rename from server/tests/api/search/search-activitypub-video-playlists.tsrename to packages/tests/src/api/search/search-activitypub-video-playlists.tsindex 2bb5d869ac..33ecfd8e7e 100644--- a/server/tests/api/search/search-activitypub-video-playlists.ts+++ b/packages/tests/src/api/search/search-activitypub-video-playlists.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { VideoPlaylistPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { VideoPlaylistPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -12,7 +12,7 @@ import {setDefaultAccountAvatar,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test ActivityPub playlists search', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/search/search-activitypub-videos.ts b/packages/tests/src/api/search/search-activitypub-videos.tssimilarity index 97%rename from server/tests/api/search/search-activitypub-videos.tsrename to packages/tests/src/api/search/search-activitypub-videos.tsindex 4c71184227..72759f21ed 100644--- a/server/tests/api/search/search-activitypub-videos.ts+++ b/packages/tests/src/api/search/search-activitypub-videos.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -12,7 +12,7 @@ import {setDefaultAccountAvatar,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test ActivityPub videos search', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/search/search-channels.ts b/packages/tests/src/api/search/search-channels.tssimilarity index 97%rename from server/tests/api/search/search-channels.tsrename to packages/tests/src/api/search/search-channels.tsindex c6b098a938..36596e0364 100644--- a/server/tests/api/search/search-channels.ts+++ b/packages/tests/src/api/search/search-channels.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { VideoChannel } from '@shared/models'+import { VideoChannel } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -11,7 +11,7 @@ import {setAccessTokensToServers,setDefaultAccountAvatar,setDefaultChannelAvatar-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test channels search', function () {let server: PeerTubeServerdiff --git a/server/tests/api/search/search-index.ts b/packages/tests/src/api/search/search-index.tssimilarity index 98%rename from server/tests/api/search/search-index.tsrename to packages/tests/src/api/search/search-index.tsindex cbe628cccc..4bac7ea94a 100644--- a/server/tests/api/search/search-index.ts+++ b/packages/tests/src/api/search/search-index.ts@@ -8,8 +8,14 @@ import {VideoPlaylistsSearchQuery,VideoPlaylistType,VideosSearchQuery-} from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/server-commands'+} from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ SearchCommand,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test index search', function () {const localVideoName = 'local video' + new Date().toISOString()diff --git a/server/tests/api/search/search-playlists.ts b/packages/tests/src/api/search/search-playlists.tssimilarity index 97%rename from server/tests/api/search/search-playlists.tsrename to packages/tests/src/api/search/search-playlists.tsindex a357674c28..cd16e202e9 100644--- a/server/tests/api/search/search-playlists.ts+++ b/packages/tests/src/api/search/search-playlists.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { VideoPlaylistPrivacy } from '@shared/models'+import { VideoPlaylistPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -12,7 +12,7 @@ import {setDefaultAccountAvatar,setDefaultChannelAvatar,setDefaultVideoChannel-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test playlists search', function () {let server: PeerTubeServerdiff --git a/server/tests/api/search/search-videos.ts b/packages/tests/src/api/search/search-videos.tssimilarity index 99%rename from server/tests/api/search/search-videos.tsrename to packages/tests/src/api/search/search-videos.tsindex f7f50147d5..0739f08862 100644--- a/server/tests/api/search/search-videos.ts+++ b/packages/tests/src/api/search/search-videos.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -14,7 +14,7 @@ import {setDefaultChannelAvatar,setDefaultVideoChannel,stopFfmpeg-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test videos search', function () {let server: PeerTubeServerdiff --git a/server/tests/api/server/auto-follows.ts b/packages/tests/src/api/server/auto-follows.tssimilarity index 96%rename from server/tests/api/server/auto-follows.tsrename to packages/tests/src/api/server/auto-follows.tsindex 6ce1a3799b..aa272ebcc3 100644--- a/server/tests/api/server/auto-follows.ts+++ b/packages/tests/src/api/server/auto-follows.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { MockInstancesIndex } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'+import { MockInstancesIndex } from '@tests/shared/mock-servers/index.js'+import { wait } from '@peertube/peertube-core-utils'+import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@peertube/peertube-server-commands'async function checkFollow (follower: PeerTubeServer, following: PeerTubeServer, exists: boolean) {{diff --git a/server/tests/api/server/bulk.ts b/packages/tests/src/api/server/bulk.tssimilarity index 99%rename from server/tests/api/server/bulk.tsrename to packages/tests/src/api/server/bulk.tsindex 66d791a0f2..725bcfef28 100644--- a/server/tests/api/server/bulk.ts+++ b/packages/tests/src/api/server/bulk.ts@@ -9,7 +9,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test bulk actions', function () {const commentsUser3: { videoId: number, commentId: number }[] = []diff --git a/server/tests/api/server/config-defaults.ts b/packages/tests/src/api/server/config-defaults.tssimilarity index 96%rename from server/tests/api/server/config-defaults.tsrename to packages/tests/src/api/server/config-defaults.tsindex 041032f2bd..e874af012e 100644--- a/server/tests/api/server/config-defaults.ts+++ b/packages/tests/src/api/server/config-defaults.ts@@ -1,9 +1,15 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { FIXTURE_URLS } from '@server/tests/shared'-import { VideoDetails, VideoPrivacy } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands'+import { VideoDetails, VideoPrivacy } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ setAccessTokensToServers,+ setDefaultVideoChannel+} from '@peertube/peertube-server-commands'+import { FIXTURE_URLS } from '@tests/shared/tests.js'describe('Test config defaults', function () {let server: PeerTubeServerdiff --git a/server/tests/api/server/config.ts b/packages/tests/src/api/server/config.tssimilarity index 99%rename from server/tests/api/server/config.tsrename to packages/tests/src/api/server/config.tsindex a614d92d29..ce64668f81 100644--- a/server/tests/api/server/config.ts+++ b/packages/tests/src/api/server/config.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { parallelTests } from '@shared/core-utils'-import { CustomConfig, HttpStatusCode } from '@shared/models'+import { parallelTests } from '@peertube/peertube-node-utils'+import { CustomConfig, HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -10,7 +10,7 @@ import {makeGetRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {expect(data.instance.name).to.equal('PeerTube')diff --git a/server/tests/api/server/contact-form.ts b/packages/tests/src/api/server/contact-form.tssimilarity index 92%rename from server/tests/api/server/contact-form.tsrename to packages/tests/src/api/server/contact-form.tsindex 0256cc193f..03389aa64f 100644--- a/server/tests/api/server/contact-form.ts+++ b/packages/tests/src/api/server/contact-form.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { MockSmtpServer } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,ConfigCommand,@@ -12,7 +12,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test contact form', function () {let server: PeerTubeServerdiff --git a/server/tests/api/server/email.ts b/packages/tests/src/api/server/email.tssimilarity index 98%rename from server/tests/api/server/email.tsrename to packages/tests/src/api/server/email.tsindex 9141cc697f..6d3f3f3bb4 100644--- a/server/tests/api/server/email.ts+++ b/packages/tests/src/api/server/email.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { MockSmtpServer } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'+import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,ConfigCommand,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test emails', function () {let server: PeerTubeServerdiff --git a/server/tests/api/server/follow-constraints.ts b/packages/tests/src/api/server/follow-constraints.tssimilarity index 99%rename from server/tests/api/server/follow-constraints.tsrename to packages/tests/src/api/server/follow-constraints.tsindex ff53328584..8d277c906c 100644--- a/server/tests/api/server/follow-constraints.ts+++ b/packages/tests/src/api/server/follow-constraints.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'+import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -9,7 +9,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test follow constraints', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/server/follows-moderation.ts b/packages/tests/src/api/server/follows-moderation.tssimilarity index 98%rename from server/tests/api/server/follows-moderation.tsrename to packages/tests/src/api/server/follows-moderation.tsindex d145dd9d2c..811dd5c221 100644--- a/server/tests/api/server/follows-moderation.ts+++ b/packages/tests/src/api/server/follows-moderation.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { expectStartWith } from '@server/tests/shared'-import { ActorFollow, FollowState } from '@shared/models'+import { expectStartWith } from '@tests/shared/checks.js'+import { ActorFollow, FollowState } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function checkServer1And2HasFollowers (servers: PeerTubeServer[], state = 'accepted') {const fns = [diff --git a/server/tests/api/server/follows.ts b/packages/tests/src/api/server/follows.tssimilarity index 98%rename from server/tests/api/server/follows.tsrename to packages/tests/src/api/server/follows.tsindex e3e4605eec..fbe2e87dae 100644--- a/server/tests/api/server/follows.ts+++ b/packages/tests/src/api/server/follows.ts@@ -1,9 +1,12 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { completeVideoCheck, dateIsValid, expectAccountFollows, expectChannelsFollows, testCaptionFile } from '@server/tests/shared'-import { Video, VideoPrivacy } from '@shared/models'-import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'+import { Video, VideoPrivacy } from '@peertube/peertube-models'+import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@peertube/peertube-server-commands'+import { expectAccountFollows, expectChannelsFollows } from '@tests/shared/actors.js'+import { testCaptionFile } from '@tests/shared/captions.js'+import { dateIsValid } from '@tests/shared/checks.js'+import { completeVideoCheck } from '@tests/shared/videos.js'describe('Test follows', function () {diff --git a/server/tests/api/server/handle-down.ts b/packages/tests/src/api/server/handle-down.tssimilarity index 97%rename from server/tests/api/server/handle-down.tsrename to packages/tests/src/api/server/handle-down.tsindex 1d524aa935..604df129fe 100644--- a/server/tests/api/server/handle-down.ts+++ b/packages/tests/src/api/server/handle-down.ts@@ -1,9 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { completeVideoCheck, SQLCommand } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,CommentsCommand,@@ -12,7 +11,9 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { SQLCommand } from '@tests/shared/sql-command.js'+import { completeVideoCheck } from '@tests/shared/videos.js'describe('Test handle downs', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/server/homepage.ts b/packages/tests/src/api/server/homepage.tssimilarity index 95%rename from server/tests/api/server/homepage.tsrename to packages/tests/src/api/server/homepage.tsindex 9c45800f2b..082a2fb91f 100644--- a/server/tests/api/server/homepage.ts+++ b/packages/tests/src/api/server/homepage.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -11,7 +11,7 @@ import {setAccessTokensToServers,setDefaultAccountAvatar,setDefaultChannelAvatar-} from '../../../../shared/server-commands/index'+} from '@peertube/peertube-server-commands'async function getHomepageState (server: PeerTubeServer) {const config = await server.config.getConfig()diff --git a/packages/tests/src/api/server/index.ts b/packages/tests/src/api/server/index.tsnew file mode 100644index 0000000000..5c80a5a37e--- /dev/null+++ b/packages/tests/src/api/server/index.ts@@ -0,0 +1,22 @@+import './auto-follows.js'+import './bulk.js'+import './config-defaults.js'+import './config.js'+import './contact-form.js'+import './email.js'+import './follow-constraints.js'+import './follows.js'+import './follows-moderation.js'+import './homepage.js'+import './handle-down.js'+import './jobs.js'+import './logs.js'+import './reverse-proxy.js'+import './services.js'+import './slow-follows.js'+import './stats.js'+import './tracker.js'+import './no-client.js'+import './open-telemetry.js'+import './plugins.js'+import './proxy.js'diff --git a/server/tests/api/server/jobs.ts b/packages/tests/src/api/server/jobs.tssimilarity index 95%rename from server/tests/api/server/jobs.tsrename to packages/tests/src/api/server/jobs.tsindex d0e6df7197..3d60b1431f 100644--- a/server/tests/api/server/jobs.ts+++ b/packages/tests/src/api/server/jobs.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { dateIsValid } from '@server/tests/shared'-import { wait } from '@shared/core-utils'+import { dateIsValid } from '@tests/shared/checks.js'+import { wait } from '@peertube/peertube-core-utils'import {cleanupTests,createMultipleServers,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test jobs', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/server/logs.ts b/packages/tests/src/api/server/logs.tssimilarity index 98%rename from server/tests/api/server/logs.tsrename to packages/tests/src/api/server/logs.tsindex 9cf04c5018..11c86d6942 100644--- a/server/tests/api/server/logs.ts+++ b/packages/tests/src/api/server/logs.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test logs', function () {let server: PeerTubeServerdiff --git a/server/tests/api/server/no-client.ts b/packages/tests/src/api/server/no-client.tssimilarity index 85%rename from server/tests/api/server/no-client.tsrename to packages/tests/src/api/server/no-client.tsindex 193f6c9877..0f097d50b0 100644--- a/server/tests/api/server/no-client.ts+++ b/packages/tests/src/api/server/no-client.ts@@ -1,6 +1,6 @@import request from 'supertest'-import { HttpStatusCode } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/server-commands'+import { HttpStatusCode } from '@peertube/peertube-models'+import { cleanupTests, createSingleServer, PeerTubeServer } from '@peertube/peertube-server-commands'describe('Start and stop server without web client routes', function () {let server: PeerTubeServerdiff --git a/server/tests/api/server/open-telemetry.ts b/packages/tests/src/api/server/open-telemetry.tssimilarity index 93%rename from server/tests/api/server/open-telemetry.tsrename to packages/tests/src/api/server/open-telemetry.tsindex 508e9d6491..8ed3801db0 100644--- a/server/tests/api/server/open-telemetry.ts+++ b/packages/tests/src/api/server/open-telemetry.ts@@ -1,9 +1,16 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { expectLogContain, expectLogDoesNotContain, MockHTTP } from '@server/tests/shared'-import { HttpStatusCode, PlaybackMetricCreate, VideoPrivacy, VideoResolution } from '@shared/models'-import { cleanupTests, createSingleServer, makeRawRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { HttpStatusCode, PlaybackMetricCreate, VideoPrivacy, VideoResolution } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ makeRawRequest,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'+import { expectLogDoesNotContain, expectLogContain } from '@tests/shared/checks.js'+import { MockHTTP } from '@tests/shared/mock-servers/mock-http.js'describe('Open Telemetry', function () {let server: PeerTubeServerdiff --git a/server/tests/api/server/plugins.ts b/packages/tests/src/api/server/plugins.tssimilarity index 97%rename from server/tests/api/server/plugins.tsrename to packages/tests/src/api/server/plugins.tsindex a0e9db1d3c..a78cea0257 100644--- a/server/tests/api/server/plugins.ts+++ b/packages/tests/src/api/server/plugins.ts@@ -1,11 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pathExists, remove } from 'fs-extra'+import { pathExists, remove } from 'fs-extra/esm'import { join } from 'path'-import { SQLCommand, testHelloWorldRegisteredSettings } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { HttpStatusCode, PluginType } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, PluginType } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -14,7 +13,9 @@ import {PeerTubeServer,PluginsCommand,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { SQLCommand } from '@tests/shared/sql-command.js'+import { testHelloWorldRegisteredSettings } from '@tests/shared/plugins.js'describe('Test plugins', function () {let server: PeerTubeServerdiff --git a/server/tests/api/server/proxy.ts b/packages/tests/src/api/server/proxy.tssimilarity index 89%rename from server/tests/api/server/proxy.tsrename to packages/tests/src/api/server/proxy.tsindex 9337468d58..c7d13f4abc 100644--- a/server/tests/api/server/proxy.ts+++ b/packages/tests/src/api/server/proxy.ts@@ -1,9 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { expectNotStartWith, expectStartWith, FIXTURE_URLS, MockProxy } from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'-import { HttpStatusCode, VideoPrivacy } from '@shared/models'+import { HttpStatusCode, HttpStatusCodeType, VideoPrivacy } from '@peertube/peertube-models'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -13,7 +12,10 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { expectStartWith, expectNotStartWith } from '@tests/shared/checks.js'+import { MockProxy } from '@tests/shared/mock-servers/mock-proxy.js'describe('Test proxy', function () {let servers: PeerTubeServer[] = []@@ -82,7 +84,7 @@ describe('Test proxy', function () {describe('Videos import', async function () {- function quickImport (expectedStatus: HttpStatusCode = HttpStatusCode.OK_200) {+ function quickImport (expectedStatus: HttpStatusCodeType = HttpStatusCode.OK_200) {return servers[0].imports.importVideo({attributes: {name: 'video import',diff --git a/server/tests/api/server/reverse-proxy.ts b/packages/tests/src/api/server/reverse-proxy.tssimilarity index 96%rename from server/tests/api/server/reverse-proxy.tsrename to packages/tests/src/api/server/reverse-proxy.tsindex 11c96c4b52..7e334cc3e5 100644--- a/server/tests/api/server/reverse-proxy.ts+++ b/packages/tests/src/api/server/reverse-proxy.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@peertube/peertube-server-commands'describe('Test application behind a reverse proxy', function () {let server: PeerTubeServerdiff --git a/server/tests/api/server/services.ts b/packages/tests/src/api/server/services.tssimilarity index 95%rename from server/tests/api/server/services.tsrename to packages/tests/src/api/server/services.tsindex a10e9baed0..349d29a587 100644--- a/server/tests/api/server/services.ts+++ b/packages/tests/src/api/server/services.ts@@ -1,8 +1,14 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands'-import { Video, VideoPlaylistPrivacy } from '@shared/models'+import { Video, VideoPlaylistPrivacy } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ setAccessTokensToServers,+ setDefaultVideoChannel+} from '@peertube/peertube-server-commands'describe('Test services', function () {let server: PeerTubeServer = nulldiff --git a/server/tests/api/server/slow-follows.ts b/packages/tests/src/api/server/slow-follows.tssimilarity index 96%rename from server/tests/api/server/slow-follows.tsrename to packages/tests/src/api/server/slow-follows.tsindex a967fa724e..d031090018 100644--- a/server/tests/api/server/slow-follows.ts+++ b/packages/tests/src/api/server/slow-follows.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { Job } from '@shared/models'+import { Job } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -9,7 +9,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test slow follows', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/server/stats.ts b/packages/tests/src/api/server/stats.tssimilarity index 97%rename from server/tests/api/server/stats.tsrename to packages/tests/src/api/server/stats.tsindex a1bf189fac..32ab323ce4 100644--- a/server/tests/api/server/stats.ts+++ b/packages/tests/src/api/server/stats.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { ActivityType, VideoPlaylistPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { ActivityType, VideoPlaylistPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -12,7 +12,7 @@ import {setDefaultAccountAvatar,setDefaultChannelAvatar,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test stats (excluding redundancy)', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/server/tracker.ts b/packages/tests/src/api/server/tracker.tssimilarity index 95%rename from server/tests/api/server/tracker.tsrename to packages/tests/src/api/server/tracker.tsindex a0ce2ca35d..4df4e4613c 100644--- a/server/tests/api/server/tracker.ts+++ b/packages/tests/src/api/server/tracker.ts@@ -2,7 +2,13 @@import { decode as magnetUriDecode, encode as magnetUriEncode } from 'magnet-uri'import WebTorrent from 'webtorrent'-import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import {+ cleanupTests,+ createSingleServer,+ killallServers,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test tracker', function () {let server: PeerTubeServerdiff --git a/server/tests/api/transcoding/audio-only.ts b/packages/tests/src/api/transcoding/audio-only.tssimilarity index 95%rename from server/tests/api/transcoding/audio-only.tsrename to packages/tests/src/api/transcoding/audio-only.tsindex f4cc012ef4..6d04103480 100644--- a/server/tests/api/transcoding/audio-only.ts+++ b/packages/tests/src/api/transcoding/audio-only.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { getAudioStream, getVideoStreamDimensionsInfo } from '@shared/ffmpeg'+import { getAudioStream, getVideoStreamDimensionsInfo } from '@peertube/peertube-ffmpeg'import {cleanupTests,createMultipleServers,@@ -9,7 +9,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test audio only video transcoding', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/transcoding/create-transcoding.ts b/packages/tests/src/api/transcoding/create-transcoding.tssimilarity index 95%rename from server/tests/api/transcoding/create-transcoding.tsrename to packages/tests/src/api/transcoding/create-transcoding.tsindex 9a891043cf..b0a9c7556d 100644--- a/server/tests/api/transcoding/create-transcoding.ts+++ b/packages/tests/src/api/transcoding/create-transcoding.ts@@ -1,9 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { checkResolutionsInMasterPlaylist, expectStartWith } from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'-import { HttpStatusCode, VideoDetails } from '@shared/models'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'+import { HttpStatusCode, VideoDetails } from '@peertube/peertube-models'import {cleanupTests,ConfigCommand,@@ -15,7 +14,9 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { expectStartWith } from '@tests/shared/checks.js'+import { checkResolutionsInMasterPlaylist } from '@tests/shared/streaming-playlists.js'async function checkFilesInObjectStorage (objectStorage: ObjectStorageCommand, video: VideoDetails) {for (const file of video.files) {diff --git a/server/tests/api/transcoding/hls.ts b/packages/tests/src/api/transcoding/hls.tssimilarity index 91%rename from server/tests/api/transcoding/hls.tsrename to packages/tests/src/api/transcoding/hls.tsindex d67043c2ae..884f98e877 100644--- a/server/tests/api/transcoding/hls.ts+++ b/packages/tests/src/api/transcoding/hls.ts@@ -1,9 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { join } from 'path'-import { checkDirectoryIsEmpty, checkTmpIsEmpty, completeCheckHlsPlaylist } from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -12,8 +11,10 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'-import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'+} from '@peertube/peertube-server-commands'+import { DEFAULT_AUDIO_RESOLUTION } from '@peertube/peertube-server/server/initializers/constants.js'+import { checkDirectoryIsEmpty, checkTmpIsEmpty } from '@tests/shared/directories.js'+import { completeCheckHlsPlaylist } from '@tests/shared/streaming-playlists.js'describe('Test HLS videos', function () {let servers: PeerTubeServer[] = []diff --git a/packages/tests/src/api/transcoding/index.ts b/packages/tests/src/api/transcoding/index.tsnew file mode 100644index 0000000000..c25cd51c34--- /dev/null+++ b/packages/tests/src/api/transcoding/index.ts@@ -0,0 +1,6 @@+export * from './audio-only.js'+export * from './create-transcoding.js'+export * from './hls.js'+export * from './transcoder.js'+export * from './update-while-transcoding.js'+export * from './video-studio.js'diff --git a/server/tests/api/transcoding/transcoder.ts b/packages/tests/src/api/transcoding/transcoder.tssimilarity index 97%rename from server/tests/api/transcoding/transcoder.tsrename to packages/tests/src/api/transcoding/transcoder.tsindex 5386d236fe..8900491f58 100644--- a/server/tests/api/transcoding/transcoder.ts+++ b/packages/tests/src/api/transcoding/transcoder.ts@@ -1,9 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { canDoQuickTranscode } from '@server/lib/transcoding/transcoding-quick-transcode'-import { checkWebTorrentWorks, generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared'-import { buildAbsoluteFixturePath, getAllFiles, getMaxTheoreticalBitrate, getMinTheoreticalBitrate, omit } from '@shared/core-utils'+import { getAllFiles, getMaxTheoreticalBitrate, getMinTheoreticalBitrate, omit } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoFileMetadata, VideoState } from '@peertube/peertube-models'+import { canDoQuickTranscode } from '@peertube/peertube-server/server/lib/transcoding/transcoding-quick-transcode.js'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {ffprobePromise,getAudioStream,@@ -11,8 +12,7 @@ import {getVideoStreamDimensionsInfo,getVideoStreamFPS,hasAudioStream-} from '@shared/ffmpeg'-import { HttpStatusCode, VideoFileMetadata, VideoState } from '@shared/models'+} from '@peertube/peertube-ffmpeg'import {cleanupTests,createMultipleServers,@@ -21,7 +21,9 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { generateVideoWithFramerate, generateHighBitrateVideo } from '@tests/shared/generate.js'+import { checkWebTorrentWorks } from '@tests/shared/webtorrent.js'function updateConfigForTranscoding (server: PeerTubeServer) {return server.config.updateCustomSubConfig({diff --git a/server/tests/api/transcoding/update-while-transcoding.ts b/packages/tests/src/api/transcoding/update-while-transcoding.tssimilarity index 93%rename from server/tests/api/transcoding/update-while-transcoding.tsrename to packages/tests/src/api/transcoding/update-while-transcoding.tsindex cfb4fa0cca..9990bc7456 100644--- a/server/tests/api/transcoding/update-while-transcoding.ts+++ b/packages/tests/src/api/transcoding/update-while-transcoding.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { completeCheckHlsPlaylist } from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled, wait } from '@shared/core-utils'-import { VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { VideoPrivacy } from '@peertube/peertube-models'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -11,7 +11,8 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { completeCheckHlsPlaylist } from '@tests/shared/streaming-playlists.js'describe('Test update video privacy while transcoding', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/transcoding/video-studio.ts b/packages/tests/src/api/transcoding/video-studio.tssimilarity index 95%rename from server/tests/api/transcoding/video-studio.tsrename to packages/tests/src/api/transcoding/video-studio.tsindex ba68f8e242..8a3788aa61 100644--- a/server/tests/api/transcoding/video-studio.ts+++ b/packages/tests/src/api/transcoding/video-studio.ts@@ -1,7 +1,7 @@import { expect } from 'chai'-import { checkPersistentTmpIsEmpty, checkVideoDuration, expectStartWith } from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled, getAllFiles } from '@shared/core-utils'-import { VideoStudioTask } from '@shared/models'+import { getAllFiles } from '@peertube/peertube-core-utils'+import { VideoStudioTask } from '@peertube/peertube-models'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -12,7 +12,9 @@ import {setDefaultVideoChannel,VideoStudioCommand,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { checkVideoDuration, expectStartWith } from '@tests/shared/checks.js'+import { checkPersistentTmpIsEmpty } from '@tests/shared/directories.js'describe('Test video studio', function () {let servers: PeerTubeServer[] = []diff --git a/packages/tests/src/api/users/index.ts b/packages/tests/src/api/users/index.tsnew file mode 100644index 0000000000..830d4da62b--- /dev/null+++ b/packages/tests/src/api/users/index.ts@@ -0,0 +1,8 @@+import './oauth.js'+import './registrations`.js'+import './two-factor.js'+import './user-subscriptions.js'+import './user-videos.js'+import './users.js'+import './users-multiple-servers.js'+import './users-email-verification.js'diff --git a/server/tests/api/users/oauth.ts b/packages/tests/src/api/users/oauth.tssimilarity index 95%rename from server/tests/api/users/oauth.tsrename to packages/tests/src/api/users/oauth.tsindex 1536158759..fe50872cb1 100644--- a/server/tests/api/users/oauth.ts+++ b/packages/tests/src/api/users/oauth.ts@@ -1,10 +1,16 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { SQLCommand } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { HttpStatusCode, OAuth2ErrorCode, PeerTubeProblemDocument } from '@shared/models'-import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, OAuth2ErrorCode, PeerTubeProblemDocument } from '@peertube/peertube-models'+import { SQLCommand } from '@tests/shared/sql-command.js'+import {+ cleanupTests,+ createSingleServer,+ killallServers,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test oauth', function () {let server: PeerTubeServerdiff --git a/server/tests/api/users/registrations.ts b/packages/tests/src/api/users/registrations.tssimilarity index 98%rename from server/tests/api/users/registrations.tsrename to packages/tests/src/api/users/registrations.tsindex e6524f07de..dbe1bc4f5e 100644--- a/server/tests/api/users/registrations.ts+++ b/packages/tests/src/api/users/registrations.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { MockSmtpServer } from '@server/tests/shared'-import { UserRegistrationState, UserRole } from '@shared/models'+import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'+import { UserRegistrationState, UserRole } from '@peertube/peertube-models'import {cleanupTests,ConfigCommand,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test registrations', function () {let server: PeerTubeServerdiff --git a/server/tests/api/users/two-factor.ts b/packages/tests/src/api/users/two-factor.tssimilarity index 95%rename from server/tests/api/users/two-factor.tsrename to packages/tests/src/api/users/two-factor.tsindex 0dcab9e17c..fda125d20b 100644--- a/server/tests/api/users/two-factor.ts+++ b/packages/tests/src/api/users/two-factor.ts@@ -1,16 +1,22 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { expectStartWith } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, TwoFactorCommand } from '@shared/server-commands'+import { HttpStatusCode, HttpStatusCodeType } from '@peertube/peertube-models'+import { expectStartWith } from '@tests/shared/checks.js'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ setAccessTokensToServers,+ TwoFactorCommand+} from '@peertube/peertube-server-commands'async function login (options: {server: PeerTubeServerusername: stringpassword: stringotpToken?: string- expectedStatus?: HttpStatusCode+ expectedStatus?: HttpStatusCodeType}) {const { server, username, password, otpToken, expectedStatus } = optionsdiff --git a/server/tests/api/users/user-subscriptions.ts b/packages/tests/src/api/users/user-subscriptions.tssimilarity index 99%rename from server/tests/api/users/user-subscriptions.tsrename to packages/tests/src/api/users/user-subscriptions.tsindex ad2b82a4a7..eb4ea9539b 100644--- a/server/tests/api/users/user-subscriptions.ts+++ b/packages/tests/src/api/users/user-subscriptions.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { VideoPrivacy } from '@shared/models'+import { VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -12,7 +12,7 @@ import {setDefaultChannelAvatar,SubscriptionsCommand,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test users subscriptions', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/users/user-videos.ts b/packages/tests/src/api/users/user-videos.tssimilarity index 98%rename from server/tests/api/users/user-videos.tsrename to packages/tests/src/api/users/user-videos.tsindex 77226e48e3..7b075d0401 100644--- a/server/tests/api/users/user-videos.ts+++ b/packages/tests/src/api/users/user-videos.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -10,7 +10,7 @@ import {setDefaultAccountAvatar,setDefaultChannelAvatar,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test user videos', function () {let server: PeerTubeServerdiff --git a/server/tests/api/users/users-email-verification.ts b/packages/tests/src/api/users/users-email-verification.tssimilarity index 96%rename from server/tests/api/users/users-email-verification.tsrename to packages/tests/src/api/users/users-email-verification.tsindex 909226311b..689e3c4bbf 100644--- a/server/tests/api/users/users-email-verification.ts+++ b/packages/tests/src/api/users/users-email-verification.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { MockSmtpServer } from '@server/tests/shared'-import { HttpStatusCode } from '@shared/models'+import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,ConfigCommand,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test users email verification', function () {let server: PeerTubeServerdiff --git a/server/tests/api/users/users-multiple-servers.ts b/packages/tests/src/api/users/users-multiple-servers.tssimilarity index 94%rename from server/tests/api/users/users-multiple-servers.tsrename to packages/tests/src/api/users/users-multiple-servers.tsindex 3823b74eff..61e3aa0012 100644--- a/server/tests/api/users/users-multiple-servers.ts+++ b/packages/tests/src/api/users/users-multiple-servers.ts@@ -1,14 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import {- checkActorFilesWereRemoved,- checkTmpIsEmpty,- checkVideoFilesWereRemoved,- saveVideoInServers,- testImage-} from '@server/tests/shared'-import { MyUser } from '@shared/models'+import { MyUser } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -17,7 +10,11 @@ import {setAccessTokensToServers,setDefaultChannelAvatar,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { checkActorFilesWereRemoved } from '@tests/shared/actors.js'+import { testImage } from '@tests/shared/checks.js'+import { checkTmpIsEmpty } from '@tests/shared/directories.js'+import { saveVideoInServers, checkVideoFilesWereRemoved } from '@tests/shared/videos.js'describe('Test users with multiple servers', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/users/users.ts b/packages/tests/src/api/users/users.tssimilarity index 99%rename from server/tests/api/users/users.tsrename to packages/tests/src/api/users/users.tsindex 67ade1d0dc..a0090a463b 100644--- a/server/tests/api/users/users.ts+++ b/packages/tests/src/api/users/users.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { testImageSize } from '@server/tests/shared'-import { AbuseState, HttpStatusCode, UserAdminFlag, UserRole, VideoPlaylistType } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { testImageSize } from '@tests/shared/checks.js'+import { AbuseState, HttpStatusCode, UserAdminFlag, UserRole, VideoPlaylistType } from '@peertube/peertube-models'+import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@peertube/peertube-server-commands'describe('Test users', function () {let server: PeerTubeServerdiff --git a/server/tests/api/videos/channel-import-videos.ts b/packages/tests/src/api/videos/channel-import-videos.tssimilarity index 96%rename from server/tests/api/videos/channel-import-videos.tsrename to packages/tests/src/api/videos/channel-import-videos.tsindex a66f88a0ec..d0e47fe95f 100644--- a/server/tests/api/videos/channel-import-videos.ts+++ b/packages/tests/src/api/videos/channel-import-videos.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { FIXTURE_URLS } from '@server/tests/shared'-import { areHttpImportTestsDisabled } from '@shared/core-utils'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { areHttpImportTestsDisabled } from '@peertube/peertube-node-utils'import {createSingleServer,getServerImportConfig,@@ -10,7 +10,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test videos import in a channel', function () {if (areHttpImportTestsDisabled()) returndiff --git a/packages/tests/src/api/videos/index.ts b/packages/tests/src/api/videos/index.tsnew file mode 100644index 0000000000..fcb1d5a818--- /dev/null+++ b/packages/tests/src/api/videos/index.ts@@ -0,0 +1,23 @@+import './multiple-servers.js'+import './resumable-upload.js'+import './single-server.js'+import './video-captions.js'+import './video-change-ownership.js'+import './video-channels.js'+import './channel-import-videos.js'+import './video-channel-syncs.js'+import './video-comments.js'+import './video-description.js'+import './video-files.js'+import './video-imports.js'+import './video-nsfw.js'+import './video-playlists.js'+import './video-playlist-thumbnails.js'+import './video-source.js'+import './video-privacy.js'+import './video-schedule-update.js'+import './videos-common-filters.js'+import './videos-history.js'+import './videos-overview.js'+import './video-static-file-privacy.js'+import './video-storyboard.js'diff --git a/server/tests/api/videos/multiple-servers.ts b/packages/tests/src/api/videos/multiple-servers.tssimilarity index 98%rename from server/tests/api/videos/multiple-servers.tsrename to packages/tests/src/api/videos/multiple-servers.tsindex e9aa0e3a19..03afd7cbbe 100644--- a/server/tests/api/videos/multiple-servers.ts+++ b/packages/tests/src/api/videos/multiple-servers.ts@@ -2,17 +2,9 @@import { expect } from 'chai'import request from 'supertest'-import {- checkTmpIsEmpty,- checkVideoFilesWereRemoved,- checkWebTorrentWorks,- completeVideoCheck,- dateIsValid,- saveVideoInServers,- testImageGeneratedByFFmpeg-} from '@server/tests/shared'-import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'-import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -23,7 +15,11 @@ import {setDefaultAccountAvatar,setDefaultChannelAvatar,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { testImageGeneratedByFFmpeg, dateIsValid } from '@tests/shared/checks.js'+import { checkTmpIsEmpty } from '@tests/shared/directories.js'+import { completeVideoCheck, saveVideoInServers, checkVideoFilesWereRemoved } from '@tests/shared/videos.js'+import { checkWebTorrentWorks } from '@tests/shared/webtorrent.js'describe('Test multiple servers', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/videos/resumable-upload.ts b/packages/tests/src/api/videos/resumable-upload.tssimilarity index 95%rename from server/tests/api/videos/resumable-upload.tsrename to packages/tests/src/api/videos/resumable-upload.tsindex cac1201e95..628e0298c9 100644--- a/server/tests/api/videos/resumable-upload.ts+++ b/packages/tests/src/api/videos/resumable-upload.ts@@ -1,12 +1,18 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pathExists, readdir, stat } from 'fs-extra'+import { pathExists } from 'fs-extra/esm'+import { readdir, stat } from 'fs/promises'import { join } from 'path'-import { buildAbsoluteFixturePath } from '@shared/core-utils'-import { sha1 } from '@shared/extra-utils'-import { HttpStatusCode, VideoPrivacy } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands'+import { HttpStatusCode, HttpStatusCodeType, VideoPrivacy } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath, sha1 } from '@peertube/peertube-node-utils'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ setAccessTokensToServers,+ setDefaultVideoChannel+} from '@peertube/peertube-server-commands'// Most classic resumable upload tests are done in other test suites@@ -54,7 +60,7 @@ describe('Test resumable upload', function () {token?: stringpathUploadId: stringsize?: number- expectedStatus?: HttpStatusCode+ expectedStatus?: HttpStatusCodeTypecontentLength?: numbercontentRange?: stringcontentRangeBuilder?: (start: number, chunk: any) => stringdiff --git a/server/tests/api/videos/single-server.ts b/packages/tests/src/api/videos/single-server.tssimilarity index 97%rename from server/tests/api/videos/single-server.tsrename to packages/tests/src/api/videos/single-server.tsindex 66414aa5bb..b87192a575 100644--- a/server/tests/api/videos/single-server.ts+++ b/packages/tests/src/api/videos/single-server.ts@@ -1,9 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { checkVideoFilesWereRemoved, completeVideoCheck, testImageGeneratedByFFmpeg } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { Video, VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { Video, VideoPrivacy } from '@peertube/peertube-models'+import { checkVideoFilesWereRemoved, completeVideoCheck } from '@tests/shared/videos.js'+import { testImageGeneratedByFFmpeg } from '@tests/shared/checks.js'import {cleanupTests,createSingleServer,@@ -12,7 +13,7 @@ import {setDefaultAccountAvatar,setDefaultChannelAvatar,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test a single server', function () {@@ -92,7 +93,7 @@ describe('Test a single server', function () {before(async function () {this.timeout(30000)- server = await createSingleServer(1)+ server = await createSingleServer(1, {})await setAccessTokensToServers([ server ])await setDefaultChannelAvatar(server)diff --git a/server/tests/api/videos/video-captions.ts b/packages/tests/src/api/videos/video-captions.tssimilarity index 96%rename from server/tests/api/videos/video-captions.tsrename to packages/tests/src/api/videos/video-captions.tsindex 0630c9d3a7..0270225490 100644--- a/server/tests/api/videos/video-captions.ts+++ b/packages/tests/src/api/videos/video-captions.ts@@ -1,8 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { checkVideoFilesWereRemoved, testCaptionFile } from '@server/tests/shared'-import { wait } from '@shared/core-utils'+import { wait } from '@peertube/peertube-core-utils'import {cleanupTests,createMultipleServers,@@ -10,7 +9,9 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { testCaptionFile } from '@tests/shared/captions.js'+import { checkVideoFilesWereRemoved } from '@tests/shared/videos.js'describe('Test video captions', function () {const uuidRegex = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'diff --git a/server/tests/api/videos/video-change-ownership.ts b/packages/tests/src/api/videos/video-change-ownership.tssimilarity index 98%rename from server/tests/api/videos/video-change-ownership.tsrename to packages/tests/src/api/videos/video-change-ownership.tsindex 99d774c2b1..717c37469b 100644--- a/server/tests/api/videos/video-change-ownership.ts+++ b/packages/tests/src/api/videos/video-change-ownership.ts@@ -11,8 +11,8 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'-import { HttpStatusCode, VideoPrivacy } from '@shared/models'+} from '@peertube/peertube-server-commands'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'describe('Test video change ownership - nominal', function () {let servers: PeerTubeServer[] = []@@ -33,7 +33,7 @@ describe('Test video change ownership - nominal', function () {let command: ChangeOwnershipCommandbefore(async function () {- this.timeout(50000)+ this.timeout(240000)servers = await createMultipleServers(2)await setAccessTokensToServers(servers)diff --git a/server/tests/api/videos/video-channel-syncs.ts b/packages/tests/src/api/videos/video-channel-syncs.tssimilarity index 97%rename from server/tests/api/videos/video-channel-syncs.tsrename to packages/tests/src/api/videos/video-channel-syncs.tsindex 7f688c7d6b..54212bcb5d 100644--- a/server/tests/api/videos/video-channel-syncs.ts+++ b/packages/tests/src/api/videos/video-channel-syncs.ts@@ -1,9 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { FIXTURE_URLS, SQLCommand } from '@server/tests/shared'-import { areHttpImportTestsDisabled } from '@shared/core-utils'-import { VideoChannelSyncState, VideoInclude, VideoPrivacy } from '@shared/models'+import { areHttpImportTestsDisabled } from '@peertube/peertube-node-utils'+import { VideoChannelSyncState, VideoInclude, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -14,7 +13,9 @@ import {setDefaultChannelAvatar,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { SQLCommand } from '@tests/shared/sql-command.js'+import { FIXTURE_URLS } from '@tests/shared/tests.js'describe('Test channel synchronizations', function () {if (areHttpImportTestsDisabled()) returndiff --git a/server/tests/api/videos/video-channels.ts b/packages/tests/src/api/videos/video-channels.tssimilarity index 97%rename from server/tests/api/videos/video-channels.tsrename to packages/tests/src/api/videos/video-channels.tsindex f7cf84618d..64b1b93154 100644--- a/server/tests/api/videos/video-channels.ts+++ b/packages/tests/src/api/videos/video-channels.ts@@ -2,10 +2,11 @@import { expect } from 'chai'import { basename } from 'path'-import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'-import { SQLCommand, testFileExistsOrNot, testImage } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { ActorImageType, User, VideoChannel } from '@shared/models'+import { ACTOR_IMAGES_SIZE } from '@peertube/peertube-server/server/initializers/constants.js'+import { testFileExistsOrNot, testImage } from '@tests/shared/checks.js'+import { SQLCommand } from '@tests/shared/sql-command.js'+import { wait } from '@peertube/peertube-core-utils'+import { ActorImageType, User, VideoChannel } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -15,7 +16,7 @@ import {setDefaultAccountAvatar,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function findChannel (server: PeerTubeServer, channelId: number) {const body = await server.channels.list({ sort: '-name' })diff --git a/server/tests/api/videos/video-comments.ts b/packages/tests/src/api/videos/video-comments.tssimilarity index 99%rename from server/tests/api/videos/video-comments.tsrename to packages/tests/src/api/videos/video-comments.tsindex b7d5624a6b..f17db9979b 100644--- a/server/tests/api/videos/video-comments.ts+++ b/packages/tests/src/api/videos/video-comments.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { dateIsValid, testImage } from '@server/tests/shared'+import { dateIsValid, testImage } from '@tests/shared/checks.js'import {cleanupTests,CommentsCommand,@@ -10,7 +10,7 @@ import {setAccessTokensToServers,setDefaultAccountAvatar,setDefaultChannelAvatar-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video comments', function () {let server: PeerTubeServerdiff --git a/server/tests/api/videos/video-description.ts b/packages/tests/src/api/videos/video-description.tssimilarity index 98%rename from server/tests/api/videos/video-description.tsrename to packages/tests/src/api/videos/video-description.tsindex 1f3d4adbb5..eb41cd71cc 100644--- a/server/tests/api/videos/video-description.ts+++ b/packages/tests/src/api/videos/video-description.ts@@ -8,7 +8,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video description', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/videos/video-files.ts b/packages/tests/src/api/videos/video-files.tssimilarity index 98%rename from server/tests/api/videos/video-files.tsrename to packages/tests/src/api/videos/video-files.tsindex 4f75cd106f..1d7c218a41 100644--- a/server/tests/api/videos/video-files.ts+++ b/packages/tests/src/api/videos/video-files.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test videos files', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/videos/video-imports.ts b/packages/tests/src/api/videos/video-imports.tssimilarity index 97%rename from server/tests/api/videos/video-imports.tsrename to packages/tests/src/api/videos/video-imports.tsindex b78b4f3448..09efe99310 100644--- a/server/tests/api/videos/video-imports.ts+++ b/packages/tests/src/api/videos/video-imports.ts@@ -1,11 +1,11 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pathExists, readdir, remove } from 'fs-extra'+import { pathExists, remove } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { join } from 'path'-import { FIXTURE_URLS, testCaptionFile, testImageGeneratedByFFmpeg } from '@server/tests/shared'-import { areHttpImportTestsDisabled } from '@shared/core-utils'-import { CustomConfig, HttpStatusCode, Video, VideoImportState, VideoPrivacy, VideoResolution, VideoState } from '@shared/models'+import { areHttpImportTestsDisabled } from '@peertube/peertube-node-utils'+import { CustomConfig, HttpStatusCode, Video, VideoImportState, VideoPrivacy, VideoResolution, VideoState } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -16,8 +16,11 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'-import { DeepPartial } from '@shared/typescript-utils'+} from '@peertube/peertube-server-commands'+import { DeepPartial } from '@peertube/peertube-typescript-utils'+import { testCaptionFile } from '@tests/shared/captions.js'+import { testImageGeneratedByFFmpeg } from '@tests/shared/checks.js'+import { FIXTURE_URLS } from '@tests/shared/tests.js'async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMagnet: string, idTorrent: string) {const videoHttp = await server.videos.get({ id: idHttp })diff --git a/server/tests/api/videos/video-nsfw.ts b/packages/tests/src/api/videos/video-nsfw.tssimilarity index 98%rename from server/tests/api/videos/video-nsfw.tsrename to packages/tests/src/api/videos/video-nsfw.tsindex 65e9c8730b..fc5225dd27 100644--- a/server/tests/api/videos/video-nsfw.ts+++ b/packages/tests/src/api/videos/video-nsfw.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'-import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models'+import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@peertube/peertube-server-commands'+import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@peertube/peertube-models'function createOverviewRes (overview: VideosOverview) {const videos = overview.categories[0].videosdiff --git a/server/tests/api/videos/video-passwords.ts b/packages/tests/src/api/videos/video-passwords.tssimilarity index 96%rename from server/tests/api/videos/video-passwords.tsrename to packages/tests/src/api/videos/video-passwords.tsindex e01a93a4dd..60e0e28bdc 100644--- a/server/tests/api/videos/video-passwords.ts+++ b/packages/tests/src/api/videos/video-passwords.ts@@ -9,8 +9,8 @@ import {setAccessTokensToServers,setDefaultAccountAvatar,setDefaultChannelAvatar-} from '@shared/server-commands'-import { VideoPrivacy } from '@shared/models'+} from '@peertube/peertube-server-commands'+import { VideoPrivacy } from '@peertube/peertube-models'describe('Test video passwords', function () {let server: PeerTubeServerdiff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/packages/tests/src/api/videos/video-playlist-thumbnails.tssimilarity index 97%rename from server/tests/api/videos/video-playlist-thumbnails.tsrename to packages/tests/src/api/videos/video-playlist-thumbnails.tsindex c274c20bf5..d79c92f723 100644--- a/server/tests/api/videos/video-playlist-thumbnails.ts+++ b/packages/tests/src/api/videos/video-playlist-thumbnails.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { testImageGeneratedByFFmpeg } from '@server/tests/shared'-import { VideoPlaylistPrivacy } from '@shared/models'+import { testImageGeneratedByFFmpeg } from '@tests/shared/checks.js'+import { VideoPlaylistPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -11,7 +11,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Playlist thumbnail', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/videos/video-playlists.ts b/packages/tests/src/api/videos/video-playlists.tssimilarity index 99%rename from server/tests/api/videos/video-playlists.tsrename to packages/tests/src/api/videos/video-playlists.tsindex 3bfa874cb8..578d01093d 100644--- a/server/tests/api/videos/video-playlists.ts+++ b/packages/tests/src/api/videos/video-playlists.ts@@ -1,18 +1,18 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { checkPlaylistFilesWereRemoved, testImageGeneratedByFFmpeg } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { uuidToShort } from '@shared/extra-utils'+import { wait } from '@peertube/peertube-core-utils'import {HttpStatusCode,VideoPlaylist,VideoPlaylistCreateResult,VideoPlaylistElementType,+ VideoPlaylistElementType_Type,VideoPlaylistPrivacy,VideoPlaylistType,VideoPrivacy-} from '@shared/models'+} from '@peertube/peertube-models'+import { uuidToShort } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -23,12 +23,14 @@ import {setDefaultAccountAvatar,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { testImageGeneratedByFFmpeg } from '@tests/shared/checks.js'+import { checkPlaylistFilesWereRemoved } from '@tests/shared/video-playlists.js'async function checkPlaylistElementType (servers: PeerTubeServer[],playlistId: string,- type: VideoPlaylistElementType,+ type: VideoPlaylistElementType_Type,position: number,name: string,total: numberdiff --git a/server/tests/api/videos/video-privacy.ts b/packages/tests/src/api/videos/video-privacy.tssimilarity index 97%rename from server/tests/api/videos/video-privacy.tsrename to packages/tests/src/api/videos/video-privacy.tsindex de96bcfcc6..9171463a46 100644--- a/server/tests/api/videos/video-privacy.ts+++ b/packages/tests/src/api/videos/video-privacy.ts@@ -1,9 +1,16 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'-import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ doubleFollow,+ PeerTubeServer,+ setAccessTokensToServers,+ waitJobs+} from '@peertube/peertube-server-commands'describe('Test video privacy', function () {const servers: PeerTubeServer[] = []diff --git a/server/tests/api/videos/video-schedule-update.ts b/packages/tests/src/api/videos/video-schedule-update.tssimilarity index 94%rename from server/tests/api/videos/video-schedule-update.tsrename to packages/tests/src/api/videos/video-schedule-update.tsindex bf341c6485..96d71933ec 100644--- a/server/tests/api/videos/video-schedule-update.ts+++ b/packages/tests/src/api/videos/video-schedule-update.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'function in10Seconds () {const now = new Date()@@ -40,7 +40,7 @@ describe('Test video update scheduler', function () {privacy: VideoPrivacy.PRIVATE,scheduleUpdate: {updateAt: in10Seconds().toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}@@ -103,7 +103,7 @@ describe('Test video update scheduler', function () {name: 'video 2 updated',scheduleUpdate: {updateAt: in10Seconds().toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}diff --git a/server/tests/api/videos/video-source.ts b/packages/tests/src/api/videos/video-source.tssimilarity index 98%rename from server/tests/api/videos/video-source.tsrename to packages/tests/src/api/videos/video-source.tsindex 1f394f9047..efe8c38020 100644--- a/server/tests/api/videos/video-source.ts+++ b/packages/tests/src/api/videos/video-source.ts@@ -1,8 +1,9 @@-import { expect } from 'chai'-import { expectStartWith } from '@server/tests/shared'/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { areMockObjectStorageTestsDisabled, getAllFiles } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { expect } from 'chai'+import { getAllFiles } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { expectStartWith } from '@tests/shared/checks.js'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -15,7 +16,7 @@ import {setDefaultAccountAvatar,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test a video file replacement', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/api/videos/video-static-file-privacy.ts b/packages/tests/src/api/videos/video-static-file-privacy.tssimilarity index 97%rename from server/tests/api/videos/video-static-file-privacy.tsrename to packages/tests/src/api/videos/video-static-file-privacy.tsindex 0a9864134f..7c8d148154 100644--- a/server/tests/api/videos/video-static-file-privacy.ts+++ b/packages/tests/src/api/videos/video-static-file-privacy.ts@@ -2,9 +2,8 @@import { expect } from 'chai'import { decode } from 'magnet-uri'-import { checkVideoFileTokenReinjection, expectStartWith, parseTorrentVideo } from '@server/tests/shared'-import { getAllFiles, wait } from '@shared/core-utils'-import { HttpStatusCode, LiveVideo, VideoDetails, VideoPrivacy } from '@shared/models'+import { getAllFiles, wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, HttpStatusCodeType, LiveVideo, VideoDetails, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -16,7 +15,10 @@ import {setDefaultVideoChannel,stopFfmpeg,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { expectStartWith } from '@tests/shared/checks.js'+import { checkVideoFileTokenReinjection } from '@tests/shared/streaming-playlists.js'+import { parseTorrentVideo } from '@tests/shared/webtorrent.js'describe('Test video static file privacy', function () {let server: PeerTubeServer@@ -156,7 +158,7 @@ describe('Test video static file privacy', function () {privacy: VideoPrivacy.PRIVATE,scheduleUpdate: {updateAt: new Date(Date.now() + 1000).toISOString(),- privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC+ privacy: VideoPrivacy.PUBLIC}}@@ -191,7 +193,7 @@ describe('Test video static file privacy', function () {async function checkVideoFiles (options: {id: string- expectedStatus: HttpStatusCode+ expectedStatus: HttpStatusCodeTypetoken: stringvideoFileToken: stringvideoPassword?: stringdiff --git a/server/tests/api/videos/video-storyboard.ts b/packages/tests/src/api/videos/video-storyboard.tssimilarity index 95%rename from server/tests/api/videos/video-storyboard.tsrename to packages/tests/src/api/videos/video-storyboard.tsindex 07f371cad5..7d156aa7f2 100644--- a/server/tests/api/videos/video-storyboard.ts+++ b/packages/tests/src/api/videos/video-storyboard.ts@@ -1,11 +1,11 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { readdir } from 'fs-extra'+import { readdir } from 'fs/promises'import { basename } from 'path'-import { FIXTURE_URLS } from '@server/tests/shared'-import { areHttpImportTestsDisabled } from '@shared/core-utils'-import { HttpStatusCode, VideoPrivacy } from '@shared/models'+import { FIXTURE_URLS } from '@tests/shared/tests.js'+import { areHttpImportTestsDisabled } from '@peertube/peertube-node-utils'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -17,7 +17,7 @@ import {setDefaultVideoChannel,stopFfmpeg,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function checkStoryboard (options: {server: PeerTubeServerdiff --git a/server/tests/api/videos/videos-common-filters.ts b/packages/tests/src/api/videos/videos-common-filters.tssimilarity index 96%rename from server/tests/api/videos/videos-common-filters.tsrename to packages/tests/src/api/videos/videos-common-filters.tsindex 48de7c5379..9e75bd6ca1 100644--- a/server/tests/api/videos/videos-common-filters.ts+++ b/packages/tests/src/api/videos/videos-common-filters.ts@@ -1,8 +1,18 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pick } from '@shared/core-utils'-import { HttpStatusCode, UserRole, Video, VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models'+import { pick } from '@peertube/peertube-core-utils'+import {+ HttpStatusCode,+ HttpStatusCodeType,+ UserRole,+ Video,+ VideoDetails,+ VideoInclude,+ VideoIncludeType,+ VideoPrivacy,+ VideoPrivacyType+} from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -13,7 +23,7 @@ import {setDefaultAccountAvatar,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test videos filter', function () {let servers: PeerTubeServer[]@@ -82,12 +92,12 @@ describe('Test videos filter', function () {isLocal?: booleanhasWebVideoFiles?: booleanhasHLSFiles?: boolean- include?: VideoInclude- privacyOneOf?: VideoPrivacy[]+ include?: VideoIncludeType+ privacyOneOf?: VideoPrivacyType[]category?: numbertagsAllOf?: string[]token?: string- expectedStatus?: HttpStatusCode+ expectedStatus?: HttpStatusCodeTypeexcludeAlreadyWatched?: boolean}) {const res = await makeGetRequest({@@ -118,10 +128,10 @@ describe('Test videos filter', function () {options: {server: PeerTubeServerisLocal?: boolean- include?: VideoInclude- privacyOneOf?: VideoPrivacy[]+ include?: VideoIncludeType+ privacyOneOf?: VideoPrivacyType[]token?: string- expectedStatus?: HttpStatusCode+ expectedStatus?: HttpStatusCodeTypeskipSubscription?: booleanexcludeAlreadyWatched?: boolean}diff --git a/server/tests/api/videos/videos-history.ts b/packages/tests/src/api/videos/videos-history.tssimilarity index 96%rename from server/tests/api/videos/videos-history.tsrename to packages/tests/src/api/videos/videos-history.tsindex 6df26ab7dc..75c0fcebd9 100644--- a/server/tests/api/videos/videos-history.ts+++ b/packages/tests/src/api/videos/videos-history.ts@@ -1,9 +1,15 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { Video } from '@shared/models'-import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { wait } from '@peertube/peertube-core-utils'+import { Video } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ killallServers,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test videos history', function () {let server: PeerTubeServer = nulldiff --git a/server/tests/api/videos/videos-overview.ts b/packages/tests/src/api/videos/videos-overview.tssimilarity index 95%rename from server/tests/api/videos/videos-overview.tsrename to packages/tests/src/api/videos/videos-overview.tsindex f2496e35ec..7d74d6db2c 100644--- a/server/tests/api/videos/videos-overview.ts+++ b/packages/tests/src/api/videos/videos-overview.ts@@ -1,9 +1,9 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { VideosOverview } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { wait } from '@peertube/peertube-core-utils'+import { VideosOverview } from '@peertube/peertube-models'+import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@peertube/peertube-server-commands'describe('Test a videos overview', function () {let server: PeerTubeServer = nulldiff --git a/packages/tests/src/api/views/index.ts b/packages/tests/src/api/views/index.tsnew file mode 100644index 0000000000..2b7334d1a2--- /dev/null+++ b/packages/tests/src/api/views/index.ts@@ -0,0 +1,5 @@+export * from './video-views-counter.js'+export * from './video-views-overall-stats.js'+export * from './video-views-retention-stats.js'+export * from './video-views-timeserie-stats.js'+export * from './videos-views-cleaner.js'diff --git a/server/tests/api/views/video-views-counter.ts b/packages/tests/src/api/views/video-views-counter.tssimilarity index 97%rename from server/tests/api/views/video-views-counter.tsrename to packages/tests/src/api/views/video-views-counter.tsindex 0c1b7859cc..d9afb0f18d 100644--- a/server/tests/api/views/video-views-counter.ts+++ b/packages/tests/src/api/views/video-views-counter.ts@@ -2,9 +2,9 @@import { expect } from 'chai'import { FfmpegCommand } from 'fluent-ffmpeg'-import { prepareViewsServers, prepareViewsVideos, processViewsBuffer } from '@server/tests/shared'-import { wait } from '@shared/core-utils'-import { cleanupTests, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands'+import { prepareViewsServers, prepareViewsVideos, processViewsBuffer } from '@tests/shared/views.js'+import { wait } from '@peertube/peertube-core-utils'+import { cleanupTests, PeerTubeServer, stopFfmpeg, waitJobs } from '@peertube/peertube-server-commands'describe('Test video views/viewers counters', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/views/video-views-overall-stats.ts b/packages/tests/src/api/views/video-views-overall-stats.tssimilarity index 98%rename from server/tests/api/views/video-views-overall-stats.tsrename to packages/tests/src/api/views/video-views-overall-stats.tsindex ac636961ea..6ea0da2d95 100644--- a/server/tests/api/views/video-views-overall-stats.ts+++ b/packages/tests/src/api/views/video-views-overall-stats.ts@@ -2,10 +2,10 @@import { expect } from 'chai'import { FfmpegCommand } from 'fluent-ffmpeg'-import { prepareViewsServers, prepareViewsVideos, processViewersStats } from '@server/tests/shared'-import { cleanupTests, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands'-import { wait } from '@shared/core-utils'-import { VideoStatsOverall } from '@shared/models'+import { prepareViewsServers, prepareViewsVideos, processViewersStats } from '@tests/shared/views.js'+import { cleanupTests, PeerTubeServer, stopFfmpeg, waitJobs } from '@peertube/peertube-server-commands'+import { wait } from '@peertube/peertube-core-utils'+import { VideoStatsOverall } from '@peertube/peertube-models'/***diff --git a/server/tests/api/views/video-views-retention-stats.ts b/packages/tests/src/api/views/video-views-retention-stats.tssimilarity index 94%rename from server/tests/api/views/video-views-retention-stats.tsrename to packages/tests/src/api/views/video-views-retention-stats.tsindex 5b9ce4c929..4cd0c7da9f 100644--- a/server/tests/api/views/video-views-retention-stats.ts+++ b/packages/tests/src/api/views/video-views-retention-stats.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { prepareViewsServers, prepareViewsVideos, processViewersStats } from '@server/tests/shared'-import { cleanupTests, PeerTubeServer } from '@shared/server-commands'+import { prepareViewsServers, prepareViewsVideos, processViewersStats } from '@tests/shared/views.js'+import { cleanupTests, PeerTubeServer } from '@peertube/peertube-server-commands'describe('Test views retention stats', function () {let servers: PeerTubeServer[]diff --git a/server/tests/api/views/video-views-timeserie-stats.ts b/packages/tests/src/api/views/video-views-timeserie-stats.tssimilarity index 98%rename from server/tests/api/views/video-views-timeserie-stats.tsrename to packages/tests/src/api/views/video-views-timeserie-stats.tsindex 2d991d7ea6..44fccb644f 100644--- a/server/tests/api/views/video-views-timeserie-stats.ts+++ b/packages/tests/src/api/views/video-views-timeserie-stats.ts@@ -2,9 +2,9 @@import { expect } from 'chai'import { FfmpegCommand } from 'fluent-ffmpeg'-import { prepareViewsServers, prepareViewsVideos, processViewersStats } from '@server/tests/shared'-import { VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@shared/models'-import { cleanupTests, PeerTubeServer, stopFfmpeg } from '@shared/server-commands'+import { prepareViewsServers, prepareViewsVideos, processViewersStats } from '@tests/shared/views.js'+import { VideoStatsTimeserie, VideoStatsTimeserieMetric } from '@peertube/peertube-models'+import { cleanupTests, PeerTubeServer, stopFfmpeg } from '@peertube/peertube-server-commands'function buildOneMonthAgo () {const monthAgo = new Date()diff --git a/server/tests/api/views/videos-views-cleaner.ts b/packages/tests/src/api/views/videos-views-cleaner.tssimilarity index 93%rename from server/tests/api/views/videos-views-cleaner.tsrename to packages/tests/src/api/views/videos-views-cleaner.tsindex a84cd43c7c..521dd9b5ec 100644--- a/server/tests/api/views/videos-views-cleaner.ts+++ b/packages/tests/src/api/views/videos-views-cleaner.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { SQLCommand } from '@server/tests/shared'-import { wait } from '@shared/core-utils'+import { SQLCommand } from '@tests/shared/sql-command.js'+import { wait } from '@peertube/peertube-core-utils'import {cleanupTests,createMultipleServers,@@ -11,7 +11,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test video views cleaner', function () {let servers: PeerTubeServer[]@@ -21,7 +21,7 @@ describe('Test video views cleaner', function () {let videoIdServer2: stringbefore(async function () {- this.timeout(120000)+ this.timeout(240000)servers = await createMultipleServers(2)await setAccessTokensToServers(servers)diff --git a/server/tests/cli/create-generate-storyboard-job.ts b/packages/tests/src/cli/create-generate-storyboard-job.tssimilarity index 93%rename from server/tests/cli/create-generate-storyboard-job.tsrename to packages/tests/src/cli/create-generate-storyboard-job.tsindex 02a4be8ae2..5a1c61ef1a 100644--- a/server/tests/cli/create-generate-storyboard-job.ts+++ b/packages/tests/src/cli/create-generate-storyboard-job.ts@@ -1,9 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { readdir, remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { join } from 'path'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -12,8 +13,8 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'-import { SQLCommand } from '../shared'+} from '@peertube/peertube-server-commands'+import { SQLCommand } from '../shared/sql-command.js'function listStoryboardFiles (server: PeerTubeServer) {const storage = server.getDirectoryPath('storyboards')diff --git a/server/tests/cli/create-import-video-file-job.ts b/packages/tests/src/cli/create-import-video-file-job.tssimilarity index 92%rename from server/tests/cli/create-import-video-file-job.tsrename to packages/tests/src/cli/create-import-video-file-job.tsindex edd727967c..fa934510cf 100644--- a/server/tests/cli/create-import-video-file-job.ts+++ b/packages/tests/src/cli/create-import-video-file-job.ts@@ -1,19 +1,19 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { expect } from 'chai'-import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'-import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models'+import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@peertube/peertube-models'+import { areMockObjectStorageTestsDisabled, buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {+ ObjectStorageCommand,+ PeerTubeServer,cleanupTests,createMultipleServers,doubleFollow,makeRawRequest,- ObjectStorageCommand,- PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'-import { expectStartWith } from '../shared'+} from '@peertube/peertube-server-commands'+import { expect } from 'chai'+import { expectStartWith } from '../shared/checks.js'function assertVideoProperties (video: VideoFile, resolution: number, extname: string, size?: number) {expect(video).to.have.nested.property('resolution.id', resolution)@@ -75,7 +75,7 @@ function runTests (enableObjectStorage: boolean) {})it('Should run a import job on video 1 with a lower resolution', async function () {- const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i server/tests/fixtures/video_short_480.webm`+ const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i ${buildAbsoluteFixturePath('video_short_480.webm')}`await servers[0].cli.execWithEnv(command)await waitJobs(servers)@@ -97,7 +97,7 @@ function runTests (enableObjectStorage: boolean) {})it('Should run a import job on video 2 with the same resolution and a different extension', async function () {- const command = `npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`+ const command = `npm run create-import-video-file-job -- -v ${video2UUID} -i ${buildAbsoluteFixturePath('video_short.ogv')}`await servers[1].cli.execWithEnv(command)await waitJobs(servers)@@ -121,7 +121,7 @@ function runTests (enableObjectStorage: boolean) {})it('Should run a import job on video 2 with the same resolution and the same extension', async function () {- const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i server/tests/fixtures/video_short2.webm`+ const command = `npm run create-import-video-file-job -- -v ${video1ShortId} -i ${buildAbsoluteFixturePath('video_short2.webm')}`await servers[0].cli.execWithEnv(command)await waitJobs(servers)diff --git a/server/tests/cli/create-move-video-storage-job.ts b/packages/tests/src/cli/create-move-video-storage-job.tssimilarity index 91%rename from server/tests/cli/create-move-video-storage-job.tsrename to packages/tests/src/cli/create-move-video-storage-job.tsindex fc6a8e6488..1bee7414f7 100644--- a/server/tests/cli/create-move-video-storage-job.ts+++ b/packages/tests/src/cli/create-move-video-storage-job.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { join } from 'path'-import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'-import { HttpStatusCode, VideoDetails } from '@shared/models'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'+import { HttpStatusCode, VideoDetails } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -12,8 +12,9 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'-import { checkDirectoryIsEmpty, expectStartWith } from '../shared'+} from '@peertube/peertube-server-commands'+import { expectStartWith } from '../shared/checks.js'+import { checkDirectoryIsEmpty } from '@tests/shared/directories.js'async function checkFiles (origin: PeerTubeServer, video: VideoDetails, objectStorage?: ObjectStorageCommand) {for (const file of video.files) {diff --git a/server/tests/cli/index.ts b/packages/tests/src/cli/index.tssimilarity index 100%rename from server/tests/cli/index.tsrename to packages/tests/src/cli/index.tsdiff --git a/server/tests/cli/peertube.ts b/packages/tests/src/cli/peertube.tssimilarity index 73%rename from server/tests/cli/peertube.tsrename to packages/tests/src/cli/peertube.tsindex ad14fde913..2c66b7a18b 100644--- a/server/tests/cli/peertube.ts+++ b/packages/tests/src/cli/peertube.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { areHttpImportTestsDisabled, buildAbsoluteFixturePath } from '@shared/core-utils'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'import {cleanupTests,CLICommand,@@ -10,8 +10,8 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'-import { FIXTURE_URLS, testHelloWorldRegisteredSettings } from '../shared'+} from '@peertube/peertube-server-commands'+import { testHelloWorldRegisteredSettings } from '../shared/plugins.js'describe('Test CLI wrapper', function () {let server: PeerTubeServer@@ -19,7 +19,7 @@ describe('Test CLI wrapper', function () {let cliCommand: CLICommand- const cmd = 'node ./dist/server/tools/peertube.js'+ const cmd = 'node ./apps/peertube-cli/dist/peertube.js'before(async function () {this.timeout(30000)@@ -94,7 +94,7 @@ describe('Test CLI wrapper', function () {})})- describe('Video upload/import', function () {+ describe('Video upload', function () {it('Should upload a video', async function () {this.timeout(60000)@@ -114,80 +114,6 @@ describe('Test CLI wrapper', function () {expect(video.support).to.equal('support_text')expect(video.channel.name).to.equal('user_channel')})-- it('Should import a video', async function () {- if (areHttpImportTestsDisabled()) return-- this.timeout(60000)-- const params = `--target-url ${FIXTURE_URLS.youtube} --channel-name user_channel`- await cliCommand.execWithEnv(`${cmd} import ${params}`)- })-- it('Should have imported the video', async function () {- if (areHttpImportTestsDisabled()) return-- this.timeout(60000)-- await waitJobs([ server ])-- const { total, data } = await server.videos.list()- expect(total).to.equal(2)-- const video = data.find(v => v.name === 'small video - youtube')- expect(video).to.not.be.undefined-- const videoDetails = await server.videos.get({ id: video.id })- expect(videoDetails.channel.name).to.equal('user_channel')- expect(videoDetails.support).to.equal('super support text')- expect(videoDetails.nsfw).to.be.false- })-- it('Should not import again the same video', async function () {- if (areHttpImportTestsDisabled()) return-- this.timeout(60000)-- const params = `--target-url ${FIXTURE_URLS.youtube} --channel-name user_channel`- await cliCommand.execWithEnv(`${cmd} import ${params}`)-- await waitJobs([ server ])-- const { total, data } = await server.videos.list()- expect(total).to.equal(2)-- const videos = data.filter(v => v.name === 'small video - youtube')- expect(videos).to.have.lengthOf(1)-- // So we can reimport it- await server.videos.remove({ token: userAccessToken, id: videos[0].id })- })-- it('Should import and override some imported attributes', async function () {- if (areHttpImportTestsDisabled()) return-- this.timeout(60000)-- const params = `--target-url ${FIXTURE_URLS.youtube} ` +- `--channel-name user_channel --video-name toto --nsfw --support support`- await cliCommand.execWithEnv(`${cmd} import ${params}`)-- await waitJobs([ server ])-- {- const { total, data } = await server.videos.list()- expect(total).to.equal(2)-- const video = data.find(v => v.name === 'toto')- expect(video).to.not.be.undefined-- const videoDetails = await server.videos.get({ id: video.id })- expect(videoDetails.channel.name).to.equal('user_channel')- expect(videoDetails.support).to.equal('support')- expect(videoDetails.nsfw).to.be.true- expect(videoDetails.commentsEnabled).to.be.true- }- })})describe('Admin auth', function () {diff --git a/server/tests/cli/plugins.ts b/packages/tests/src/cli/plugins.tssimilarity index 97%rename from server/tests/cli/plugins.tsrename to packages/tests/src/cli/plugins.tsindex c646e20d97..ab7f7dd859 100644--- a/server/tests/cli/plugins.ts+++ b/packages/tests/src/cli/plugins.ts@@ -8,7 +8,7 @@ import {PeerTubeServer,PluginsCommand,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test plugin scripts', function () {let server: PeerTubeServerdiff --git a/server/tests/cli/prune-storage.ts b/packages/tests/src/cli/prune-storage.tssimilarity index 96%rename from server/tests/cli/prune-storage.tsrename to packages/tests/src/cli/prune-storage.tsindex 72a4b1332a..c07a2a9755 100644--- a/server/tests/cli/prune-storage.ts+++ b/packages/tests/src/cli/prune-storage.ts@@ -1,11 +1,12 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { createFile, readdir } from 'fs-extra'+import { createFile } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { join } from 'path'-import { wait } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { HttpStatusCode, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { buildUUID } from '@peertube/peertube-node-utils'+import { HttpStatusCode, VideoPlaylistPrivacy, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,CLICommand,@@ -17,7 +18,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function assertNotExists (server: PeerTubeServer, directory: string, substring: string) {const files = await readdir(server.servers.buildDirectory(directory))diff --git a/server/tests/cli/regenerate-thumbnails.ts b/packages/tests/src/cli/regenerate-thumbnails.tssimilarity index 96%rename from server/tests/cli/regenerate-thumbnails.tsrename to packages/tests/src/cli/regenerate-thumbnails.tsindex 66de7f79c4..1448e5cfc3 100644--- a/server/tests/cli/regenerate-thumbnails.ts+++ b/packages/tests/src/cli/regenerate-thumbnails.ts@@ -1,7 +1,7 @@import { expect } from 'chai'-import { writeFile } from 'fs-extra'+import { writeFile } from 'fs/promises'import { basename, join } from 'path'-import { HttpStatusCode, Video } from '@shared/models'+import { HttpStatusCode, Video } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -10,7 +10,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '../../../shared/server-commands'+} from '@peertube/peertube-server-commands'async function testThumbnail (server: PeerTubeServer, videoId: number | string) {const video = await server.videos.get({ id: videoId })diff --git a/server/tests/cli/reset-password.ts b/packages/tests/src/cli/reset-password.tssimilarity index 90%rename from server/tests/cli/reset-password.tsrename to packages/tests/src/cli/reset-password.tsindex 79892173b0..62e1a37a0c 100644--- a/server/tests/cli/reset-password.ts+++ b/packages/tests/src/cli/reset-password.ts@@ -1,4 +1,4 @@-import { cleanupTests, CLICommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { cleanupTests, CLICommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@peertube/peertube-server-commands'describe('Test reset password scripts', function () {let server: PeerTubeServerdiff --git a/server/tests/cli/update-host.ts b/packages/tests/src/cli/update-host.tssimilarity index 96%rename from server/tests/cli/update-host.tsrename to packages/tests/src/cli/update-host.tsindex 386c384e6f..e5f165e5e9 100644--- a/server/tests/cli/update-host.ts+++ b/packages/tests/src/cli/update-host.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { getAllFiles } from '@shared/core-utils'+import { getAllFiles } from '@peertube/peertube-core-utils'import {cleanupTests,createSingleServer,@@ -10,8 +10,8 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'-import { parseTorrentVideo } from '../shared'+} from '@peertube/peertube-server-commands'+import { parseTorrentVideo } from '@tests/shared/webtorrent.js'describe('Test update host scripts', function () {let server: PeerTubeServerdiff --git a/server/tests/client.ts b/packages/tests/src/client.tssimilarity index 99%rename from server/tests/client.tsrename to packages/tests/src/client.tsindex 68f3a1d14f..a162054943 100644--- a/server/tests/client.ts+++ b/packages/tests/src/client.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { omit } from '@shared/core-utils'+import { omit } from '@peertube/peertube-core-utils'import {Account,HTMLServerConfig,@@ -10,7 +10,7 @@ import {VideoPlaylistCreateResult,VideoPlaylistPrivacy,VideoPrivacy-} from '@shared/models'+} from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -21,7 +21,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '../../shared/server-commands'+} from '@peertube/peertube-server-commands'function checkIndexTags (html: string, title: string, description: string, css: string, config: ServerConfig) {expect(html).to.contain('<title>' + title + '</title>')diff --git a/server/tests/external-plugins/akismet.ts b/packages/tests/src/external-plugins/akismet.tssimilarity index 97%rename from server/tests/external-plugins/akismet.tsrename to packages/tests/src/external-plugins/akismet.tsindex e964bf0c2c..c6d3b77526 100644--- a/server/tests/external-plugins/akismet.ts+++ b/packages/tests/src/external-plugins/akismet.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -9,7 +9,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Official plugin Akismet', function () {let servers: PeerTubeServer[]diff --git a/server/tests/external-plugins/auth-ldap.ts b/packages/tests/src/external-plugins/auth-ldap.tssimilarity index 97%rename from server/tests/external-plugins/auth-ldap.tsrename to packages/tests/src/external-plugins/auth-ldap.tsindex d51d337be7..ad058110c1 100644--- a/server/tests/external-plugins/auth-ldap.ts+++ b/packages/tests/src/external-plugins/auth-ldap.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'-import { HttpStatusCode } from '@shared/models'+import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@peertube/peertube-server-commands'+import { HttpStatusCode } from '@peertube/peertube-models'describe('Official plugin auth-ldap', function () {let server: PeerTubeServerdiff --git a/server/tests/external-plugins/auto-block-videos.ts b/packages/tests/src/external-plugins/auto-block-videos.tssimilarity index 95%rename from server/tests/external-plugins/auto-block-videos.tsrename to packages/tests/src/external-plugins/auto-block-videos.tsindex 95d7a4b58a..6146c827cf 100644--- a/server/tests/external-plugins/auto-block-videos.ts+++ b/packages/tests/src/external-plugins/auto-block-videos.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { Video } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { Video } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -10,8 +10,8 @@ import {killallServers,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'-import { MockBlocklist } from '../shared'+} from '@peertube/peertube-server-commands'+import { MockBlocklist } from '../shared/mock-servers/index.js'async function check (server: PeerTubeServer, videoUUID: string, exists = true) {const { data } = await server.videos.list()diff --git a/server/tests/external-plugins/auto-mute.ts b/packages/tests/src/external-plugins/auto-mute.tssimilarity index 95%rename from server/tests/external-plugins/auto-mute.tsrename to packages/tests/src/external-plugins/auto-mute.tsindex a9bf3c173a..b4050e236f 100644--- a/server/tests/external-plugins/auto-mute.ts+++ b/packages/tests/src/external-plugins/auto-mute.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -11,8 +11,8 @@ import {makeGetRequest,PeerTubeServer,setAccessTokensToServers-} from '@shared/server-commands'-import { MockBlocklist } from '../shared'+} from '@peertube/peertube-server-commands'+import { MockBlocklist } from '../shared/mock-servers/index.js'describe('Official plugin auto-mute', function () {const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list'diff --git a/server/tests/external-plugins/index.ts b/packages/tests/src/external-plugins/index.tssimilarity index 100%rename from server/tests/external-plugins/index.tsrename to packages/tests/src/external-plugins/index.tsdiff --git a/server/tests/feeds/feeds.ts b/packages/tests/src/feeds/feeds.tssimilarity index 99%rename from server/tests/feeds/feeds.tsrename to packages/tests/src/feeds/feeds.tsindex 1754ac466d..7587bb34ed 100644--- a/server/tests/feeds/feeds.ts+++ b/packages/tests/src/feeds/feeds.ts@@ -1,8 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'+import chaiJSONSChema from 'chai-json-schema'+import chaiXML from 'chai-xml'import { XMLParser, XMLValidator } from 'fast-xml-parser'-import { HttpStatusCode, VideoPrivacy } from '@shared/models'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -17,10 +19,10 @@ import {setDefaultVideoChannel,stopFfmpeg,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'-chai.use(require('chai-xml'))-chai.use(require('chai-json-schema'))+chai.use(chaiXML)+chai.use(chaiJSONSChema)chai.config.includeStack = trueconst expect = chai.expectdiff --git a/server/tests/feeds/index.ts b/packages/tests/src/feeds/index.tssimilarity index 100%rename from server/tests/feeds/index.tsrename to packages/tests/src/feeds/index.tsdiff --git a/server/tests/misc-endpoints.ts b/packages/tests/src/misc-endpoints.tssimilarity index 96%rename from server/tests/misc-endpoints.tsrename to packages/tests/src/misc-endpoints.tsindex f9cf2b717c..0067578ed2 100644--- a/server/tests/misc-endpoints.ts+++ b/packages/tests/src/misc-endpoints.ts@@ -1,11 +1,17 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { writeJson } from 'fs-extra'+import { writeJson } from 'fs-extra/esm'import { join } from 'path'-import { HttpStatusCode, VideoPrivacy } from '@shared/models'-import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'-import { expectLogDoesNotContain } from './shared'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ makeGetRequest,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'+import { expectLogDoesNotContain } from './shared/checks.js'describe('Test misc endpoints', function () {let server: PeerTubeServerdiff --git a/server/tests/peertube-runner/client-cli.ts b/packages/tests/src/peertube-runner/client-cli.tssimilarity index 89%rename from server/tests/peertube-runner/client-cli.tsrename to packages/tests/src/peertube-runner/client-cli.tsindex 5cbdc4e77a..814b7f13a8 100644--- a/server/tests/peertube-runner/client-cli.ts+++ b/packages/tests/src/peertube-runner/client-cli.ts@@ -1,8 +1,14 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { PeerTubeRunnerProcess } from '@server/tests/shared'-import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands'+import { PeerTubeRunnerProcess } from '@tests/shared/peertube-runner-process.js'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ setAccessTokensToServers,+ setDefaultVideoChannel+} from '@peertube/peertube-server-commands'describe('Test peertube-runner program client CLI', function () {let server: PeerTubeServerdiff --git a/packages/tests/src/peertube-runner/index.ts b/packages/tests/src/peertube-runner/index.tsnew file mode 100644index 0000000000..29f21694f7--- /dev/null+++ b/packages/tests/src/peertube-runner/index.ts@@ -0,0 +1,4 @@+export * from './client-cli.js'+export * from './live-transcoding.js'+export * from './studio-transcoding.js'+export * from './vod-transcoding.js'diff --git a/server/tests/peertube-runner/live-transcoding.ts b/packages/tests/src/peertube-runner/live-transcoding.tssimilarity index 91%rename from server/tests/peertube-runner/live-transcoding.tsrename to packages/tests/src/peertube-runner/live-transcoding.tsindex 41b01f8d59..9351bc5e23 100644--- a/server/tests/peertube-runner/live-transcoding.ts+++ b/packages/tests/src/peertube-runner/live-transcoding.ts@@ -1,14 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import {- checkPeerTubeRunnerCacheIsEmpty,- expectStartWith,- PeerTubeRunnerProcess,- SQLCommand,- testLiveVideoResolutions-} from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled, wait } from '@shared/core-utils'-import { HttpStatusCode, VideoPrivacy } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -23,7 +17,12 @@ import {waitJobs,waitUntilLivePublishedOnAllServers,waitUntilLiveWaitingOnAllServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { expectStartWith } from '@tests/shared/checks.js'+import { checkPeerTubeRunnerCacheIsEmpty } from '@tests/shared/directories.js'+import { testLiveVideoResolutions } from '@tests/shared/live.js'+import { PeerTubeRunnerProcess } from '@tests/shared/peertube-runner-process.js'+import { SQLCommand } from '@tests/shared/sql-command.js'describe('Test Live transcoding in peertube-runner program', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/peertube-runner/studio-transcoding.ts b/packages/tests/src/peertube-runner/studio-transcoding.tssimilarity index 88%rename from server/tests/peertube-runner/studio-transcoding.tsrename to packages/tests/src/peertube-runner/studio-transcoding.tsindex 56bfef8970..50e61091a3 100644--- a/server/tests/peertube-runner/studio-transcoding.ts+++ b/packages/tests/src/peertube-runner/studio-transcoding.ts@@ -1,7 +1,7 @@import { expect } from 'chai'-import { checkPeerTubeRunnerCacheIsEmpty, checkVideoDuration, expectStartWith, PeerTubeRunnerProcess } from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled, getAllFiles, wait } from '@shared/core-utils'+import { getAllFiles, wait } from '@peertube/peertube-core-utils'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -12,7 +12,10 @@ import {setDefaultVideoChannel,VideoStudioCommand,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { expectStartWith, checkVideoDuration } from '@tests/shared/checks.js'+import { checkPeerTubeRunnerCacheIsEmpty } from '@tests/shared/directories.js'+import { PeerTubeRunnerProcess } from '@tests/shared/peertube-runner-process.js'describe('Test studio transcoding in peertube-runner program', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/peertube-runner/vod-transcoding.ts b/packages/tests/src/peertube-runner/vod-transcoding.tssimilarity index 94%rename from server/tests/peertube-runner/vod-transcoding.tsrename to packages/tests/src/peertube-runner/vod-transcoding.tsindex b3b62e5e0e..ff5cefe366 100644--- a/server/tests/peertube-runner/vod-transcoding.ts+++ b/packages/tests/src/peertube-runner/vod-transcoding.ts@@ -1,13 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import {- checkPeerTubeRunnerCacheIsEmpty,- completeCheckHlsPlaylist,- completeWebVideoFilesCheck,- PeerTubeRunnerProcess-} from '@server/tests/shared'-import { areMockObjectStorageTestsDisabled, getAllFiles, wait } from '@shared/core-utils'-import { VideoPrivacy } from '@shared/models'+import { getAllFiles, wait } from '@peertube/peertube-core-utils'+import { VideoPrivacy } from '@peertube/peertube-models'+import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'import {cleanupTests,createMultipleServers,@@ -17,7 +12,11 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'+import { checkPeerTubeRunnerCacheIsEmpty } from '@tests/shared/directories.js'+import { PeerTubeRunnerProcess } from '@tests/shared/peertube-runner-process.js'+import { completeCheckHlsPlaylist } from '@tests/shared/streaming-playlists.js'+import { completeWebVideoFilesCheck } from '@tests/shared/videos.js'describe('Test VOD transcoding in peertube-runner program', function () {let servers: PeerTubeServer[] = []diff --git a/server/tests/plugins/action-hooks.ts b/packages/tests/src/plugins/action-hooks.tssimilarity index 99%rename from server/tests/plugins/action-hooks.tsrename to packages/tests/src/plugins/action-hooks.tsindex 773be0d765..136c7671b3 100644--- a/server/tests/plugins/action-hooks.ts+++ b/packages/tests/src/plugins/action-hooks.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { ServerHookName, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'+import { ServerHookName, VideoPlaylistPrivacy, VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -12,7 +12,7 @@ import {setDefaultVideoChannel,stopFfmpeg,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test plugin action hooks', function () {let servers: PeerTubeServer[]diff --git a/server/tests/plugins/external-auth.ts b/packages/tests/src/plugins/external-auth.tssimilarity index 98%rename from server/tests/plugins/external-auth.tsrename to packages/tests/src/plugins/external-auth.tsindex e4015939a9..c7fe221859 100644--- a/server/tests/plugins/external-auth.ts+++ b/packages/tests/src/plugins/external-auth.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { HttpStatusCode, UserAdminFlag, UserRole } from '@shared/models'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, HttpStatusCodeType, UserAdminFlag, UserRole } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -10,7 +10,7 @@ import {PeerTubeServer,PluginsCommand,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function loginExternal (options: {server: PeerTubeServer@@ -18,8 +18,8 @@ async function loginExternal (options: {authName: stringusername: stringquery?: any- expectedStatus?: HttpStatusCode- expectedStatusStep2?: HttpStatusCode+ expectedStatus?: HttpStatusCodeType+ expectedStatusStep2?: HttpStatusCodeType}) {const res = await options.server.plugins.getExternalAuth({npmName: options.npmName,diff --git a/server/tests/plugins/filter-hooks.ts b/packages/tests/src/plugins/filter-hooks.tssimilarity index 99%rename from server/tests/plugins/filter-hooks.tsrename to packages/tests/src/plugins/filter-hooks.tsindex 8382b400f4..88cfee631f 100644--- a/server/tests/plugins/filter-hooks.ts+++ b/packages/tests/src/plugins/filter-hooks.ts@@ -9,7 +9,7 @@ import {VideoPlaylist,VideoPlaylistPrivacy,VideoPrivacy-} from '@shared/models'+} from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -22,8 +22,8 @@ import {setAccessTokensToServers,setDefaultVideoChannel,waitJobs-} from '@shared/server-commands'-import { FIXTURE_URLS } from '../shared'+} from '@peertube/peertube-server-commands'+import { FIXTURE_URLS } from '../shared/tests.js'describe('Test plugin filter hooks', function () {let servers: PeerTubeServer[]diff --git a/server/tests/plugins/html-injection.ts b/packages/tests/src/plugins/html-injection.tssimilarity index 97%rename from server/tests/plugins/html-injection.tsrename to packages/tests/src/plugins/html-injection.tsindex fe16bf1e68..269a45b987 100644--- a/server/tests/plugins/html-injection.ts+++ b/packages/tests/src/plugins/html-injection.ts@@ -8,7 +8,7 @@ import {PeerTubeServer,PluginsCommand,setAccessTokensToServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'describe('Test plugins HTML injection', function () {let server: PeerTubeServer = nulldiff --git a/server/tests/plugins/id-and-pass-auth.ts b/packages/tests/src/plugins/id-and-pass-auth.tssimilarity index 97%rename from server/tests/plugins/id-and-pass-auth.tsrename to packages/tests/src/plugins/id-and-pass-auth.tsindex 127c29cbc3..a332f0eec7 100644--- a/server/tests/plugins/id-and-pass-auth.ts+++ b/packages/tests/src/plugins/id-and-pass-auth.ts@@ -1,9 +1,15 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { wait } from '@shared/core-utils'-import { HttpStatusCode, UserRole } from '@shared/models'-import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/server-commands'+import { wait } from '@peertube/peertube-core-utils'+import { HttpStatusCode, UserRole } from '@peertube/peertube-models'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ PluginsCommand,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test id and pass auth plugins', function () {let server: PeerTubeServerdiff --git a/server/tests/plugins/index.ts b/packages/tests/src/plugins/index.tssimilarity index 100%rename from server/tests/plugins/index.tsrename to packages/tests/src/plugins/index.tsdiff --git a/server/tests/plugins/plugin-helpers.ts b/packages/tests/src/plugins/plugin-helpers.tssimilarity index 98%rename from server/tests/plugins/plugin-helpers.tsrename to packages/tests/src/plugins/plugin-helpers.tsindex f5a0cbe85f..d2bd8596e5 100644--- a/server/tests/plugins/plugin-helpers.ts+++ b/packages/tests/src/plugins/plugin-helpers.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pathExists } from 'fs-extra'-import { HttpStatusCode, ThumbnailType } from '@shared/models'+import { pathExists } from 'fs-extra/esm'+import { HttpStatusCode, ThumbnailType } from '@peertube/peertube-models'import {cleanupTests,createMultipleServers,@@ -14,8 +14,8 @@ import {PluginsCommand,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'-import { checkVideoFilesWereRemoved } from '../shared'+} from '@peertube/peertube-server-commands'+import { checkVideoFilesWereRemoved } from '@tests/shared/videos.js'function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) {const body = { command }diff --git a/server/tests/plugins/plugin-router.ts b/packages/tests/src/plugins/plugin-router.tssimilarity index 96%rename from server/tests/plugins/plugin-router.tsrename to packages/tests/src/plugins/plugin-router.tsindex 40b15eb79c..6f3571c055 100644--- a/server/tests/plugins/plugin-router.ts+++ b/packages/tests/src/plugins/plugin-router.ts@@ -9,8 +9,8 @@ import {PeerTubeServer,PluginsCommand,setAccessTokensToServers-} from '@shared/server-commands'-import { HttpStatusCode } from '@shared/models'+} from '@peertube/peertube-server-commands'+import { HttpStatusCode } from '@peertube/peertube-models'describe('Test plugin helpers', function () {let server: PeerTubeServerdiff --git a/server/tests/plugins/plugin-storage.ts b/packages/tests/src/plugins/plugin-storage.tssimilarity index 93%rename from server/tests/plugins/plugin-storage.tsrename to packages/tests/src/plugins/plugin-storage.tsindex 112652a1fe..f9b0ead0c2 100644--- a/server/tests/plugins/plugin-storage.ts+++ b/packages/tests/src/plugins/plugin-storage.ts@@ -1,8 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pathExists, readdir, readFile } from 'fs-extra'+import { pathExists } from 'fs-extra/esm'+import { readdir, readFile } from 'fs/promises'import { join } from 'path'+import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -10,8 +12,7 @@ import {PeerTubeServer,PluginsCommand,setAccessTokensToServers-} from '@shared/server-commands'-import { HttpStatusCode } from '@shared/models'+} from '@peertube/peertube-server-commands'describe('Test plugin storage', function () {let server: PeerTubeServerdiff --git a/server/tests/plugins/plugin-transcoding.ts b/packages/tests/src/plugins/plugin-transcoding.tssimilarity index 98%rename from server/tests/plugins/plugin-transcoding.tsrename to packages/tests/src/plugins/plugin-transcoding.tsindex 21f82fbacf..2f50f65ff0 100644--- a/server/tests/plugins/plugin-transcoding.ts+++ b/packages/tests/src/plugins/plugin-transcoding.ts@@ -1,8 +1,8 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { getAudioStream, getVideoStream, getVideoStreamFPS } from '@shared/ffmpeg'-import { VideoPrivacy } from '@shared/models'+import { getAudioStream, getVideoStream, getVideoStreamFPS } from '@peertube/peertube-ffmpeg'+import { VideoPrivacy } from '@peertube/peertube-models'import {cleanupTests,createSingleServer,@@ -12,7 +12,7 @@ import {setDefaultVideoChannel,testFfmpegStreamError,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function createLiveWrapper (server: PeerTubeServer) {const liveAttributes = {diff --git a/server/tests/plugins/plugin-unloading.ts b/packages/tests/src/plugins/plugin-unloading.tssimilarity index 95%rename from server/tests/plugins/plugin-unloading.tsrename to packages/tests/src/plugins/plugin-unloading.tsindex 5aca1a0c01..70310bc8c1 100644--- a/server/tests/plugins/plugin-unloading.ts+++ b/packages/tests/src/plugins/plugin-unloading.ts@@ -8,8 +8,8 @@ import {PeerTubeServer,PluginsCommand,setAccessTokensToServers-} from '@shared/server-commands'-import { HttpStatusCode } from '@shared/models'+} from '@peertube/peertube-server-commands'+import { HttpStatusCode } from '@peertube/peertube-models'describe('Test plugins module unloading', function () {let server: PeerTubeServer = nulldiff --git a/server/tests/plugins/plugin-websocket.ts b/packages/tests/src/plugins/plugin-websocket.tssimilarity index 92%rename from server/tests/plugins/plugin-websocket.tsrename to packages/tests/src/plugins/plugin-websocket.tsindex adaa28b1d9..832dcebd0e 100644--- a/server/tests/plugins/plugin-websocket.ts+++ b/packages/tests/src/plugins/plugin-websocket.ts@@ -1,7 +1,13 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import WebSocket from 'ws'-import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/server-commands'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ PluginsCommand,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'function buildWebSocket (server: PeerTubeServer, path: string) {return new WebSocket('ws://' + server.host + path)diff --git a/server/tests/plugins/translations.ts b/packages/tests/src/plugins/translations.tssimilarity index 92%rename from server/tests/plugins/translations.tsrename to packages/tests/src/plugins/translations.tsindex 67e4683f8f..a69e141342 100644--- a/server/tests/plugins/translations.ts+++ b/packages/tests/src/plugins/translations.ts@@ -1,7 +1,13 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/server-commands'+import {+ cleanupTests,+ createSingleServer,+ PeerTubeServer,+ PluginsCommand,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'describe('Test plugin translations', function () {let server: PeerTubeServerdiff --git a/server/tests/plugins/video-constants.ts b/packages/tests/src/plugins/video-constants.tssimilarity index 96%rename from server/tests/plugins/video-constants.tsrename to packages/tests/src/plugins/video-constants.tsindex c388f02d1d..b81240a649 100644--- a/server/tests/plugins/video-constants.ts+++ b/packages/tests/src/plugins/video-constants.ts@@ -8,8 +8,8 @@ import {PeerTubeServer,PluginsCommand,setAccessTokensToServers-} from '@shared/server-commands'-import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'+} from '@peertube/peertube-server-commands'+import { HttpStatusCode, VideoPlaylistPrivacy, VideoPrivacy } from '@peertube/peertube-models'describe('Test plugin altering video constants', function () {let server: PeerTubeServer@@ -72,7 +72,7 @@ describe('Test plugin altering video constants', function () {})it('Should not be able to create a video with this privacy', async function () {- const attributes = { name: 'video', privacy: 2 }+ const attributes = { name: 'video', privacy: VideoPrivacy.UNLISTED }await server.videos.upload({ attributes, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })})diff --git a/server/tests/api/activitypub/helpers.ts b/packages/tests/src/server-helpers/activitypub.tssimilarity index 62%rename from server/tests/api/activitypub/helpers.tsrename to packages/tests/src/server-helpers/activitypub.tsindex bad86ef47b..dfcd0389f6 100644--- a/server/tests/api/activitypub/helpers.ts+++ b/packages/tests/src/server-helpers/activitypub.ts@@ -1,19 +1,28 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'+import { signAndContextify } from '@peertube/peertube-server/server/helpers/activity-pub-utils.js'+import {+ isHTTPSignatureVerified,+ isJsonLDSignatureVerified,+ parseHTTPSignature+} from '@peertube/peertube-server/server/helpers/peertube-crypto.js'+import { buildRequestStub } from '@tests/shared/tests.js'import { expect } from 'chai'-import { cloneDeep } from 'lodash'-import { signAndContextify } from '@server/lib/activitypub/send'-import { buildRequestStub } from '@server/tests/shared'-import { buildAbsoluteFixturePath } from '@shared/core-utils'-import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto'+import { readJsonSync } from 'fs-extra/esm'+import cloneDeep from 'lodash-es/cloneDeep.js'++function fakeFilter () {+ return (data: any) => Promise.resolve(data)+}describe('Test activity pub helpers', function () {describe('When checking the Linked Signature', function () {it('Should fail with an invalid Mastodon signature', async function () {- const body = require(buildAbsoluteFixturePath('./ap-json/mastodon/create-bad-signature.json'))- const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKey+ const body = readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/create-bad-signature.json'))+ const publicKey = readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKeyconst fromActor = { publicKey, url: 'http://localhost:9002/accounts/peertube' }const result = await isJsonLDSignatureVerified(fromActor as any, body)@@ -22,8 +31,8 @@ describe('Test activity pub helpers', function () {})it('Should fail with an invalid public key', async function () {- const body = require(buildAbsoluteFixturePath('./ap-json/mastodon/create.json'))- const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/bad-public-key.json')).publicKey+ const body = readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/create.json'))+ const publicKey = readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/bad-public-key.json')).publicKeyconst fromActor = { publicKey, url: 'http://localhost:9002/accounts/peertube' }const result = await isJsonLDSignatureVerified(fromActor as any, body)@@ -32,8 +41,8 @@ describe('Test activity pub helpers', function () {})it('Should succeed with a valid Mastodon signature', async function () {- const body = require(buildAbsoluteFixturePath('./ap-json/mastodon/create.json'))- const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKey+ const body = readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/create.json'))+ const publicKey = readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKeyconst fromActor = { publicKey, url: 'http://localhost:9002/accounts/peertube' }const result = await isJsonLDSignatureVerified(fromActor as any, body)@@ -42,11 +51,11 @@ describe('Test activity pub helpers', function () {})it('Should fail with an invalid PeerTube signature', async function () {- const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/invalid-keys.json'))- const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))+ const keys = readJsonSync(buildAbsoluteFixturePath('./ap-json/peertube/invalid-keys.json'))+ const body = readJsonSync(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey }- const signedBody = await signAndContextify(actorSignature as any, body, 'Announce')+ const signedBody = await signAndContextify(actorSignature as any, body, 'Announce', fakeFilter())const fromActor = { publicKey: keys.publicKey, url: 'http://localhost:9002/accounts/peertube' }const result = await isJsonLDSignatureVerified(fromActor as any, signedBody)@@ -55,11 +64,11 @@ describe('Test activity pub helpers', function () {})it('Should succeed with a valid PeerTube signature', async function () {- const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json'))- const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))+ const keys = readJsonSync(buildAbsoluteFixturePath('./ap-json/peertube/keys.json'))+ const body = readJsonSync(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json'))const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey }- const signedBody = await signAndContextify(actorSignature as any, body, 'Announce')+ const signedBody = await signAndContextify(actorSignature as any, body, 'Announce', fakeFilter())const fromActor = { publicKey: keys.publicKey, url: 'http://localhost:9002/accounts/peertube' }const result = await isJsonLDSignatureVerified(fromActor as any, signedBody)@@ -74,12 +83,12 @@ describe('Test activity pub helpers', function () {req.method = 'POST'req.url = '/accounts/ronan/inbox'- const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/bad-http-signature.json')))+ const mastodonObject = cloneDeep(readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/bad-http-signature.json')))req.body = mastodonObject.bodyreq.headers = mastodonObject.headersconst parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10)- const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKey+ const publicKey = readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKeyconst actor = { publicKey }const verified = isHTTPSignatureVerified(parsed, actor as any)@@ -92,12 +101,12 @@ describe('Test activity pub helpers', function () {req.method = 'POST'req.url = '/accounts/ronan/inbox'- const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json')))+ const mastodonObject = cloneDeep(readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json')))req.body = mastodonObject.bodyreq.headers = mastodonObject.headersconst parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10)- const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/bad-public-key.json')).publicKey+ const publicKey = readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/bad-public-key.json')).publicKeyconst actor = { publicKey }const verified = isHTTPSignatureVerified(parsed, actor as any)@@ -110,7 +119,7 @@ describe('Test activity pub helpers', function () {req.method = 'POST'req.url = '/accounts/ronan/inbox'- const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json')))+ const mastodonObject = cloneDeep(readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json')))req.body = mastodonObject.bodyreq.headers = mastodonObject.headers@@ -129,7 +138,7 @@ describe('Test activity pub helpers', function () {req.method = 'POST'req.url = '/accounts/ronan/inbox'- const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json')))+ const mastodonObject = cloneDeep(readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json')))req.body = mastodonObject.bodyreq.headers = mastodonObject.headersreq.headers = 'Signature ' + mastodonObject.headers@@ -149,12 +158,12 @@ describe('Test activity pub helpers', function () {req.method = 'POST'req.url = '/accounts/ronan/inbox'- const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json')))+ const mastodonObject = cloneDeep(readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json')))req.body = mastodonObject.bodyreq.headers = mastodonObject.headersconst parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10)- const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKey+ const publicKey = readJsonSync(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKeyconst actor = { publicKey }const verified = isHTTPSignatureVerified(parsed, actor as any)diff --git a/server/tests/helpers/core-utils.ts b/packages/tests/src/server-helpers/core-utils.tssimilarity index 95%rename from server/tests/helpers/core-utils.tsrename to packages/tests/src/server-helpers/core-utils.tsindex cd2f07e4a5..06c78591e7 100644--- a/server/tests/helpers/core-utils.ts+++ b/packages/tests/src/server-helpers/core-utils.ts@@ -1,11 +1,11 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { snakeCase } from 'lodash'+import snakeCase from 'lodash-es/snakeCase.js'import validator from 'validator'-import { getAverageTheoreticalBitrate, getMaxTheoreticalBitrate } from '@shared/core-utils'-import { VideoResolution } from '@shared/models'-import { objectConverter, parseBytes, parseDurationToMs } from '../../helpers/core-utils'+import { getAverageTheoreticalBitrate, getMaxTheoreticalBitrate } from '@peertube/peertube-core-utils'+import { VideoResolution } from '@peertube/peertube-models'+import { objectConverter, parseBytes, parseDurationToMs } from '@peertube/peertube-server/server/helpers/core-utils.js'describe('Parse Bytes', function () {@@ -72,7 +72,7 @@ describe('Object', function () {}function valueConverter (v: any) {- if (validator.isNumeric(v + '')) return parseInt('' + v, 10)+ if (validator.default.isNumeric(v + '')) return parseInt('' + v, 10)return v}diff --git a/server/tests/helpers/crypto.ts b/packages/tests/src/server-helpers/crypto.tssimilarity index 89%rename from server/tests/helpers/crypto.tsrename to packages/tests/src/server-helpers/crypto.tsindex b508c715b9..4bf5b8a45c 100644--- a/server/tests/helpers/crypto.ts+++ b/packages/tests/src/server-helpers/crypto.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { decrypt, encrypt } from '@server/helpers/peertube-crypto'+import { decrypt, encrypt } from '@peertube/peertube-server/server/helpers/peertube-crypto.js'describe('Encrypt/Descrypt', function () {diff --git a/server/tests/helpers/dns.ts b/packages/tests/src/server-helpers/dns.tssimilarity index 86%rename from server/tests/helpers/dns.tsrename to packages/tests/src/server-helpers/dns.tsindex 49b506e7be..64e3112a26 100644--- a/server/tests/helpers/dns.ts+++ b/packages/tests/src/server-helpers/dns.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { isResolvingToUnicastOnly } from '@server/helpers/dns'+import { isResolvingToUnicastOnly } from '@peertube/peertube-server/server/helpers/dns.js'describe('DNS helpers', function () {diff --git a/server/tests/helpers/image.ts b/packages/tests/src/server-helpers/image.tssimilarity index 91%rename from server/tests/helpers/image.tsrename to packages/tests/src/server-helpers/image.tsindex 6021ffc48e..34675d3856 100644--- a/server/tests/helpers/image.ts+++ b/packages/tests/src/server-helpers/image.ts@@ -1,11 +1,12 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { readFile, remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'+import { readFile } from 'fs/promises'import { join } from 'path'-import { execPromise } from '@server/helpers/core-utils'-import { buildAbsoluteFixturePath, root } from '@shared/core-utils'-import { processImage } from '../../../server/helpers/image-utils'+import { buildAbsoluteFixturePath, root } from '@peertube/peertube-node-utils'+import { execPromise } from '@peertube/peertube-server/server/helpers/core-utils.js'+import { processImage } from '@peertube/peertube-server/server/helpers/image-utils.js'async function checkBuffers (path1: string, path2: string, equals: boolean) {const [ buf1, buf2 ] = await Promise.all([diff --git a/packages/tests/src/server-helpers/index.ts b/packages/tests/src/server-helpers/index.tsnew file mode 100644index 0000000000..04a26560cb--- /dev/null+++ b/packages/tests/src/server-helpers/index.ts@@ -0,0 +1,10 @@+import './activitypub.js'+import './core-utils.js'+import './crypto.js'+import './dns.js'+import './image.js'+import './markdown.js'+import './mentions.js'+import './request.js'+import './validator.js'+import './version.js'diff --git a/server/tests/helpers/markdown.ts b/packages/tests/src/server-helpers/markdown.tssimilarity index 91%rename from server/tests/helpers/markdown.tsrename to packages/tests/src/server-helpers/markdown.tsindex 6fab31d6f0..96e3c34dc2 100644--- a/server/tests/helpers/markdown.ts+++ b/packages/tests/src/server-helpers/markdown.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { mdToOneLinePlainText } from '@server/helpers/markdown'+import { mdToOneLinePlainText } from '@peertube/peertube-server/server/helpers/markdown.js'import { expect } from 'chai'describe('Markdown helpers', function () {diff --git a/packages/tests/src/server-helpers/mentions.ts b/packages/tests/src/server-helpers/mentions.tsnew file mode 100644index 0000000000..153931d60b--- /dev/null+++ b/packages/tests/src/server-helpers/mentions.ts@@ -0,0 +1,17 @@+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */++import { expect } from 'chai'+import { extractMentions } from '@peertube/peertube-server/server/helpers/mentions.js'++describe('Comment model', function () {+ it('Should correctly extract mentions', async function () {+ const text = '@florian @jean@localhost:9000 @flo @another@localhost:9000 @[email protected] hello ' ++ 'email@localhost:9000 coucou.com no? @chocobozzz @chocobozzz @end'++ const isOwned = true++ const result = extractMentions(text, isOwned).sort((a, b) => a.localeCompare(b))++ expect(result).to.deep.equal([ 'another', 'chocobozzz', 'end', 'flo', 'florian', 'jean' ])+ })+})diff --git a/server/tests/helpers/request.ts b/packages/tests/src/server-helpers/request.tssimilarity index 81%rename from server/tests/helpers/request.tsrename to packages/tests/src/server-helpers/request.tsindex 363237df52..f4b9af52e7 100644--- a/server/tests/helpers/request.ts+++ b/packages/tests/src/server-helpers/request.ts@@ -1,11 +1,13 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pathExists, remove } from 'fs-extra'+import { pathExists, remove } from 'fs-extra/esm'import { join } from 'path'-import { root, wait } from '@shared/core-utils'-import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests'-import { FIXTURE_URLS, Mock429 } from '../shared'+import { wait } from '@peertube/peertube-core-utils'+import { root } from '@peertube/peertube-node-utils'+import { doRequest, doRequestAndSaveToFile } from '@peertube/peertube-server/server/helpers/requests.js'+import { Mock429 } from '@tests/shared/mock-servers/mock-429.js'+import { FIXTURE_URLS } from '@tests/shared/tests.js'describe('Request helpers', function () {const destPath1 = join(root(), 'test-output-1.txt')diff --git a/server/tests/helpers/validator.ts b/packages/tests/src/server-helpers/validator.tssimilarity index 90%rename from server/tests/helpers/validator.tsrename to packages/tests/src/server-helpers/validator.tsindex f40a3aaae9..792bd501c2 100644--- a/server/tests/helpers/validator.ts+++ b/packages/tests/src/server-helpers/validator.ts@@ -1,7 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { isPluginStableOrUnstableVersionValid, isPluginStableVersionValid } from '@server/helpers/custom-validators/plugins'+import {+ isPluginStableOrUnstableVersionValid,+ isPluginStableVersionValid+} from '@peertube/peertube-server/server/helpers/custom-validators/plugins.js'describe('Validators', function () {diff --git a/server/tests/helpers/version.ts b/packages/tests/src/server-helpers/version.tssimilarity index 96%rename from server/tests/helpers/version.tsrename to packages/tests/src/server-helpers/version.tsindex 2a90efba30..76892d1e78 100644--- a/server/tests/helpers/version.ts+++ b/packages/tests/src/server-helpers/version.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { compareSemVer } from '@shared/core-utils'+import { compareSemVer } from '@peertube/peertube-core-utils'describe('Version', function () {diff --git a/packages/tests/src/server-lib/index.ts b/packages/tests/src/server-lib/index.tsnew file mode 100644index 0000000000..873f53e154--- /dev/null+++ b/packages/tests/src/server-lib/index.ts@@ -0,0 +1 @@+export * from './video-constant-registry-factory.js'diff --git a/server/tests/lib/video-constant-registry-factory.ts b/packages/tests/src/server-lib/video-constant-registry-factory.tssimilarity index 94%rename from server/tests/lib/video-constant-registry-factory.tsrename to packages/tests/src/server-lib/video-constant-registry-factory.tsindex c3480dc12f..6bf2d1db69 100644--- a/server/tests/lib/video-constant-registry-factory.ts+++ b/packages/tests/src/server-lib/video-constant-registry-factory.ts@@ -1,17 +1,14 @@/* eslint-disable @typescript-eslint/no-unused-expressions */import { expect } from 'chai'-import { VideoConstantManagerFactory } from '@server/lib/plugins/video-constant-manager-factory'+import { VideoPlaylistPrivacyType, VideoPrivacyType } from '@peertube/peertube-models'import {VIDEO_CATEGORIES,VIDEO_LANGUAGES,VIDEO_LICENCES,VIDEO_PLAYLIST_PRIVACIES,VIDEO_PRIVACIES-} from '@server/initializers/constants'-import {- VideoPlaylistPrivacy,- VideoPrivacy-} from '@shared/models'+} from '@peertube/peertube-server/server/initializers/constants.js'+import { VideoConstantManagerFactory } from '@peertube/peertube-server/server/lib/plugins/video-constant-manager-factory.js'describe('VideoConstantManagerFactory', function () {const factory = new VideoConstantManagerFactory('peertube-plugin-constants')@@ -74,7 +71,7 @@ describe('VideoConstantManagerFactory', function () {})describe('PlaylistPrivacyManager', () => {- const playlistPrivacyManager = factory.createVideoConstantManager<VideoPlaylistPrivacy>('playlistPrivacy')+ const playlistPrivacyManager = factory.createVideoConstantManager<VideoPlaylistPrivacyType>('playlistPrivacy')it('Should be able to list all video playlist privacy constants', () => {const constants = playlistPrivacyManager.getConstants()expect(constants).to.deep.equal(VIDEO_PLAYLIST_PRIVACIES)@@ -100,7 +97,7 @@ describe('VideoConstantManagerFactory', function () {})describe('VideoPrivacyManager', () => {- const videoPrivacyManager = factory.createVideoConstantManager<VideoPrivacy>('privacy')+ const videoPrivacyManager = factory.createVideoConstantManager<VideoPrivacyType>('privacy')it('Should be able to list all video privacy constants', () => {const constants = videoPrivacyManager.getConstants()expect(constants).to.deep.equal(VIDEO_PRIVACIES)diff --git a/server/tests/shared/actors.ts b/packages/tests/src/shared/actors.tssimilarity index 89%rename from server/tests/shared/actors.tsrename to packages/tests/src/shared/actors.tsindex 41fd72e894..02d507a490 100644--- a/server/tests/shared/actors.ts+++ b/packages/tests/src/shared/actors.ts@@ -1,9 +1,10 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pathExists, readdir } from 'fs-extra'-import { Account, VideoChannel } from '@shared/models'-import { PeerTubeServer } from '@shared/server-commands'+import { pathExists } from 'fs-extra/esm'+import { readdir } from 'fs/promises'+import { Account, VideoChannel } from '@peertube/peertube-models'+import { PeerTubeServer } from '@peertube/peertube-server-commands'async function expectChannelsFollows (options: {server: PeerTubeServerdiff --git a/server/tests/shared/captions.ts b/packages/tests/src/shared/captions.tssimilarity index 89%rename from server/tests/shared/captions.tsrename to packages/tests/src/shared/captions.tsindex 35e722408a..436cf8dcca 100644--- a/server/tests/shared/captions.ts+++ b/packages/tests/src/shared/captions.ts@@ -1,6 +1,6 @@import { expect } from 'chai'import request from 'supertest'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCode } from '@peertube/peertube-models'async function testCaptionFile (url: string, captionPath: string, toTest: RegExp | string) {const res = await request(url)diff --git a/server/tests/shared/checks.ts b/packages/tests/src/shared/checks.tssimilarity index 89%rename from server/tests/shared/checks.tsrename to packages/tests/src/shared/checks.tsindex 90179c6ac7..fea618a30e 100644--- a/server/tests/shared/checks.ts+++ b/packages/tests/src/shared/checks.ts@@ -1,14 +1,12 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */import { expect } from 'chai'-import { pathExists, readFile } from 'fs-extra'-import JPEG from 'jpeg-js'+import { pathExists } from 'fs-extra/esm'+import { readFile } from 'fs/promises'import { join } from 'path'-import pixelmatch from 'pixelmatch'-import { PNG } from 'pngjs'-import { root } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'-import { makeGetRequest, PeerTubeServer } from '@shared/server-commands'+import { HttpStatusCode } from '@peertube/peertube-models'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'+import { makeGetRequest, PeerTubeServer } from '@peertube/peertube-server-commands'// Default interval -> 5 minutesfunction dateIsValid (dateString: string | Date, interval = 300000) {@@ -53,7 +51,7 @@ async function testImageSize (url: string, imageName: string, imageHTTPPath: strconst body = res.body- const data = await readFile(join(root(), 'server', 'tests', 'fixtures', imageName + extension))+ const data = await readFile(buildAbsoluteFixturePath(imageName + extension))const minLength = data.length - ((40 * data.length) / 100)const maxLength = data.length + ((40 * data.length) / 100)@@ -66,6 +64,7 @@ async function testImageGeneratedByFFmpeg (url: string, imageName: string, imageconsole.log('Pixel comparison of image generated by ffmpeg is disabled. ' +'You can enable it using `ENABLE_FFMPEG_THUMBNAIL_PIXEL_COMPARISON_TESTS=true env variable')+ return}return testImage(url, imageName, imageHTTPPath, extension)@@ -79,7 +78,11 @@ async function testImage (url: string, imageName: string, imageHTTPPath: string,})const body = res.body- const data = await readFile(join(root(), 'server', 'tests', 'fixtures', imageName + extension))+ const data = await readFile(buildAbsoluteFixturePath(imageName + extension))++ const { PNG } = await import('pngjs')+ const JPEG = await import('jpeg-js')+ const pixelmatch = (await import('pixelmatch')).defaultconst img1 = imageHTTPPath.endsWith('.png')? PNG.sync.read(body)diff --git a/server/tests/shared/directories.ts b/packages/tests/src/shared/directories.tssimilarity index 90%rename from server/tests/shared/directories.tsrename to packages/tests/src/shared/directories.tsindex 5ad12d78ab..f21e7b7c64 100644--- a/server/tests/shared/directories.ts+++ b/packages/tests/src/shared/directories.ts@@ -1,11 +1,12 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pathExists, readdir } from 'fs-extra'+import { pathExists } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { homedir } from 'os'import { join } from 'path'-import { PeerTubeServer } from '@shared/server-commands'-import { PeerTubeRunnerProcess } from './peertube-runner-process'+import { PeerTubeServer } from '@peertube/peertube-server-commands'+import { PeerTubeRunnerProcess } from './peertube-runner-process.js'export async function checkTmpIsEmpty (server: PeerTubeServer) {await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ])diff --git a/server/tests/shared/generate.ts b/packages/tests/src/shared/generate.tssimilarity index 86%rename from server/tests/shared/generate.tsrename to packages/tests/src/shared/generate.tsindex 3788b049f8..ab2ecaf403 100644--- a/server/tests/shared/generate.ts+++ b/packages/tests/src/shared/generate.ts@@ -1,9 +1,9 @@import { expect } from 'chai'-import ffmpeg from 'fluent-ffmpeg'-import { ensureDir, pathExists } from 'fs-extra'+import { ensureDir, pathExists } from 'fs-extra/esm'import { dirname } from 'path'-import { buildAbsoluteFixturePath, getMaxTheoreticalBitrate } from '@shared/core-utils'-import { getVideoStreamBitrate, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@shared/ffmpeg'+import { getMaxTheoreticalBitrate } from '@peertube/peertube-core-utils'+import { buildAbsoluteFixturePath } from '@peertube/peertube-node-utils'+import { getVideoStreamBitrate, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@peertube/peertube-ffmpeg'async function ensureHasTooBigBitrate (fixturePath: string) {const bitrate = await getVideoStreamBitrate(fixturePath)@@ -20,7 +20,10 @@ async function generateHighBitrateVideo () {await ensureDir(dirname(tempFixturePath))const exists = await pathExists(tempFixturePath)+if (!exists) {+ const ffmpeg = (await import('fluent-ffmpeg')).default+console.log('Generating high bitrate video.')// Generate a random, high bitrate video on the fly, so we don't have to include@@ -51,6 +54,8 @@ async function generateVideoWithFramerate (fps = 60) {const exists = await pathExists(tempFixturePath)if (!exists) {+ const ffmpeg = (await import('fluent-ffmpeg')).default+console.log('Generating video with framerate %d.', fps)return new Promise<string>((res, rej) => {diff --git a/server/tests/shared/live.ts b/packages/tests/src/shared/live.tssimilarity index 93%rename from server/tests/shared/live.tsrename to packages/tests/src/shared/live.tsindex 9d8c1d9418..9c7991b0d9 100644--- a/server/tests/shared/live.ts+++ b/packages/tests/src/shared/live.ts@@ -1,13 +1,14 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { pathExists, readdir } from 'fs-extra'+import { pathExists } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { join } from 'path'-import { sha1 } from '@shared/extra-utils'-import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models'-import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands'-import { SQLCommand } from './sql-command'-import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists'+import { sha1 } from '@peertube/peertube-node-utils'+import { LiveVideo, VideoStreamingPlaylistType } from '@peertube/peertube-models'+import { ObjectStorageCommand, PeerTubeServer } from '@peertube/peertube-server-commands'+import { SQLCommand } from './sql-command.js'+import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists.js'async function checkLiveCleanup (options: {server: PeerTubeServerdiff --git a/packages/tests/src/shared/mock-servers/index.ts b/packages/tests/src/shared/mock-servers/index.tsnew file mode 100644index 0000000000..9d1c63c67e--- /dev/null+++ b/packages/tests/src/shared/mock-servers/index.ts@@ -0,0 +1,8 @@+export * from './mock-429.js'+export * from './mock-email.js'+export * from './mock-http.js'+export * from './mock-instances-index.js'+export * from './mock-joinpeertube-versions.js'+export * from './mock-object-storage.js'+export * from './mock-plugin-blocklist.js'+export * from './mock-proxy.js'diff --git a/server/tests/shared/mock-servers/mock-429.ts b/packages/tests/src/shared/mock-servers/mock-429.tssimilarity index 99%rename from server/tests/shared/mock-servers/mock-429.tsrename to packages/tests/src/shared/mock-servers/mock-429.tsindex 1fc20b079c..5fcb1447dc 100644--- a/server/tests/shared/mock-servers/mock-429.ts+++ b/packages/tests/src/shared/mock-servers/mock-429.ts@@ -1,6 +1,6 @@import express from 'express'import { Server } from 'http'-import { getPort, randomListen, terminateServer } from './shared'+import { getPort, randomListen, terminateServer } from './shared.js'export class Mock429 {private server: Serverdiff --git a/server/tests/shared/mock-servers/mock-email.ts b/packages/tests/src/shared/mock-servers/mock-email.tssimilarity index 90%rename from server/tests/shared/mock-servers/mock-email.tsrename to packages/tests/src/shared/mock-servers/mock-email.tsindex 6eda2dfda0..7c618e57f6 100644--- a/server/tests/shared/mock-servers/mock-email.ts+++ b/packages/tests/src/shared/mock-servers/mock-email.ts@@ -1,5 +1,6 @@import MailDev from '@peertube/maildev'-import { parallelTests, randomInt } from '@shared/core-utils'+import { randomInt } from '@peertube/peertube-core-utils'+import { parallelTests } from '@peertube/peertube-node-utils'class MockSmtpServer {diff --git a/server/tests/shared/mock-servers/mock-http.ts b/packages/tests/src/shared/mock-servers/mock-http.tssimilarity index 99%rename from server/tests/shared/mock-servers/mock-http.tsrename to packages/tests/src/shared/mock-servers/mock-http.tsindex b7a019e077..bc1a9ce915 100644--- a/server/tests/shared/mock-servers/mock-http.ts+++ b/packages/tests/src/shared/mock-servers/mock-http.ts@@ -1,6 +1,6 @@import express from 'express'import { Server } from 'http'-import { getPort, randomListen, terminateServer } from './shared'+import { getPort, randomListen, terminateServer } from './shared.js'export class MockHTTP {private server: Serverdiff --git a/server/tests/shared/mock-servers/mock-instances-index.ts b/packages/tests/src/shared/mock-servers/mock-instances-index.tssimilarity index 99%rename from server/tests/shared/mock-servers/mock-instances-index.tsrename to packages/tests/src/shared/mock-servers/mock-instances-index.tsindex 598b007f12..a213673582 100644--- a/server/tests/shared/mock-servers/mock-instances-index.ts+++ b/packages/tests/src/shared/mock-servers/mock-instances-index.ts@@ -1,6 +1,6 @@import express from 'express'import { Server } from 'http'-import { getPort, randomListen, terminateServer } from './shared'+import { getPort, randomListen, terminateServer } from './shared.js'export class MockInstancesIndex {private server: Serverdiff --git a/server/tests/shared/mock-servers/mock-joinpeertube-versions.ts b/packages/tests/src/shared/mock-servers/mock-joinpeertube-versions.tssimilarity index 93%rename from server/tests/shared/mock-servers/mock-joinpeertube-versions.tsrename to packages/tests/src/shared/mock-servers/mock-joinpeertube-versions.tsindex 502f4e2f54..0783165e48 100644--- a/server/tests/shared/mock-servers/mock-joinpeertube-versions.ts+++ b/packages/tests/src/shared/mock-servers/mock-joinpeertube-versions.ts@@ -1,6 +1,6 @@import express from 'express'import { Server } from 'http'-import { getPort, randomListen } from './shared'+import { getPort, randomListen } from './shared.js'export class MockJoinPeerTubeVersions {private server: Serverdiff --git a/server/tests/shared/mock-servers/mock-object-storage.ts b/packages/tests/src/shared/mock-servers/mock-object-storage.tssimilarity index 93%rename from server/tests/shared/mock-servers/mock-object-storage.tsrename to packages/tests/src/shared/mock-servers/mock-object-storage.tsindex ae76c4f3f8..f97c57fd7c 100644--- a/server/tests/shared/mock-servers/mock-object-storage.ts+++ b/packages/tests/src/shared/mock-servers/mock-object-storage.ts@@ -2,8 +2,8 @@ import express from 'express'import got, { RequestError } from 'got'import { Server } from 'http'import { pipeline } from 'stream'-import { ObjectStorageCommand } from '@shared/server-commands'-import { getPort, randomListen, terminateServer } from './shared'+import { ObjectStorageCommand } from '@peertube/peertube-server-commands'+import { getPort, randomListen, terminateServer } from './shared.js'export class MockObjectStorageProxy {private server: Serverdiff --git a/server/tests/shared/mock-servers/mock-plugin-blocklist.ts b/packages/tests/src/shared/mock-servers/mock-plugin-blocklist.tssimilarity index 99%rename from server/tests/shared/mock-servers/mock-plugin-blocklist.tsrename to packages/tests/src/shared/mock-servers/mock-plugin-blocklist.tsindex 5d6e018164..c0b6518ba3 100644--- a/server/tests/shared/mock-servers/mock-plugin-blocklist.ts+++ b/packages/tests/src/shared/mock-servers/mock-plugin-blocklist.ts@@ -1,6 +1,6 @@import express, { Request, Response } from 'express'import { Server } from 'http'-import { getPort, randomListen, terminateServer } from './shared'+import { getPort, randomListen, terminateServer } from './shared.js'type BlocklistResponse = {data: {diff --git a/server/tests/shared/mock-servers/mock-proxy.ts b/packages/tests/src/shared/mock-servers/mock-proxy.tssimilarity index 89%rename from server/tests/shared/mock-servers/mock-proxy.tsrename to packages/tests/src/shared/mock-servers/mock-proxy.tsindex e741d6735d..e731670d87 100644--- a/server/tests/shared/mock-servers/mock-proxy.ts+++ b/packages/tests/src/shared/mock-servers/mock-proxy.ts@@ -1,6 +1,6 @@import { createServer, Server } from 'http'import { createProxy } from 'proxy'-import { getPort, terminateServer } from './shared'+import { getPort, terminateServer } from './shared.js'class MockProxy {private server: Serverdiff --git a/server/tests/shared/mock-servers/shared.ts b/packages/tests/src/shared/mock-servers/shared.tssimilarity index 100%rename from server/tests/shared/mock-servers/shared.tsrename to packages/tests/src/shared/mock-servers/shared.tsdiff --git a/server/tests/shared/notifications.ts b/packages/tests/src/shared/notifications.tssimilarity index 99%rename from server/tests/shared/notifications.tsrename to packages/tests/src/shared/notifications.tsindex 6c0688d5aa..3accd73221 100644--- a/server/tests/shared/notifications.ts+++ b/packages/tests/src/shared/notifications.ts@@ -1,26 +1,27 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { expect } from 'chai'-import { inspect } from 'util'import {AbuseState,- PluginType,+ AbuseStateType,+ PluginType_Type,UserNotification,UserNotificationSetting,UserNotificationSettingValue,UserNotificationType-} from '@shared/models'+} from '@peertube/peertube-models'import {ConfigCommand,+ PeerTubeServer,createMultipleServers,doubleFollow,- PeerTubeServer,setAccessTokensToServers,setDefaultAccountAvatar,setDefaultChannelAvatar,setDefaultVideoChannel-} from '@shared/server-commands'-import { MockSmtpServer } from './mock-servers'+} from '@peertube/peertube-server-commands'+import { expect } from 'chai'+import { inspect } from 'util'+import { MockSmtpServer } from './mock-servers/index.js'type CheckerBaseParams = {server: PeerTubeServer@@ -483,7 +484,7 @@ async function checkNewAbuseMessage (options: CheckerBaseParams & {async function checkAbuseStateChange (options: CheckerBaseParams & {abuseId: number- state: AbuseState+ state: AbuseStateTypecheckType: CheckerType}) {const { abuseId, state } = options@@ -667,7 +668,7 @@ async function checkNewPeerTubeVersion (options: CheckerBaseParams & {}async function checkNewPluginVersion (options: CheckerBaseParams & {- pluginType: PluginType+ pluginType: PluginType_TypepluginName: stringcheckType: CheckerType}) {@@ -774,10 +775,11 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an// ---------------------------------------------------------------------------export {+ type CheckerType,+ type CheckerBaseParams,+getAllNotificationsSettings,- CheckerBaseParams,- CheckerType,checkMyVideoImportIsFinished,checkUserRegistered,checkAutoInstanceFollowing,diff --git a/server/tests/shared/peertube-runner-process.ts b/packages/tests/src/shared/peertube-runner-process.tssimilarity index 72%rename from server/tests/shared/peertube-runner-process.tsrename to packages/tests/src/shared/peertube-runner-process.tsindex 9304ebcc84..3d1f299f2f 100644--- a/server/tests/shared/peertube-runner-process.ts+++ b/packages/tests/src/shared/peertube-runner-process.ts@@ -1,8 +1,8 @@-import { ChildProcess, fork } from 'child_process'+import { ChildProcess, fork, ForkOptions } from 'child_process'import execa from 'execa'import { join } from 'path'-import { root } from '@shared/core-utils'-import { PeerTubeServer } from '@shared/server-commands'+import { root } from '@peertube/peertube-node-utils'+import { PeerTubeServer } from '@peertube/peertube-server-commands'export class PeerTubeRunnerProcess {private app?: ChildProcess@@ -19,10 +19,12 @@ export class PeerTubeRunnerProcess {return new Promise<void>((res, rej) => {const args = [ 'server', '--verbose', ...this.buildIdArg() ]- const forkOptions = {+ const forkOptions: ForkOptions = {detached: false,- silent: true+ silent: true,+ execArgv: [] // Don't inject parent node options}+this.app = fork(this.getRunnerPath(), args, forkOptions)this.app.stdout.on('data', data => {@@ -57,7 +59,7 @@ export class PeerTubeRunnerProcess {args.push(runnerDescription)}- return execa.node(this.getRunnerPath(), args)+ return this.runCommand(this.getRunnerPath(), args)}unregisterPeerTubeInstance (options: {@@ -66,12 +68,12 @@ export class PeerTubeRunnerProcess {const { runnerName } = optionsconst args = [ 'unregister', '--url', this.server.url, '--runner-name', runnerName, ...this.buildIdArg() ]- return execa.node(this.getRunnerPath(), args)+ return this.runCommand(this.getRunnerPath(), args)}async listRegisteredPeerTubeInstances () {const args = [ 'list-registered', ...this.buildIdArg() ]- const { stdout } = await execa.node(this.getRunnerPath(), args)+ const { stdout } = await this.runCommand(this.getRunnerPath(), args)return stdout}@@ -89,10 +91,14 @@ export class PeerTubeRunnerProcess {}private getRunnerPath () {- return join(root(), 'packages', 'peertube-runner', 'dist', 'peertube-runner.js')+ return join(root(), 'apps', 'peertube-runner', 'dist', 'peertube-runner.js')}private buildIdArg () {return [ '--id', this.getId() ]}++ private runCommand (path: string, args: string[]) {+ return execa.node(path, args, { env: { ...process.env, NODE_OPTIONS: '' } })+ }}diff --git a/server/tests/shared/plugins.ts b/packages/tests/src/shared/plugins.tssimilarity index 89%rename from server/tests/shared/plugins.tsrename to packages/tests/src/shared/plugins.tsindex 036fce2ff9..c2afcbcbf8 100644--- a/server/tests/shared/plugins.ts+++ b/packages/tests/src/shared/plugins.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { expect } from 'chai'-import { PeerTubeServer } from '@shared/server-commands'+import { PeerTubeServer } from '@peertube/peertube-server-commands'async function testHelloWorldRegisteredSettings (server: PeerTubeServer) {const body = await server.plugins.getRegisteredSettings({ npmName: 'peertube-plugin-hello-world' })diff --git a/server/tests/shared/requests.ts b/packages/tests/src/shared/requests.tssimilarity index 74%rename from server/tests/shared/requests.tsrename to packages/tests/src/shared/requests.tsindex 0cfeab7b2f..fc70ad6ed9 100644--- a/server/tests/shared/requests.ts+++ b/packages/tests/src/shared/requests.ts@@ -1,4 +1,4 @@-import { doRequest } from '@server/helpers/requests'+import { doRequest } from '@peertube/peertube-server/server/helpers/requests.js'export function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {const options = {diff --git a/server/tests/shared/sql-command.ts b/packages/tests/src/shared/sql-command.tssimilarity index 97%rename from server/tests/shared/sql-command.tsrename to packages/tests/src/shared/sql-command.tsindex 5c53a8ac65..1c4f893511 100644--- a/server/tests/shared/sql-command.ts+++ b/packages/tests/src/shared/sql-command.ts@@ -1,6 +1,6 @@import { QueryTypes, Sequelize } from 'sequelize'-import { forceNumber } from '@shared/core-utils'-import { PeerTubeServer } from '@shared/server-commands'+import { forceNumber } from '@peertube/peertube-core-utils'+import { PeerTubeServer } from '@peertube/peertube-server-commands'export class SQLCommand {private sequelize: Sequelizediff --git a/server/tests/shared/streaming-playlists.ts b/packages/tests/src/shared/streaming-playlists.tssimilarity index 95%rename from server/tests/shared/streaming-playlists.tsrename to packages/tests/src/shared/streaming-playlists.tsindex e4f88bc252..f2f0fbe85f 100644--- a/server/tests/shared/streaming-playlists.ts+++ b/packages/tests/src/shared/streaming-playlists.ts@@ -2,13 +2,19 @@import { expect } from 'chai'import { basename, dirname, join } from 'path'-import { removeFragmentedMP4Ext, uuidRegex } from '@shared/core-utils'-import { sha256 } from '@shared/extra-utils'-import { HttpStatusCode, VideoPrivacy, VideoResolution, VideoStreamingPlaylist, VideoStreamingPlaylistType } from '@shared/models'-import { makeRawRequest, PeerTubeServer } from '@shared/server-commands'-import { expectStartWith } from './checks'-import { hlsInfohashExist } from './tracker'-import { checkWebTorrentWorks } from './webtorrent'+import { removeFragmentedMP4Ext, uuidRegex } from '@peertube/peertube-core-utils'+import {+ HttpStatusCode,+ VideoPrivacy,+ VideoResolution,+ VideoStreamingPlaylist,+ VideoStreamingPlaylistType+} from '@peertube/peertube-models'+import { sha256 } from '@peertube/peertube-node-utils'+import { makeRawRequest, PeerTubeServer } from '@peertube/peertube-server-commands'+import { expectStartWith } from './checks.js'+import { hlsInfohashExist } from './tracker.js'+import { checkWebTorrentWorks } from './webtorrent.js'async function checkSegmentHash (options: {server: PeerTubeServerdiff --git a/server/tests/shared/tests.ts b/packages/tests/src/shared/tests.tssimilarity index 100%rename from server/tests/shared/tests.tsrename to packages/tests/src/shared/tests.tsdiff --git a/server/tests/shared/tracker.ts b/packages/tests/src/shared/tracker.tssimilarity index 85%rename from server/tests/shared/tracker.tsrename to packages/tests/src/shared/tracker.tsindex 9c1f0246a3..6ab4304562 100644--- a/server/tests/shared/tracker.ts+++ b/packages/tests/src/shared/tracker.ts@@ -1,6 +1,6 @@import { expect } from 'chai'-import { sha1 } from '@shared/extra-utils'-import { makeGetRequest } from '@shared/server-commands'+import { sha1 } from '@peertube/peertube-node-utils'+import { makeGetRequest } from '@peertube/peertube-server-commands'async function hlsInfohashExist (serverUrl: string, masterPlaylistUrl: string, fileNumber: number) {const path = '/tracker/announce'diff --git a/server/tests/shared/video-playlists.ts b/packages/tests/src/shared/video-playlists.tssimilarity index 80%rename from server/tests/shared/video-playlists.tsrename to packages/tests/src/shared/video-playlists.tsindex 8db303fd86..81dc43ed6b 100644--- a/server/tests/shared/video-playlists.ts+++ b/packages/tests/src/shared/video-playlists.ts@@ -1,6 +1,6 @@import { expect } from 'chai'-import { readdir } from 'fs-extra'-import { PeerTubeServer } from '@shared/server-commands'+import { readdir } from 'fs/promises'+import { PeerTubeServer } from '@peertube/peertube-server-commands'async function checkPlaylistFilesWereRemoved (playlistUUID: string,diff --git a/server/tests/shared/videos.ts b/packages/tests/src/shared/videos.tssimilarity index 93%rename from server/tests/shared/videos.tsrename to packages/tests/src/shared/videos.tsindex ac24bb173f..9bdcbf0584 100644--- a/server/tests/shared/videos.ts+++ b/packages/tests/src/shared/videos.ts@@ -1,16 +1,22 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */import { expect } from 'chai'-import { pathExists, readdir } from 'fs-extra'+import { pathExists } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { basename, join } from 'path'-import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '@server/initializers/constants'-import { getLowercaseExtension, pick, uuidRegex } from '@shared/core-utils'-import { HttpStatusCode, VideoCaption, VideoDetails, VideoPrivacy, VideoResolution } from '@shared/models'-import { makeRawRequest, PeerTubeServer, VideoEdit, waitJobs } from '@shared/server-commands'-import { dateIsValid, expectStartWith, testImageGeneratedByFFmpeg } from './checks'-import { checkWebTorrentWorks } from './webtorrent'--loadLanguages()+import { pick, uuidRegex } from '@peertube/peertube-core-utils'+import { HttpStatusCode, HttpStatusCodeType, VideoCaption, VideoDetails, VideoPrivacy, VideoResolution } from '@peertube/peertube-models'+import {+ loadLanguages,+ VIDEO_CATEGORIES,+ VIDEO_LANGUAGES,+ VIDEO_LICENCES,+ VIDEO_PRIVACIES+} from '@peertube/peertube-server/server/initializers/constants.js'+import { getLowercaseExtension } from '@peertube/peertube-node-utils'+import { makeRawRequest, PeerTubeServer, VideoEdit, waitJobs } from '@peertube/peertube-server-commands'+import { dateIsValid, expectStartWith, testImageGeneratedByFFmpeg } from './checks.js'+import { checkWebTorrentWorks } from './webtorrent.js'async function completeWebVideoFilesCheck (options: {server: PeerTubeServer@@ -144,6 +150,8 @@ async function completeVideoCheck (options: {}) {const { attributes, originServer, server, videoUUID } = options+ await loadLanguages()+const video = await server.videos.get({ id: videoUUID })if (!attributes.likes) attributes.likes = 0@@ -192,7 +200,7 @@ async function completeVideoCheck (options: {expect(video.channel.name).to.equal(attributes.channel.name)expect(video.channel.host).to.equal(attributes.account.host)expect(video.channel.isLocal).to.equal(attributes.channel.isLocal)- expect(dateIsValid(video.channel.createdAt.toString())).to.be.true+ expect(video.channel.createdAt).to.existexpect(dateIsValid(video.channel.updatedAt.toString())).to.be.trueexpect(video.commentsEnabled).to.equal(attributes.commentsEnabled)expect(video.downloadEnabled).to.equal(attributes.downloadEnabled)@@ -272,8 +280,8 @@ function checkUploadVideoParam (options: {server: PeerTubeServertoken: stringattributes: Partial<VideoEdit>- expectedStatus?: HttpStatusCode- completedExpectedStatus?: HttpStatusCode+ expectedStatus?: HttpStatusCodeType+ completedExpectedStatus?: HttpStatusCodeTypemode?: 'legacy' | 'resumable'}) {const { server, token, attributes, completedExpectedStatus, expectedStatus, mode = 'legacy' } = optionsdiff --git a/server/tests/shared/views.ts b/packages/tests/src/shared/views.tssimilarity index 90%rename from server/tests/shared/views.tsrename to packages/tests/src/shared/views.tsindex e6b2897151..b791eff252 100644--- a/server/tests/shared/views.ts+++ b/packages/tests/src/shared/views.ts@@ -1,6 +1,6 @@-import { FfmpegCommand } from 'fluent-ffmpeg'-import { wait } from '@shared/core-utils'-import { VideoCreateResult, VideoPrivacy } from '@shared/models'+import type { FfmpegCommand } from 'fluent-ffmpeg'+import { wait } from '@peertube/peertube-core-utils'+import { VideoCreateResult, VideoPrivacy } from '@peertube/peertube-models'import {createMultipleServers,doubleFollow,@@ -9,7 +9,7 @@ import {setDefaultVideoChannel,waitJobs,waitUntilLivePublishedOnAllServers-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'async function processViewersStats (servers: PeerTubeServer[]) {await wait(6000)diff --git a/server/tests/shared/webtorrent.ts b/packages/tests/src/shared/webtorrent.tssimilarity index 78%rename from server/tests/shared/webtorrent.tsrename to packages/tests/src/shared/webtorrent.tsindex d5bd86500d..1be54426a1 100644--- a/server/tests/shared/webtorrent.ts+++ b/packages/tests/src/shared/webtorrent.ts@@ -1,12 +1,12 @@import { expect } from 'chai'-import { readFile } from 'fs-extra'+import { readFile } from 'fs/promises'import parseTorrent from 'parse-torrent'import { basename, join } from 'path'-import * as WebTorrent from 'webtorrent'-import { VideoFile } from '@shared/models'-import { PeerTubeServer } from '@shared/server-commands'+import type { Instance, Torrent } from 'webtorrent'+import { VideoFile } from '@peertube/peertube-models'+import { PeerTubeServer } from '@peertube/peertube-server-commands'-let webtorrent: WebTorrent.Instance+let webtorrent: Instanceexport async function checkWebTorrentWorks (magnetUri: string, pathMatch?: RegExp) {const torrent = await webtorrentAdd(magnetUri, true)@@ -33,15 +33,15 @@ export async function parseTorrentVideo (server: PeerTubeServer, file: VideoFile// Private// ----------------------------------------------------------------------------function webtorrentAdd (torrentId: string, refreshWebTorrent = false) {- const WebTorrent = require('webtorrent')+async function webtorrentAdd (torrentId: string, refreshWebTorrent = false) {+ const WebTorrent = (await import('webtorrent')).defaultif (webtorrent && refreshWebTorrent) webtorrent.destroy()if (!webtorrent || refreshWebTorrent) webtorrent = new WebTorrent()webtorrent.on('error', err => console.error('Error in webtorrent', err))- return new Promise<WebTorrent.Torrent>(res => {+ return new Promise<Torrent>(res => {const torrent = webtorrent.add(torrentId, res)torrent.on('error', err => console.error('Error in webtorrent torrent', err))diff --git a/packages/tests/tsconfig.json b/packages/tests/tsconfig.jsonnew file mode 100644index 0000000000..91a74b4bec--- /dev/null+++ b/packages/tests/tsconfig.json@@ -0,0 +1,27 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "outDir": "./dist",+ "baseUrl": "./",+ "rootDir": "src",+ "tsBuildInfoFile": "./dist/.tsbuildinfo",+ "paths": {+ "@tests/*": [ "src/*" ]+ }+ },+ "references": [+ { "path": "../core-utils" },+ { "path": "../ffmpeg" },+ { "path": "../models" },+ { "path": "../node-utils" },+ { "path": "../typescript-utils" },+ { "path": "../server-commands" },+ { "path": "../../server/tsconfig.lib.json" }+ ],+ "include": [+ "./src/**/*.ts"+ ],+ "exclude": [+ "./fixtures"+ ]+}diff --git a/packages/types/README.md b/packages/types-generator/README.mdsimilarity index 100%rename from packages/types/README.mdrename to packages/types-generator/README.mddiff --git a/packages/types/generate-package.ts b/packages/types-generator/generate-package.tssimilarity index 84%rename from packages/types/generate-package.tsrename to packages/types-generator/generate-package.tsindex 125259bb40..2b2f516230 100644--- a/packages/types/generate-package.ts+++ b/packages/types-generator/generate-package.ts@@ -1,8 +1,9 @@import { execSync } from 'child_process'import depcheck, { PackageDependencies } from 'depcheck'-import { copyFile, readJson, remove, writeFile, writeJSON } from 'fs-extra'+import { readJson, remove, writeJSON } from 'fs-extra/esm'+import { copyFile, writeFile } from 'fs/promises'import { join, resolve } from 'path'-import { root } from '../../shared/core-utils'+import { currentDir, root } from '@peertube/peertube-node-utils'if (!process.argv[2]) {console.error('Need version as argument')@@ -20,17 +21,25 @@ run()})async function run () {- const typesPath = __dirname+ const typesPath = currentDir(import.meta.url)const typesDistPath = join(typesPath, 'dist')++ await remove(typesDistPath)+const typesDistPackageJsonPath = join(typesDistPath, 'package.json')const typesDistGitIgnorePath = join(typesDistPath, '.gitignore')+const mainPackageJson = await readJson(join(root(), 'package.json'))++ const typesTsConfigPath = join(typesPath, 'tsconfig.types.json')+const distTsConfigPath = join(typesPath, 'tsconfig.dist.json')const distTsConfig = await readJson(distTsConfigPath)+const clientPackageJson = await readJson(join(root(), 'client', 'package.json'))await remove(typesDistPath)- execSync('npm run tsc -- -b --verbose packages/types', { stdio: 'inherit' })+ execSync(`npm run tsc -- -b ${typesTsConfigPath} --verbose`, { stdio: 'inherit' })execSync(`npm run resolve-tspaths -- --project ${distTsConfigPath} --src ${typesDistPath} --out ${typesDistPath}`, { stdio: 'inherit' })const allDependencies = Object.assign(@@ -40,6 +49,8 @@ async function run () {clientPackageJson.devDependencies) as PackageDependencies+ const toIgnore = Object.keys(distTsConfig?.compilerOptions?.paths || [])+// https://github.com/depcheck/depcheck#apiconst depcheckOptions = {parsers: { '**/*.ts': depcheck.parser.typescript },@@ -47,7 +58,7 @@ async function run () {depcheck.detector.requireCallExpression,depcheck.detector.importDeclaration],- ignoreMatches: Object.keys(distTsConfig?.compilerOptions?.paths || []),+ ignoreMatches: toIgnore,package: { dependencies: allDependencies }}@@ -68,7 +79,7 @@ async function run () {console.log(`Removing ${Object.keys(unusedDependencies).length} unused dependencies.`)const dependencies = Object.keys(allDependencies)- .filter(dependencyName => !unusedDependencies.includes(dependencyName))+ .filter(dependencyName => !unusedDependencies.includes(dependencyName) && !toIgnore.includes(dependencyName)).reduce((dependencies, dependencyName) => {dependencies[dependencyName] = allDependencies[dependencyName]return dependenciesdiff --git a/packages/types-generator/package.json b/packages/types-generator/package.jsonnew file mode 100644index 0000000000..a722358514--- /dev/null+++ b/packages/types-generator/package.json@@ -0,0 +1,9 @@+{+ "name": "@peertube/peertube-types-generator",+ "private": true,+ "version": "0.0.0",+ "type": "module",+ "dependencies": {+ "@peertube/peertube-core-utils": "*"+ }+}diff --git a/packages/types-generator/src/client/index.ts b/packages/types-generator/src/client/index.tsnew file mode 100644index 0000000000..8868dd5b00--- /dev/null+++ b/packages/types-generator/src/client/index.ts@@ -0,0 +1 @@+export * from '@client/types/index.js'diff --git a/packages/types/src/client/tsconfig.json b/packages/types-generator/src/client/tsconfig.types.jsonsimilarity index 74%rename from packages/types/src/client/tsconfig.jsonrename to packages/types-generator/src/client/tsconfig.types.jsonindex bb76fbe213..f60b43f07a 100644--- a/packages/types/src/client/tsconfig.json+++ b/packages/types-generator/src/client/tsconfig.types.json@@ -6,10 +6,14 @@"emitDeclarationOnly": true,"outDir": "../../dist/client/","rootDir": "./",- "tsBuildInfoFile": "../../dist/tsconfig.client.types.tsbuildinfo"+ "baseUrl": "./",+ "tsBuildInfoFile": "../../dist/tsconfig.client.types.tsbuildinfo",+ "paths": {+ "@client/*": [ "../../../../client/src/*" ]+ }},"references": [{ "path": "../../../../client/tsconfig.types.json" }],- "files": ["index.ts"]+ "files": [ "./index.ts" ]}diff --git a/packages/types-generator/src/index.ts b/packages/types-generator/src/index.tsnew file mode 100644index 0000000000..b5669ea243--- /dev/null+++ b/packages/types-generator/src/index.ts@@ -0,0 +1,3 @@+export * from '@server/types/index.js'+export * from '@server/types/models/index.js'+export * from '@peertube/peertube-models'diff --git a/packages/types/tests/test.ts b/packages/types-generator/tests/test.tssimilarity index 86%rename from packages/types/tests/test.tsrename to packages/types-generator/tests/test.tsindex 8c53320a1d..bfdcdeed5b 100644--- a/packages/types/tests/test.ts+++ b/packages/types-generator/tests/test.ts@@ -1,5 +1,5 @@-import { RegisterServerOptions, Video } from '../dist'-import { RegisterClientOptions } from '../dist/client'+import { RegisterServerOptions, Video } from '../dist/index.js'+import { RegisterClientOptions } from '../dist/client/index.js'function register1 ({ registerHook }: RegisterServerOptions) {registerHook({diff --git a/packages/types-generator/tsconfig.dist.json b/packages/types-generator/tsconfig.dist.jsonnew file mode 100644index 0000000000..6c24a67bae--- /dev/null+++ b/packages/types-generator/tsconfig.dist.json@@ -0,0 +1,17 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "typeRoots": [+ "node_modules/@types",+ "client/node_modules/@types"+ ],+ "baseUrl": "./dist",+ "paths": {+ "@server/*": [ "server/server/*" ],+ "@client/*": [ "client/*" ],+ "@peertube/peertube-models": [ "peertube-models" ],+ "@peertube/peertube-typescript-utils": [ "peertube-typescript-utils" ]+ }+ }+}+diff --git a/packages/types-generator/tsconfig.json b/packages/types-generator/tsconfig.jsonnew file mode 100644index 0000000000..fe09d93957--- /dev/null+++ b/packages/types-generator/tsconfig.json@@ -0,0 +1,11 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "rootDir": ".",+ "noEmit": true+ },+ "files": [ "./generate-package.ts" ],+ "references": [+ { "path": "../node-utils" }+ ]+}diff --git a/packages/types/tsconfig.json b/packages/types-generator/tsconfig.types.jsonsimilarity index 57%rename from packages/types/tsconfig.jsonrename to packages/types-generator/tsconfig.types.jsonindex f8e16f6b4f..a3a1b7c0d4 100644--- a/packages/types/tsconfig.json+++ b/packages/types-generator/tsconfig.types.json@@ -4,20 +4,20 @@"stripInternal": true,"removeComments": false,"emitDeclarationOnly": true,+ "sourceMap": false,"outDir": "./dist/",- "baseUrl": "./src/",- "rootDir": "./src/",+ "baseUrl": "./",+ "rootDir": "./src","tsBuildInfoFile": "./dist/tsconfig.server.types.tsbuildinfo","paths": {- "@server/*": [ "../../../server/*" ],- "@shared/*": [ "../../../shared/*" ],- "@client/*": [ "../../../client/src/*" ]+ "@server/*": [ "../../server/server/*" ]}},"references": [- { "path": "../../shared/tsconfig.types.json" },+ { "path": "../models/tsconfig.types.json" },+ { "path": "../typescript-utils/tsconfig.types.json" },{ "path": "../../server/tsconfig.types.json" },- { "path": "./src/client/tsconfig.json" }+ { "path": "./src/client/tsconfig.types.json" }],"files": ["./src/index.ts"]}diff --git a/packages/types/src/client/index.ts b/packages/types/src/client/index.tsdeleted file mode 100644index 5ee10ecb81..0000000000--- a/packages/types/src/client/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from '@client/types'diff --git a/packages/types/src/index.ts b/packages/types/src/index.tsdeleted file mode 100644index a8adca2878..0000000000--- a/packages/types/src/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from '@server/types'-export * from '@server/types/models'-export * from '@shared/models'diff --git a/packages/types/tsconfig.dist.json b/packages/types/tsconfig.dist.jsondeleted file mode 100644index fbc92712b9..0000000000--- a/packages/types/tsconfig.dist.json+++ /dev/null@@ -1,16 +0,0 @@-{- "extends": "./tsconfig.json",- "compilerOptions": {- "typeRoots": [- "node_modules/@types",- "client/node_modules/@types"- ],- "baseUrl": "./dist",- "paths": {- "@server/*": [ "server/*" ],- "@shared/*": [ "shared/*" ],- "@client/*": [ "client/*" ]- }- }-}-diff --git a/packages/typescript-utils/package.json b/packages/typescript-utils/package.jsonnew file mode 100644index 0000000000..9608bb018a--- /dev/null+++ b/packages/typescript-utils/package.json@@ -0,0 +1,19 @@+{+ "name": "@peertube/peertube-typescript-utils",+ "private": true,+ "version": "0.0.0",+ "main": "dist/index.js",+ "files": [ "dist" ],+ "exports": {+ "types": "./dist/index.d.ts",+ "peertube:tsx": "./src/index.ts",+ "default": "./dist/index.js"+ },+ "type": "module",+ "devDependencies": {},+ "scripts": {+ "build": "tsc",+ "watch": "tsc -w"+ },+ "dependencies": {}+}diff --git a/packages/typescript-utils/src/index.ts b/packages/typescript-utils/src/index.tsnew file mode 100644index 0000000000..fdc633235f--- /dev/null+++ b/packages/typescript-utils/src/index.ts@@ -0,0 +1 @@+export * from './types.js'diff --git a/shared/typescript-utils/types.ts b/packages/typescript-utils/src/types.tssimilarity index 100%rename from shared/typescript-utils/types.tsrename to packages/typescript-utils/src/types.tsdiff --git a/packages/typescript-utils/tsconfig.json b/packages/typescript-utils/tsconfig.jsonnew file mode 100644index 0000000000..58fa2330ba--- /dev/null+++ b/packages/typescript-utils/tsconfig.json@@ -0,0 +1,8 @@+{+ "extends": "../../tsconfig.base.json",+ "compilerOptions": {+ "outDir": "./dist",+ "rootDir": "src",+ "tsBuildInfoFile": "./dist/.tsbuildinfo"+ }+}diff --git a/packages/typescript-utils/tsconfig.types.json b/packages/typescript-utils/tsconfig.types.jsonnew file mode 100644index 0000000000..e666b4ca26--- /dev/null+++ b/packages/typescript-utils/tsconfig.types.json@@ -0,0 +1,10 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "outDir": "../types-generator/dist/peertube-typescript-utils",+ "tsBuildInfoFile": "../types-generator/dist/peertube-typescript-utils/.tsbuildinfo",+ "stripInternal": true,+ "removeComments": false,+ "emitDeclarationOnly": true+ }+}diff --git a/scripts/benchmark.ts b/scripts/benchmark.tsindex 92fbd54905..c4e4c72753 100644--- a/scripts/benchmark.ts+++ b/scripts/benchmark.ts@@ -1,8 +1,14 @@import autocannon, { printResult } from 'autocannon'import { program } from 'commander'-import { writeJson } from 'fs-extra'-import { Video, VideoPrivacy } from '@shared/models'-import { createMultipleServers, doubleFollow, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'+import { writeJson } from 'fs-extra/esm'+import { Video, VideoPrivacy } from '@peertube/peertube-models'+import {+ createMultipleServers,+ doubleFollow,+ killallServers,+ PeerTubeServer,+ setAccessTokensToServers+} from '@peertube/peertube-server-commands'let servers: PeerTubeServer[]// First serverdiff --git a/scripts/build/peertube-cli.sh b/scripts/build/peertube-cli.shnew file mode 100644index 0000000000..51886a0db1--- /dev/null+++ b/scripts/build/peertube-cli.sh@@ -0,0 +1,12 @@+#!/bin/bash++set -eu++cd ./apps/peertube-cli+rm -rf ./dist++../../node_modules/.bin/tsc -b --verbose+rm -rf ./dist+mkdir ./dist++node ./scripts/build.jsdiff --git a/scripts/build/peertube-runner.sh b/scripts/build/peertube-runner.shindex 7f6ad5eded..321d10b4b8 100755--- a/scripts/build/peertube-runner.sh+++ b/scripts/build/peertube-runner.sh@@ -2,12 +2,11 @@set -eu--cd ./packages/peertube-runner+cd ./apps/peertube-runnerrm -rf ./dist../../node_modules/.bin/tsc -b --verboserm -rf ./distmkdir ./dist-./node_modules/.bin/esbuild ./peertube-runner.ts --bundle --platform=node --target=node16 --external:"./lib-cov/fluent-ffmpeg" --external:pg-hstore --outfile=dist/peertube-runner.js+node ./scripts/build.jsdiff --git a/scripts/build/server.sh b/scripts/build/server.shindex a2dfc3dd9c..bbab633a2c 100755--- a/scripts/build/server.sh+++ b/scripts/build/server.sh@@ -2,10 +2,11 @@set -eu-rm -rf ./dist+rm -rf ./dist ./packages/*/dist-npm run tsc -- -b --verbose+npm run tsc -- -b --verbose server/tsconfig.jsonnpm run resolve-tspaths:server-cp -r "./server/static" "./server/assets" "./dist/server"-cp -r "./server/lib/emails" "./dist/server/lib"+cp -r "./server/server/static" "./server/server/assets" ./dist/server+cp -r "./server/server/lib/emails" "./dist/server/lib"+cp "./server/scripts/upgrade.sh" "./dist/scripts"diff --git a/scripts/build/tests.sh b/scripts/build/tests.shnew file mode 100755index 0000000000..f94dde2a4d--- /dev/null+++ b/scripts/build/tests.sh@@ -0,0 +1,9 @@+#!/bin/bash++set -eu++rm -rf ./packages/tests/dist++npm run tsc -- -b --verbose ./packages/tests/tsconfig.json+npm run resolve-tspaths:server-lib+npm run resolve-tspaths:testsdiff --git a/scripts/ci.sh b/scripts/ci.shindex 9fb67f6341..64968cf943 100755--- a/scripts/ci.sh+++ b/scripts/ci.sh@@ -10,7 +10,7 @@ firetries=3speedFactor="${2:-1}"-runTest () {+runJSTest () {jobname=$1shift@@ -24,7 +24,7 @@ runTest () {joblog="$jobname-ci.log"parallel -j $jobs --retries $retries \- "echo Trying {} >> $joblog; npm run mocha -- -c --timeout 30000 --exit --bail {}" \+ "echo Trying {} >> $joblog; npm run mocha -- --timeout 30000 --no-config -c --exit --bail {}" \::: $filescat "$joblog" | sort | uniq -c@@ -32,92 +32,116 @@ runTest () {}findTestFiles () {- exception="-not -name index.js"+ exception="-not -name index.js -not -name index.ts -not -name *.d.ts"if [ ! -z ${2+x} ]; thenexception="$exception -not -name $2"fi- find $1 -type f -name "*.js" $exception | xargs echo+ find $1 -type f \( -name "*.js" -o -name "*.ts" \) $exception | xargs echo}if [ "$1" = "types-package" ]; thennpm run generate-types-package 0.0.0- npm run tsc -- --noEmit --esModuleInterop packages/types/tests/test.ts++ # Test on in independent directory+ rm -fr /tmp/types-generator+ mkdir -p /tmp/types-generator+ cp -r packages/types-generator/tests /tmp/types-generator/tests+ cp -r packages/types-generator/dist /tmp/types-generator/dist+ (cd /tmp/types-generator/dist && npm install)++ npm run tsc -- --noEmit --esModuleInterop --moduleResolution node16 /tmp/types-generator/tests/test.ts+ rm -r /tmp/types-generatorelif [ "$1" = "client" ]; thennpm run build+ npm run build:tests- feedsFiles=$(findTestFiles ./dist/server/tests/feeds)- helperFiles=$(findTestFiles ./dist/server/tests/helpers)- libFiles=$(findTestFiles ./dist/server/tests/lib)- miscFiles="./dist/server/tests/client.js ./dist/server/tests/misc-endpoints.js"+ feedsFiles=$(findTestFiles ./packages/tests/dist/feeds)+ miscFiles="./packages/tests/dist/client.js ./packages/tests/dist/misc-endpoints.js"# Not in their own task, they need an index.html- pluginFiles="./dist/server/tests/plugins/html-injection.js ./dist/server/tests/api/server/plugins.js"+ pluginFiles="./packages/tests/dist/plugins/html-injection.js ./packages/tests/dist/api/server/plugins.js"++ MOCHA_PARALLEL=true runJSTest "$1" $((2*$speedFactor)) $feedsFiles $miscFiles $pluginFiles- MOCHA_PARALLEL=true runTest "$1" $((2*$speedFactor)) $feedsFiles $helperFiles $miscFiles $pluginFiles $libFiles+ # Use TS tests directly because we import server files+ helperFiles=$(findTestFiles ./packages/tests/src/server-helpers)+ libFiles=$(findTestFiles ./packages/tests/src/server-lib)++ npm run mocha -- --timeout 30000 -c --exit --bail $libFiles $helperFileselif [ "$1" = "cli-plugin" ]; then# Simulate HTMLmkdir -p "./client/dist/en-US/"cp "./client/src/index.html" "./client/dist/en-US/index.html"npm run build:server- npm run setup:cli+ npm run build:tests+ npm run build:peertube-cli- pluginsFiles=$(findTestFiles ./dist/server/tests/plugins html-injection.js)- cliFiles=$(findTestFiles ./dist/server/tests/cli)+ # html-injection test needs an HTML file+ pluginsFiles=$(findTestFiles ./packages/tests/dist/plugins html-injection.js)+ cliFiles=$(findTestFiles ./packages/tests/dist/cli)- MOCHA_PARALLEL=true runTest "$1" $((2*$speedFactor)) $pluginsFiles- runTest "$1" 1 $cliFiles+ MOCHA_PARALLEL=true runJSTest "$1" $((2*$speedFactor)) $pluginsFiles+ runJSTest "$1" 1 $cliFileselif [ "$1" = "api-1" ]; thennpm run build:server+ npm run build:tests- checkParamFiles=$(findTestFiles ./dist/server/tests/api/check-params)- notificationsFiles=$(findTestFiles ./dist/server/tests/api/notifications)- searchFiles=$(findTestFiles ./dist/server/tests/api/search)+ checkParamFiles=$(findTestFiles ./packages/tests/dist/api/check-params)+ notificationsFiles=$(findTestFiles ./packages/tests/dist/api/notifications)+ searchFiles=$(findTestFiles ./packages/tests/dist/api/search)- MOCHA_PARALLEL=true runTest "$1" $((3*$speedFactor)) $notificationsFiles $searchFiles $checkParamFiles+ MOCHA_PARALLEL=true runJSTest "$1" $((3*$speedFactor)) $notificationsFiles $searchFiles $checkParamFileselif [ "$1" = "api-2" ]; thennpm run build:server+ npm run build:tests- liveFiles=$(findTestFiles ./dist/server/tests/api/live)- serverFiles=$(findTestFiles ./dist/server/tests/api/server plugins.js)- usersFiles=$(findTestFiles ./dist/server/tests/api/users)+ liveFiles=$(findTestFiles ./packages/tests/dist/api/live)+ # plugins test needs an HTML file+ serverFiles=$(findTestFiles ./packages/tests/dist/api/server plugins.js)+ usersFiles=$(findTestFiles ./packages/tests/dist/api/users)- MOCHA_PARALLEL=true runTest "$1" $((3*$speedFactor)) $liveFiles $serverFiles $usersFiles+ MOCHA_PARALLEL=true runJSTest "$1" $((3*$speedFactor)) $liveFiles $serverFiles $usersFileselif [ "$1" = "api-3" ]; thennpm run build:server+ npm run build:tests- videosFiles=$(findTestFiles ./dist/server/tests/api/videos)- viewsFiles=$(findTestFiles ./dist/server/tests/api/views)+ videosFiles=$(findTestFiles ./packages/tests/dist/api/videos)+ viewsFiles=$(findTestFiles ./packages/tests/dist/api/views)- MOCHA_PARALLEL=true runTest "$1" $((3*$speedFactor)) $viewsFiles $videosFiles+ MOCHA_PARALLEL=true runJSTest "$1" $((3*$speedFactor)) $viewsFiles $videosFileselif [ "$1" = "api-4" ]; thennpm run build:server+ npm run build:tests- moderationFiles=$(findTestFiles ./dist/server/tests/api/moderation)- redundancyFiles=$(findTestFiles ./dist/server/tests/api/redundancy)- objectStorageFiles=$(findTestFiles ./dist/server/tests/api/object-storage)- activitypubFiles=$(findTestFiles ./dist/server/tests/api/activitypub)+ moderationFiles=$(findTestFiles ./packages/tests/dist/api/moderation)+ redundancyFiles=$(findTestFiles ./packages/tests/dist/api/redundancy)+ objectStorageFiles=$(findTestFiles ./packages/tests/dist/api/object-storage)+ activitypubFiles=$(findTestFiles ./packages/tests/dist/api/activitypub)- MOCHA_PARALLEL=true runTest "$1" $((2*$speedFactor)) $moderationFiles $redundancyFiles $activitypubFiles $objectStorageFiles+ MOCHA_PARALLEL=true runJSTest "$1" $((2*$speedFactor)) $moderationFiles $redundancyFiles $activitypubFiles $objectStorageFileselif [ "$1" = "api-5" ]; thennpm run build:server+ npm run build:tests- transcodingFiles=$(findTestFiles ./dist/server/tests/api/transcoding)- runnersFiles=$(findTestFiles ./dist/server/tests/api/runners)+ transcodingFiles=$(findTestFiles ./packages/tests/dist/api/transcoding)+ runnersFiles=$(findTestFiles ./packages/tests/dist/api/runners)- MOCHA_PARALLEL=true runTest "$1" $((2*$speedFactor)) $transcodingFiles $runnersFiles+ MOCHA_PARALLEL=true runJSTest "$1" $((2*$speedFactor)) $transcodingFiles $runnersFileselif [ "$1" = "external-plugins" ]; thennpm run build:server+ npm run build:testsnpm run build:peertube-runner- externalPluginsFiles=$(findTestFiles ./dist/server/tests/external-plugins)- peertubeRunnerFiles=$(findTestFiles ./dist/server/tests/peertube-runner)+ externalPluginsFiles=$(findTestFiles ./packages/tests/dist/external-plugins)+ peertubeRunnerFiles=$(findTestFiles ./packages/tests/dist/peertube-runner)- runTest "$1" 1 $externalPluginsFiles- MOCHA_PARALLEL=true runTest "$1" $((2*$speedFactor)) $peertubeRunnerFiles+ runJSTest "$1" 1 $externalPluginsFiles+ MOCHA_PARALLEL=true runJSTest "$1" $((2*$speedFactor)) $peertubeRunnerFileselif [ "$1" = "lint" ]; then- npm run eslint -- --ext .ts "./server/**/*.ts" "shared/**/*.ts" "scripts/**/*.ts"+ npm run eslint -- --ext .ts "server/**/*.ts" "scripts/**/*.ts" "packages/**/*.ts" "apps/**/*.ts"+npm run swagger-cli -- validate support/doc/api/openapi.yaml( cd clientdiff --git a/scripts/client-build-stats.ts b/scripts/client-build-stats.tsindex d5ecd5fea3..3b26aa6474 100644--- a/scripts/client-build-stats.ts+++ b/scripts/client-build-stats.ts@@ -1,6 +1,6 @@-import { readdir, stat } from 'fs-extra'+import { readdir, stat } from 'fs/promises'import { join } from 'path'-import { root } from '@shared/core-utils'+import { root } from '@peertube/peertube-node-utils'async function run () {const result = {diff --git a/scripts/dev/cli.sh b/scripts/dev/cli.shdeleted file mode 100755index 39ecaad944..0000000000--- a/scripts/dev/cli.sh+++ /dev/null@@ -1,16 +0,0 @@-#!/bin/bash--set -eu--rm -rf ./dist/server/tools/--(- cd ./server/tools- yarn install --pure-lockfile-)--mkdir -p "./dist/server/tools"-cp -r "./server/tools/node_modules" "./dist/server/tools"--cd ./server/tools-../../node_modules/.bin/tsc-watch --build --verbose --onSuccess 'sh -c "cd ../../ && npm run resolve-tspaths:server"'diff --git a/scripts/dev/peertube-cli.sh b/scripts/dev/peertube-cli.shnew file mode 100755index 0000000000..172bf038ed--- /dev/null+++ b/scripts/dev/peertube-cli.sh@@ -0,0 +1,11 @@+#!/bin/bash++set -eu++rm -rf ./apps/peertube-cli/dist++cd ./apps/peertube-cli++../../node_modules/.bin/concurrently -k \+ "../../node_modules/.bin/tsc -w --noEmit" \+ "node ./scripts/watch.js"diff --git a/scripts/dev/peertube-runner.sh b/scripts/dev/peertube-runner.shindex e392593721..7bd756123b 100755--- a/scripts/dev/peertube-runner.sh+++ b/scripts/dev/peertube-runner.sh@@ -2,10 +2,10 @@set -eu-rm -rf ./packages/peertube-runner/dist+rm -rf ./apps/peertube-runner/dist-cd ./packages/peertube-runner+cd ./apps/peertube-runner../../node_modules/.bin/concurrently -k \"../../node_modules/.bin/tsc -w --noEmit" \- "./node_modules/.bin/esbuild ./peertube-runner.ts --bundle --sourcemap --platform=node --external:"./lib-cov/fluent-ffmpeg" --external:pg-hstore --watch --outfile=dist/peertube-runner.js"+ "node ./scripts/watch.js"diff --git a/scripts/dev/server.sh b/scripts/dev/server.shindex c52c5124c4..4112cb2f81 100755--- a/scripts/dev/server.sh+++ b/scripts/dev/server.sh@@ -16,10 +16,10 @@ cp -r "./client/src/locale" "./client/dist/locale"mkdir -p "./dist/server/lib"-npm run tsc -- -b -v --incremental+npm run tsc -- -b -v --incremental server/tsconfig.jsonnpm run resolve-tspaths:server-cp -r ./server/static ./server/assets ./dist/server-cp -r "./server/lib/emails" "./dist/server/lib"+cp -r ./server/server/static ./server/server/assets ./dist/server+cp -r "./server/server/lib/emails" "./dist/server/lib"-./node_modules/.bin/tsc-watch --build --preserveWatchOutput --verbose --onSuccess 'sh -c "npm run resolve-tspaths:server && NODE_ENV=dev node dist/server"'+./node_modules/.bin/tsc-watch --build --preserveWatchOutput --verbose --onSuccess 'sh -c "npm run resolve-tspaths:server && NODE_ENV=dev node dist/server"' server/tsconfig.jsondiff --git a/scripts/generate-code-contributors.ts b/scripts/generate-code-contributors.tsindex 2fd0ecdf32..408bbec5d7 100755--- a/scripts/generate-code-contributors.ts+++ b/scripts/generate-code-contributors.ts@@ -1,4 +1,4 @@-import { CLICommand } from '@shared/server-commands'+import { CLICommand } from '@peertube/peertube-server-commands'run().then(() => process.exit(0))diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.tsindex 696a097b10..887ab86af0 100755--- a/scripts/i18n/create-custom-files.ts+++ b/scripts/i18n/create-custom-files.ts@@ -1,6 +1,7 @@-import { writeJSON } from 'fs-extra'+import { readJsonSync, writeJSON } from 'fs-extra/esm'import { join } from 'path'-import { root, USER_ROLE_LABELS } from '@shared/core-utils'+import { I18N_LOCALES, USER_ROLE_LABELS } from '@peertube/peertube-core-utils'+import { root } from '@peertube/peertube-node-utils'import {ABUSE_STATES,buildLanguages,@@ -14,10 +15,9 @@ import {VIDEO_PLAYLIST_TYPES,VIDEO_PRIVACIES,VIDEO_STATES-} from '../../server/initializers/constants'-import { I18N_LOCALES } from '../../shared/core-utils/i18n'+} from '../../server/initializers/constants.js'-const videojs = require(join(root(), 'client', 'src', 'locale', 'videojs.en-US.json'))+const videojs = readJsonSync(join(root(), 'client', 'src', 'locale', 'videojs.en-US.json'))const playerKeys = {'Quality': 'Quality','Auto': 'Auto',@@ -131,13 +131,13 @@ async function writeAll () {for (const key of Object.keys(I18N_LOCALES)) {const playerJsonPath = join(localePath, `player.${key}.json`)- const translatedPlayer = require(playerJsonPath)+ const translatedPlayer = readJsonSync(playerJsonPath)const newTranslatedPlayer = Object.assign({}, playerKeys, translatedPlayer)await writeJSON(playerJsonPath, newTranslatedPlayer, { spaces: 4 })const serverJsonPath = join(localePath, `server.${key}.json`)- const translatedServer = require(serverJsonPath)+ const translatedServer = readJsonSync(serverJsonPath)const newTranslatedServer = Object.assign({}, serverKeys, translatedServer)await writeJSON(serverJsonPath, newTranslatedServer, { spaces: 4 })diff --git a/scripts/nightly.sh b/scripts/nightly.shindex 572277f9d9..e911c549de 100755--- a/scripts/nightly.sh+++ b/scripts/nightly.sh@@ -20,6 +20,13 @@ tar_name="peertube-nightly-$today.tar.xz"npm run build -- --source-map+# Clean up declaration files+find dist/ packages/core-utils/dist/ \+ packages/ffmpeg/dist/ \+ packages/node-utils/dist/ \+ packages/models/dist/ \+ \( -name '*.d.ts' -o -name '*.d.ts.map' \) -type f -delete+nightly_version="nightly-$today"sed -i 's/"version": "\([^"]\+\)"/"version": "\1-'"$nightly_version"'"/' ./package.json@@ -28,6 +35,10 @@ sed -i 's/"version": "\([^"]\+\)"/"version": "\1-'"$nightly_version"'"/' ./packa# local variablesdirectories_to_archive=("$directory_name/CREDITS.md" "$directory_name/FAQ.md" \"$directory_name/LICENSE" "$directory_name/README.md" \+ "$directory_name/packages/core-utils/dist/" "$directory_name/packages/core-utils/package.json" \+ "$directory_name/packages/ffmpeg/dist/" "$directory_name/packages/ffmpeg/package.json" \+ "$directory_name/packages/node-utils/dist/" "$directory_name/packages/node-utils/package.json" \+ "$directory_name/packages/models/dist/" "$directory_name/packages/models/package.json" \"$directory_name/client/dist/" "$directory_name/client/yarn.lock" \"$directory_name/client/package.json" "$directory_name/config" \"$directory_name/dist" "$directory_name/package.json" \diff --git a/scripts/release.sh b/scripts/release.shindex 2b922a749b..0df9efa1dd 100755--- a/scripts/release.sh+++ b/scripts/release.sh@@ -69,11 +69,22 @@ npm run build -- --source-maprm -f "./client/dist/en-US/stats.json"rm -f "./client/dist/embed-stats.json"+# Clean up declaration files+find dist/ packages/core-utils/dist/ \+ packages/ffmpeg/dist/ \+ packages/node-utils/dist/ \+ packages/models/dist/ \+ \( -name '*.d.ts' -o -name '*.d.ts.map' \) -type f -delete+# Creating the archives(# local variablesdirectories_to_archive=("$directory_name/CREDITS.md" "$directory_name/FAQ.md" \"$directory_name/LICENSE" "$directory_name/README.md" \+ "$directory_name/packages/core-utils/dist/" "$directory_name/packages/core-utils/package.json" \+ "$directory_name/packages/ffmpeg/dist/" "$directory_name/packages/ffmpeg/package.json" \+ "$directory_name/packages/node-utils/dist/" "$directory_name/packages/node-utils/package.json" \+ "$directory_name/packages/models/dist/" "$directory_name/packages/models/package.json" \"$directory_name/client/dist/" "$directory_name/client/yarn.lock" \"$directory_name/client/package.json" "$directory_name/config" \"$directory_name/dist" "$directory_name/package.json" \@@ -124,7 +135,7 @@ rm -f "./client/dist/embed-stats.json"# Release types packagenpm run generate-types-package "$version"- cd packages/types/dist+ cd packages/types-generator/distnpm publish --access publicfi)diff --git a/scripts/setup/cli.sh b/scripts/setup/cli.shdeleted file mode 100755index 2e9b8a5053..0000000000--- a/scripts/setup/cli.sh+++ /dev/null@@ -1,17 +0,0 @@-#!/bin/sh--set -eu--NOCLIENT=1 yarn install --pure-lockfile--rm -rf ./dist/server/tools/--(- cd ./server/tools- yarn install --pure-lockfile- ../../node_modules/.bin/tsc --build --verbose-)--cp -r "./server/tools/node_modules" "./dist/server/tools"--npm run resolve-tspaths:serverdiff --git a/scripts/simulate-many-viewers.ts b/scripts/simulate-many-viewers.tsindex a993e175a4..d6d9fd69e2 100644--- a/scripts/simulate-many-viewers.ts+++ b/scripts/simulate-many-viewers.ts@@ -1,5 +1,5 @@import Bluebird from 'bluebird'-import { wait } from '@shared/core-utils'+import { wait } from '@peertube/peertube-core-utils'import {createSingleServer,doubleFollow,@@ -7,7 +7,7 @@ import {PeerTubeServer,setAccessTokensToServers,waitJobs-} from '@shared/server-commands'+} from '@peertube/peertube-server-commands'let servers: PeerTubeServer[]const viewers: { xForwardedFor: string }[] = []diff --git a/scripts/tsconfig.json b/scripts/tsconfig.jsonindex 0cfd927a6c..0a7e075995 100644--- a/scripts/tsconfig.json+++ b/scripts/tsconfig.json@@ -4,7 +4,10 @@"outDir": "../dist/scripts"},"references": [- { "path": "../shared" },+ { "path": "../packages/core-utils" },+ { "path": "../packages/models" },+ { "path": "../packages/node-utils" },+ { "path": "../packages/server-commands" },{ "path": "../server" }]}diff --git a/server/controllers/api/search/shared/index.ts b/server/controllers/api/search/shared/index.tsdeleted file mode 100644index 9c56149efa..0000000000--- a/server/controllers/api/search/shared/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './utils'diff --git a/server/controllers/feeds/shared/index.ts b/server/controllers/feeds/shared/index.tsdeleted file mode 100644index 0136c84775..0000000000--- a/server/controllers/feeds/shared/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './video-feed-utils'-export * from './common-feed-utils'diff --git a/server/controllers/index.ts b/server/controllers/index.tsdeleted file mode 100644index 8a647aff16..0000000000--- a/server/controllers/index.ts+++ /dev/null@@ -1,14 +0,0 @@-export * from './activitypub'-export * from './api'-export * from './sitemap'-export * from './client'-export * from './download'-export * from './feeds'-export * from './lazy-static'-export * from './misc'-export * from './object-storage-proxy'-export * from './plugins'-export * from './services'-export * from './static'-export * from './tracker'-export * from './well-known'diff --git a/server/helpers/ffmpeg/index.ts b/server/helpers/ffmpeg/index.tsdeleted file mode 100644index bf1c73fb65..0000000000--- a/server/helpers/ffmpeg/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './codecs'-export * from './ffmpeg-image'-export * from './ffmpeg-options'-export * from './framerate'diff --git a/server/helpers/youtube-dl/index.ts b/server/helpers/youtube-dl/index.tsdeleted file mode 100644index 6afc77dcf1..0000000000--- a/server/helpers/youtube-dl/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './youtube-dl-cli'-export * from './youtube-dl-info-builder'-export * from './youtube-dl-wrapper'diff --git a/server/lib/activitypub/actors/index.ts b/server/lib/activitypub/actors/index.tsdeleted file mode 100644index 5ee2a6f1a5..0000000000--- a/server/lib/activitypub/actors/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './get'-export * from './image'-export * from './keys'-export * from './refresh'-export * from './updater'-export * from './webfinger'diff --git a/server/lib/activitypub/actors/shared/index.ts b/server/lib/activitypub/actors/shared/index.tsdeleted file mode 100644index 52af1a8e14..0000000000--- a/server/lib/activitypub/actors/shared/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './creator'-export * from './object-to-model-attributes'-export * from './url-to-object'diff --git a/server/lib/activitypub/playlists/index.ts b/server/lib/activitypub/playlists/index.tsdeleted file mode 100644index e2470a6740..0000000000--- a/server/lib/activitypub/playlists/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './get'-export * from './create-update'-export * from './refresh'diff --git a/server/lib/activitypub/playlists/shared/index.ts b/server/lib/activitypub/playlists/shared/index.tsdeleted file mode 100644index a217f22915..0000000000--- a/server/lib/activitypub/playlists/shared/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './object-to-model-attributes'-export * from './url-to-object'diff --git a/server/lib/activitypub/process/index.ts b/server/lib/activitypub/process/index.tsdeleted file mode 100644index 5466739c1c..0000000000--- a/server/lib/activitypub/process/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './process'diff --git a/server/lib/activitypub/send/index.ts b/server/lib/activitypub/send/index.tsdeleted file mode 100644index 852ea2e741..0000000000--- a/server/lib/activitypub/send/index.ts+++ /dev/null@@ -1,10 +0,0 @@-export * from './http'-export * from './send-accept'-export * from './send-announce'-export * from './send-create'-export * from './send-delete'-export * from './send-follow'-export * from './send-like'-export * from './send-reject'-export * from './send-undo'-export * from './send-update'diff --git a/server/lib/activitypub/send/shared/index.ts b/server/lib/activitypub/send/shared/index.tsdeleted file mode 100644index bda5791154..0000000000--- a/server/lib/activitypub/send/shared/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './audience-utils'-export * from './send-utils'diff --git a/server/lib/activitypub/videos/index.ts b/server/lib/activitypub/videos/index.tsdeleted file mode 100644index b220625980..0000000000--- a/server/lib/activitypub/videos/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './federate'-export * from './get'-export * from './refresh'-export * from './updater'diff --git a/server/lib/activitypub/videos/shared/index.ts b/server/lib/activitypub/videos/shared/index.tsdeleted file mode 100644index 951403493e..0000000000--- a/server/lib/activitypub/videos/shared/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './abstract-builder'-export * from './creator'-export * from './object-to-model-attributes'-export * from './trackers'-export * from './url-to-object'-export * from './video-sync-attributes'diff --git a/server/lib/files-cache/index.ts b/server/lib/files-cache/index.tsdeleted file mode 100644index 5630a9b806..0000000000--- a/server/lib/files-cache/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './avatar-permanent-file-cache'-export * from './video-miniature-permanent-file-cache'-export * from './video-captions-simple-file-cache'-export * from './video-previews-simple-file-cache'-export * from './video-storyboards-simple-file-cache'-export * from './video-torrents-simple-file-cache'diff --git a/server/lib/files-cache/shared/index.ts b/server/lib/files-cache/shared/index.tsdeleted file mode 100644index 61c4aacc7a..0000000000--- a/server/lib/files-cache/shared/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './abstract-permanent-file-cache'-export * from './abstract-simple-file-cache'diff --git a/server/lib/job-queue/index.ts b/server/lib/job-queue/index.tsdeleted file mode 100644index 57231e6492..0000000000--- a/server/lib/job-queue/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './job-queue'diff --git a/server/lib/live/index.ts b/server/lib/live/index.tsdeleted file mode 100644index 8b46800da1..0000000000--- a/server/lib/live/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './live-manager'-export * from './live-quota-store'-export * from './live-segment-sha-store'-export * from './live-utils'diff --git a/server/lib/live/shared/index.ts b/server/lib/live/shared/index.tsdeleted file mode 100644index c4d1b59eca..0000000000--- a/server/lib/live/shared/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './muxing-session'diff --git a/server/lib/live/shared/transcoding-wrapper/index.ts b/server/lib/live/shared/transcoding-wrapper/index.tsdeleted file mode 100644index ae28fa1ca1..0000000000--- a/server/lib/live/shared/transcoding-wrapper/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './abstract-transcoding-wrapper'-export * from './ffmpeg-transcoding-wrapper'-export * from './remote-transcoding-wrapper'diff --git a/server/lib/model-loaders/index.ts b/server/lib/model-loaders/index.tsdeleted file mode 100644index 9e5152cb2b..0000000000--- a/server/lib/model-loaders/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './actor'-export * from './video'diff --git a/server/lib/notifier/index.ts b/server/lib/notifier/index.tsdeleted file mode 100644index 5bc2f5f506..0000000000--- a/server/lib/notifier/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './notifier'diff --git a/server/lib/notifier/shared/abuse/index.ts b/server/lib/notifier/shared/abuse/index.tsdeleted file mode 100644index 7b54c5591e..0000000000--- a/server/lib/notifier/shared/abuse/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './abuse-state-change-for-reporter'-export * from './new-abuse-for-moderators'-export * from './new-abuse-message-for-reporter'-export * from './new-abuse-message-for-moderators'diff --git a/server/lib/notifier/shared/blacklist/index.ts b/server/lib/notifier/shared/blacklist/index.tsdeleted file mode 100644index 2f98d88ae2..0000000000--- a/server/lib/notifier/shared/blacklist/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './new-auto-blacklist-for-moderators'-export * from './new-blacklist-for-owner'-export * from './unblacklist-for-owner'diff --git a/server/lib/notifier/shared/comment/index.ts b/server/lib/notifier/shared/comment/index.tsdeleted file mode 100644index ae01a96461..0000000000--- a/server/lib/notifier/shared/comment/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './comment-mention'-export * from './new-comment-for-video-owner'diff --git a/server/lib/notifier/shared/common/index.ts b/server/lib/notifier/shared/common/index.tsdeleted file mode 100644index 0b25702786..0000000000--- a/server/lib/notifier/shared/common/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './abstract-notification'diff --git a/server/lib/notifier/shared/follow/index.ts b/server/lib/notifier/shared/follow/index.tsdeleted file mode 100644index 27f5289d9e..0000000000--- a/server/lib/notifier/shared/follow/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './auto-follow-for-instance'-export * from './follow-for-instance'-export * from './follow-for-user'diff --git a/server/lib/notifier/shared/index.ts b/server/lib/notifier/shared/index.tsdeleted file mode 100644index cc3ce8c7c8..0000000000--- a/server/lib/notifier/shared/index.ts+++ /dev/null@@ -1,7 +0,0 @@-export * from './abuse'-export * from './blacklist'-export * from './comment'-export * from './common'-export * from './follow'-export * from './instance'-export * from './video-publication'diff --git a/server/lib/notifier/shared/instance/index.ts b/server/lib/notifier/shared/instance/index.tsdeleted file mode 100644index 8c75a8ee9b..0000000000--- a/server/lib/notifier/shared/instance/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './new-peertube-version-for-admins'-export * from './new-plugin-version-for-admins'-export * from './direct-registration-for-moderators'-export * from './registration-request-for-moderators'diff --git a/server/lib/notifier/shared/video-publication/index.ts b/server/lib/notifier/shared/video-publication/index.tsdeleted file mode 100644index 5e92cb011b..0000000000--- a/server/lib/notifier/shared/video-publication/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './new-video-for-subscribers'-export * from './import-finished-for-owner'-export * from './owned-publication-after-auto-unblacklist'-export * from './owned-publication-after-schedule-update'-export * from './owned-publication-after-transcoding'-export * from './studio-edition-finished-for-owner'diff --git a/server/lib/object-storage/index.ts b/server/lib/object-storage/index.tsdeleted file mode 100644index 3ad6cab635..0000000000--- a/server/lib/object-storage/index.ts+++ /dev/null@@ -1,5 +0,0 @@-export * from './keys'-export * from './proxy'-export * from './pre-signed-urls'-export * from './urls'-export * from './videos'diff --git a/server/lib/object-storage/shared/client.ts b/server/lib/object-storage/shared/client.tsdeleted file mode 100644index d5cb074df8..0000000000--- a/server/lib/object-storage/shared/client.ts+++ /dev/null@@ -1,71 +0,0 @@-import { S3Client } from '@aws-sdk/client-s3'-import { NodeHttpHandler } from '@aws-sdk/node-http-handler'-import { logger } from '@server/helpers/logger'-import { isProxyEnabled } from '@server/helpers/proxy'-import { getAgent } from '@server/helpers/requests'-import { CONFIG } from '@server/initializers/config'-import { lTags } from './logger'--function getProxyRequestHandler () {- if (!isProxyEnabled()) return null-- const { agent } = getAgent()-- return new NodeHttpHandler({- httpAgent: agent.http,- httpsAgent: agent.https- })-}--let endpointParsed: URL-function getEndpointParsed () {- if (endpointParsed) return endpointParsed-- endpointParsed = new URL(getEndpoint())-- return endpointParsed-}--let s3Client: S3Client-function getClient () {- if (s3Client) return s3Client-- const OBJECT_STORAGE = CONFIG.OBJECT_STORAGE-- s3Client = new S3Client({- endpoint: getEndpoint(),- region: OBJECT_STORAGE.REGION,- credentials: OBJECT_STORAGE.CREDENTIALS.ACCESS_KEY_ID- ? {- accessKeyId: OBJECT_STORAGE.CREDENTIALS.ACCESS_KEY_ID,- secretAccessKey: OBJECT_STORAGE.CREDENTIALS.SECRET_ACCESS_KEY- }- : undefined,- requestHandler: getProxyRequestHandler()- })-- logger.info('Initialized S3 client %s with region %s.', getEndpoint(), OBJECT_STORAGE.REGION, lTags())-- return s3Client-}--// -----------------------------------------------------------------------------export {- getEndpointParsed,- getClient-}--// -----------------------------------------------------------------------------let endpoint: string-function getEndpoint () {- if (endpoint) return endpoint-- const endpointConfig = CONFIG.OBJECT_STORAGE.ENDPOINT- endpoint = endpointConfig.startsWith('http://') || endpointConfig.startsWith('https://')- ? CONFIG.OBJECT_STORAGE.ENDPOINT- : 'https://' + CONFIG.OBJECT_STORAGE.ENDPOINT-- return endpoint-}diff --git a/server/lib/object-storage/shared/index.ts b/server/lib/object-storage/shared/index.tsdeleted file mode 100644index 11e10aa9f7..0000000000--- a/server/lib/object-storage/shared/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './client'-export * from './logger'-export * from './object-storage-helpers'diff --git a/server/lib/opentelemetry/metric-helpers/index.ts b/server/lib/opentelemetry/metric-helpers/index.tsdeleted file mode 100644index 47b24a54f1..0000000000--- a/server/lib/opentelemetry/metric-helpers/index.ts+++ /dev/null@@ -1,7 +0,0 @@-export * from './bittorrent-tracker-observers-builder'-export * from './lives-observers-builder'-export * from './job-queue-observers-builder'-export * from './nodejs-observers-builder'-export * from './playback-metrics'-export * from './stats-observers-builder'-export * from './viewers-observers-builder'diff --git a/server/lib/opentelemetry/tracing.ts b/server/lib/opentelemetry/tracing.tsdeleted file mode 100644index 9a81680b2b..0000000000--- a/server/lib/opentelemetry/tracing.ts+++ /dev/null@@ -1,94 +0,0 @@-import { SequelizeInstrumentation } from 'opentelemetry-instrumentation-sequelize'-import { context, diag, DiagLogLevel, trace } from '@opentelemetry/api'-import { JaegerExporter } from '@opentelemetry/exporter-jaeger'-import { registerInstrumentations } from '@opentelemetry/instrumentation'-import { DnsInstrumentation } from '@opentelemetry/instrumentation-dns'-import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'-import FsInstrumentation from '@opentelemetry/instrumentation-fs'-import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'-import { IORedisInstrumentation } from '@opentelemetry/instrumentation-ioredis'-import { PgInstrumentation } from '@opentelemetry/instrumentation-pg'-import { Resource } from '@opentelemetry/resources'-import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base'-import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node'-import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'--const tracer = trace.getTracer('peertube')--function registerOpentelemetryTracing () {- if (CONFIG.OPEN_TELEMETRY.TRACING.ENABLED !== true) return-- logger.info('Registering Open Telemetry tracing')-- const customLogger = (level: string) => {- return (message: string, ...args: unknown[]) => {- let fullMessage = message-- for (const arg of args) {- if (typeof arg === 'string') fullMessage += arg- else break- }-- logger[level](fullMessage)- }- }-- diag.setLogger({- error: customLogger('error'),- warn: customLogger('warn'),- info: customLogger('info'),- debug: customLogger('debug'),- verbose: customLogger('verbose')- }, DiagLogLevel.INFO)-- const tracerProvider = new NodeTracerProvider({- resource: new Resource({- [SemanticResourceAttributes.SERVICE_NAME]: 'peertube'- })- })-- registerInstrumentations({- tracerProvider,- instrumentations: [- new PgInstrumentation({- enhancedDatabaseReporting: true- }),- new DnsInstrumentation(),- new HttpInstrumentation(),- new ExpressInstrumentation(),- new IORedisInstrumentation({- dbStatementSerializer: function (cmdName, cmdArgs) {- return [ cmdName, ...cmdArgs ].join(' ')- }- }),- new FsInstrumentation(),- new SequelizeInstrumentation()- ]- })-- tracerProvider.addSpanProcessor(- new BatchSpanProcessor(- new JaegerExporter({ endpoint: CONFIG.OPEN_TELEMETRY.TRACING.JAEGER_EXPORTER.ENDPOINT })- )- )-- tracerProvider.register()-}--async function wrapWithSpanAndContext <T> (spanName: string, cb: () => Promise<T>) {- const span = tracer.startSpan(spanName)- const activeContext = trace.setSpan(context.active(), span)-- const result = await context.with(activeContext, () => cb())- span.end()-- return result-}--export {- registerOpentelemetryTracing,- tracer,- wrapWithSpanAndContext-}diff --git a/server/lib/runners/index.ts b/server/lib/runners/index.tsdeleted file mode 100644index a737c7b597..0000000000--- a/server/lib/runners/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './job-handlers'-export * from './runner'-export * from './runner-urls'diff --git a/server/lib/runners/job-handlers/index.ts b/server/lib/runners/job-handlers/index.tsdeleted file mode 100644index 40ad2f97a0..0000000000--- a/server/lib/runners/job-handlers/index.ts+++ /dev/null@@ -1,7 +0,0 @@-export * from './abstract-job-handler'-export * from './live-rtmp-hls-transcoding-job-handler'-export * from './runner-job-handlers'-export * from './video-studio-transcoding-job-handler'-export * from './vod-audio-merge-transcoding-job-handler'-export * from './vod-hls-transcoding-job-handler'-export * from './vod-web-video-transcoding-job-handler'diff --git a/server/lib/runners/job-handlers/shared/index.ts b/server/lib/runners/job-handlers/shared/index.tsdeleted file mode 100644index 348273ae20..0000000000--- a/server/lib/runners/job-handlers/shared/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './vod-helpers'diff --git a/server/lib/transcoding/shared/index.ts b/server/lib/transcoding/shared/index.tsdeleted file mode 100644index f0b45bcbb8..0000000000--- a/server/lib/transcoding/shared/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './job-builders'-export * from './ffmpeg-builder'diff --git a/server/lib/transcoding/shared/job-builders/index.ts b/server/lib/transcoding/shared/job-builders/index.tsdeleted file mode 100644index 9b1c82adf9..0000000000--- a/server/lib/transcoding/shared/job-builders/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './transcoding-job-queue-builder'-export * from './transcoding-runner-job-builder'diff --git a/server/lib/views/shared/index.ts b/server/lib/views/shared/index.tsdeleted file mode 100644index 1394711835..0000000000--- a/server/lib/views/shared/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './video-viewer-counters'-export * from './video-viewer-stats'-export * from './video-views'diff --git a/server/lib/worker/workers/image-processor.ts b/server/lib/worker/workers/image-processor.tsdeleted file mode 100644index 0ab41a5a09..0000000000--- a/server/lib/worker/workers/image-processor.ts+++ /dev/null@@ -1,7 +0,0 @@-import { processImage } from '@server/helpers/image-utils'--module.exports = processImage--export {- processImage-}diff --git a/server/middlewares/cache/index.ts b/server/middlewares/cache/index.tsdeleted file mode 100644index 79b512828d..0000000000--- a/server/middlewares/cache/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './cache'diff --git a/server/middlewares/cache/shared/index.ts b/server/middlewares/cache/shared/index.tsdeleted file mode 100644index c707eaf7a9..0000000000--- a/server/middlewares/cache/shared/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './api-cache'diff --git a/server/middlewares/index.ts b/server/middlewares/index.tsdeleted file mode 100644index b40f864cef..0000000000--- a/server/middlewares/index.ts+++ /dev/null@@ -1,15 +0,0 @@-export * from './validators'-export * from './cache'-export * from './activitypub'-export * from './async'-export * from './auth'-export * from './pagination'-export * from './rate-limiter'-export * from './robots'-export * from './servers'-export * from './sort'-export * from './user-right'-export * from './dnt'-export * from './error'-export * from './doc'-export * from './csp'diff --git a/server/middlewares/validators/activitypub/index.ts b/server/middlewares/validators/activitypub/index.tsdeleted file mode 100644index 159338d262..0000000000--- a/server/middlewares/validators/activitypub/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './activity'-export * from './signature'-export * from './pagination'diff --git a/server/middlewares/validators/index.ts b/server/middlewares/validators/index.tsdeleted file mode 100644index 1d0964667a..0000000000--- a/server/middlewares/validators/index.ts+++ /dev/null@@ -1,31 +0,0 @@-export * from './abuse'-export * from './account'-export * from './activitypub'-export * from './actor-image'-export * from './blocklist'-export * from './bulk'-export * from './config'-export * from './express'-export * from './feeds'-export * from './follows'-export * from './jobs'-export * from './logs'-export * from './metrics'-export * from './object-storage-proxy'-export * from './oembed'-export * from './pagination'-export * from './plugins'-export * from './redundancy'-export * from './search'-export * from './server'-export * from './sort'-export * from './static'-export * from './themes'-export * from './user-email-verification'-export * from './user-history'-export * from './user-notifications'-export * from './user-registrations'-export * from './user-subscriptions'-export * from './users'-export * from './videos'-export * from './webfinger'diff --git a/server/middlewares/validators/runners/index.ts b/server/middlewares/validators/runners/index.tsdeleted file mode 100644index 9a9629a80f..0000000000--- a/server/middlewares/validators/runners/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './jobs'-export * from './registration-token'-export * from './runners'diff --git a/server/middlewares/validators/shared/index.ts b/server/middlewares/validators/shared/index.tsdeleted file mode 100644index e5cff2dda6..0000000000--- a/server/middlewares/validators/shared/index.ts+++ /dev/null@@ -1,14 +0,0 @@-export * from './abuses'-export * from './accounts'-export * from './users'-export * from './utils'-export * from './video-blacklists'-export * from './video-captions'-export * from './video-channels'-export * from './video-channel-syncs'-export * from './video-comments'-export * from './video-imports'-export * from './video-ownerships'-export * from './video-playlists'-export * from './video-passwords'-export * from './videos'diff --git a/server/middlewares/validators/videos/index.ts b/server/middlewares/validators/videos/index.tsdeleted file mode 100644index 8c6fc49b1b..0000000000--- a/server/middlewares/validators/videos/index.ts+++ /dev/null@@ -1,19 +0,0 @@-export * from './video-blacklist'-export * from './video-captions'-export * from './video-channel-sync'-export * from './video-channels'-export * from './video-comments'-export * from './video-files'-export * from './video-imports'-export * from './video-live'-export * from './video-ownership-changes'-export * from './video-passwords'-export * from './video-rates'-export * from './video-shares'-export * from './video-source'-export * from './video-stats'-export * from './video-studio'-export * from './video-token'-export * from './video-transcoding'-export * from './video-view'-export * from './videos'diff --git a/server/middlewares/validators/videos/shared/index.ts b/server/middlewares/validators/videos/shared/index.tsdeleted file mode 100644index eb11dcc6ab..0000000000--- a/server/middlewares/validators/videos/shared/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './upload'-export * from './video-validators'diff --git a/server/models/migrations.ts b/server/models/migrations.tsdeleted file mode 100644index 6c11332a1a..0000000000--- a/server/models/migrations.ts+++ /dev/null@@ -1,27 +0,0 @@-import { ModelAttributeColumnOptions } from 'sequelize'--declare namespace Migration {- interface Boolean extends ModelAttributeColumnOptions {- defaultValue: boolean | null- }-- interface String extends ModelAttributeColumnOptions {- defaultValue: string | null- }-- interface Integer extends ModelAttributeColumnOptions {- defaultValue: number | null- }-- interface BigInteger extends ModelAttributeColumnOptions {- defaultValue: number | null- }-- interface UUID extends ModelAttributeColumnOptions {- defaultValue: null- }-}--export {- Migration-}diff --git a/server/models/shared/index.ts b/server/models/shared/index.tsdeleted file mode 100644index 5a7621e4df..0000000000--- a/server/models/shared/index.ts+++ /dev/null@@ -1,8 +0,0 @@-export * from './abstract-run-query'-export * from './model-builder'-export * from './model-cache'-export * from './query'-export * from './sequelize-helpers'-export * from './sort'-export * from './sql'-export * from './update'diff --git a/server/models/video/formatter/index.ts b/server/models/video/formatter/index.tsdeleted file mode 100644index 77b4065590..0000000000--- a/server/models/video/formatter/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './video-activity-pub-format'-export * from './video-api-format'diff --git a/server/models/video/formatter/shared/index.ts b/server/models/video/formatter/shared/index.tsdeleted file mode 100644index d558fa7d62..0000000000--- a/server/models/video/formatter/shared/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './video-format-utils'diff --git a/server/models/video/sql/video/index.ts b/server/models/video/sql/video/index.tsdeleted file mode 100644index e9132d5e1f..0000000000--- a/server/models/video/sql/video/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './video-model-get-query-builder'-export * from './videos-id-list-query-builder'-export * from './videos-model-list-query-builder'diff --git a/server/package.json b/server/package.jsonnew file mode 100644index 0000000000..2bf62ff85b--- /dev/null+++ b/server/package.json@@ -0,0 +1,12 @@+{+ "name": "@peertube/peertube-server",+ "private": true,+ "version": "0.0.0",+ "files": [ "dist" ],+ "type": "module",+ "exports": {+ "./*": "./dist/*"+ },+ "devDependencies": {},+ "dependencies": {}+}diff --git a/scripts/create-generate-storyboard-job.ts b/server/scripts/create-generate-storyboard-job.tssimilarity index 93%rename from scripts/create-generate-storyboard-job.tsrename to server/scripts/create-generate-storyboard-job.tsindex 47c08edac2..1f70e4d15a 100644--- a/scripts/create-generate-storyboard-job.ts+++ b/server/scripts/create-generate-storyboard-job.ts@@ -1,9 +1,9 @@import { program } from 'commander'-import { toCompleteUUID } from '@server/helpers/custom-validators/misc'-import { initDatabaseModels } from '@server/initializers/database'-import { JobQueue } from '@server/lib/job-queue'-import { VideoModel } from '@server/models/video/video'-import { StoryboardModel } from '@server/models/video/storyboard'+import { toCompleteUUID } from '@server/helpers/custom-validators/misc.js'+import { initDatabaseModels } from '@server/initializers/database.js'+import { JobQueue } from '@server/lib/job-queue/index.js'+import { StoryboardModel } from '@server/models/video/storyboard.js'+import { VideoModel } from '@server/models/video/video.js'program.description('Generate videos storyboard')diff --git a/scripts/create-import-video-file-job.ts b/server/scripts/create-import-video-file-job.tssimilarity index 90%rename from scripts/create-import-video-file-job.tsrename to server/scripts/create-import-video-file-job.tsindex 9cb387d2e3..33a45fba16 100644--- a/scripts/create-import-video-file-job.ts+++ b/server/scripts/create-import-video-file-job.ts@@ -1,9 +1,9 @@import { program } from 'commander'import { resolve } from 'path'-import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'-import { initDatabaseModels } from '../server/initializers/database'-import { JobQueue } from '../server/lib/job-queue'-import { VideoModel } from '../server/models/video/video'+import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc.js'+import { initDatabaseModels } from '../server/initializers/database.js'+import { JobQueue } from '../server/lib/job-queue/index.js'+import { VideoModel } from '../server/models/video/video.js'program.option('-v, --video [videoUUID]', 'Video UUID')diff --git a/scripts/create-move-video-storage-job.ts b/server/scripts/create-move-video-storage-job.tssimilarity index 90%rename from scripts/create-move-video-storage-job.tsrename to server/scripts/create-move-video-storage-job.tsindex 8537114eba..a615d1f446 100644--- a/scripts/create-move-video-storage-job.ts+++ b/server/scripts/create-move-video-storage-job.ts@@ -1,11 +1,11 @@import { program } from 'commander'-import { toCompleteUUID } from '@server/helpers/custom-validators/misc'-import { CONFIG } from '@server/initializers/config'-import { initDatabaseModels } from '@server/initializers/database'-import { JobQueue } from '@server/lib/job-queue'-import { moveToExternalStorageState } from '@server/lib/video-state'-import { VideoModel } from '@server/models/video/video'-import { VideoState, VideoStorage } from '@shared/models'+import { toCompleteUUID } from '@server/helpers/custom-validators/misc.js'+import { CONFIG } from '@server/initializers/config.js'+import { initDatabaseModels } from '@server/initializers/database.js'+import { JobQueue } from '@server/lib/job-queue/index.js'+import { moveToExternalStorageState } from '@server/lib/video-state.js'+import { VideoModel } from '@server/models/video/video.js'+import { VideoState, VideoStorage } from '@peertube/peertube-models'program.description('Move videos to another storage.')diff --git a/scripts/migrations/peertube-4.0.ts b/server/scripts/migrations/peertube-4.0.tssimilarity index 86%rename from scripts/migrations/peertube-4.0.tsrename to server/scripts/migrations/peertube-4.0.tsindex b0891c2e63..619c1da710 100644--- a/scripts/migrations/peertube-4.0.ts+++ b/server/scripts/migrations/peertube-4.0.ts@@ -1,19 +1,25 @@import Bluebird from 'bluebird'-import { move, readFile, writeFile } from 'fs-extra'+import { move } from 'fs-extra/esm'+import { readFile, writeFile } from 'fs/promises'import { join } from 'path'-import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'-import { JobQueue } from '@server/lib/job-queue'-import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getHlsResolutionPlaylistFilename } from '@server/lib/paths'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { VideoModel } from '@server/models/video/video'-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'-import { initDatabaseModels } from '../../server/initializers/database'+import { initDatabaseModels } from '@server/initializers/database.js'+import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'+import { JobQueue } from '@server/lib/job-queue/index.js'+import {+ generateHLSMasterPlaylistFilename,+ generateHlsSha256SegmentsFilename,+ getHlsResolutionPlaylistFilename+} from '@server/lib/paths.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'+import { VideoModel } from '@server/models/video/video.js'run().then(() => process.exit(0)).catch(err => {console.error(err)process.exit(-1)+})async function run () {diff --git a/scripts/migrations/peertube-4.2.ts b/server/scripts/migrations/peertube-4.2.tssimilarity index 82%rename from scripts/migrations/peertube-4.2.tsrename to server/scripts/migrations/peertube-4.2.tsindex d8929692b3..6c89ee39ef 100644--- a/scripts/migrations/peertube-4.2.ts+++ b/server/scripts/migrations/peertube-4.2.ts@@ -1,20 +1,19 @@-import { minBy } from 'lodash'+import { ActorImageType } from '@peertube/peertube-models'+import { buildUUID, getLowercaseExtension } from '@peertube/peertube-node-utils'+import { getImageSize, processImage } from '@server/helpers/image-utils.js'+import { CONFIG } from '@server/initializers/config.js'+import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants.js'+import { initDatabaseModels } from '@server/initializers/database.js'+import { updateActorImages } from '@server/lib/activitypub/actors/index.js'+import { sendUpdateActor } from '@server/lib/activitypub/send/index.js'+import { getBiggestActorImage } from '@server/lib/actor-image.js'+import { JobQueue } from '@server/lib/job-queue/index.js'+import { AccountModel } from '@server/models/account/account.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import { MAccountDefault, MActorDefault, MChannelDefault } from '@server/types/models/index.js'+import minBy from 'lodash-es/minBy.js'import { join } from 'path'-import { getImageSize, processImage } from '@server/helpers/image-utils'-import { CONFIG } from '@server/initializers/config'-import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'-import { updateActorImages } from '@server/lib/activitypub/actors'-import { sendUpdateActor } from '@server/lib/activitypub/send'-import { getBiggestActorImage } from '@server/lib/actor-image'-import { JobQueue } from '@server/lib/job-queue'-import { AccountModel } from '@server/models/account/account'-import { ActorModel } from '@server/models/actor/actor'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { MAccountDefault, MActorDefault, MChannelDefault } from '@server/types/models'-import { getLowercaseExtension } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { ActorImageType } from '@shared/models'-import { initDatabaseModels } from '../../server/initializers/database'run().then(() => process.exit(0))diff --git a/scripts/migrations/peertube-5.0.ts b/server/scripts/migrations/peertube-5.0.tssimilarity index 81%rename from scripts/migrations/peertube-5.0.tsrename to server/scripts/migrations/peertube-5.0.tsindex a0f51a64c5..6139abd088 100644--- a/scripts/migrations/peertube-5.0.ts+++ b/server/scripts/migrations/peertube-5.0.ts@@ -1,12 +1,12 @@-import { ensureDir } from 'fs-extra'+import { ensureDir } from 'fs-extra/esm'import { Op } from 'sequelize'-import { updateTorrentMetadata } from '@server/helpers/webtorrent'-import { DIRECTORIES } from '@server/initializers/constants'-import { moveFilesIfPrivacyChanged } from '@server/lib/video-privacy'-import { VideoModel } from '@server/models/video/video'-import { MVideoFullLight } from '@server/types/models'-import { VideoPrivacy } from '@shared/models'-import { initDatabaseModels } from '../../server/initializers/database'+import { updateTorrentMetadata } from '@server/helpers/webtorrent.js'+import { DIRECTORIES } from '@server/initializers/constants.js'+import { moveFilesIfPrivacyChanged } from '@server/lib/video-privacy.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideoFullLight } from '@server/types/models/index.js'+import { VideoPrivacy } from '@peertube/peertube-models'+import { initDatabaseModels } from '@server/initializers/database.js'run().then(() => process.exit(0))diff --git a/scripts/parse-log.ts b/server/scripts/parse-log.tssimilarity index 94%rename from scripts/parse-log.tsrename to server/scripts/parse-log.tsindex 6770f090b5..e80c0d9273 100755--- a/scripts/parse-log.ts+++ b/server/scripts/parse-log.ts@@ -1,13 +1,14 @@import { program } from 'commander'-import { createReadStream, readdir } from 'fs-extra'+import { createReadStream } from 'fs'+import { readdir } from 'fs/promises'import { join } from 'path'import { stdin } from 'process'import { createInterface } from 'readline'import { format as sqlFormat } from 'sql-formatter'import { inspect } from 'util'import * as winston from 'winston'-import { labelFormatter, mtimeSortFilesDesc } from '../server/helpers/logger'-import { CONFIG } from '../server/initializers/config'+import { labelFormatter, mtimeSortFilesDesc } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'program.option('-l, --level [level]', 'Level log (debug/info/warn/error)')diff --git a/scripts/plugin/install.ts b/server/scripts/plugin/install.tssimilarity index 98%rename from scripts/plugin/install.tsrename to server/scripts/plugin/install.tsindex 138f34446e..3b13120ff0 100755--- a/scripts/plugin/install.ts+++ b/server/scripts/plugin/install.ts@@ -1,7 +1,7 @@import { program } from 'commander'import { isAbsolute } from 'path'-import { initDatabaseModels } from '../../server/initializers/database'-import { PluginManager } from '../../server/lib/plugins/plugin-manager'+import { initDatabaseModels } from '../../server/initializers/database.js'+import { PluginManager } from '../../server/lib/plugins/plugin-manager.js'program.option('-n, --npm-name [npmName]', 'Plugin to install')diff --git a/scripts/plugin/uninstall.ts b/server/scripts/plugin/uninstall.tssimilarity index 79%rename from scripts/plugin/uninstall.tsrename to server/scripts/plugin/uninstall.tsindex 7705946856..baf0422c4f 100755--- a/scripts/plugin/uninstall.ts+++ b/server/scripts/plugin/uninstall.ts@@ -1,6 +1,6 @@import { program } from 'commander'-import { initDatabaseModels } from '../../server/initializers/database'-import { PluginManager } from '../../server/lib/plugins/plugin-manager'+import { initDatabaseModels } from '@server/initializers/database.js'+import { PluginManager } from '@server/lib/plugins/plugin-manager.js'program.option('-n, --npm-name [npmName]', 'Package name to install')diff --git a/scripts/prune-storage.ts b/server/scripts/prune-storage.tssimilarity index 86%rename from scripts/prune-storage.tsrename to server/scripts/prune-storage.tsindex 9a73a8600c..9309724b98 100755--- a/scripts/prune-storage.ts+++ b/server/scripts/prune-storage.ts@@ -1,19 +1,20 @@-import { map } from 'bluebird'-import { readdir, remove, stat } from 'fs-extra'+import Bluebird from 'bluebird'+import { remove } from 'fs-extra/esm'+import { readdir, stat } from 'fs/promises'import { basename, join } from 'path'-import { get, start } from 'prompt'-import { DIRECTORIES } from '@server/initializers/constants'-import { VideoFileModel } from '@server/models/video/video-file'-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'-import { uniqify } from '@shared/core-utils'-import { ThumbnailType } from '@shared/models'-import { getUUIDFromFilename } from '../server/helpers/utils'-import { CONFIG } from '../server/initializers/config'-import { initDatabaseModels } from '../server/initializers/database'-import { ActorImageModel } from '../server/models/actor/actor-image'-import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy'-import { ThumbnailModel } from '../server/models/video/thumbnail'-import { VideoModel } from '../server/models/video/video'+import prompt from 'prompt'+import { uniqify } from '@peertube/peertube-core-utils'+import { ThumbnailType, ThumbnailType_Type } from '@peertube/peertube-models'+import { DIRECTORIES } from '@server/initializers/constants.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'+import { getUUIDFromFilename } from '../server/helpers/utils.js'+import { CONFIG } from '../server/initializers/config.js'+import { initDatabaseModels } from '../server/initializers/database.js'+import { ActorImageModel } from '../server/models/actor/actor-image.js'+import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy.js'+import { ThumbnailModel } from '../server/models/video/thumbnail.js'+import { VideoModel } from '../server/models/video/video.js'run().then(() => process.exit(0))@@ -82,7 +83,7 @@ async function pruneDirectory (directory: string, existFun: ExistFun) {const files = await readdir(directory)const toDelete: string[] = []- await map(files, async file => {+ await Bluebird.map(files, async file => {const filePath = join(directory, file)if (await existFun(filePath) !== true) {@@ -115,7 +116,7 @@ function doesTorrentFileExist () {return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath))}-function doesThumbnailExist (keepOnlyOwned: boolean, type: ThumbnailType) {+function doesThumbnailExist (keepOnlyOwned: boolean, type: ThumbnailType_Type) {return async (filePath: string) => {const thumbnail = await ThumbnailModel.loadByFilename(basename(filePath), type)if (!thumbnail) return false@@ -162,7 +163,8 @@ async function doesRedundancyExist (filePath: string) {async function askConfirmation () {return new Promise((res, rej) => {- start()+ prompt.start()+const schema = {properties: {confirm: {@@ -175,7 +177,8 @@ async function askConfirmation () {}}}- get(schema, function (err, result) {++ prompt.get(schema, function (err, result) {if (err) return rej(err)return res(result.confirm?.match(/y/) !== null)diff --git a/scripts/regenerate-thumbnails.ts b/server/scripts/regenerate-thumbnails.tssimilarity index 85%rename from scripts/regenerate-thumbnails.tsrename to server/scripts/regenerate-thumbnails.tsindex 061819387a..d4346ce400 100644--- a/scripts/regenerate-thumbnails.ts+++ b/server/scripts/regenerate-thumbnails.ts@@ -1,10 +1,10 @@-import { map } from 'bluebird'+import Bluebird from 'bluebird'import { program } from 'commander'-import { pathExists, remove } from 'fs-extra'-import { generateImageFilename, processImage } from '@server/helpers/image-utils'-import { THUMBNAILS_SIZE } from '@server/initializers/constants'-import { initDatabaseModels } from '@server/initializers/database'-import { VideoModel } from '@server/models/video/video'+import { pathExists, remove } from 'fs-extra/esm'+import { generateImageFilename, processImage } from '@server/helpers/image-utils.js'+import { THUMBNAILS_SIZE } from '@server/initializers/constants.js'+import { initDatabaseModels } from '@server/initializers/database.js'+import { VideoModel } from '@server/models/video/video.js'program.description('Regenerate local thumbnails using preview files')@@ -19,7 +19,7 @@ async function run () {const ids = await VideoModel.listLocalIds()- await map(ids, id => {+ await Bluebird.map(ids, id => {return processVideo(id).catch(err => console.error('Cannot process video %d.', id, err))}, { concurrency: 20 })diff --git a/scripts/reset-password.ts b/server/scripts/reset-password.tssimilarity index 79%rename from scripts/reset-password.tsrename to server/scripts/reset-password.tsindex b2e5639fb6..96e301ba9c 100755--- a/scripts/reset-password.ts+++ b/server/scripts/reset-password.ts@@ -1,7 +1,9 @@import { program } from 'commander'-import { isUserPasswordValid } from '../server/helpers/custom-validators/users'-import { initDatabaseModels } from '../server/initializers/database'-import { UserModel } from '../server/models/user/user'+import readline from 'readline'+import { Writable } from 'stream'+import { isUserPasswordValid } from '@server/helpers/custom-validators/users.js'+import { initDatabaseModels } from '@server/initializers/database.js'+import { UserModel } from '@server/models/user/user.js'program.option('-u, --user [user]', 'User')@@ -24,8 +26,6 @@ initDatabaseModels(true)process.exit(-1)}- const readline = require('readline')- const Writable = require('stream').Writableconst mutableStdout = new Writable({write: function (_chunk, _encoding, callback) {callback()diff --git a/scripts/update-host.ts b/server/scripts/update-host.tssimilarity index 84%rename from scripts/update-host.tsrename to server/scripts/update-host.tsindex 1d17ce1521..52ac4947a7 100755--- a/scripts/update-host.ts+++ b/server/scripts/update-host.ts@@ -1,21 +1,21 @@-import { updateTorrentMetadata } from '@server/helpers/webtorrent'-import { getServerActor } from '@server/models/application/application'-import { WEBSERVER } from '../server/initializers/constants'-import { initDatabaseModels } from '../server/initializers/database'+import { updateTorrentMetadata } from '@server/helpers/webtorrent.js'+import { getServerActor } from '@server/models/application/application.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { initDatabaseModels } from '@server/initializers/database.js'import {getLocalAccountActivityPubUrl,getLocalVideoActivityPubUrl,getLocalVideoAnnounceActivityPubUrl,getLocalVideoChannelActivityPubUrl,getLocalVideoCommentActivityPubUrl-} from '../server/lib/activitypub/url'-import { AccountModel } from '../server/models/account/account'-import { ActorModel } from '../server/models/actor/actor'-import { ActorFollowModel } from '../server/models/actor/actor-follow'-import { VideoModel } from '../server/models/video/video'-import { VideoChannelModel } from '../server/models/video/video-channel'-import { VideoCommentModel } from '../server/models/video/video-comment'-import { VideoShareModel } from '../server/models/video/video-share'+} from '@server/lib/activitypub/url.js'+import { AccountModel } from '@server/models/account/account.js'+import { ActorFollowModel } from '@server/models/actor/actor-follow.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import { VideoCommentModel } from '@server/models/video/video-comment.js'+import { VideoShareModel } from '@server/models/video/video-share.js'+import { VideoModel } from '@server/models/video/video.js'run().then(() => process.exit(0))diff --git a/scripts/upgrade.sh b/server/scripts/upgrade.shsimilarity index 100%rename from scripts/upgrade.shrename to server/scripts/upgrade.shdiff --git a/server.ts b/server/server.tssimilarity index 84%rename from server.tsrename to server/server.tsindex 605b94be09..7f9c68ad9e 100644--- a/server.ts+++ b/server/server.ts@@ -1,28 +1,15 @@-// ----------- Node modules ------------import { registerOpentelemetryTracing } from './server/lib/opentelemetry/tracing'-registerOpentelemetryTracing()--import express from 'express'-import morgan, { token } from 'morgan'-import cors from 'cors'-import cookieParser from 'cookie-parser'-import { frameguard } from 'helmet'-import { parse } from 'useragent'-import anonymize from 'ip-anonymize'-import { program as cli } from 'commander'+import { registerOpentelemetryTracing } from '@server/lib/opentelemetry/tracing.js'+await registerOpentelemetryTracing()process.title = 'peertube'-// Create our main app-const app = express().disable('x-powered-by')-// ----------- Core checker ------------import { checkMissedConfig, checkFFmpeg, checkNodeVersion } from './server/initializers/checker-before-init'+import { checkMissedConfig, checkFFmpeg, checkNodeVersion } from './server/initializers/checker-before-init.js'// Do not use barrels because we don't want to load all modules here (we need to initialize database first)-import { CONFIG } from './server/initializers/config'-import { API_VERSION, WEBSERVER, loadLanguages } from './server/initializers/constants'-import { logger } from './server/helpers/logger'+import { CONFIG } from './server/initializers/config.js'+import { API_VERSION, WEBSERVER, loadLanguages } from './server/initializers/constants.js'+import { logger } from './server/helpers/logger.js'const missed = checkMissedConfig()if (missed.length !== 0) {@@ -43,7 +30,7 @@ try {process.exit(-1)}-import { checkConfig, checkActivityPubUrls, checkFFmpegVersion } from './server/initializers/checker-after-init'+import { checkConfig, checkActivityPubUrls, checkFFmpegVersion } from './server/initializers/checker-after-init.js'try {checkConfig()@@ -52,6 +39,37 @@ try {process.exit(-1)}+// ----------- Database -----------++// Initialize database and models+import { initDatabaseModels, checkDatabaseConnectionOrDie } from './server/initializers/database.js'+checkDatabaseConnectionOrDie()++import { migrate } from './server/initializers/migrator.js'+migrate()+ .then(() => initDatabaseModels(false))+ .then(() => startApplication())+ .catch(err => {+ logger.error('Cannot start application.', { err })+ process.exit(-1)+ })++// ----------- Initialize -----------+loadLanguages()+ .catch(err => logger.error('Cannot load languages', { err }))++// Express configuration+import express from 'express'+import morgan, { token } from 'morgan'+import cors from 'cors'+import cookieParser from 'cookie-parser'+import { frameguard } from 'helmet'+import { parse } from 'useragent'+import anonymize from 'ip-anonymize'+import { program as cli } from 'commander'++const app = express().disable('x-powered-by')+// Trust our proxy (IP forwarding...)app.set('trust proxy', CONFIG.TRUST_PROXY)@@ -67,7 +85,7 @@ app.use((_req, res, next) => {})// Security middleware-import { baseCSP } from './server/middlewares/csp'+import { baseCSP } from './server/middlewares/csp.js'if (CONFIG.CSP.ENABLED) {app.use(baseCSP)@@ -79,28 +97,10 @@ if (CONFIG.SECURITY.FRAMEGUARD.ENABLED) {}))}-// ----------- Database -------------// Initialize database and models-import { initDatabaseModels, checkDatabaseConnectionOrDie } from './server/initializers/database'-checkDatabaseConnectionOrDie()--import { migrate } from './server/initializers/migrator'-migrate()- .then(() => initDatabaseModels(false))- .then(() => startApplication())- .catch(err => {- logger.error('Cannot start application.', { err })- process.exit(-1)- })--// ----------- Initialize ------------loadLanguages()-// ----------- PeerTube modules ------------import { installApplication } from './server/initializers/installer'-import { Emailer } from './server/lib/emailer'-import { JobQueue } from './server/lib/job-queue'+import { installApplication } from './server/initializers/installer.js'+import { Emailer } from './server/lib/emailer.js'+import { JobQueue } from './server/lib/job-queue/index.js'import {activityPubRouter,apiRouter,@@ -117,36 +117,36 @@ import {createWebsocketTrackerServer,sitemapRouter,downloadRouter-} from './server/controllers'-import { advertiseDoNotTrack } from './server/middlewares/dnt'-import { apiFailMiddleware } from './server/middlewares/error'-import { Redis } from './server/lib/redis'-import { ActorFollowScheduler } from './server/lib/schedulers/actor-follow-scheduler'-import { RemoveOldViewsScheduler } from './server/lib/schedulers/remove-old-views-scheduler'-import { UpdateVideosScheduler } from './server/lib/schedulers/update-videos-scheduler'-import { YoutubeDlUpdateScheduler } from './server/lib/schedulers/youtube-dl-update-scheduler'-import { VideosRedundancyScheduler } from './server/lib/schedulers/videos-redundancy-scheduler'-import { RemoveOldHistoryScheduler } from './server/lib/schedulers/remove-old-history-scheduler'-import { AutoFollowIndexInstances } from './server/lib/schedulers/auto-follow-index-instances'-import { RemoveDanglingResumableUploadsScheduler } from './server/lib/schedulers/remove-dangling-resumable-uploads-scheduler'-import { VideoViewsBufferScheduler } from './server/lib/schedulers/video-views-buffer-scheduler'-import { GeoIPUpdateScheduler } from './server/lib/schedulers/geo-ip-update-scheduler'-import { RunnerJobWatchDogScheduler } from './server/lib/schedulers/runner-job-watch-dog-scheduler'-import { isHTTPSignatureDigestValid } from './server/helpers/peertube-crypto'-import { PeerTubeSocket } from './server/lib/peertube-socket'-import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls'-import { PluginsCheckScheduler } from './server/lib/schedulers/plugins-check-scheduler'-import { PeerTubeVersionCheckScheduler } from './server/lib/schedulers/peertube-version-check-scheduler'-import { Hooks } from './server/lib/plugins/hooks'-import { PluginManager } from './server/lib/plugins/plugin-manager'-import { LiveManager } from './server/lib/live'-import { HttpStatusCode } from './shared/models/http/http-error-codes'-import { ServerConfigManager } from '@server/lib/server-config-manager'-import { VideoViewsManager } from '@server/lib/views/video-views-manager'-import { isTestOrDevInstance } from './server/helpers/core-utils'-import { OpenTelemetryMetrics } from '@server/lib/opentelemetry/metrics'-import { ApplicationModel } from '@server/models/application/application'-import { VideoChannelSyncLatestScheduler } from '@server/lib/schedulers/video-channel-sync-latest-scheduler'+} from './server/controllers/index.js'+import { advertiseDoNotTrack } from './server/middlewares/dnt.js'+import { apiFailMiddleware } from './server/middlewares/error.js'+import { Redis } from './server/lib/redis.js'+import { ActorFollowScheduler } from './server/lib/schedulers/actor-follow-scheduler.js'+import { RemoveOldViewsScheduler } from './server/lib/schedulers/remove-old-views-scheduler.js'+import { UpdateVideosScheduler } from './server/lib/schedulers/update-videos-scheduler.js'+import { YoutubeDlUpdateScheduler } from './server/lib/schedulers/youtube-dl-update-scheduler.js'+import { VideosRedundancyScheduler } from './server/lib/schedulers/videos-redundancy-scheduler.js'+import { RemoveOldHistoryScheduler } from './server/lib/schedulers/remove-old-history-scheduler.js'+import { AutoFollowIndexInstances } from './server/lib/schedulers/auto-follow-index-instances.js'+import { RemoveDanglingResumableUploadsScheduler } from './server/lib/schedulers/remove-dangling-resumable-uploads-scheduler.js'+import { VideoViewsBufferScheduler } from './server/lib/schedulers/video-views-buffer-scheduler.js'+import { GeoIPUpdateScheduler } from './server/lib/schedulers/geo-ip-update-scheduler.js'+import { RunnerJobWatchDogScheduler } from './server/lib/schedulers/runner-job-watch-dog-scheduler.js'+import { isHTTPSignatureDigestValid } from './server/helpers/peertube-crypto.js'+import { PeerTubeSocket } from './server/lib/peertube-socket.js'+import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls.js'+import { PluginsCheckScheduler } from './server/lib/schedulers/plugins-check-scheduler.js'+import { PeerTubeVersionCheckScheduler } from './server/lib/schedulers/peertube-version-check-scheduler.js'+import { Hooks } from './server/lib/plugins/hooks.js'+import { PluginManager } from './server/lib/plugins/plugin-manager.js'+import { LiveManager } from './server/lib/live/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { ServerConfigManager } from '@server/lib/server-config-manager.js'+import { VideoViewsManager } from '@server/lib/views/video-views-manager.js'+import { isTestOrDevInstance } from '@peertube/peertube-node-utils'+import { OpenTelemetryMetrics } from '@server/lib/opentelemetry/metrics.js'+import { ApplicationModel } from '@server/models/application/application.js'+import { VideoChannelSyncLatestScheduler } from '@server/lib/schedulers/video-channel-sync-latest-scheduler.js'// ----------- Command line -----------diff --git a/server/assets/default-audio-background.jpg b/server/server/assets/default-audio-background.jpgsimilarity index 100%rename from server/assets/default-audio-background.jpgrename to server/server/assets/default-audio-background.jpgdiff --git a/server/assets/default-live-background.jpg b/server/server/assets/default-live-background.jpgsimilarity index 100%rename from server/assets/default-live-background.jpgrename to server/server/assets/default-live-background.jpgdiff --git a/server/controllers/activitypub/client.ts b/server/server/controllers/activitypub/client.tssimilarity index 89%rename from server/controllers/activitypub/client.tsrename to server/server/controllers/activitypub/client.tsindex be52f1662e..5d5e43bf54 100644--- a/server/controllers/activitypub/client.ts+++ b/server/server/controllers/activitypub/client.ts@@ -1,23 +1,23 @@import cors from 'cors'import express from 'express'-import { activityPubCollectionPagination } from '@server/lib/activitypub/collection'-import { activityPubContextify } from '@server/lib/activitypub/context'-import { getServerActor } from '@server/models/application/application'-import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models'-import { VideoCommentObject } from '@shared/models'-import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos'-import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'-import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants'-import { audiencify, getAudience } from '../../lib/activitypub/audience'-import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send'-import { buildCreateActivity } from '../../lib/activitypub/send/send-create'-import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike'+import { VideoCommentObject, VideoPlaylistPrivacy, VideoPrivacy, VideoRateType } from '@peertube/peertube-models'+import { activityPubCollectionPagination } from '@server/lib/activitypub/collection.js'+import { getContextFilter } from '@server/lib/activitypub/context.js'+import { getServerActor } from '@server/models/application/application.js'+import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models/index.js'+import { activityPubContextify } from '../../helpers/activity-pub-utils.js'+import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants.js'+import { audiencify, getAudience } from '../../lib/activitypub/audience.js'+import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send/index.js'+import { buildCreateActivity } from '../../lib/activitypub/send/send-create.js'+import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike.js'import {getLocalVideoCommentsActivityPubUrl,getLocalVideoDislikesActivityPubUrl,getLocalVideoLikesActivityPubUrl,getLocalVideoSharesActivityPubUrl-} from '../../lib/activitypub/url'+} from '../../lib/activitypub/url.js'+import { cacheRoute } from '../../middlewares/cache/cache.js'import {activityPubRateLimiter,asyncMiddleware,@@ -27,18 +27,21 @@ import {videoChannelsNameWithHostValidator,videosCustomGetValidator,videosShareValidator-} from '../../middlewares'-import { cacheRoute } from '../../middlewares/cache/cache'-import { getAccountVideoRateValidatorFactory, getVideoLocalViewerValidator, videoCommentGetValidator } from '../../middlewares/validators'-import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator } from '../../middlewares/validators/redundancy'-import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists'-import { AccountModel } from '../../models/account/account'-import { AccountVideoRateModel } from '../../models/account/account-video-rate'-import { ActorFollowModel } from '../../models/actor/actor-follow'-import { VideoCommentModel } from '../../models/video/video-comment'-import { VideoPlaylistModel } from '../../models/video/video-playlist'-import { VideoShareModel } from '../../models/video/video-share'-import { activityPubResponse } from './utils'+} from '../../middlewares/index.js'+import {+ getAccountVideoRateValidatorFactory,+ getVideoLocalViewerValidator,+ videoCommentGetValidator+} from '../../middlewares/validators/index.js'+import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator } from '../../middlewares/validators/redundancy.js'+import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists.js'+import { AccountVideoRateModel } from '../../models/account/account-video-rate.js'+import { AccountModel } from '../../models/account/account.js'+import { ActorFollowModel } from '../../models/actor/actor-follow.js'+import { VideoCommentModel } from '../../models/video/video-comment.js'+import { VideoPlaylistModel } from '../../models/video/video-playlist.js'+import { VideoShareModel } from '../../models/video/video-share.js'+import { activityPubResponse } from './utils.js'const activityPubClientRouter = express.Router()activityPubClientRouter.use(cors())@@ -217,35 +220,35 @@ export {async function accountController (req: express.Request, res: express.Response) {const account = res.locals.account- return activityPubResponse(activityPubContextify(await account.toActivityPubObject(), 'Actor'), res)+ return activityPubResponse(activityPubContextify(await account.toActivityPubObject(), 'Actor', getContextFilter()), res)}async function accountFollowersController (req: express.Request, res: express.Response) {const account = res.locals.accountconst activityPubResult = await actorFollowers(req, account.Actor)- return activityPubResponse(activityPubContextify(activityPubResult, 'Collection'), res)+ return activityPubResponse(activityPubContextify(activityPubResult, 'Collection', getContextFilter()), res)}async function accountFollowingController (req: express.Request, res: express.Response) {const account = res.locals.accountconst activityPubResult = await actorFollowing(req, account.Actor)- return activityPubResponse(activityPubContextify(activityPubResult, 'Collection'), res)+ return activityPubResponse(activityPubContextify(activityPubResult, 'Collection', getContextFilter()), res)}async function accountPlaylistsController (req: express.Request, res: express.Response) {const account = res.locals.accountconst activityPubResult = await actorPlaylists(req, { account })- return activityPubResponse(activityPubContextify(activityPubResult, 'Collection'), res)+ return activityPubResponse(activityPubContextify(activityPubResult, 'Collection', getContextFilter()), res)}async function videoChannelPlaylistsController (req: express.Request, res: express.Response) {const channel = res.locals.videoChannelconst activityPubResult = await actorPlaylists(req, { channel })- return activityPubResponse(activityPubContextify(activityPubResult, 'Collection'), res)+ return activityPubResponse(activityPubContextify(activityPubResult, 'Collection', getContextFilter()), res)}function getAccountVideoRateFactory (rateType: VideoRateType) {@@ -257,7 +260,7 @@ function getAccountVideoRateFactory (rateType: VideoRateType) {? buildLikeActivity(accountVideoRate.url, byActor, accountVideoRate.Video): buildDislikeActivity(accountVideoRate.url, byActor, accountVideoRate.Video)- return activityPubResponse(activityPubContextify(APObject, 'Rate'), res)+ return activityPubResponse(activityPubContextify(APObject, 'Rate', getContextFilter()), res)}}@@ -274,10 +277,10 @@ async function videoController (req: express.Request, res: express.Response) {if (req.path.endsWith('/activity')) {const data = buildCreateActivity(videoAP.url, video.VideoChannel.Account.Actor, videoObject, audience)- return activityPubResponse(activityPubContextify(data, 'Video'), res)+ return activityPubResponse(activityPubContextify(data, 'Video', getContextFilter()), res)}- return activityPubResponse(activityPubContextify(videoObject, 'Video'), res)+ return activityPubResponse(activityPubContextify(videoObject, 'Video', getContextFilter()), res)}async function videoAnnounceController (req: express.Request, res: express.Response) {@@ -287,7 +290,7 @@ async function videoAnnounceController (req: express.Request, res: express.Respoconst { activity } = await buildAnnounceWithVideoAudience(share.Actor, share, res.locals.videoAll, undefined)- return activityPubResponse(activityPubContextify(activity, 'Announce'), res)+ return activityPubResponse(activityPubContextify(activity, 'Announce', getContextFilter()), res)}async function videoAnnouncesController (req: express.Request, res: express.Response) {@@ -304,7 +307,7 @@ async function videoAnnouncesController (req: express.Request, res: express.Resp}const json = await activityPubCollectionPagination(getLocalVideoSharesActivityPubUrl(video), handler, req.query.page)- return activityPubResponse(activityPubContextify(json, 'Collection'), res)+ return activityPubResponse(activityPubContextify(json, 'Collection', getContextFilter()), res)}async function videoLikesController (req: express.Request, res: express.Response) {@@ -314,7 +317,7 @@ async function videoLikesController (req: express.Request, res: express.Responseconst json = await videoRates(req, 'like', video, getLocalVideoLikesActivityPubUrl(video))- return activityPubResponse(activityPubContextify(json, 'Collection'), res)+ return activityPubResponse(activityPubContextify(json, 'Collection', getContextFilter()), res)}async function videoDislikesController (req: express.Request, res: express.Response) {@@ -324,7 +327,7 @@ async function videoDislikesController (req: express.Request, res: express.Respoconst json = await videoRates(req, 'dislike', video, getLocalVideoDislikesActivityPubUrl(video))- return activityPubResponse(activityPubContextify(json, 'Collection'), res)+ return activityPubResponse(activityPubContextify(json, 'Collection', getContextFilter()), res)}async function videoCommentsController (req: express.Request, res: express.Response) {@@ -342,27 +345,27 @@ async function videoCommentsController (req: express.Request, res: express.Respo}const json = await activityPubCollectionPagination(getLocalVideoCommentsActivityPubUrl(video), handler, req.query.page)- return activityPubResponse(activityPubContextify(json, 'Collection'), res)+ return activityPubResponse(activityPubContextify(json, 'Collection', getContextFilter()), res)}async function videoChannelController (req: express.Request, res: express.Response) {const videoChannel = res.locals.videoChannel- return activityPubResponse(activityPubContextify(await videoChannel.toActivityPubObject(), 'Actor'), res)+ return activityPubResponse(activityPubContextify(await videoChannel.toActivityPubObject(), 'Actor', getContextFilter()), res)}async function videoChannelFollowersController (req: express.Request, res: express.Response) {const videoChannel = res.locals.videoChannelconst activityPubResult = await actorFollowers(req, videoChannel.Actor)- return activityPubResponse(activityPubContextify(activityPubResult, 'Collection'), res)+ return activityPubResponse(activityPubContextify(activityPubResult, 'Collection', getContextFilter()), res)}async function videoChannelFollowingController (req: express.Request, res: express.Response) {const videoChannel = res.locals.videoChannelconst activityPubResult = await actorFollowing(req, videoChannel.Actor)- return activityPubResponse(activityPubContextify(activityPubResult, 'Collection'), res)+ return activityPubResponse(activityPubContextify(activityPubResult, 'Collection', getContextFilter()), res)}async function videoCommentController (req: express.Request, res: express.Response) {@@ -380,11 +383,11 @@ async function videoCommentController (req: express.Request, res: express.Responif (req.path.endsWith('/activity')) {const data = buildCreateActivity(videoComment.url, videoComment.Account.Actor, videoCommentObject as VideoCommentObject, audience)- return activityPubResponse(activityPubContextify(data, 'Comment'), res)+ return activityPubResponse(activityPubContextify(data, 'Comment', getContextFilter()), res)}}- return activityPubResponse(activityPubContextify(videoCommentObject, 'Comment'), res)+ return activityPubResponse(activityPubContextify(videoCommentObject, 'Comment', getContextFilter()), res)}async function videoRedundancyController (req: express.Request, res: express.Response) {@@ -399,10 +402,10 @@ async function videoRedundancyController (req: express.Request, res: express.Resif (req.path.endsWith('/activity')) {const data = buildCreateActivity(videoRedundancy.url, serverActor, object, audience)- return activityPubResponse(activityPubContextify(data, 'CacheFile'), res)+ return activityPubResponse(activityPubContextify(data, 'CacheFile', getContextFilter()), res)}- return activityPubResponse(activityPubContextify(object, 'CacheFile'), res)+ return activityPubResponse(activityPubContextify(object, 'CacheFile', getContextFilter()), res)}async function videoPlaylistController (req: express.Request, res: express.Response) {@@ -417,7 +420,7 @@ async function videoPlaylistController (req: express.Request, res: express.Respoconst audience = getAudience(playlist.OwnerAccount.Actor, playlist.privacy === VideoPlaylistPrivacy.PUBLIC)const object = audiencify(json, audience)- return activityPubResponse(activityPubContextify(object, 'Playlist'), res)+ return activityPubResponse(activityPubContextify(object, 'Playlist', getContextFilter()), res)}function videoPlaylistElementController (req: express.Request, res: express.Response) {@@ -426,13 +429,13 @@ function videoPlaylistElementController (req: express.Request, res: express.Respif (redirectIfNotOwned(videoPlaylistElement.url, res)) returnconst json = videoPlaylistElement.toActivityPubObject()- return activityPubResponse(activityPubContextify(json, 'Playlist'), res)+ return activityPubResponse(activityPubContextify(json, 'Playlist', getContextFilter()), res)}function getVideoLocalViewerController (req: express.Request, res: express.Response) {const localViewer = res.locals.localViewerFull- return activityPubResponse(activityPubContextify(localViewer.toActivityPubObject(), 'WatchAction'), res)+ return activityPubResponse(activityPubContextify(localViewer.toActivityPubObject(), 'WatchAction', getContextFilter()), res)}// ---------------------------------------------------------------------------diff --git a/server/controllers/activitypub/inbox.ts b/server/server/controllers/activitypub/inbox.tssimilarity index 91%rename from server/controllers/activitypub/inbox.tsrename to server/server/controllers/activitypub/inbox.tsindex 862c7baf12..6473cea064 100644--- a/server/controllers/activitypub/inbox.ts+++ b/server/server/controllers/activitypub/inbox.ts@@ -1,9 +1,8 @@import express from 'express'-import { InboxManager } from '@server/lib/activitypub/inbox-manager'-import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, RootActivity } from '@shared/models'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { isActivityValid } from '../../helpers/custom-validators/activitypub/activity'-import { logger } from '../../helpers/logger'+import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, HttpStatusCode, RootActivity } from '@peertube/peertube-models'+import { InboxManager } from '@server/lib/activitypub/inbox-manager.js'+import { isActivityValid } from '../../helpers/custom-validators/activitypub/activity.js'+import { logger } from '../../helpers/logger.js'import {activityPubRateLimiter,asyncMiddleware,@@ -12,8 +11,8 @@ import {localAccountValidator,signatureValidator,videoChannelsNameWithHostValidator-} from '../../middlewares'-import { activityPubValidator } from '../../middlewares/validators/activitypub/activity'+} from '../../middlewares/index.js'+import { activityPubValidator } from '../../middlewares/validators/activitypub/activity.js'const inboxRouter = express.Router()diff --git a/server/controllers/activitypub/index.ts b/server/server/controllers/activitypub/index.tssimilarity index 69%rename from server/controllers/activitypub/index.tsrename to server/server/controllers/activitypub/index.tsindex c14d95108e..7057457ee0 100644--- a/server/controllers/activitypub/index.ts+++ b/server/server/controllers/activitypub/index.ts@@ -1,8 +1,8 @@import express from 'express'-import { activityPubClientRouter } from './client'-import { inboxRouter } from './inbox'-import { outboxRouter } from './outbox'+import { activityPubClientRouter } from './client.js'+import { inboxRouter } from './inbox.js'+import { outboxRouter } from './outbox.js'const activityPubRouter = express.Router()diff --git a/server/controllers/activitypub/outbox.ts b/server/server/controllers/activitypub/outbox.tssimilarity index 80%rename from server/controllers/activitypub/outbox.tsrename to server/server/controllers/activitypub/outbox.tsindex 8c88b6971e..7714f8400b 100644--- a/server/controllers/activitypub/outbox.ts+++ b/server/server/controllers/activitypub/outbox.ts@@ -1,22 +1,22 @@import express from 'express'-import { activityPubCollectionPagination } from '@server/lib/activitypub/collection'-import { activityPubContextify } from '@server/lib/activitypub/context'-import { MActorLight } from '@server/types/models'-import { Activity } from '../../../shared/models/activitypub/activity'-import { VideoPrivacy } from '../../../shared/models/videos'-import { logger } from '../../helpers/logger'-import { buildAudience } from '../../lib/activitypub/audience'-import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send'+import { Activity, VideoPrivacy } from '@peertube/peertube-models'+import { activityPubContextify } from '@server/helpers/activity-pub-utils.js'+import { activityPubCollectionPagination } from '@server/lib/activitypub/collection.js'+import { getContextFilter } from '@server/lib/activitypub/context.js'+import { MActorLight } from '@server/types/models/index.js'+import { logger } from '../../helpers/logger.js'+import { buildAudience } from '../../lib/activitypub/audience.js'+import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send/index.js'import {activityPubRateLimiter,asyncMiddleware,ensureIsLocalChannel,localAccountValidator,videoChannelsNameWithHostValidator-} from '../../middlewares'-import { apPaginationValidator } from '../../middlewares/validators/activitypub'-import { VideoModel } from '../../models/video/video'-import { activityPubResponse } from './utils'+} from '../../middlewares/index.js'+import { apPaginationValidator } from '../../middlewares/validators/activitypub/index.js'+import { VideoModel } from '../../models/video/video.js'+import { activityPubResponse } from './utils.js'const outboxRouter = express.Router()@@ -53,7 +53,7 @@ async function outboxController (req: express.Request, res: express.Response) {const handler = (start: number, count: number) => buildActivities(actor, start, count)const json = await activityPubCollectionPagination(actorOutboxUrl, handler, req.query.page, req.query.size)- return activityPubResponse(activityPubContextify(json, 'Collection'), res)+ return activityPubResponse(activityPubContextify(json, 'Collection', getContextFilter()), res)}async function buildActivities (actor: MActorLight, start: number, count: number) {diff --git a/server/controllers/activitypub/utils.ts b/server/server/controllers/activitypub/utils.tssimilarity index 100%rename from server/controllers/activitypub/utils.tsrename to server/server/controllers/activitypub/utils.tsdiff --git a/server/controllers/api/abuse.ts b/server/server/controllers/api/abuse.tssimilarity index 93%rename from server/controllers/api/abuse.tsrename to server/server/controllers/api/abuse.tsindex d582f198d1..78fd514c6a 100644--- a/server/controllers/api/abuse.ts+++ b/server/server/controllers/api/abuse.ts@@ -1,14 +1,14 @@import express from 'express'-import { logger } from '@server/helpers/logger'-import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@server/lib/moderation'-import { Notifier } from '@server/lib/notifier'-import { AbuseModel } from '@server/models/abuse/abuse'-import { AbuseMessageModel } from '@server/models/abuse/abuse-message'-import { getServerActor } from '@server/models/application/application'-import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'-import { AbuseCreate, AbuseState, HttpStatusCode, UserRight } from '@shared/models'-import { getFormattedObjects } from '../../helpers/utils'-import { sequelizeTypescript } from '../../initializers/database'+import { logger } from '@server/helpers/logger.js'+import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@server/lib/moderation.js'+import { Notifier } from '@server/lib/notifier/index.js'+import { AbuseMessageModel } from '@server/models/abuse/abuse-message.js'+import { AbuseModel } from '@server/models/abuse/abuse.js'+import { getServerActor } from '@server/models/application/application.js'+import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils'+import { AbuseCreate, AbuseState, HttpStatusCode, UserRight } from '@peertube/peertube-models'+import { getFormattedObjects } from '../../helpers/utils.js'+import { sequelizeTypescript } from '../../initializers/database.js'import {abuseGetValidator,abuseListForAdminsValidator,@@ -28,8 +28,8 @@ import {paginationValidator,setDefaultPagination,setDefaultSort-} from '../../middlewares'-import { AccountModel } from '../../models/account/account'+} from '../../middlewares/index.js'+import { AccountModel } from '../../models/account/account.js'const abuseRouter = express.Router()diff --git a/server/controllers/api/accounts.ts b/server/server/controllers/api/accounts.tssimilarity index 92%rename from server/controllers/api/accounts.tsrename to server/server/controllers/api/accounts.tsindex 49cd7559af..b5fd4d1336 100644--- a/server/controllers/api/accounts.ts+++ b/server/server/controllers/api/accounts.ts@@ -1,12 +1,12 @@import express from 'express'-import { pickCommonVideoQuery } from '@server/helpers/query'-import { ActorFollowModel } from '@server/models/actor/actor-follow'-import { getServerActor } from '@server/models/application/application'-import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'-import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'-import { getFormattedObjects } from '../../helpers/utils'-import { JobQueue } from '../../lib/job-queue'-import { Hooks } from '../../lib/plugins/hooks'+import { pickCommonVideoQuery } from '@server/helpers/query.js'+import { ActorFollowModel } from '@server/models/actor/actor-follow.js'+import { getServerActor } from '@server/models/application/application.js'+import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync.js'+import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils.js'+import { getFormattedObjects } from '../../helpers/utils.js'+import { JobQueue } from '../../lib/job-queue/index.js'+import { Hooks } from '../../lib/plugins/hooks.js'import {apiRateLimiter,asyncMiddleware,@@ -20,7 +20,7 @@ import {videoPlaylistsSortValidator,videoRatesSortValidator,videoRatingValidator-} from '../../middlewares'+} from '../../middlewares/index.js'import {accountNameWithHostGetValidator,accountsFollowersSortValidator,@@ -31,14 +31,14 @@ import {videoChannelStatsValidator,videoChannelSyncsSortValidator,videosSortValidator-} from '../../middlewares/validators'-import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists'-import { AccountModel } from '../../models/account/account'-import { AccountVideoRateModel } from '../../models/account/account-video-rate'-import { guessAdditionalAttributesFromQuery } from '../../models/video/formatter'-import { VideoModel } from '../../models/video/video'-import { VideoChannelModel } from '../../models/video/video-channel'-import { VideoPlaylistModel } from '../../models/video/video-playlist'+} from '../../middlewares/validators/index.js'+import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists.js'+import { AccountModel } from '../../models/account/account.js'+import { AccountVideoRateModel } from '../../models/account/account-video-rate.js'+import { guessAdditionalAttributesFromQuery } from '../../models/video/formatter/index.js'+import { VideoModel } from '../../models/video/video.js'+import { VideoChannelModel } from '../../models/video/video-channel.js'+import { VideoPlaylistModel } from '../../models/video/video-playlist.js'const accountsRouter = express.Router()diff --git a/server/controllers/api/blocklist.ts b/server/server/controllers/api/blocklist.tssimilarity index 91%rename from server/controllers/api/blocklist.tsrename to server/server/controllers/api/blocklist.tsindex dee12b108c..08049431de 100644--- a/server/controllers/api/blocklist.ts+++ b/server/server/controllers/api/blocklist.ts@@ -1,12 +1,12 @@import express from 'express'-import { handleToNameAndHost } from '@server/helpers/actors'-import { logger } from '@server/helpers/logger'-import { AccountBlocklistModel } from '@server/models/account/account-blocklist'-import { getServerActor } from '@server/models/application/application'-import { ServerBlocklistModel } from '@server/models/server/server-blocklist'-import { MActorAccountId, MUserAccountId } from '@server/types/models'-import { BlockStatus } from '@shared/models'-import { apiRateLimiter, asyncMiddleware, blocklistStatusValidator, optionalAuthenticate } from '../../middlewares'+import { handleToNameAndHost } from '@server/helpers/actors.js'+import { logger } from '@server/helpers/logger.js'+import { AccountBlocklistModel } from '@server/models/account/account-blocklist.js'+import { getServerActor } from '@server/models/application/application.js'+import { ServerBlocklistModel } from '@server/models/server/server-blocklist.js'+import { MActorAccountId, MUserAccountId } from '@server/types/models/index.js'+import { BlockStatus } from '@peertube/peertube-models'+import { apiRateLimiter, asyncMiddleware, blocklistStatusValidator, optionalAuthenticate } from '../../middlewares/index.js'const blocklistRouter = express.Router()diff --git a/server/controllers/api/bulk.ts b/server/server/controllers/api/bulk.tssimilarity index 82%rename from server/controllers/api/bulk.tsrename to server/server/controllers/api/bulk.tsindex c41c7d3787..829482b4a1 100644--- a/server/controllers/api/bulk.ts+++ b/server/server/controllers/api/bulk.ts@@ -1,10 +1,9 @@import express from 'express'-import { removeComment } from '@server/lib/video-comment'-import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk'-import { VideoCommentModel } from '@server/models/video/video-comment'-import { HttpStatusCode } from '@shared/models'-import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'-import { apiRateLimiter, asyncMiddleware, authenticate } from '../../middlewares'+import { BulkRemoveCommentsOfBody, HttpStatusCode } from '@peertube/peertube-models'+import { removeComment } from '@server/lib/video-comment.js'+import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk.js'+import { VideoCommentModel } from '@server/models/video/video-comment.js'+import { apiRateLimiter, asyncMiddleware, authenticate } from '../../middlewares/index.js'const bulkRouter = express.Router()diff --git a/server/controllers/api/config.ts b/server/server/controllers/api/config.tssimilarity index 94%rename from server/controllers/api/config.tsrename to server/server/controllers/api/config.tsindex c5c4c8a747..58469e97c2 100644--- a/server/controllers/api/config.ts+++ b/server/server/controllers/api/config.ts@@ -1,15 +1,15 @@import express from 'express'-import { remove, writeJSON } from 'fs-extra'-import { snakeCase } from 'lodash'+import { remove, writeJSON } from 'fs-extra/esm'+import snakeCase from 'lodash-es/snakeCase.js'import validator from 'validator'-import { ServerConfigManager } from '@server/lib/server-config-manager'-import { About, CustomConfig, UserRight } from '@shared/models'-import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger'-import { objectConverter } from '../../helpers/core-utils'-import { CONFIG, reloadConfig } from '../../initializers/config'-import { ClientHtml } from '../../lib/client-html'-import { apiRateLimiter, asyncMiddleware, authenticate, ensureUserHasRight, openapiOperationDoc } from '../../middlewares'-import { customConfigUpdateValidator, ensureConfigIsEditable } from '../../middlewares/validators/config'+import { ServerConfigManager } from '@server/lib/server-config-manager.js'+import { About, CustomConfig, UserRight } from '@peertube/peertube-models'+import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger.js'+import { objectConverter } from '../../helpers/core-utils.js'+import { CONFIG, reloadConfig } from '../../initializers/config.js'+import { ClientHtml } from '../../lib/client-html.js'+import { apiRateLimiter, asyncMiddleware, authenticate, ensureUserHasRight, openapiOperationDoc } from '../../middlewares/index.js'+import { customConfigUpdateValidator, ensureConfigIsEditable } from '../../middlewares/validators/config.js'const configRouter = express.Router()@@ -93,7 +93,7 @@ async function deleteCustomConfig (req: express.Request, res: express.Response)auditLogger.delete(getAuditIdFromRes(res), new CustomConfigAuditView(customConfig()))- reloadConfig()+ await reloadConfig()ClientHtml.invalidCache()const data = customConfig()@@ -109,7 +109,7 @@ async function updateCustomConfig (req: express.Request, res: express.Response)await writeJSON(CONFIG.CUSTOM_FILE, toUpdateJSON, { spaces: 2 })- reloadConfig()+ await reloadConfig()ClientHtml.invalidCache()const data = customConfig()@@ -368,7 +368,7 @@ function convertCustomConfigBody (body: CustomConfig) {}function valueConverter (v: any) {- if (validator.isNumeric(v + '')) return parseInt('' + v, 10)+ if (validator.default.isNumeric(v + '')) return parseInt('' + v, 10)return v}diff --git a/server/controllers/api/custom-page.ts b/server/server/controllers/api/custom-page.tssimilarity index 90%rename from server/controllers/api/custom-page.tsrename to server/server/controllers/api/custom-page.tsindex f4e1a0e79a..0be8d46c65 100644--- a/server/controllers/api/custom-page.ts+++ b/server/server/controllers/api/custom-page.ts@@ -1,8 +1,8 @@import express from 'express'-import { ServerConfigManager } from '@server/lib/server-config-manager'-import { ActorCustomPageModel } from '@server/models/account/actor-custom-page'-import { HttpStatusCode, UserRight } from '@shared/models'-import { apiRateLimiter, asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'+import { ServerConfigManager } from '@server/lib/server-config-manager.js'+import { ActorCustomPageModel } from '@server/models/account/actor-custom-page.js'+import { HttpStatusCode, UserRight } from '@peertube/peertube-models'+import { apiRateLimiter, asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares/index.js'const customPageRouter = express.Router()diff --git a/server/controllers/api/index.ts b/server/server/controllers/api/index.tssimilarity index 61%rename from server/controllers/api/index.tsrename to server/server/controllers/api/index.tsindex 38bd135d08..cb5d59802b 100644--- a/server/controllers/api/index.ts+++ b/server/server/controllers/api/index.ts@@ -1,26 +1,26 @@import cors from 'cors'import express from 'express'-import { logger } from '@server/helpers/logger'-import { HttpStatusCode } from '../../../shared/models'-import { abuseRouter } from './abuse'-import { accountsRouter } from './accounts'-import { blocklistRouter } from './blocklist'-import { bulkRouter } from './bulk'-import { configRouter } from './config'-import { customPageRouter } from './custom-page'-import { jobsRouter } from './jobs'-import { metricsRouter } from './metrics'-import { oauthClientsRouter } from './oauth-clients'-import { overviewsRouter } from './overviews'-import { pluginRouter } from './plugins'-import { runnersRouter } from './runners'-import { searchRouter } from './search'-import { serverRouter } from './server'-import { usersRouter } from './users'-import { videoChannelRouter } from './video-channel'-import { videoChannelSyncRouter } from './video-channel-sync'-import { videoPlaylistRouter } from './video-playlist'-import { videosRouter } from './videos'+import { logger } from '@server/helpers/logger.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { abuseRouter } from './abuse.js'+import { accountsRouter } from './accounts.js'+import { blocklistRouter } from './blocklist.js'+import { bulkRouter } from './bulk.js'+import { configRouter } from './config.js'+import { customPageRouter } from './custom-page.js'+import { jobsRouter } from './jobs.js'+import { metricsRouter } from './metrics.js'+import { oauthClientsRouter } from './oauth-clients.js'+import { overviewsRouter } from './overviews.js'+import { pluginRouter } from './plugins.js'+import { runnersRouter } from './runners/index.js'+import { searchRouter } from './search/index.js'+import { serverRouter } from './server/index.js'+import { usersRouter } from './users/index.js'+import { videoChannelSyncRouter } from './video-channel-sync.js'+import { videoChannelRouter } from './video-channel.js'+import { videoPlaylistRouter } from './video-playlist.js'+import { videosRouter } from './videos/index.js'const apiRouter = express.Router()diff --git a/server/controllers/api/jobs.ts b/server/server/controllers/api/jobs.tssimilarity index 92%rename from server/controllers/api/jobs.tsrename to server/server/controllers/api/jobs.tsindex c701bc970b..9a86d2a1ea 100644--- a/server/controllers/api/jobs.ts+++ b/server/server/controllers/api/jobs.ts@@ -1,8 +1,8 @@import { Job as BullJob } from 'bullmq'import express from 'express'-import { HttpStatusCode, Job, JobState, JobType, ResultList, UserRight } from '@shared/models'-import { isArray } from '../../helpers/custom-validators/misc'-import { JobQueue } from '../../lib/job-queue'+import { HttpStatusCode, Job, JobState, JobType, ResultList, UserRight } from '@peertube/peertube-models'+import { isArray } from '../../helpers/custom-validators/misc.js'+import { JobQueue } from '../../lib/job-queue/index.js'import {apiRateLimiter,asyncMiddleware,@@ -13,8 +13,8 @@ import {paginationValidatorBuilder,setDefaultPagination,setDefaultSort-} from '../../middlewares'-import { listJobsValidator } from '../../middlewares/validators/jobs'+} from '../../middlewares/index.js'+import { listJobsValidator } from '../../middlewares/validators/jobs.js'const jobsRouter = express.Router()diff --git a/server/controllers/api/metrics.ts b/server/server/controllers/api/metrics.tssimilarity index 82%rename from server/controllers/api/metrics.tsrename to server/server/controllers/api/metrics.tsindex 909963fa7a..42299817fe 100644--- a/server/controllers/api/metrics.ts+++ b/server/server/controllers/api/metrics.ts@@ -1,8 +1,8 @@import express from 'express'-import { CONFIG } from '@server/initializers/config'-import { OpenTelemetryMetrics } from '@server/lib/opentelemetry/metrics'-import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models'-import { addPlaybackMetricValidator, apiRateLimiter, asyncMiddleware } from '../../middlewares'+import { CONFIG } from '@server/initializers/config.js'+import { OpenTelemetryMetrics } from '@server/lib/opentelemetry/metrics.js'+import { HttpStatusCode, PlaybackMetricCreate } from '@peertube/peertube-models'+import { addPlaybackMetricValidator, apiRateLimiter, asyncMiddleware } from '../../middlewares/index.js'const metricsRouter = express.Router()diff --git a/server/controllers/api/oauth-clients.ts b/server/server/controllers/api/oauth-clients.tssimilarity index 84%rename from server/controllers/api/oauth-clients.tsrename to server/server/controllers/api/oauth-clients.tsindex 1899dbb025..a9ed9e3309 100644--- a/server/controllers/api/oauth-clients.ts+++ b/server/server/controllers/api/oauth-clients.ts@@ -1,10 +1,10 @@import express from 'express'-import { isTestOrDevInstance } from '@server/helpers/core-utils'-import { OAuthClientModel } from '@server/models/oauth/oauth-client'-import { HttpStatusCode, OAuthClientLocal } from '@shared/models'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { apiRateLimiter, asyncMiddleware, openapiOperationDoc } from '../../middlewares'+import { HttpStatusCode, OAuthClientLocal } from '@peertube/peertube-models'+import { isTestOrDevInstance } from '@peertube/peertube-node-utils'+import { OAuthClientModel } from '@server/models/oauth/oauth-client.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { apiRateLimiter, asyncMiddleware, openapiOperationDoc } from '../../middlewares/index.js'const oauthClientsRouter = express.Router()diff --git a/server/controllers/api/overviews.ts b/server/server/controllers/api/overviews.tssimilarity index 90%rename from server/controllers/api/overviews.tsrename to server/server/controllers/api/overviews.tsindex fc616281e3..a34669662d 100644--- a/server/controllers/api/overviews.ts+++ b/server/server/controllers/api/overviews.ts@@ -1,14 +1,14 @@import express from 'express'import memoizee from 'memoizee'-import { logger } from '@server/helpers/logger'-import { Hooks } from '@server/lib/plugins/hooks'-import { getServerActor } from '@server/models/application/application'-import { VideoModel } from '@server/models/video/video'-import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews'-import { buildNSFWFilter } from '../../helpers/express-utils'-import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants'-import { apiRateLimiter, asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares'-import { TagModel } from '../../models/video/tag'+import { logger } from '@server/helpers/logger.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { getServerActor } from '@server/models/application/application.js'+import { VideoModel } from '@server/models/video/video.js'+import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '@peertube/peertube-models'+import { buildNSFWFilter } from '../../helpers/express-utils.js'+import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants.js'+import { apiRateLimiter, asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares/index.js'+import { TagModel } from '../../models/video/tag.js'const overviewsRouter = express.Router()diff --git a/server/controllers/api/plugins.ts b/server/server/controllers/api/plugins.tssimilarity index 95%rename from server/controllers/api/plugins.tsrename to server/server/controllers/api/plugins.tsindex 337b72b2f2..85e458c9ea 100644--- a/server/controllers/api/plugins.ts+++ b/server/server/controllers/api/plugins.ts@@ -1,8 +1,8 @@import express from 'express'-import { logger } from '@server/helpers/logger'-import { getFormattedObjects } from '@server/helpers/utils'-import { listAvailablePluginsFromIndex } from '@server/lib/plugins/plugin-index'-import { PluginManager } from '@server/lib/plugins/plugin-manager'+import { logger } from '@server/helpers/logger.js'+import { getFormattedObjects } from '@server/helpers/utils.js'+import { listAvailablePluginsFromIndex } from '@server/lib/plugins/plugin-index.js'+import { PluginManager } from '@server/lib/plugins/plugin-manager.js'import {apiRateLimiter,asyncMiddleware,@@ -14,7 +14,7 @@ import {pluginsSortValidator,setDefaultPagination,setDefaultSort-} from '@server/middlewares'+} from '@server/middlewares/index.js'import {existingPluginValidator,installOrUpdatePluginValidator,@@ -22,8 +22,8 @@ import {listPluginsValidator,uninstallPluginValidator,updatePluginSettingsValidator-} from '@server/middlewares/validators/plugins'-import { PluginModel } from '@server/models/server/plugin'+} from '@server/middlewares/validators/plugins.js'+import { PluginModel } from '@server/models/server/plugin.js'import {HttpStatusCode,InstallOrUpdatePlugin,@@ -32,7 +32,7 @@ import {PublicServerSetting,RegisteredServerSettings,UserRight-} from '@shared/models'+} from '@peertube/peertube-models'const pluginRouter = express.Router()diff --git a/server/controllers/api/runners/index.ts b/server/server/controllers/api/runners/index.tssimilarity index 74%rename from server/controllers/api/runners/index.tsrename to server/server/controllers/api/runners/index.tsindex 9998fe4cc0..b5cec3d1af 100644--- a/server/controllers/api/runners/index.ts+++ b/server/server/controllers/api/runners/index.ts@@ -1,8 +1,8 @@import express from 'express'-import { runnerJobsRouter } from './jobs'-import { runnerJobFilesRouter } from './jobs-files'-import { manageRunnersRouter } from './manage-runners'-import { runnerRegistrationTokensRouter } from './registration-tokens'+import { runnerJobsRouter } from './jobs.js'+import { runnerJobFilesRouter } from './jobs-files.js'+import { manageRunnersRouter } from './manage-runners.js'+import { runnerRegistrationTokensRouter } from './registration-tokens.js'const runnersRouter = express.Router()diff --git a/server/controllers/api/runners/jobs-files.ts b/server/server/controllers/api/runners/jobs-files.tssimilarity index 92%rename from server/controllers/api/runners/jobs-files.tsrename to server/server/controllers/api/runners/jobs-files.tsindex d28f437013..91a7302b87 100644--- a/server/controllers/api/runners/jobs-files.ts+++ b/server/server/controllers/api/runners/jobs-files.ts@@ -1,15 +1,15 @@import express from 'express'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { proxifyHLS, proxifyWebVideoFile } from '@server/lib/object-storage'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { getStudioTaskFilePath } from '@server/lib/video-studio'-import { apiRateLimiter, asyncMiddleware } from '@server/middlewares'-import { jobOfRunnerGetValidatorFactory } from '@server/middlewares/validators/runners'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { proxifyHLS, proxifyWebVideoFile } from '@server/lib/object-storage/index.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { getStudioTaskFilePath } from '@server/lib/video-studio.js'+import { apiRateLimiter, asyncMiddleware } from '@server/middlewares/index.js'+import { jobOfRunnerGetValidatorFactory } from '@server/middlewares/validators/runners/index.js'import {runnerJobGetVideoStudioTaskFileValidator,runnerJobGetVideoTranscodingFileValidator-} from '@server/middlewares/validators/runners/job-files'-import { RunnerJobState, VideoStorage } from '@shared/models'+} from '@server/middlewares/validators/runners/job-files.js'+import { RunnerJobState, VideoStorage } from '@peertube/peertube-models'const lTags = loggerTagsFactory('api', 'runner')diff --git a/server/controllers/api/runners/jobs.ts b/server/server/controllers/api/runners/jobs.tssimilarity index 96%rename from server/controllers/api/runners/jobs.tsrename to server/server/controllers/api/runners/jobs.tsindex e9e2ddf499..c7aada7c24 100644--- a/server/controllers/api/runners/jobs.ts+++ b/server/server/controllers/api/runners/jobs.ts@@ -1,11 +1,11 @@import express, { UploadFiles } from 'express'-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { createReqFiles } from '@server/helpers/express-utils'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { generateRunnerJobToken } from '@server/helpers/token-generator'-import { MIMETYPES } from '@server/initializers/constants'-import { sequelizeTypescript } from '@server/initializers/database'-import { getRunnerJobHandlerClass, runnerJobCanBeCancelled, updateLastRunnerContact } from '@server/lib/runners'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { createReqFiles } from '@server/helpers/express-utils.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { generateRunnerJobToken } from '@server/helpers/token-generator.js'+import { MIMETYPES } from '@server/initializers/constants.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { getRunnerJobHandlerClass, runnerJobCanBeCancelled, updateLastRunnerContact } from '@server/lib/runners/index.js'import {apiRateLimiter,asyncMiddleware,@@ -15,7 +15,7 @@ import {runnerJobsSortValidator,setDefaultPagination,setDefaultSort-} from '@server/middlewares'+} from '@server/middlewares/index.js'import {abortRunnerJobValidator,acceptRunnerJobValidator,@@ -27,9 +27,9 @@ import {runnerJobGetValidator,successRunnerJobValidator,updateRunnerJobValidator-} from '@server/middlewares/validators/runners'-import { RunnerModel } from '@server/models/runner/runner'-import { RunnerJobModel } from '@server/models/runner/runner-job'+} from '@server/middlewares/validators/runners/index.js'+import { RunnerModel } from '@server/models/runner/runner.js'+import { RunnerJobModel } from '@server/models/runner/runner-job.js'import {AbortRunnerJobBody,AcceptRunnerJobResult,@@ -50,7 +50,7 @@ import {VODAudioMergeTranscodingSuccess,VODHLSTranscodingSuccess,VODWebVideoTranscodingSuccess-} from '@shared/models'+} from '@peertube/peertube-models'const postRunnerJobSuccessVideoFiles = createReqFiles([ 'payload[videoFile]', 'payload[resolutionPlaylistFile]' ],diff --git a/server/controllers/api/runners/manage-runners.ts b/server/server/controllers/api/runners/manage-runners.tssimilarity index 90%rename from server/controllers/api/runners/manage-runners.tsrename to server/server/controllers/api/runners/manage-runners.tsindex be7ebc0b3f..fb2199bea7 100644--- a/server/controllers/api/runners/manage-runners.ts+++ b/server/server/controllers/api/runners/manage-runners.ts@@ -1,6 +1,7 @@import express from 'express'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { generateRunnerToken } from '@server/helpers/token-generator'+import { HttpStatusCode, ListRunnersQuery, RegisterRunnerBody, UserRight } from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { generateRunnerToken } from '@server/helpers/token-generator.js'import {apiRateLimiter,asyncMiddleware,@@ -10,10 +11,13 @@ import {runnersSortValidator,setDefaultPagination,setDefaultSort-} from '@server/middlewares'-import { deleteRunnerValidator, getRunnerFromTokenValidator, registerRunnerValidator } from '@server/middlewares/validators/runners'-import { RunnerModel } from '@server/models/runner/runner'-import { HttpStatusCode, ListRunnersQuery, RegisterRunnerBody, UserRight } from '@shared/models'+} from '@server/middlewares/index.js'+import {+ deleteRunnerValidator,+ getRunnerFromTokenValidator,+ registerRunnerValidator+} from '@server/middlewares/validators/runners/index.js'+import { RunnerModel } from '@server/models/runner/runner.js'const lTags = loggerTagsFactory('api', 'runner')diff --git a/server/controllers/api/runners/registration-tokens.ts b/server/server/controllers/api/runners/registration-tokens.tssimilarity index 93%rename from server/controllers/api/runners/registration-tokens.tsrename to server/server/controllers/api/runners/registration-tokens.tsindex 117ff271bb..462c489bbf 100644--- a/server/controllers/api/runners/registration-tokens.ts+++ b/server/server/controllers/api/runners/registration-tokens.ts@@ -1,6 +1,6 @@import express from 'express'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { generateRunnerRegistrationToken } from '@server/helpers/token-generator'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { generateRunnerRegistrationToken } from '@server/helpers/token-generator.js'import {apiRateLimiter,asyncMiddleware,@@ -10,10 +10,10 @@ import {runnerRegistrationTokensSortValidator,setDefaultPagination,setDefaultSort-} from '@server/middlewares'-import { deleteRegistrationTokenValidator } from '@server/middlewares/validators/runners'-import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token'-import { HttpStatusCode, ListRunnerRegistrationTokensQuery, UserRight } from '@shared/models'+} from '@server/middlewares/index.js'+import { deleteRegistrationTokenValidator } from '@server/middlewares/validators/runners/index.js'+import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token.js'+import { HttpStatusCode, ListRunnerRegistrationTokensQuery, UserRight } from '@peertube/peertube-models'const lTags = loggerTagsFactory('api', 'runner')diff --git a/server/controllers/api/search/index.ts b/server/server/controllers/api/search/index.tssimilarity index 57%rename from server/controllers/api/search/index.tsrename to server/server/controllers/api/search/index.tsindex 4d395161c9..f1a1f493f9 100644--- a/server/controllers/api/search/index.ts+++ b/server/server/controllers/api/search/index.ts@@ -1,8 +1,8 @@import express from 'express'-import { apiRateLimiter } from '@server/middlewares'-import { searchChannelsRouter } from './search-video-channels'-import { searchPlaylistsRouter } from './search-video-playlists'-import { searchVideosRouter } from './search-videos'+import { apiRateLimiter } from '@server/middlewares/index.js'+import { searchChannelsRouter } from './search-video-channels.js'+import { searchPlaylistsRouter } from './search-video-playlists.js'+import { searchVideosRouter } from './search-videos.js'const searchRouter = express.Router()diff --git a/server/controllers/api/search/search-video-channels.ts b/server/server/controllers/api/search/search-video-channels.tssimilarity index 83%rename from server/controllers/api/search/search-video-channels.tsrename to server/server/controllers/api/search/search-video-channels.tsindex 1d2a9d2352..cccc3b3dc5 100644--- a/server/controllers/api/search/search-video-channels.ts+++ b/server/server/controllers/api/search/search-video-channels.ts@@ -1,19 +1,18 @@import express from 'express'-import { sanitizeUrl } from '@server/helpers/core-utils'-import { pickSearchChannelQuery } from '@server/helpers/query'-import { doJSONRequest } from '@server/helpers/requests'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { findLatestAPRedirection } from '@server/lib/activitypub/activity'-import { Hooks } from '@server/lib/plugins/hooks'-import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'-import { getServerActor } from '@server/models/application/application'-import { HttpStatusCode, ResultList, VideoChannel } from '@shared/models'-import { VideoChannelsSearchQueryAfterSanitize } from '../../../../shared/models/search'-import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'-import { logger } from '../../../helpers/logger'-import { getFormattedObjects } from '../../../helpers/utils'-import { getOrCreateAPActor, loadActorUrlOrGetFromWebfinger } from '../../../lib/activitypub/actors'+import { sanitizeUrl } from '@server/helpers/core-utils.js'+import { pickSearchChannelQuery } from '@server/helpers/query.js'+import { doJSONRequest } from '@server/helpers/requests.js'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { findLatestAPRedirection } from '@server/lib/activitypub/activity.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search.js'+import { getServerActor } from '@server/models/application/application.js'+import { HttpStatusCode, ResultList, VideoChannel, VideoChannelsSearchQueryAfterSanitize } from '@peertube/peertube-models'+import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils.js'+import { logger } from '../../../helpers/logger.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { getOrCreateAPActor, loadActorUrlOrGetFromWebfinger } from '../../../lib/activitypub/actors/index.js'import {asyncMiddleware,openapiOperationDoc,@@ -23,10 +22,10 @@ import {setDefaultSearchSort,videoChannelsListSearchValidator,videoChannelsSearchSortValidator-} from '../../../middlewares'-import { VideoChannelModel } from '../../../models/video/video-channel'-import { MChannelAccountDefault } from '../../../types/models'-import { searchLocalUrl } from './shared'+} from '../../../middlewares/index.js'+import { VideoChannelModel } from '../../../models/video/video-channel.js'+import { MChannelAccountDefault } from '../../../types/models/index.js'+import { searchLocalUrl } from './shared/index.js'const searchChannelsRouter = express.Router()diff --git a/server/controllers/api/search/search-video-playlists.ts b/server/server/controllers/api/search/search-video-playlists.tssimilarity index 83%rename from server/controllers/api/search/search-video-playlists.tsrename to server/server/controllers/api/search/search-video-playlists.tsindex 97aeeaba94..4c0f98cf2e 100644--- a/server/controllers/api/search/search-video-playlists.ts+++ b/server/server/controllers/api/search/search-video-playlists.ts@@ -1,20 +1,20 @@import express from 'express'-import { sanitizeUrl } from '@server/helpers/core-utils'-import { isUserAbleToSearchRemoteURI } from '@server/helpers/express-utils'-import { logger } from '@server/helpers/logger'-import { pickSearchPlaylistQuery } from '@server/helpers/query'-import { doJSONRequest } from '@server/helpers/requests'-import { getFormattedObjects } from '@server/helpers/utils'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { findLatestAPRedirection } from '@server/lib/activitypub/activity'-import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get'-import { Hooks } from '@server/lib/plugins/hooks'-import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'-import { getServerActor } from '@server/models/application/application'-import { VideoPlaylistModel } from '@server/models/video/video-playlist'-import { MVideoPlaylistFullSummary } from '@server/types/models'-import { HttpStatusCode, ResultList, VideoPlaylist, VideoPlaylistsSearchQueryAfterSanitize } from '@shared/models'+import { sanitizeUrl } from '@server/helpers/core-utils.js'+import { isUserAbleToSearchRemoteURI } from '@server/helpers/express-utils.js'+import { logger } from '@server/helpers/logger.js'+import { pickSearchPlaylistQuery } from '@server/helpers/query.js'+import { doJSONRequest } from '@server/helpers/requests.js'+import { getFormattedObjects } from '@server/helpers/utils.js'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { findLatestAPRedirection } from '@server/lib/activitypub/activity.js'+import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search.js'+import { getServerActor } from '@server/models/application/application.js'+import { VideoPlaylistModel } from '@server/models/video/video-playlist.js'+import { MVideoPlaylistFullSummary } from '@server/types/models/index.js'+import { HttpStatusCode, ResultList, VideoPlaylist, VideoPlaylistsSearchQueryAfterSanitize } from '@peertube/peertube-models'import {asyncMiddleware,openapiOperationDoc,@@ -24,8 +24,8 @@ import {setDefaultSearchSort,videoPlaylistsListSearchValidator,videoPlaylistsSearchSortValidator-} from '../../../middlewares'-import { searchLocalUrl } from './shared'+} from '../../../middlewares/index.js'+import { searchLocalUrl } from './shared/index.js'const searchPlaylistsRouter = express.Router()diff --git a/server/controllers/api/search/search-videos.ts b/server/server/controllers/api/search/search-videos.tssimilarity index 83%rename from server/controllers/api/search/search-videos.tsrename to server/server/controllers/api/search/search-videos.tsindex b330643358..a6700ed7d5 100644--- a/server/controllers/api/search/search-videos.ts+++ b/server/server/controllers/api/search/search-videos.ts@@ -1,19 +1,18 @@import express from 'express'-import { sanitizeUrl } from '@server/helpers/core-utils'-import { pickSearchVideoQuery } from '@server/helpers/query'-import { doJSONRequest } from '@server/helpers/requests'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { findLatestAPRedirection } from '@server/lib/activitypub/activity'-import { getOrCreateAPVideo } from '@server/lib/activitypub/videos'-import { Hooks } from '@server/lib/plugins/hooks'-import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'-import { getServerActor } from '@server/models/application/application'-import { HttpStatusCode, ResultList, Video } from '@shared/models'-import { VideosSearchQueryAfterSanitize } from '../../../../shared/models/search'-import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'-import { logger } from '../../../helpers/logger'-import { getFormattedObjects } from '../../../helpers/utils'+import { sanitizeUrl } from '@server/helpers/core-utils.js'+import { pickSearchVideoQuery } from '@server/helpers/query.js'+import { doJSONRequest } from '@server/helpers/requests.js'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { findLatestAPRedirection } from '@server/lib/activitypub/activity.js'+import { getOrCreateAPVideo } from '@server/lib/activitypub/videos/index.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search.js'+import { getServerActor } from '@server/models/application/application.js'+import { HttpStatusCode, ResultList, Video, VideosSearchQueryAfterSanitize } from '@peertube/peertube-models'+import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils.js'+import { logger } from '../../../helpers/logger.js'+import { getFormattedObjects } from '../../../helpers/utils.js'import {asyncMiddleware,commonVideosFiltersValidator,@@ -24,11 +23,11 @@ import {setDefaultSearchSort,videosSearchSortValidator,videosSearchValidator-} from '../../../middlewares'-import { guessAdditionalAttributesFromQuery } from '../../../models/video/formatter'-import { VideoModel } from '../../../models/video/video'-import { MVideoAccountLightBlacklistAllFiles } from '../../../types/models'-import { searchLocalUrl } from './shared'+} from '../../../middlewares/index.js'+import { guessAdditionalAttributesFromQuery } from '../../../models/video/formatter/index.js'+import { VideoModel } from '../../../models/video/video.js'+import { MVideoAccountLightBlacklistAllFiles } from '../../../types/models/index.js'+import { searchLocalUrl } from './shared/index.js'const searchVideosRouter = express.Router()diff --git a/server/server/controllers/api/search/shared/index.ts b/server/server/controllers/api/search/shared/index.tsnew file mode 100644index 0000000000..84814912c5--- /dev/null+++ b/server/server/controllers/api/search/shared/index.ts@@ -0,0 +1 @@+export * from './utils.js'diff --git a/server/controllers/api/search/shared/utils.ts b/server/server/controllers/api/search/shared/utils.tssimilarity index 100%rename from server/controllers/api/search/shared/utils.tsrename to server/server/controllers/api/search/shared/utils.tsdiff --git a/server/controllers/api/server/contact.ts b/server/server/controllers/api/server/contact.tssimilarity index 71%rename from server/controllers/api/server/contact.tsrename to server/server/controllers/api/server/contact.tsindex 56596bea5e..53e73fa2b6 100644--- a/server/controllers/api/server/contact.ts+++ b/server/server/controllers/api/server/contact.ts@@ -1,10 +1,9 @@-import { logger } from '@server/helpers/logger'import express from 'express'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { ContactForm } from '../../../../shared/models/server'-import { Emailer } from '../../../lib/emailer'-import { Redis } from '../../../lib/redis'-import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares'+import { ContactForm, HttpStatusCode } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { Emailer } from '../../../lib/emailer.js'+import { Redis } from '../../../lib/redis.js'+import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares/index.js'const contactRouter = express.Router()diff --git a/server/controllers/api/server/debug.ts b/server/server/controllers/api/server/debug.tssimilarity index 83%rename from server/controllers/api/server/debug.tsrename to server/server/controllers/api/server/debug.tsindex f3792bfc81..338a1214fd 100644--- a/server/controllers/api/server/debug.ts+++ b/server/server/controllers/api/server/debug.ts@@ -1,14 +1,12 @@import express from 'express'-import { InboxManager } from '@server/lib/activitypub/inbox-manager'-import { RemoveDanglingResumableUploadsScheduler } from '@server/lib/schedulers/remove-dangling-resumable-uploads-scheduler'-import { VideoViewsBufferScheduler } from '@server/lib/schedulers/video-views-buffer-scheduler'-import { VideoViewsManager } from '@server/lib/views/video-views-manager'-import { Debug, SendDebugCommand } from '@shared/models'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { UserRight } from '../../../../shared/models/users'-import { authenticate, ensureUserHasRight } from '../../../middlewares'-import { VideoChannelSyncLatestScheduler } from '@server/lib/schedulers/video-channel-sync-latest-scheduler'-import { UpdateVideosScheduler } from '@server/lib/schedulers/update-videos-scheduler'+import { Debug, HttpStatusCode, SendDebugCommand, UserRight } from '@peertube/peertube-models'+import { InboxManager } from '@server/lib/activitypub/inbox-manager.js'+import { RemoveDanglingResumableUploadsScheduler } from '@server/lib/schedulers/remove-dangling-resumable-uploads-scheduler.js'+import { UpdateVideosScheduler } from '@server/lib/schedulers/update-videos-scheduler.js'+import { VideoChannelSyncLatestScheduler } from '@server/lib/schedulers/video-channel-sync-latest-scheduler.js'+import { VideoViewsBufferScheduler } from '@server/lib/schedulers/video-views-buffer-scheduler.js'+import { VideoViewsManager } from '@server/lib/views/video-views-manager.js'+import { authenticate, ensureUserHasRight } from '../../../middlewares/index.js'const debugRouter = express.Router()diff --git a/server/controllers/api/server/follows.ts b/server/server/controllers/api/server/follows.tssimilarity index 92%rename from server/controllers/api/server/follows.tsrename to server/server/controllers/api/server/follows.tsindex 87828813a7..d7f84053a3 100644--- a/server/controllers/api/server/follows.ts+++ b/server/server/controllers/api/server/follows.ts@@ -1,16 +1,14 @@import express from 'express'-import { getServerActor } from '@server/models/application/application'-import { ServerFollowCreate } from '@shared/models'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { UserRight } from '../../../../shared/models/users'-import { logger } from '../../../helpers/logger'-import { getFormattedObjects } from '../../../helpers/utils'-import { SERVER_ACTOR_NAME } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow'-import { sendAccept, sendReject, sendUndoFollow } from '../../../lib/activitypub/send'-import { JobQueue } from '../../../lib/job-queue'-import { removeRedundanciesOfServer } from '../../../lib/redundancy'+import { HttpStatusCode, ServerFollowCreate, UserRight } from '@peertube/peertube-models'+import { getServerActor } from '@server/models/application/application.js'+import { logger } from '../../../helpers/logger.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { SERVER_ACTOR_NAME } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow.js'+import { sendAccept, sendReject, sendUndoFollow } from '../../../lib/activitypub/send/index.js'+import { JobQueue } from '../../../lib/job-queue/index.js'+import { removeRedundanciesOfServer } from '../../../lib/redundancy.js'import {asyncMiddleware,authenticate,@@ -19,7 +17,7 @@ import {setBodyHostsPort,setDefaultPagination,setDefaultSort-} from '../../../middlewares'+} from '../../../middlewares/index.js'import {acceptFollowerValidator,followValidator,@@ -29,8 +27,8 @@ import {listFollowsValidator,rejectFollowerValidator,removeFollowingValidator-} from '../../../middlewares/validators'-import { ActorFollowModel } from '../../../models/actor/actor-follow'+} from '../../../middlewares/validators/index.js'+import { ActorFollowModel } from '../../../models/actor/actor-follow.js'const serverFollowsRouter = express.Router()serverFollowsRouter.get('/following',diff --git a/server/controllers/api/server/index.ts b/server/server/controllers/api/server/index.tssimilarity index 54%rename from server/controllers/api/server/index.tsrename to server/server/controllers/api/server/index.tsindex 57f7d601c3..e3df8889bc 100644--- a/server/controllers/api/server/index.ts+++ b/server/server/controllers/api/server/index.ts@@ -1,12 +1,12 @@import express from 'express'-import { apiRateLimiter } from '@server/middlewares'-import { contactRouter } from './contact'-import { debugRouter } from './debug'-import { serverFollowsRouter } from './follows'-import { logsRouter } from './logs'-import { serverRedundancyRouter } from './redundancy'-import { serverBlocklistRouter } from './server-blocklist'-import { statsRouter } from './stats'+import { apiRateLimiter } from '@server/middlewares/index.js'+import { contactRouter } from './contact.js'+import { debugRouter } from './debug.js'+import { serverFollowsRouter } from './follows.js'+import { logsRouter } from './logs.js'+import { serverRedundancyRouter } from './redundancy.js'+import { serverBlocklistRouter } from './server-blocklist.js'+import { statsRouter } from './stats.js'const serverRouter = express.Router()diff --git a/server/controllers/api/server/logs.ts b/server/server/controllers/api/server/logs.tssimilarity index 89%rename from server/controllers/api/server/logs.tsrename to server/server/controllers/api/server/logs.tsindex ed0aa6e8e7..1ebf8053c5 100644--- a/server/controllers/api/server/logs.ts+++ b/server/server/controllers/api/server/logs.ts@@ -1,16 +1,14 @@import express from 'express'-import { readdir, readFile } from 'fs-extra'+import { readdir, readFile } from 'fs/promises'import { join } from 'path'-import { isArray } from '@server/helpers/custom-validators/misc'-import { logger, mtimeSortFilesDesc } from '@server/helpers/logger'-import { pick } from '@shared/core-utils'-import { ClientLogCreate, HttpStatusCode } from '@shared/models'-import { ServerLogLevel } from '../../../../shared/models/server/server-log-level.type'-import { UserRight } from '../../../../shared/models/users'-import { CONFIG } from '../../../initializers/config'-import { AUDIT_LOG_FILENAME, LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers/constants'-import { asyncMiddleware, authenticate, buildRateLimiter, ensureUserHasRight, optionalAuthenticate } from '../../../middlewares'-import { createClientLogValidator, getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs'+import { pick } from '@peertube/peertube-core-utils'+import { ClientLogCreate, HttpStatusCode, ServerLogLevel, UserRight } from '@peertube/peertube-models'+import { isArray } from '@server/helpers/custom-validators/misc.js'+import { logger, mtimeSortFilesDesc } from '@server/helpers/logger.js'+import { CONFIG } from '../../../initializers/config.js'+import { AUDIT_LOG_FILENAME, LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers/constants.js'+import { asyncMiddleware, authenticate, buildRateLimiter, ensureUserHasRight, optionalAuthenticate } from '../../../middlewares/index.js'+import { createClientLogValidator, getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs.js'const createClientLogRateLimiter = buildRateLimiter({windowMs: CONFIG.RATES_LIMIT.RECEIVE_CLIENT_LOG.WINDOW_MS,diff --git a/server/controllers/api/server/redundancy.ts b/server/server/controllers/api/server/redundancy.tssimilarity index 89%rename from server/controllers/api/server/redundancy.tsrename to server/server/controllers/api/server/redundancy.tsindex 94e187cd42..e16f855933 100644--- a/server/controllers/api/server/redundancy.ts+++ b/server/server/controllers/api/server/redundancy.ts@@ -1,10 +1,9 @@import express from 'express'-import { JobQueue } from '@server/lib/job-queue'-import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { UserRight } from '../../../../shared/models/users'-import { logger } from '../../../helpers/logger'-import { removeRedundanciesOfServer, removeVideoRedundancy } from '../../../lib/redundancy'+import { HttpStatusCode, UserRight } from '@peertube/peertube-models'+import { JobQueue } from '@server/lib/job-queue/index.js'+import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy.js'+import { logger } from '../../../helpers/logger.js'+import { removeRedundanciesOfServer, removeVideoRedundancy } from '../../../lib/redundancy.js'import {asyncMiddleware,authenticate,@@ -13,13 +12,13 @@ import {setDefaultPagination,setDefaultVideoRedundanciesSort,videoRedundanciesSortValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'import {addVideoRedundancyValidator,listVideoRedundanciesValidator,removeVideoRedundancyValidator,updateServerRedundancyValidator-} from '../../../middlewares/validators/redundancy'+} from '../../../middlewares/validators/redundancy.js'const serverRedundancyRouter = express.Router()diff --git a/server/controllers/api/server/server-blocklist.ts b/server/server/controllers/api/server/server-blocklist.tssimilarity index 89%rename from server/controllers/api/server/server-blocklist.tsrename to server/server/controllers/api/server/server-blocklist.tsindex 740f95da3d..9ca7ec03e6 100644--- a/server/controllers/api/server/server-blocklist.ts+++ b/server/server/controllers/api/server/server-blocklist.ts@@ -1,12 +1,16 @@import 'multer'import express from 'express'-import { logger } from '@server/helpers/logger'-import { getServerActor } from '@server/models/application/application'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { UserRight } from '../../../../shared/models/users'-import { getFormattedObjects } from '../../../helpers/utils'-import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'+import { HttpStatusCode, UserRight } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { getServerActor } from '@server/models/application/application.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import {+ addAccountInBlocklist,+ addServerInBlocklist,+ removeAccountFromBlocklist,+ removeServerFromBlocklist+} from '../../../lib/blocklist.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -15,7 +19,7 @@ import {paginationValidator,setDefaultPagination,setDefaultSort-} from '../../../middlewares'+} from '../../../middlewares/index.js'import {accountsBlocklistSortValidator,blockAccountValidator,@@ -23,9 +27,9 @@ import {serversBlocklistSortValidator,unblockAccountByServerValidator,unblockServerByServerValidator-} from '../../../middlewares/validators'-import { AccountBlocklistModel } from '../../../models/account/account-blocklist'-import { ServerBlocklistModel } from '../../../models/server/server-blocklist'+} from '../../../middlewares/validators/index.js'+import { AccountBlocklistModel } from '../../../models/account/account-blocklist.js'+import { ServerBlocklistModel } from '../../../models/server/server-blocklist.js'const serverBlocklistRouter = express.Router()diff --git a/server/controllers/api/server/stats.ts b/server/server/controllers/api/server/stats.tssimilarity index 69%rename from server/controllers/api/server/stats.tsrename to server/server/controllers/api/server/stats.tsindex 2ab398f4de..5a5f70f02c 100644--- a/server/controllers/api/server/stats.ts+++ b/server/server/controllers/api/server/stats.ts@@ -1,9 +1,9 @@import express from 'express'-import { StatsManager } from '@server/lib/stat-manager'-import { ROUTE_CACHE_LIFETIME } from '../../../initializers/constants'-import { asyncMiddleware } from '../../../middlewares'-import { cacheRoute } from '../../../middlewares/cache/cache'-import { Hooks } from '@server/lib/plugins/hooks'+import { StatsManager } from '@server/lib/stat-manager.js'+import { ROUTE_CACHE_LIFETIME } from '../../../initializers/constants.js'+import { asyncMiddleware } from '../../../middlewares/index.js'+import { cacheRoute } from '../../../middlewares/cache/cache.js'+import { Hooks } from '@server/lib/plugins/hooks.js'const statsRouter = express.Router()diff --git a/server/controllers/api/users/email-verification.ts b/server/server/controllers/api/users/email-verification.tssimilarity index 90%rename from server/controllers/api/users/email-verification.tsrename to server/server/controllers/api/users/email-verification.tsindex 230aaa9af7..ef9dc30b6a 100644--- a/server/controllers/api/users/email-verification.ts+++ b/server/server/controllers/api/users/email-verification.ts@@ -1,13 +1,13 @@import express from 'express'-import { HttpStatusCode } from '@shared/models'-import { CONFIG } from '../../../initializers/config'-import { sendVerifyRegistrationEmail, sendVerifyUserEmail } from '../../../lib/user'-import { asyncMiddleware, buildRateLimiter } from '../../../middlewares'+import { HttpStatusCode } from '@peertube/peertube-models'+import { CONFIG } from '../../../initializers/config.js'+import { sendVerifyRegistrationEmail, sendVerifyUserEmail } from '../../../lib/user.js'+import { asyncMiddleware, buildRateLimiter } from '../../../middlewares/index.js'import {registrationVerifyEmailValidator,usersAskSendVerifyEmailValidator,usersVerifyEmailValidator-} from '../../../middlewares/validators'+} from '../../../middlewares/validators/index.js'const askSendEmailLimiter = buildRateLimiter({windowMs: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.WINDOW_MS,diff --git a/server/controllers/api/users/index.ts b/server/server/controllers/api/users/index.tssimilarity index 88%rename from server/controllers/api/users/index.tsrename to server/server/controllers/api/users/index.tsindex 5eac6fd0f6..e5290fe25c 100644--- a/server/controllers/api/users/index.ts+++ b/server/server/controllers/api/users/index.ts@@ -1,18 +1,18 @@import express from 'express'-import { tokensRouter } from '@server/controllers/api/users/token'-import { Hooks } from '@server/lib/plugins/hooks'-import { OAuthTokenModel } from '@server/models/oauth/oauth-token'-import { MUserAccountDefault } from '@server/types/models'-import { pick } from '@shared/core-utils'-import { HttpStatusCode, UserCreate, UserCreateResult, UserRight, UserUpdate } from '@shared/models'-import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger'-import { logger } from '../../../helpers/logger'-import { generateRandomString, getFormattedObjects } from '../../../helpers/utils'-import { WEBSERVER } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { Emailer } from '../../../lib/emailer'-import { Redis } from '../../../lib/redis'-import { buildUser, createUserAccountAndChannelAndPlaylist } from '../../../lib/user'+import { tokensRouter } from '@server/controllers/api/users/token.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { OAuthTokenModel } from '@server/models/oauth/oauth-token.js'+import { MUserAccountDefault } from '@server/types/models/index.js'+import { pick } from '@peertube/peertube-core-utils'+import { HttpStatusCode, UserCreate, UserCreateResult, UserRight, UserUpdate } from '@peertube/peertube-models'+import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger.js'+import { logger } from '../../../helpers/logger.js'+import { generateRandomString, getFormattedObjects } from '../../../helpers/utils.js'+import { WEBSERVER } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { Emailer } from '../../../lib/emailer.js'+import { Redis } from '../../../lib/redis.js'+import { buildUser, createUserAccountAndChannelAndPlaylist } from '../../../lib/user.js'import {adminUsersSortValidator,apiRateLimiter,@@ -29,24 +29,24 @@ import {usersListValidator,usersRemoveValidator,usersUpdateValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'import {ensureCanModerateUser,usersAskResetPasswordValidator,usersBlockingValidator,usersResetPasswordValidator-} from '../../../middlewares/validators'-import { UserModel } from '../../../models/user/user'-import { emailVerificationRouter } from './email-verification'-import { meRouter } from './me'-import { myAbusesRouter } from './my-abuses'-import { myBlocklistRouter } from './my-blocklist'-import { myVideosHistoryRouter } from './my-history'-import { myNotificationsRouter } from './my-notifications'-import { mySubscriptionsRouter } from './my-subscriptions'-import { myVideoPlaylistsRouter } from './my-video-playlists'-import { registrationsRouter } from './registrations'-import { twoFactorRouter } from './two-factor'+} from '../../../middlewares/validators/index.js'+import { UserModel } from '../../../models/user/user.js'+import { emailVerificationRouter } from './email-verification.js'+import { meRouter } from './me.js'+import { myAbusesRouter } from './my-abuses.js'+import { myBlocklistRouter } from './my-blocklist.js'+import { myVideosHistoryRouter } from './my-history.js'+import { myNotificationsRouter } from './my-notifications.js'+import { mySubscriptionsRouter } from './my-subscriptions.js'+import { myVideoPlaylistsRouter } from './my-video-playlists.js'+import { registrationsRouter } from './registrations.js'+import { twoFactorRouter } from './two-factor.js'const auditLogger = auditLoggerFactory('users')diff --git a/server/controllers/api/users/me.ts b/server/server/controllers/api/users/me.tssimilarity index 87%rename from server/controllers/api/users/me.tsrename to server/server/controllers/api/users/me.tsindex 26811136ed..69edd342d6 100644--- a/server/controllers/api/users/me.ts+++ b/server/server/controllers/api/users/me.ts@@ -1,18 +1,24 @@import 'multer'import express from 'express'-import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'-import { Hooks } from '@server/lib/plugins/hooks'-import { pick } from '@shared/core-utils'-import { ActorImageType, HttpStatusCode, UserUpdateMe, UserVideoQuota, UserVideoRate as FormattedUserVideoRate } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { createReqFiles } from '../../../helpers/express-utils'-import { getFormattedObjects } from '../../../helpers/utils'-import { CONFIG } from '../../../initializers/config'-import { MIMETYPES } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { sendUpdateActor } from '../../../lib/activitypub/send'-import { deleteLocalActorImageFile, updateLocalActorImageFiles } from '../../../lib/local-actor'-import { getOriginalVideoFileTotalDailyFromUser, getOriginalVideoFileTotalFromUser, sendVerifyUserEmail } from '../../../lib/user'+import { pick } from '@peertube/peertube-core-utils'+import {+ ActorImageType,+ HttpStatusCode,+ UserUpdateMe,+ UserVideoQuota,+ UserVideoRate as FormattedUserVideoRate+} from '@peertube/peertube-models'+import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { createReqFiles } from '../../../helpers/express-utils.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { CONFIG } from '../../../initializers/config.js'+import { MIMETYPES } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { sendUpdateActor } from '../../../lib/activitypub/send/index.js'+import { deleteLocalActorImageFile, updateLocalActorImageFiles } from '../../../lib/local-actor.js'+import { getOriginalVideoFileTotalDailyFromUser, getOriginalVideoFileTotalFromUser, sendVerifyUserEmail } from '../../../lib/user.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -23,20 +29,20 @@ import {setDefaultVideosSort,usersUpdateMeValidator,usersVideoRatingValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'+import { updateAvatarValidator } from '../../../middlewares/validators/actor-image.js'import {deleteMeValidator,getMyVideoImportsValidator,usersVideosValidator,videoImportsSortValidator,videosSortValidator-} from '../../../middlewares/validators'-import { updateAvatarValidator } from '../../../middlewares/validators/actor-image'-import { AccountModel } from '../../../models/account/account'-import { AccountVideoRateModel } from '../../../models/account/account-video-rate'-import { UserModel } from '../../../models/user/user'-import { VideoModel } from '../../../models/video/video'-import { VideoImportModel } from '../../../models/video/video-import'+} from '../../../middlewares/validators/index.js'+import { AccountVideoRateModel } from '../../../models/account/account-video-rate.js'+import { AccountModel } from '../../../models/account/account.js'+import { UserModel } from '../../../models/user/user.js'+import { VideoImportModel } from '../../../models/video/video-import.js'+import { VideoModel } from '../../../models/video/video.js'const auditLogger = auditLoggerFactory('users')diff --git a/server/controllers/api/users/my-abuses.ts b/server/server/controllers/api/users/my-abuses.tssimilarity index 91%rename from server/controllers/api/users/my-abuses.tsrename to server/server/controllers/api/users/my-abuses.tsindex 103c3d3326..510d5528f7 100644--- a/server/controllers/api/users/my-abuses.ts+++ b/server/server/controllers/api/users/my-abuses.ts@@ -1,5 +1,5 @@import express from 'express'-import { AbuseModel } from '@server/models/abuse/abuse'+import { AbuseModel } from '@server/models/abuse/abuse.js'import {abuseListForUserValidator,abusesSortValidator,@@ -8,7 +8,7 @@ import {paginationValidator,setDefaultPagination,setDefaultSort-} from '../../../middlewares'+} from '../../../middlewares/index.js'const myAbusesRouter = express.Router()diff --git a/server/controllers/api/users/my-blocklist.ts b/server/server/controllers/api/users/my-blocklist.tssimilarity index 89%rename from server/controllers/api/users/my-blocklist.tsrename to server/server/controllers/api/users/my-blocklist.tsindex 0b56645cf3..46a988ea64 100644--- a/server/controllers/api/users/my-blocklist.ts+++ b/server/server/controllers/api/users/my-blocklist.ts@@ -1,10 +1,15 @@import 'multer'import express from 'express'-import { logger } from '@server/helpers/logger'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { getFormattedObjects } from '../../../helpers/utils'-import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'+import { HttpStatusCode } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import {+ addAccountInBlocklist,+ addServerInBlocklist,+ removeAccountFromBlocklist,+ removeServerFromBlocklist+} from '../../../lib/blocklist.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -13,16 +18,16 @@ import {setDefaultPagination,setDefaultSort,unblockAccountByAccountValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'import {accountsBlocklistSortValidator,blockAccountValidator,blockServerValidator,serversBlocklistSortValidator,unblockServerByAccountValidator-} from '../../../middlewares/validators'-import { AccountBlocklistModel } from '../../../models/account/account-blocklist'-import { ServerBlocklistModel } from '../../../models/server/server-blocklist'+} from '../../../middlewares/validators/index.js'+import { AccountBlocklistModel } from '../../../models/account/account-blocklist.js'+import { ServerBlocklistModel } from '../../../models/server/server-blocklist.js'const myBlocklistRouter = express.Router()diff --git a/server/controllers/api/users/my-history.ts b/server/server/controllers/api/users/my-history.tssimilarity index 89%rename from server/controllers/api/users/my-history.tsrename to server/server/controllers/api/users/my-history.tsindex e6d3e86ac4..c2106e4e5c 100644--- a/server/controllers/api/users/my-history.ts+++ b/server/server/controllers/api/users/my-history.ts@@ -1,8 +1,8 @@-import { forceNumber } from '@shared/core-utils'import express from 'express'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { getFormattedObjects } from '../../../helpers/utils'-import { sequelizeTypescript } from '../../../initializers/database'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { sequelizeTypescript } from '../../../initializers/database.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -12,8 +12,8 @@ import {userHistoryListValidator,userHistoryRemoveAllValidator,userHistoryRemoveElementValidator-} from '../../../middlewares'-import { UserVideoHistoryModel } from '../../../models/user/user-video-history'+} from '../../../middlewares/index.js'+import { UserVideoHistoryModel } from '../../../models/user/user-video-history.js'const myVideosHistoryRouter = express.Router()diff --git a/server/controllers/api/users/my-notifications.ts b/server/server/controllers/api/users/my-notifications.tssimilarity index 90%rename from server/controllers/api/users/my-notifications.tsrename to server/server/controllers/api/users/my-notifications.tsindex 6014cdbbf7..c0172a452c 100644--- a/server/controllers/api/users/my-notifications.ts+++ b/server/server/controllers/api/users/my-notifications.ts@@ -1,8 +1,8 @@import 'multer'import express from 'express'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { UserNotificationSetting } from '../../../../shared/models/users'+import { HttpStatusCode, UserNotificationSetting } from '@peertube/peertube-models'+import { getFormattedObjects } from '@server/helpers/utils.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -11,15 +11,14 @@ import {setDefaultPagination,setDefaultSort,userNotificationsSortValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'import {listUserNotificationsValidator,markAsReadUserNotificationsValidator,updateNotificationSettingsValidator-} from '../../../middlewares/validators/user-notifications'-import { UserNotificationSettingModel } from '../../../models/user/user-notification-setting'-import { meRouter } from './me'-import { getFormattedObjects } from '@server/helpers/utils'+} from '../../../middlewares/validators/user-notifications.js'+import { UserNotificationSettingModel } from '../../../models/user/user-notification-setting.js'+import { meRouter } from './me.js'const myNotificationsRouter = express.Router()diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/server/controllers/api/users/my-subscriptions.tssimilarity index 88%rename from server/controllers/api/users/my-subscriptions.tsrename to server/server/controllers/api/users/my-subscriptions.tsindex c4360f59df..f2010950e0 100644--- a/server/controllers/api/users/my-subscriptions.ts+++ b/server/server/controllers/api/users/my-subscriptions.ts@@ -1,15 +1,15 @@import 'multer'import express from 'express'-import { handlesToNameAndHost } from '@server/helpers/actors'-import { pickCommonVideoQuery } from '@server/helpers/query'-import { sendUndoFollow } from '@server/lib/activitypub/send'-import { Hooks } from '@server/lib/plugins/hooks'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'-import { getFormattedObjects } from '../../../helpers/utils'-import { sequelizeTypescript } from '../../../initializers/database'-import { JobQueue } from '../../../lib/job-queue'+import { HttpStatusCode } from '@peertube/peertube-models'+import { handlesToNameAndHost } from '@server/helpers/actors.js'+import { pickCommonVideoQuery } from '@server/helpers/query.js'+import { sendUndoFollow } from '@server/lib/activitypub/send/index.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { JobQueue } from '../../../lib/job-queue/index.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -21,16 +21,16 @@ import {setDefaultVideosSort,userSubscriptionAddValidator,userSubscriptionGetValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'import {areSubscriptionsExistValidator,userSubscriptionListValidator,userSubscriptionsSortValidator,videosSortValidator-} from '../../../middlewares/validators'-import { ActorFollowModel } from '../../../models/actor/actor-follow'-import { guessAdditionalAttributesFromQuery } from '../../../models/video/formatter'-import { VideoModel } from '../../../models/video/video'+} from '../../../middlewares/validators/index.js'+import { ActorFollowModel } from '../../../models/actor/actor-follow.js'+import { guessAdditionalAttributesFromQuery } from '../../../models/video/formatter/index.js'+import { VideoModel } from '../../../models/video/video.js'const mySubscriptionsRouter = express.Router()diff --git a/server/controllers/api/users/my-video-playlists.ts b/server/server/controllers/api/users/my-video-playlists.tssimilarity index 84%rename from server/controllers/api/users/my-video-playlists.tsrename to server/server/controllers/api/users/my-video-playlists.tsindex fbdbb7e500..a72ea103de 100644--- a/server/controllers/api/users/my-video-playlists.ts+++ b/server/server/controllers/api/users/my-video-playlists.ts@@ -1,10 +1,10 @@import express from 'express'-import { forceNumber } from '@shared/core-utils'-import { uuidToShort } from '@shared/extra-utils'-import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'-import { asyncMiddleware, authenticate } from '../../../middlewares'-import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists'-import { VideoPlaylistModel } from '../../../models/video/video-playlist'+import { forceNumber } from '@peertube/peertube-core-utils'+import { VideosExistInPlaylists } from '@peertube/peertube-models'+import { uuidToShort } from '@peertube/peertube-node-utils'+import { asyncMiddleware, authenticate } from '../../../middlewares/index.js'+import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists.js'+import { VideoPlaylistModel } from '../../../models/video/video-playlist.js'const myVideoPlaylistsRouter = express.Router()diff --git a/server/controllers/api/users/registrations.ts b/server/server/controllers/api/users/registrations.tssimilarity index 94%rename from server/controllers/api/users/registrations.tsrename to server/server/controllers/api/users/registrations.tsindex 5e213d6cce..6c2a309e8f 100644--- a/server/controllers/api/users/registrations.ts+++ b/server/server/controllers/api/users/registrations.ts@@ -1,8 +1,8 @@import express from 'express'-import { Emailer } from '@server/lib/emailer'-import { Hooks } from '@server/lib/plugins/hooks'-import { UserRegistrationModel } from '@server/models/user/user-registration'-import { pick } from '@shared/core-utils'+import { Emailer } from '@server/lib/emailer.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { UserRegistrationModel } from '@server/models/user/user-registration.js'+import { pick } from '@peertube/peertube-core-utils'import {HttpStatusCode,UserRegister,@@ -10,12 +10,12 @@ import {UserRegistrationState,UserRegistrationUpdateState,UserRight-} from '@shared/models'-import { auditLoggerFactory, UserAuditView } from '../../../helpers/audit-logger'-import { logger } from '../../../helpers/logger'-import { CONFIG } from '../../../initializers/config'-import { Notifier } from '../../../lib/notifier'-import { buildUser, createUserAccountAndChannelAndPlaylist, sendVerifyRegistrationEmail, sendVerifyUserEmail } from '../../../lib/user'+} from '@peertube/peertube-models'+import { auditLoggerFactory, UserAuditView } from '../../../helpers/audit-logger.js'+import { logger } from '../../../helpers/logger.js'+import { CONFIG } from '../../../initializers/config.js'+import { Notifier } from '../../../lib/notifier/index.js'+import { buildUser, createUserAccountAndChannelAndPlaylist, sendVerifyRegistrationEmail, sendVerifyUserEmail } from '../../../lib/user.js'import {acceptOrRejectRegistrationValidator,asyncMiddleware,@@ -33,7 +33,7 @@ import {userRegistrationsSortValidator,usersDirectRegistrationValidator,usersRequestRegistrationValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'const auditLogger = auditLoggerFactory('users')diff --git a/server/controllers/api/users/token.ts b/server/server/controllers/api/users/token.tssimilarity index 89%rename from server/controllers/api/users/token.tsrename to server/server/controllers/api/users/token.tsindex c6afea67c2..a3f18f6e1d 100644--- a/server/controllers/api/users/token.ts+++ b/server/server/controllers/api/users/token.ts@@ -1,14 +1,14 @@import express from 'express'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { OTP } from '@server/initializers/constants'-import { getAuthNameFromRefreshGrant, getBypassFromExternalAuth, getBypassFromPasswordGrant } from '@server/lib/auth/external-auth'-import { handleOAuthToken, MissingTwoFactorError } from '@server/lib/auth/oauth'-import { BypassLogin, revokeToken } from '@server/lib/auth/oauth-model'-import { Hooks } from '@server/lib/plugins/hooks'-import { asyncMiddleware, authenticate, buildRateLimiter, openapiOperationDoc } from '@server/middlewares'-import { buildUUID } from '@shared/extra-utils'-import { ScopedToken } from '@shared/models/users/user-scoped-token'+import { ScopedToken } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { OTP } from '@server/initializers/constants.js'+import { getAuthNameFromRefreshGrant, getBypassFromExternalAuth, getBypassFromPasswordGrant } from '@server/lib/auth/external-auth.js'+import { BypassLogin, revokeToken } from '@server/lib/auth/oauth-model.js'+import { handleOAuthToken, MissingTwoFactorError } from '@server/lib/auth/oauth.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { asyncMiddleware, authenticate, buildRateLimiter, openapiOperationDoc } from '@server/middlewares/index.js'+import { buildUUID } from '@peertube/peertube-node-utils'const tokensRouter = express.Router()diff --git a/server/controllers/api/users/two-factor.ts b/server/server/controllers/api/users/two-factor.tssimilarity index 87%rename from server/controllers/api/users/two-factor.tsrename to server/server/controllers/api/users/two-factor.tsindex e6ae9e4dd4..f3dba3a532 100644--- a/server/controllers/api/users/two-factor.ts+++ b/server/server/controllers/api/users/two-factor.ts@@ -1,15 +1,15 @@import express from 'express'-import { generateOTPSecret, isOTPValid } from '@server/helpers/otp'-import { encrypt } from '@server/helpers/peertube-crypto'-import { CONFIG } from '@server/initializers/config'-import { Redis } from '@server/lib/redis'-import { asyncMiddleware, authenticate, usersCheckCurrentPasswordFactory } from '@server/middlewares'+import { generateOTPSecret, isOTPValid } from '@server/helpers/otp.js'+import { encrypt } from '@server/helpers/peertube-crypto.js'+import { CONFIG } from '@server/initializers/config.js'+import { Redis } from '@server/lib/redis.js'+import { asyncMiddleware, authenticate, usersCheckCurrentPasswordFactory } from '@server/middlewares/index.js'import {confirmTwoFactorValidator,disableTwoFactorValidator,requestOrConfirmTwoFactorValidator-} from '@server/middlewares/validators/two-factor'-import { HttpStatusCode, TwoFactorEnableResult } from '@shared/models'+} from '@server/middlewares/validators/two-factor.js'+import { HttpStatusCode, TwoFactorEnableResult } from '@peertube/peertube-models'const twoFactorRouter = express.Router()diff --git a/server/controllers/api/video-channel-sync.ts b/server/server/controllers/api/video-channel-sync.tssimilarity index 88%rename from server/controllers/api/video-channel-sync.tsrename to server/server/controllers/api/video-channel-sync.tsindex 6b52ac7ddd..fb1f05f7c4 100644--- a/server/controllers/api/video-channel-sync.ts+++ b/server/server/controllers/api/video-channel-sync.ts@@ -1,6 +1,6 @@import express from 'express'-import { auditLoggerFactory, getAuditIdFromRes, VideoChannelSyncAuditView } from '@server/helpers/audit-logger'-import { logger } from '@server/helpers/logger'+import { auditLoggerFactory, getAuditIdFromRes, VideoChannelSyncAuditView } from '@server/helpers/audit-logger.js'+import { logger } from '@server/helpers/logger.js'import {apiRateLimiter,asyncMiddleware,@@ -10,10 +10,10 @@ import {ensureSyncExists,ensureSyncIsEnabled,videoChannelSyncValidator-} from '@server/middlewares'-import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'-import { MChannelSyncFormattable } from '@server/types/models'-import { HttpStatusCode, VideoChannelSyncState } from '@shared/models'+} from '@server/middlewares/index.js'+import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync.js'+import { MChannelSyncFormattable } from '@server/types/models/index.js'+import { HttpStatusCode, VideoChannelSyncState } from '@peertube/peertube-models'const videoChannelSyncRouter = express.Router()const auditLogger = auditLoggerFactory('channel-syncs')diff --git a/server/controllers/api/video-channel.ts b/server/server/controllers/api/video-channel.tssimilarity index 92%rename from server/controllers/api/video-channel.tsrename to server/server/controllers/api/video-channel.tsindex 18de5bf6a2..4add1a637a 100644--- a/server/controllers/api/video-channel.ts+++ b/server/server/controllers/api/video-channel.ts@@ -1,21 +1,27 @@import express from 'express'-import { pickCommonVideoQuery } from '@server/helpers/query'-import { Hooks } from '@server/lib/plugins/hooks'-import { ActorFollowModel } from '@server/models/actor/actor-follow'-import { getServerActor } from '@server/models/application/application'-import { MChannelBannerAccountDefault } from '@server/types/models'-import { ActorImageType, HttpStatusCode, VideoChannelCreate, VideoChannelUpdate, VideosImportInChannelCreate } from '@shared/models'-import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'-import { resetSequelizeInstance } from '../../helpers/database-utils'-import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'-import { logger } from '../../helpers/logger'-import { getFormattedObjects } from '../../helpers/utils'-import { MIMETYPES } from '../../initializers/constants'-import { sequelizeTypescript } from '../../initializers/database'-import { sendUpdateActor } from '../../lib/activitypub/send'-import { JobQueue } from '../../lib/job-queue'-import { deleteLocalActorImageFile, updateLocalActorImageFiles } from '../../lib/local-actor'-import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel'+import {+ ActorImageType,+ HttpStatusCode,+ VideoChannelCreate,+ VideoChannelUpdate,+ VideosImportInChannelCreate+} from '@peertube/peertube-models'+import { pickCommonVideoQuery } from '@server/helpers/query.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { ActorFollowModel } from '@server/models/actor/actor-follow.js'+import { getServerActor } from '@server/models/application/application.js'+import { MChannelBannerAccountDefault } from '@server/types/models/index.js'+import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger.js'+import { resetSequelizeInstance } from '../../helpers/database-utils.js'+import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils.js'+import { logger } from '../../helpers/logger.js'+import { getFormattedObjects } from '../../helpers/utils.js'+import { MIMETYPES } from '../../initializers/constants.js'+import { sequelizeTypescript } from '../../initializers/database.js'+import { sendUpdateActor } from '../../lib/activitypub/send/index.js'+import { JobQueue } from '../../lib/job-queue/index.js'+import { deleteLocalActorImageFile, updateLocalActorImageFiles } from '../../lib/local-actor.js'+import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel.js'import {apiRateLimiter,asyncMiddleware,@@ -33,7 +39,8 @@ import {videoChannelsSortValidator,videoChannelsUpdateValidator,videoPlaylistsSortValidator-} from '../../middlewares'+} from '../../middlewares/index.js'+import { updateAvatarValidator, updateBannerValidator } from '../../middlewares/validators/actor-image.js'import {ensureChannelOwnerCanUpload,ensureIsLocalChannel,@@ -42,14 +49,13 @@ import {videoChannelsListValidator,videoChannelsNameWithHostValidator,videosSortValidator-} from '../../middlewares/validators'-import { updateAvatarValidator, updateBannerValidator } from '../../middlewares/validators/actor-image'-import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'-import { AccountModel } from '../../models/account/account'-import { guessAdditionalAttributesFromQuery } from '../../models/video/formatter'-import { VideoModel } from '../../models/video/video'-import { VideoChannelModel } from '../../models/video/video-channel'-import { VideoPlaylistModel } from '../../models/video/video-playlist'+} from '../../middlewares/validators/index.js'+import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists.js'+import { AccountModel } from '../../models/account/account.js'+import { guessAdditionalAttributesFromQuery } from '../../models/video/formatter/index.js'+import { VideoChannelModel } from '../../models/video/video-channel.js'+import { VideoPlaylistModel } from '../../models/video/video-playlist.js'+import { VideoModel } from '../../models/video/video.js'const auditLogger = auditLoggerFactory('channels')const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT)diff --git a/server/controllers/api/video-playlist.ts b/server/server/controllers/api/video-playlist.tssimilarity index 91%rename from server/controllers/api/video-playlist.tsrename to server/server/controllers/api/video-playlist.tsindex 73362e1e30..64207f50d0 100644--- a/server/controllers/api/video-playlist.ts+++ b/server/server/controllers/api/video-playlist.ts@@ -1,28 +1,32 @@import express from 'express'-import { scheduleRefreshIfNeeded } from '@server/lib/activitypub/playlists'-import { VideoMiniaturePermanentFileCache } from '@server/lib/files-cache'-import { Hooks } from '@server/lib/plugins/hooks'-import { getServerActor } from '@server/models/application/application'-import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models'-import { forceNumber } from '@shared/core-utils'-import { uuidToShort } from '@shared/extra-utils'-import { VideoPlaylistCreateResult, VideoPlaylistElementCreateResult } from '@shared/models'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/video-playlist-create.model'-import { VideoPlaylistElementCreate } from '../../../shared/models/videos/playlist/video-playlist-element-create.model'-import { VideoPlaylistElementUpdate } from '../../../shared/models/videos/playlist/video-playlist-element-update.model'-import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'-import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model'-import { VideoPlaylistUpdate } from '../../../shared/models/videos/playlist/video-playlist-update.model'-import { resetSequelizeInstance } from '../../helpers/database-utils'-import { createReqFiles } from '../../helpers/express-utils'-import { logger } from '../../helpers/logger'-import { getFormattedObjects } from '../../helpers/utils'-import { MIMETYPES, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers/constants'-import { sequelizeTypescript } from '../../initializers/database'-import { sendCreateVideoPlaylist, sendDeleteVideoPlaylist, sendUpdateVideoPlaylist } from '../../lib/activitypub/send'-import { getLocalVideoPlaylistActivityPubUrl, getLocalVideoPlaylistElementActivityPubUrl } from '../../lib/activitypub/url'-import { updateLocalPlaylistMiniatureFromExisting } from '../../lib/thumbnail'+import { forceNumber } from '@peertube/peertube-core-utils'+import {+ HttpStatusCode,+ VideoPlaylistCreate,+ VideoPlaylistCreateResult,+ VideoPlaylistElementCreate,+ VideoPlaylistElementCreateResult,+ VideoPlaylistElementUpdate,+ VideoPlaylistPrivacy,+ VideoPlaylistPrivacyType,+ VideoPlaylistReorder,+ VideoPlaylistUpdate+} from '@peertube/peertube-models'+import { scheduleRefreshIfNeeded } from '@server/lib/activitypub/playlists/index.js'+import { VideoMiniaturePermanentFileCache } from '@server/lib/files-cache/index.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { getServerActor } from '@server/models/application/application.js'+import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models/index.js'+import { uuidToShort } from '@peertube/peertube-node-utils'+import { resetSequelizeInstance } from '../../helpers/database-utils.js'+import { createReqFiles } from '../../helpers/express-utils.js'+import { logger } from '../../helpers/logger.js'+import { getFormattedObjects } from '../../helpers/utils.js'+import { MIMETYPES, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers/constants.js'+import { sequelizeTypescript } from '../../initializers/database.js'+import { sendCreateVideoPlaylist, sendDeleteVideoPlaylist, sendUpdateVideoPlaylist } from '../../lib/activitypub/send/index.js'+import { getLocalVideoPlaylistActivityPubUrl, getLocalVideoPlaylistElementActivityPubUrl } from '../../lib/activitypub/url.js'+import { updateLocalPlaylistMiniatureFromExisting } from '../../lib/thumbnail.js'import {apiRateLimiter,asyncMiddleware,@@ -32,8 +36,8 @@ import {paginationValidator,setDefaultPagination,setDefaultSort-} from '../../middlewares'-import { videoPlaylistsSortValidator } from '../../middlewares/validators'+} from '../../middlewares/index.js'+import { videoPlaylistsSortValidator } from '../../middlewares/validators/index.js'import {commonVideoPlaylistFiltersValidator,videoPlaylistsAddValidator,@@ -43,10 +47,10 @@ import {videoPlaylistsReorderVideosValidator,videoPlaylistsUpdateOrRemoveVideoValidator,videoPlaylistsUpdateValidator-} from '../../middlewares/validators/videos/video-playlists'-import { AccountModel } from '../../models/account/account'-import { VideoPlaylistModel } from '../../models/video/video-playlist'-import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element'+} from '../../middlewares/validators/videos/video-playlists.js'+import { AccountModel } from '../../models/account/account.js'+import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element.js'+import { VideoPlaylistModel } from '../../models/video/video-playlist.js'const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT)@@ -247,7 +251,7 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response)if (videoPlaylistInfoToUpdate.description !== undefined) videoPlaylistInstance.description = videoPlaylistInfoToUpdate.descriptionif (videoPlaylistInfoToUpdate.privacy !== undefined) {- videoPlaylistInstance.privacy = forceNumber(videoPlaylistInfoToUpdate.privacy)+ videoPlaylistInstance.privacy = forceNumber(videoPlaylistInfoToUpdate.privacy) as VideoPlaylistPrivacyTypeif (wasNotPrivatePlaylist === true && videoPlaylistInstance.privacy === VideoPlaylistPrivacy.PRIVATE) {await sendDeleteVideoPlaylist(videoPlaylistInstance, t)diff --git a/server/controllers/api/videos/blacklist.ts b/server/server/controllers/api/videos/blacklist.tssimilarity index 93%rename from server/controllers/api/videos/blacklist.tsrename to server/server/controllers/api/videos/blacklist.tsindex 4103bb0630..1facbc5d3f 100644--- a/server/controllers/api/videos/blacklist.ts+++ b/server/server/controllers/api/videos/blacklist.ts@@ -1,9 +1,9 @@import express from 'express'-import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist'-import { HttpStatusCode, UserRight, VideoBlacklistCreate } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { getFormattedObjects } from '../../../helpers/utils'-import { sequelizeTypescript } from '../../../initializers/database'+import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist.js'+import { HttpStatusCode, UserRight, VideoBlacklistCreate } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { sequelizeTypescript } from '../../../initializers/database.js'import {asyncMiddleware,authenticate,@@ -17,8 +17,8 @@ import {videosBlacklistFiltersValidator,videosBlacklistRemoveValidator,videosBlacklistUpdateValidator-} from '../../../middlewares'-import { VideoBlacklistModel } from '../../../models/video/video-blacklist'+} from '../../../middlewares/index.js'+import { VideoBlacklistModel } from '../../../models/video/video-blacklist.js'const blacklistRouter = express.Router()diff --git a/server/controllers/api/videos/captions.ts b/server/server/controllers/api/videos/captions.tssimilarity index 85%rename from server/controllers/api/videos/captions.tsrename to server/server/controllers/api/videos/captions.tsindex 2b511a3983..b8e7149c6b 100644--- a/server/controllers/api/videos/captions.ts+++ b/server/server/controllers/api/videos/captions.ts@@ -1,17 +1,17 @@import express from 'express'-import { Hooks } from '@server/lib/plugins/hooks'-import { MVideoCaption } from '@server/types/models'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils'-import { createReqFiles } from '../../../helpers/express-utils'-import { logger } from '../../../helpers/logger'-import { getFormattedObjects } from '../../../helpers/utils'-import { MIMETYPES } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { federateVideoIfNeeded } from '../../../lib/activitypub/videos'-import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares'-import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators'-import { VideoCaptionModel } from '../../../models/video/video-caption'+import { HttpStatusCode } from '@peertube/peertube-models'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { MVideoCaption } from '@server/types/models/index.js'+import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils.js'+import { createReqFiles } from '../../../helpers/express-utils.js'+import { logger } from '../../../helpers/logger.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { MIMETYPES } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { federateVideoIfNeeded } from '../../../lib/activitypub/videos/index.js'+import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares/index.js'+import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators/index.js'+import { VideoCaptionModel } from '../../../models/video/video-caption.js'const reqVideoCaptionAdd = createReqFiles([ 'captionfile' ], MIMETYPES.VIDEO_CAPTIONS.MIMETYPE_EXT)diff --git a/server/controllers/api/videos/comment.ts b/server/server/controllers/api/videos/comment.tssimilarity index 90%rename from server/controllers/api/videos/comment.tsrename to server/server/controllers/api/videos/comment.tsindex 70ca21500a..ae89943822 100644--- a/server/controllers/api/videos/comment.ts+++ b/server/server/controllers/api/videos/comment.ts@@ -1,15 +1,19 @@-import { MCommentFormattable } from '@server/types/models'import express from 'express'--import { ResultList, ThreadsResultList, UserRight, VideoCommentCreate } from '../../../../shared/models'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { VideoCommentThreads } from '../../../../shared/models/videos/comment/video-comment.model'-import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger'-import { getFormattedObjects } from '../../../helpers/utils'-import { sequelizeTypescript } from '../../../initializers/database'-import { Notifier } from '../../../lib/notifier'-import { Hooks } from '../../../lib/plugins/hooks'-import { buildFormattedCommentTree, createVideoComment, removeComment } from '../../../lib/video-comment'+import {+ HttpStatusCode,+ ResultList,+ ThreadsResultList,+ UserRight,+ VideoCommentCreate,+ VideoCommentThreads+} from '@peertube/peertube-models'+import { MCommentFormattable } from '@server/types/models/index.js'+import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { Notifier } from '../../../lib/notifier/index.js'+import { Hooks } from '../../../lib/plugins/hooks.js'+import { buildFormattedCommentTree, createVideoComment, removeComment } from '../../../lib/video-comment.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -19,7 +23,7 @@ import {paginationValidator,setDefaultPagination,setDefaultSort-} from '../../../middlewares'+} from '../../../middlewares/index.js'import {addVideoCommentReplyValidator,addVideoCommentThreadValidator,@@ -29,9 +33,9 @@ import {removeVideoCommentValidator,videoCommentsValidator,videoCommentThreadsSortValidator-} from '../../../middlewares/validators'-import { AccountModel } from '../../../models/account/account'-import { VideoCommentModel } from '../../../models/video/video-comment'+} from '../../../middlewares/validators/index.js'+import { AccountModel } from '../../../models/account/account.js'+import { VideoCommentModel } from '../../../models/video/video-comment.js'const auditLogger = auditLoggerFactory('comments')const videoCommentRouter = express.Router()diff --git a/server/controllers/api/videos/files.ts b/server/server/controllers/api/videos/files.tssimilarity index 89%rename from server/controllers/api/videos/files.tsrename to server/server/controllers/api/videos/files.tsindex 67b60ff639..c62c85c540 100644--- a/server/controllers/api/videos/files.ts+++ b/server/server/controllers/api/videos/files.ts@@ -1,11 +1,11 @@import express from 'express'-import toInt from 'validator/lib/toInt'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'-import { updatePlaylistAfterFileChange } from '@server/lib/hls'-import { removeAllWebVideoFiles, removeHLSFile, removeHLSPlaylist, removeWebVideoFile } from '@server/lib/video-file'-import { VideoFileModel } from '@server/models/video/video-file'-import { HttpStatusCode, UserRight } from '@shared/models'+import validator from 'validator'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'+import { updatePlaylistAfterFileChange } from '@server/lib/hls.js'+import { removeAllWebVideoFiles, removeHLSFile, removeHLSPlaylist, removeWebVideoFile } from '@server/lib/video-file.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { HttpStatusCode, UserRight } from '@peertube/peertube-models'import {asyncMiddleware,authenticate,@@ -16,7 +16,7 @@ import {videoFilesDeleteWebVideoFileValidator,videoFilesDeleteWebVideoValidator,videosGetValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'const lTags = loggerTagsFactory('api', 'video')const filesRouter = express.Router()@@ -64,7 +64,7 @@ export {// ---------------------------------------------------------------------------async function getVideoFileMetadata (req: express.Request, res: express.Response) {- const videoFile = await VideoFileModel.loadWithMetadata(toInt(req.params.videoFileId))+ const videoFile = await VideoFileModel.loadWithMetadata(validator.default.toInt(req.params.videoFileId))return res.json(videoFile.metadata)}diff --git a/server/controllers/api/videos/import.ts b/server/server/controllers/api/videos/import.tssimilarity index 90%rename from server/controllers/api/videos/import.tsrename to server/server/controllers/api/videos/import.tsindex defe9efd46..185215cc9c 100644--- a/server/controllers/api/videos/import.ts+++ b/server/server/controllers/api/videos/import.ts@@ -1,20 +1,28 @@import express from 'express'-import { move, readFile } from 'fs-extra'+import { move } from 'fs-extra/esm'+import { readFile } from 'fs/promises'import { decode } from 'magnet-uri'import parseTorrent, { Instance } from 'parse-torrent'import { join } from 'path'-import { buildYoutubeDLImport, buildVideoFromImport, insertFromImportIntoDB, YoutubeDlImportError } from '@server/lib/video-pre-import'-import { MThumbnail, MVideoThumbnail } from '@server/types/models'-import { HttpStatusCode, ServerErrorCode, ThumbnailType, VideoImportCreate, VideoImportPayload, VideoImportState } from '@shared/models'-import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger'-import { isArray } from '../../../helpers/custom-validators/misc'-import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils'-import { logger } from '../../../helpers/logger'-import { getSecureTorrentName } from '../../../helpers/utils'-import { CONFIG } from '../../../initializers/config'-import { MIMETYPES } from '../../../initializers/constants'-import { JobQueue } from '../../../lib/job-queue/job-queue'-import { updateLocalVideoMiniatureFromExisting } from '../../../lib/thumbnail'+import { buildVideoFromImport, buildYoutubeDLImport, insertFromImportIntoDB, YoutubeDlImportError } from '@server/lib/video-pre-import.js'+import { MThumbnail, MVideoThumbnail } from '@server/types/models/index.js'+import {+ HttpStatusCode,+ ServerErrorCode,+ ThumbnailType,+ VideoImportCreate,+ VideoImportPayload,+ VideoImportState+} from '@peertube/peertube-models'+import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger.js'+import { isArray } from '../../../helpers/custom-validators/misc.js'+import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils.js'+import { logger } from '../../../helpers/logger.js'+import { getSecureTorrentName } from '../../../helpers/utils.js'+import { CONFIG } from '../../../initializers/config.js'+import { MIMETYPES } from '../../../initializers/constants.js'+import { JobQueue } from '../../../lib/job-queue/job-queue.js'+import { updateLocalVideoMiniatureFromExisting } from '../../../lib/thumbnail.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -22,7 +30,7 @@ import {videoImportAddValidator,videoImportCancelValidator,videoImportDeleteValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'const auditLogger = auditLoggerFactory('video-imports')const videoImportsRouter = express.Router()diff --git a/server/controllers/api/videos/index.ts b/server/server/controllers/api/videos/index.tssimilarity index 79%rename from server/controllers/api/videos/index.tsrename to server/server/controllers/api/videos/index.tsindex 3cdd42289b..f8e3d9cb59 100644--- a/server/controllers/api/videos/index.ts+++ b/server/server/controllers/api/videos/index.ts@@ -1,18 +1,18 @@import express from 'express'-import { pickCommonVideoQuery } from '@server/helpers/query'-import { doJSONRequest } from '@server/helpers/requests'-import { openapiOperationDoc } from '@server/middlewares/doc'-import { getServerActor } from '@server/models/application/application'-import { MVideoAccountLight } from '@server/types/models'-import { HttpStatusCode } from '../../../../shared/models'-import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'-import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'-import { logger } from '../../../helpers/logger'-import { getFormattedObjects } from '../../../helpers/utils'-import { REMOTE_SCHEME, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { JobQueue } from '../../../lib/job-queue'-import { Hooks } from '../../../lib/plugins/hooks'+import { HttpStatusCode } from '@peertube/peertube-models'+import { pickCommonVideoQuery } from '@server/helpers/query.js'+import { doJSONRequest } from '@server/helpers/requests.js'+import { openapiOperationDoc } from '@server/middlewares/doc.js'+import { getServerActor } from '@server/models/application/application.js'+import { MVideoAccountLight } from '@server/types/models/index.js'+import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger.js'+import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils.js'+import { logger } from '../../../helpers/logger.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { REMOTE_SCHEME, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { JobQueue } from '../../../lib/job-queue/index.js'+import { Hooks } from '../../../lib/plugins/hooks.js'import {apiRateLimiter,asyncMiddleware,@@ -28,27 +28,27 @@ import {videosGetValidator,videosRemoveValidator,videosSortValidator-} from '../../../middlewares'-import { guessAdditionalAttributesFromQuery } from '../../../models/video/formatter'-import { VideoModel } from '../../../models/video/video'-import { blacklistRouter } from './blacklist'-import { videoCaptionsRouter } from './captions'-import { videoCommentRouter } from './comment'-import { filesRouter } from './files'-import { videoImportsRouter } from './import'-import { liveRouter } from './live'-import { ownershipVideoRouter } from './ownership'-import { videoPasswordRouter } from './passwords'-import { rateVideoRouter } from './rate'-import { videoSourceRouter } from './source'-import { statsRouter } from './stats'-import { storyboardRouter } from './storyboard'-import { studioRouter } from './studio'-import { tokenRouter } from './token'-import { transcodingRouter } from './transcoding'-import { updateRouter } from './update'-import { uploadRouter } from './upload'-import { viewRouter } from './view'+} from '../../../middlewares/index.js'+import { guessAdditionalAttributesFromQuery } from '../../../models/video/formatter/index.js'+import { VideoModel } from '../../../models/video/video.js'+import { blacklistRouter } from './blacklist.js'+import { videoCaptionsRouter } from './captions.js'+import { videoCommentRouter } from './comment.js'+import { filesRouter } from './files.js'+import { videoImportsRouter } from './import.js'+import { liveRouter } from './live.js'+import { ownershipVideoRouter } from './ownership.js'+import { videoPasswordRouter } from './passwords.js'+import { rateVideoRouter } from './rate.js'+import { videoSourceRouter } from './source.js'+import { statsRouter } from './stats.js'+import { storyboardRouter } from './storyboard.js'+import { studioRouter } from './studio.js'+import { tokenRouter } from './token.js'+import { transcodingRouter } from './transcoding.js'+import { updateRouter } from './update.js'+import { uploadRouter } from './upload.js'+import { viewRouter } from './view.js'const auditLogger = auditLoggerFactory('videos')const videosRouter = express.Router()diff --git a/server/controllers/api/videos/live.ts b/server/server/controllers/api/videos/live.tssimilarity index 87%rename from server/controllers/api/videos/live.tsrename to server/server/controllers/api/videos/live.tsindex e19e8c6520..84cb3d51b4 100644--- a/server/controllers/api/videos/live.ts+++ b/server/server/controllers/api/videos/live.ts@@ -1,31 +1,39 @@import express from 'express'-import { exists } from '@server/helpers/custom-validators/misc'-import { createReqFiles } from '@server/helpers/express-utils'-import { getFormattedObjects } from '@server/helpers/utils'-import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants'-import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'-import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'-import { Hooks } from '@server/lib/plugins/hooks'-import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'+import {+ HttpStatusCode,+ LiveVideoCreate,+ LiveVideoLatencyMode,+ LiveVideoUpdate,+ UserRight,+ VideoPrivacy,+ VideoState+} from '@peertube/peertube-models'+import { exists } from '@server/helpers/custom-validators/misc.js'+import { createReqFiles } from '@server/helpers/express-utils.js'+import { getFormattedObjects } from '@server/helpers/utils.js'+import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants.js'+import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url.js'+import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video.js'import {videoLiveAddValidator,videoLiveFindReplaySessionValidator,videoLiveGetValidator,videoLiveListSessionsValidator,videoLiveUpdateValidator-} from '@server/middlewares/validators/videos/video-live'-import { VideoLiveModel } from '@server/models/video/video-live'-import { VideoLiveSessionModel } from '@server/models/video/video-live-session'-import { MVideoDetails, MVideoFullLight, MVideoLive } from '@server/types/models'-import { buildUUID, uuidToShort } from '@shared/extra-utils'-import { HttpStatusCode, LiveVideoCreate, LiveVideoLatencyMode, LiveVideoUpdate, UserRight, VideoPrivacy, VideoState } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { sequelizeTypescript } from '../../../initializers/database'-import { updateLocalVideoMiniatureFromExisting } from '../../../lib/thumbnail'-import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, optionalAuthenticate } from '../../../middlewares'-import { VideoModel } from '../../../models/video/video'-import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting'-import { VideoPasswordModel } from '@server/models/video/video-password'+} from '@server/middlewares/validators/videos/video-live.js'+import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting.js'+import { VideoLiveSessionModel } from '@server/models/video/video-live-session.js'+import { VideoLiveModel } from '@server/models/video/video-live.js'+import { VideoPasswordModel } from '@server/models/video/video-password.js'+import { MVideoDetails, MVideoFullLight, MVideoLive } from '@server/types/models/index.js'+import { buildUUID, uuidToShort } from '@peertube/peertube-node-utils'+import { logger } from '../../../helpers/logger.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { updateLocalVideoMiniatureFromExisting } from '../../../lib/thumbnail.js'+import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, optionalAuthenticate } from '../../../middlewares/index.js'+import { VideoModel } from '../../../models/video/video.js'const liveRouter = express.Router()diff --git a/server/controllers/api/videos/ownership.ts b/server/server/controllers/api/videos/ownership.tssimilarity index 89%rename from server/controllers/api/videos/ownership.tsrename to server/server/controllers/api/videos/ownership.tsindex 88355b2895..ceb3a27394 100644--- a/server/controllers/api/videos/ownership.ts+++ b/server/server/controllers/api/videos/ownership.ts@@ -1,12 +1,11 @@import express from 'express'-import { MVideoFullLight } from '@server/types/models'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos'-import { logger } from '../../../helpers/logger'-import { getFormattedObjects } from '../../../helpers/utils'-import { sequelizeTypescript } from '../../../initializers/database'-import { sendUpdateVideo } from '../../../lib/activitypub/send'-import { changeVideoChannelShare } from '../../../lib/activitypub/share'+import { HttpStatusCode, VideoChangeOwnershipStatus, VideoState } from '@peertube/peertube-models'+import { MVideoFullLight } from '@server/types/models/index.js'+import { logger } from '../../../helpers/logger.js'+import { getFormattedObjects } from '../../../helpers/utils.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { sendUpdateVideo } from '../../../lib/activitypub/send/index.js'+import { changeVideoChannelShare } from '../../../lib/activitypub/share.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -16,10 +15,10 @@ import {videosAcceptChangeOwnershipValidator,videosChangeOwnershipValidator,videosTerminateChangeOwnershipValidator-} from '../../../middlewares'-import { VideoModel } from '../../../models/video/video'-import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership'-import { VideoChannelModel } from '../../../models/video/video-channel'+} from '../../../middlewares/index.js'+import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership.js'+import { VideoChannelModel } from '../../../models/video/video-channel.js'+import { VideoModel } from '../../../models/video/video.js'const ownershipVideoRouter = express.Router()diff --git a/server/controllers/api/videos/passwords.ts b/server/server/controllers/api/videos/passwords.tssimilarity index 90%rename from server/controllers/api/videos/passwords.tsrename to server/server/controllers/api/videos/passwords.tsindex d11cf5bccc..bc356e8ac1 100644--- a/server/controllers/api/videos/passwords.ts+++ b/server/server/controllers/api/videos/passwords.ts@@ -1,25 +1,24 @@import express from 'express'--import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { getFormattedObjects } from '../../../helpers/utils'+import { Transaction } from 'sequelize'+import { HttpStatusCode } from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { getVideoWithAttributes } from '@server/helpers/video.js'+import { VideoPasswordModel } from '@server/models/video/video-password.js'+import { getFormattedObjects } from '../../../helpers/utils.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,authenticate,setDefaultPagination,setDefaultSort-} from '../../../middlewares'+} from '../../../middlewares/index.js'import {listVideoPasswordValidator,paginationValidator,removeVideoPasswordValidator,updateVideoPasswordListValidator,videoPasswordsSortValidator-} from '../../../middlewares/validators'-import { VideoPasswordModel } from '@server/models/video/video-password'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { Transaction } from 'sequelize'-import { getVideoWithAttributes } from '@server/helpers/video'+} from '../../../middlewares/validators/index.js'const lTags = loggerTagsFactory('api', 'video')const videoPasswordRouter = express.Router()diff --git a/server/controllers/api/videos/rate.ts b/server/server/controllers/api/videos/rate.tssimilarity index 90%rename from server/controllers/api/videos/rate.tsrename to server/server/controllers/api/videos/rate.tsindex 6b26a8eee6..b0c4a328d9 100644--- a/server/controllers/api/videos/rate.ts+++ b/server/server/controllers/api/videos/rate.ts@@ -1,12 +1,12 @@import express from 'express'-import { HttpStatusCode, UserVideoRateUpdate } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { VIDEO_RATE_TYPES } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates'-import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares'-import { AccountModel } from '../../../models/account/account'-import { AccountVideoRateModel } from '../../../models/account/account-video-rate'+import { HttpStatusCode, UserVideoRateUpdate } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { VIDEO_RATE_TYPES } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates.js'+import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares/index.js'+import { AccountModel } from '../../../models/account/account.js'+import { AccountVideoRateModel } from '../../../models/account/account-video-rate.js'const rateVideoRouter = express.Router()diff --git a/server/controllers/api/videos/source.ts b/server/server/controllers/api/videos/source.tssimilarity index 90%rename from server/controllers/api/videos/source.tsrename to server/server/controllers/api/videos/source.tsindex 75fe68b6c3..d660628427 100644--- a/server/controllers/api/videos/source.ts+++ b/server/server/controllers/api/videos/source.ts@@ -1,28 +1,28 @@import express from 'express'-import { move } from 'fs-extra'-import { sequelizeTypescript } from '@server/initializers/database'-import { CreateJobArgument, CreateJobOptions, JobQueue } from '@server/lib/job-queue'-import { Hooks } from '@server/lib/plugins/hooks'-import { regenerateMiniaturesIfNeeded } from '@server/lib/thumbnail'-import { uploadx } from '@server/lib/uploadx'-import { buildMoveToObjectStorageJob } from '@server/lib/video'-import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist'-import { buildNewFile } from '@server/lib/video-file'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { buildNextVideoState } from '@server/lib/video-state'-import { openapiOperationDoc } from '@server/middlewares/doc'-import { VideoModel } from '@server/models/video/video'-import { VideoSourceModel } from '@server/models/video/video-source'-import { MStreamingPlaylistFiles, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'-import { VideoState } from '@shared/models'-import { logger, loggerTagsFactory } from '../../../helpers/logger'+import { move } from 'fs-extra/esm'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { CreateJobArgument, CreateJobOptions, JobQueue } from '@server/lib/job-queue/index.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { regenerateMiniaturesIfNeeded } from '@server/lib/thumbnail.js'+import { uploadx } from '@server/lib/uploadx.js'+import { buildMoveToObjectStorageJob } from '@server/lib/video.js'+import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist.js'+import { buildNewFile } from '@server/lib/video-file.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { buildNextVideoState } from '@server/lib/video-state.js'+import { openapiOperationDoc } from '@server/middlewares/doc.js'+import { VideoModel } from '@server/models/video/video.js'+import { VideoSourceModel } from '@server/models/video/video-source.js'+import { MStreamingPlaylistFiles, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models/index.js'+import { VideoState } from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '../../../helpers/logger.js'import {asyncMiddleware,authenticate,replaceVideoSourceResumableInitValidator,replaceVideoSourceResumableValidator,videoSourceGetLatestValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'const lTags = loggerTagsFactory('api', 'video')diff --git a/server/controllers/api/videos/stats.ts b/server/server/controllers/api/videos/stats.tssimilarity index 94%rename from server/controllers/api/videos/stats.tsrename to server/server/controllers/api/videos/stats.tsindex e79f01888b..8b3182e496 100644--- a/server/controllers/api/videos/stats.ts+++ b/server/server/controllers/api/videos/stats.ts@@ -1,13 +1,13 @@import express from 'express'-import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'-import { VideoStatsOverallQuery, VideoStatsTimeserieMetric, VideoStatsTimeserieQuery } from '@shared/models'+import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer.js'+import { VideoStatsOverallQuery, VideoStatsTimeserieMetric, VideoStatsTimeserieQuery } from '@peertube/peertube-models'import {asyncMiddleware,authenticate,videoOverallStatsValidator,videoRetentionStatsValidator,videoTimeserieStatsValidator-} from '../../../middlewares'+} from '../../../middlewares/index.js'const statsRouter = express.Router()diff --git a/server/controllers/api/videos/storyboard.ts b/server/server/controllers/api/videos/storyboard.tssimilarity index 89%rename from server/controllers/api/videos/storyboard.tsrename to server/server/controllers/api/videos/storyboard.tsindex 47a22011d3..92e5801419 100644--- a/server/controllers/api/videos/storyboard.ts+++ b/server/server/controllers/api/videos/storyboard.ts@@ -1,7 +1,7 @@import express from 'express'-import { getVideoWithAttributes } from '@server/helpers/video'-import { StoryboardModel } from '@server/models/video/storyboard'-import { asyncMiddleware, videosGetValidator } from '../../../middlewares'+import { getVideoWithAttributes } from '@server/helpers/video.js'+import { StoryboardModel } from '@server/models/video/storyboard.js'+import { asyncMiddleware, videosGetValidator } from '../../../middlewares/index.js'const storyboardRouter = express.Router()diff --git a/server/controllers/api/videos/studio.ts b/server/server/controllers/api/videos/studio.tssimilarity index 96%rename from server/controllers/api/videos/studio.tsrename to server/server/controllers/api/videos/studio.tsindex 7c31dfd2be..642bd26edb 100644--- a/server/controllers/api/videos/studio.ts+++ b/server/server/controllers/api/videos/studio.ts@@ -1,10 +1,10 @@import Bluebird from 'bluebird'import express from 'express'-import { move } from 'fs-extra'+import { move } from 'fs-extra/esm'import { basename } from 'path'-import { createAnyReqFiles } from '@server/helpers/express-utils'-import { MIMETYPES, VIDEO_FILTERS } from '@server/initializers/constants'-import { buildTaskFileFieldname, createVideoStudioJob, getStudioTaskFilePath, getTaskFileFromReq } from '@server/lib/video-studio'+import { createAnyReqFiles } from '@server/helpers/express-utils.js'+import { MIMETYPES, VIDEO_FILTERS } from '@server/initializers/constants.js'+import { buildTaskFileFieldname, createVideoStudioJob, getStudioTaskFilePath, getTaskFileFromReq } from '@server/lib/video-studio.js'import {HttpStatusCode,VideoState,@@ -15,8 +15,8 @@ import {VideoStudioTaskOutro,VideoStudioTaskPayload,VideoStudioTaskWatermark-} from '@shared/models'-import { asyncMiddleware, authenticate, videoStudioAddEditionValidator } from '../../../middlewares'+} from '@peertube/peertube-models'+import { asyncMiddleware, authenticate, videoStudioAddEditionValidator } from '../../../middlewares/index.js'const studioRouter = express.Router()diff --git a/server/controllers/api/videos/token.ts b/server/server/controllers/api/videos/token.tssimilarity index 86%rename from server/controllers/api/videos/token.tsrename to server/server/controllers/api/videos/token.tsindex e961ffd9ec..9892518aa7 100644--- a/server/controllers/api/videos/token.ts+++ b/server/server/controllers/api/videos/token.ts@@ -1,7 +1,7 @@import express from 'express'-import { VideoTokensManager } from '@server/lib/video-tokens-manager'-import { VideoPrivacy, VideoToken } from '@shared/models'-import { asyncMiddleware, optionalAuthenticate, videoFileTokenValidator, videosCustomGetValidator } from '../../../middlewares'+import { VideoTokensManager } from '@server/lib/video-tokens-manager.js'+import { VideoPrivacy, VideoToken } from '@peertube/peertube-models'+import { asyncMiddleware, optionalAuthenticate, videoFileTokenValidator, videosCustomGetValidator } from '../../../middlewares/index.js'const tokenRouter = express.Router()diff --git a/server/controllers/api/videos/transcoding.ts b/server/server/controllers/api/videos/transcoding.tssimilarity index 89%rename from server/controllers/api/videos/transcoding.tsrename to server/server/controllers/api/videos/transcoding.tsindex c0b93742f2..5a5eb6dd19 100644--- a/server/controllers/api/videos/transcoding.ts+++ b/server/server/controllers/api/videos/transcoding.ts@@ -1,11 +1,11 @@import express from 'express'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { Hooks } from '@server/lib/plugins/hooks'-import { createTranscodingJobs } from '@server/lib/transcoding/create-transcoding-job'-import { computeResolutionsToTranscode } from '@server/lib/transcoding/transcoding-resolutions'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { HttpStatusCode, UserRight, VideoState, VideoTranscodingCreate } from '@shared/models'-import { asyncMiddleware, authenticate, createTranscodingValidator, ensureUserHasRight } from '../../../middlewares'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { createTranscodingJobs } from '@server/lib/transcoding/create-transcoding-job.js'+import { computeResolutionsToTranscode } from '@server/lib/transcoding/transcoding-resolutions.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { HttpStatusCode, UserRight, VideoState, VideoTranscodingCreate } from '@peertube/peertube-models'+import { asyncMiddleware, authenticate, createTranscodingValidator, ensureUserHasRight } from '../../../middlewares/index.js'const lTags = loggerTagsFactory('api', 'video')const transcodingRouter = express.Router()diff --git a/server/controllers/api/videos/update.ts b/server/server/controllers/api/videos/update.tssimilarity index 87%rename from server/controllers/api/videos/update.tsrename to server/server/controllers/api/videos/update.tsindex 1edc509dcb..1c8cecba12 100644--- a/server/controllers/api/videos/update.ts+++ b/server/server/controllers/api/videos/update.ts@@ -1,27 +1,27 @@import express from 'express'-import { Transaction } from 'sequelize/types'-import { changeVideoChannelShare } from '@server/lib/activitypub/share'-import { addVideoJobsAfterUpdate, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'-import { setVideoPrivacy } from '@server/lib/video-privacy'-import { openapiOperationDoc } from '@server/middlewares/doc'-import { FilteredModelAttributes } from '@server/types'-import { MVideoFullLight } from '@server/types/models'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode, VideoPrivacy, VideoUpdate } from '@shared/models'-import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'-import { resetSequelizeInstance } from '../../../helpers/database-utils'-import { createReqFiles } from '../../../helpers/express-utils'-import { logger, loggerTagsFactory } from '../../../helpers/logger'-import { MIMETYPES } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { Hooks } from '../../../lib/plugins/hooks'-import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'-import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videosUpdateValidator } from '../../../middlewares'-import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'-import { VideoModel } from '../../../models/video/video'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { VideoPasswordModel } from '@server/models/video/video-password'-import { exists } from '@server/helpers/custom-validators/misc'+import { Transaction } from 'sequelize'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoPrivacy, VideoPrivacyType, VideoUpdate } from '@peertube/peertube-models'+import { exists } from '@server/helpers/custom-validators/misc.js'+import { changeVideoChannelShare } from '@server/lib/activitypub/share.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { setVideoPrivacy } from '@server/lib/video-privacy.js'+import { addVideoJobsAfterUpdate, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video.js'+import { openapiOperationDoc } from '@server/middlewares/doc.js'+import { VideoPasswordModel } from '@server/models/video/video-password.js'+import { FilteredModelAttributes } from '@server/types/index.js'+import { MVideoFullLight } from '@server/types/models/index.js'+import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger.js'+import { resetSequelizeInstance } from '../../../helpers/database-utils.js'+import { createReqFiles } from '../../../helpers/express-utils.js'+import { logger, loggerTagsFactory } from '../../../helpers/logger.js'+import { MIMETYPES } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { Hooks } from '../../../lib/plugins/hooks.js'+import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist.js'+import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videosUpdateValidator } from '../../../middlewares/index.js'+import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update.js'+import { VideoModel } from '../../../models/video/video.js'const lTags = loggerTagsFactory('api', 'video')const auditLogger = auditLoggerFactory('videos')@@ -176,7 +176,7 @@ async function updateVideoPrivacy (options: {const { videoInstance, videoInfoToUpdate, hadPrivacyForFederation, transaction } = optionsconst isNewVideo = videoInstance.isNewVideo(videoInfoToUpdate.privacy)- const newPrivacy = forceNumber(videoInfoToUpdate.privacy)+ const newPrivacy = forceNumber(videoInfoToUpdate.privacy) as VideoPrivacyTypesetVideoPrivacy(videoInstance, newPrivacy)// Delete passwords if video is not anymore password protecteddiff --git a/server/controllers/api/videos/upload.ts b/server/server/controllers/api/videos/upload.tssimilarity index 90%rename from server/controllers/api/videos/upload.tsrename to server/server/controllers/api/videos/upload.tsindex e520bf4b5e..47f06e3365 100644--- a/server/controllers/api/videos/upload.ts+++ b/server/server/controllers/api/videos/upload.ts@@ -1,29 +1,29 @@import express from 'express'-import { move } from 'fs-extra'+import { move } from 'fs-extra/esm'import { basename } from 'path'-import { getResumableUploadPath } from '@server/helpers/upload'-import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'-import { CreateJobArgument, CreateJobOptions, JobQueue } from '@server/lib/job-queue'-import { Redis } from '@server/lib/redis'-import { uploadx } from '@server/lib/uploadx'-import { buildLocalVideoFromReq, buildMoveToObjectStorageJob, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'-import { buildNewFile } from '@server/lib/video-file'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { buildNextVideoState } from '@server/lib/video-state'-import { openapiOperationDoc } from '@server/middlewares/doc'-import { VideoPasswordModel } from '@server/models/video/video-password'-import { VideoSourceModel } from '@server/models/video/video-source'-import { MVideoFile, MVideoFullLight } from '@server/types/models'-import { uuidToShort } from '@shared/extra-utils'-import { HttpStatusCode, VideoCreate, VideoPrivacy, VideoState } from '@shared/models'-import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'-import { createReqFiles } from '../../../helpers/express-utils'-import { logger, loggerTagsFactory } from '../../../helpers/logger'-import { MIMETYPES } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { Hooks } from '../../../lib/plugins/hooks'-import { generateLocalVideoMiniature } from '../../../lib/thumbnail'-import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'+import { getResumableUploadPath } from '@server/helpers/upload.js'+import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url.js'+import { CreateJobArgument, CreateJobOptions, JobQueue } from '@server/lib/job-queue/index.js'+import { Redis } from '@server/lib/redis.js'+import { uploadx } from '@server/lib/uploadx.js'+import { buildLocalVideoFromReq, buildMoveToObjectStorageJob, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video.js'+import { buildNewFile } from '@server/lib/video-file.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { buildNextVideoState } from '@server/lib/video-state.js'+import { openapiOperationDoc } from '@server/middlewares/doc.js'+import { VideoPasswordModel } from '@server/models/video/video-password.js'+import { VideoSourceModel } from '@server/models/video/video-source.js'+import { MVideoFile, MVideoFullLight } from '@server/types/models/index.js'+import { uuidToShort } from '@peertube/peertube-node-utils'+import { HttpStatusCode, VideoCreate, VideoPrivacy, VideoState } from '@peertube/peertube-models'+import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger.js'+import { createReqFiles } from '../../../helpers/express-utils.js'+import { logger, loggerTagsFactory } from '../../../helpers/logger.js'+import { MIMETYPES } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { Hooks } from '../../../lib/plugins/hooks.js'+import { generateLocalVideoMiniature } from '../../../lib/thumbnail.js'+import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist.js'import {asyncMiddleware,asyncRetryTransactionMiddleware,@@ -31,9 +31,9 @@ import {videosAddLegacyValidator,videosAddResumableInitValidator,videosAddResumableValidator-} from '../../../middlewares'-import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'-import { VideoModel } from '../../../models/video/video'+} from '../../../middlewares/index.js'+import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update.js'+import { VideoModel } from '../../../models/video/video.js'const lTags = loggerTagsFactory('api', 'video')const auditLogger = auditLoggerFactory('videos')diff --git a/server/controllers/api/videos/view.ts b/server/server/controllers/api/videos/view.tssimilarity index 80%rename from server/controllers/api/videos/view.tsrename to server/server/controllers/api/videos/view.tsindex a747fa334f..cc0534753c 100644--- a/server/controllers/api/videos/view.ts+++ b/server/server/controllers/api/videos/view.ts@@ -1,10 +1,16 @@import express from 'express'-import { Hooks } from '@server/lib/plugins/hooks'-import { VideoViewsManager } from '@server/lib/views/video-views-manager'-import { MVideoId } from '@server/types/models'-import { HttpStatusCode, VideoView } from '@shared/models'-import { asyncMiddleware, methodsValidator, openapiOperationDoc, optionalAuthenticate, videoViewValidator } from '../../../middlewares'-import { UserVideoHistoryModel } from '../../../models/user/user-video-history'+import { HttpStatusCode, VideoView } from '@peertube/peertube-models'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { VideoViewsManager } from '@server/lib/views/video-views-manager.js'+import { MVideoId } from '@server/types/models/index.js'+import {+ asyncMiddleware,+ methodsValidator,+ openapiOperationDoc,+ optionalAuthenticate,+ videoViewValidator+} from '../../../middlewares/index.js'+import { UserVideoHistoryModel } from '../../../models/user/user-video-history.js'const viewRouter = express.Router()diff --git a/server/controllers/client.ts b/server/server/controllers/client.tssimilarity index 92%rename from server/controllers/client.tsrename to server/server/controllers/client.tsindex 2d0c499042..a790859c71 100644--- a/server/controllers/client.ts+++ b/server/server/controllers/client.ts@@ -1,16 +1,16 @@import express from 'express'import { constants, promises as fs } from 'fs'-import { readFile } from 'fs-extra'+import { readFile } from 'fs/promises'import { join } from 'path'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { Hooks } from '@server/lib/plugins/hooks'-import { root } from '@shared/core-utils'-import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '@shared/core-utils/i18n'-import { HttpStatusCode } from '@shared/models'-import { STATIC_MAX_AGE } from '../initializers/constants'-import { ClientHtml, sendHTML, serveIndexHTML } from '../lib/client-html'-import { asyncMiddleware, buildRateLimiter, embedCSP } from '../middlewares'+import { buildFileLocale, getCompleteLocale, is18nLocale, LOCALE_FILES } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { currentDir, root } from '@peertube/peertube-node-utils'+import { STATIC_MAX_AGE } from '../initializers/constants.js'+import { ClientHtml, sendHTML, serveIndexHTML } from '../lib/client-html.js'+import { asyncMiddleware, buildRateLimiter, embedCSP } from '../middlewares/index.js'const clientsRouter = express.Router()@@ -135,7 +135,7 @@ function serveServerTranslations (req: express.Request, res: express.Response) {const completeLocale = getCompleteLocale(locale)const completeFileLocale = buildFileLocale(completeLocale)- const path = join(__dirname, `../../../client/dist/locale/${file}.${completeFileLocale}.json`)+ const path = join(currentDir(import.meta.url), `../../../client/dist/locale/${file}.${completeFileLocale}.json`)return res.sendFile(path, { maxAge: STATIC_MAX_AGE.SERVER })}diff --git a/server/controllers/download.ts b/server/server/controllers/download.tssimilarity index 94%rename from server/controllers/download.tsrename to server/server/controllers/download.tsindex 4b94e34bd1..51b7b3af59 100644--- a/server/controllers/download.ts+++ b/server/server/controllers/download.ts@@ -1,15 +1,15 @@import cors from 'cors'import express from 'express'-import { logger } from '@server/helpers/logger'-import { VideoTorrentsSimpleFileCache } from '@server/lib/files-cache'-import { generateHLSFilePresignedUrl, generateWebVideoPresignedUrl } from '@server/lib/object-storage'-import { Hooks } from '@server/lib/plugins/hooks'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode, VideoStorage, VideoStreamingPlaylistType } from '@shared/models'-import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants'-import { asyncMiddleware, optionalAuthenticate, videosDownloadValidator } from '../middlewares'+import { logger } from '@server/helpers/logger.js'+import { VideoTorrentsSimpleFileCache } from '@server/lib/files-cache/index.js'+import { generateHLSFilePresignedUrl, generateWebVideoPresignedUrl } from '@server/lib/object-storage/index.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models/index.js'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode, VideoStorage, VideoStreamingPlaylistType } from '@peertube/peertube-models'+import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants.js'+import { asyncMiddleware, optionalAuthenticate, videosDownloadValidator } from '../middlewares/index.js'const downloadRouter = express.Router()diff --git a/server/controllers/feeds/comment-feeds.ts b/server/server/controllers/feeds/comment-feeds.tssimilarity index 89%rename from server/controllers/feeds/comment-feeds.tsrename to server/server/controllers/feeds/comment-feeds.tsindex c013662ea4..4178f198e7 100644--- a/server/controllers/feeds/comment-feeds.ts+++ b/server/server/controllers/feeds/comment-feeds.ts@@ -1,17 +1,17 @@import express from 'express'-import { toSafeHtml } from '@server/helpers/markdown'-import { cacheRouteFactory } from '@server/middlewares'-import { CONFIG } from '../../initializers/config'-import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants'+import { toSafeHtml } from '@server/helpers/markdown.js'+import { cacheRouteFactory } from '@server/middlewares/index.js'+import { CONFIG } from '../../initializers/config.js'+import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants.js'import {asyncMiddleware,feedsFormatValidator,setFeedFormatContentType,videoCommentsFeedsValidator,feedsAccountOrChannelFiltersValidator-} from '../../middlewares'-import { VideoCommentModel } from '../../models/video/video-comment'-import { buildFeedMetadata, initFeed, sendFeed } from './shared'+} from '../../middlewares/index.js'+import { VideoCommentModel } from '../../models/video/video-comment.js'+import { buildFeedMetadata, initFeed, sendFeed } from './shared/index.js'const commentFeedsRouter = express.Router()diff --git a/server/controllers/feeds/index.ts b/server/server/controllers/feeds/index.tssimilarity index 62%rename from server/controllers/feeds/index.tsrename to server/server/controllers/feeds/index.tsindex 19352318d6..b7210372f7 100644--- a/server/controllers/feeds/index.ts+++ b/server/server/controllers/feeds/index.ts@@ -1,9 +1,9 @@import express from 'express'-import { CONFIG } from '@server/initializers/config'-import { buildRateLimiter } from '@server/middlewares'-import { commentFeedsRouter } from './comment-feeds'-import { videoFeedsRouter } from './video-feeds'-import { videoPodcastFeedsRouter } from './video-podcast-feeds'+import { CONFIG } from '@server/initializers/config.js'+import { buildRateLimiter } from '@server/middlewares/index.js'+import { commentFeedsRouter } from './comment-feeds.js'+import { videoFeedsRouter } from './video-feeds.js'+import { videoPodcastFeedsRouter } from './video-podcast-feeds.js'const feedsRouter = express.Router()diff --git a/server/controllers/feeds/shared/common-feed-utils.ts b/server/server/controllers/feeds/shared/common-feed-utils.tssimilarity index 90%rename from server/controllers/feeds/shared/common-feed-utils.tsrename to server/server/controllers/feeds/shared/common-feed-utils.tsindex 9e2f8adbbf..af9cafb5d2 100644--- a/server/controllers/feeds/shared/common-feed-utils.ts+++ b/server/server/controllers/feeds/shared/common-feed-utils.ts@@ -1,14 +1,14 @@import express from 'express'import { Feed } from '@peertube/feed'-import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings'-import { mdToOneLinePlainText } from '@server/helpers/markdown'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { getBiggestActorImage } from '@server/lib/actor-image'-import { UserModel } from '@server/models/user/user'-import { MAccountDefault, MChannelBannerAccountDefault, MUser, MVideoFullLight } from '@server/types/models'-import { pick } from '@shared/core-utils'-import { ActorImageType } from '@shared/models'+import { CustomTag, CustomXMLNS, Person } from '@peertube/feed/lib/typings/index.js'+import { mdToOneLinePlainText } from '@server/helpers/markdown.js'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { getBiggestActorImage } from '@server/lib/actor-image.js'+import { UserModel } from '@server/models/user/user.js'+import { MAccountDefault, MChannelBannerAccountDefault, MUser, MVideoFullLight } from '@server/types/models/index.js'+import { pick } from '@peertube/peertube-core-utils'+import { ActorImageType } from '@peertube/peertube-models'export function initFeed (parameters: {name: stringdiff --git a/server/server/controllers/feeds/shared/index.ts b/server/server/controllers/feeds/shared/index.tsnew file mode 100644index 0000000000..b36a7265c4--- /dev/null+++ b/server/server/controllers/feeds/shared/index.ts@@ -0,0 +1,2 @@+export * from './video-feed-utils.js'+export * from './common-feed-utils.js'diff --git a/server/controllers/feeds/shared/video-feed-utils.ts b/server/server/controllers/feeds/shared/video-feed-utils.tssimilarity index 79%rename from server/controllers/feeds/shared/video-feed-utils.tsrename to server/server/controllers/feeds/shared/video-feed-utils.tsindex b154e04fac..b6306c214c 100644--- a/server/controllers/feeds/shared/video-feed-utils.ts+++ b/server/server/controllers/feeds/shared/video-feed-utils.ts@@ -1,18 +1,18 @@-import { mdToOneLinePlainText, toSafeHtml } from '@server/helpers/markdown'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { getServerActor } from '@server/models/application/application'-import { getCategoryLabel } from '@server/models/video/formatter'-import { DisplayOnlyForFollowerOptions } from '@server/models/video/sql/video'-import { VideoModel } from '@server/models/video/video'-import { MThumbnail, MUserDefault } from '@server/types/models'-import { VideoInclude } from '@shared/models'+import { VideoIncludeType } from '@peertube/peertube-models'+import { mdToOneLinePlainText, toSafeHtml } from '@server/helpers/markdown.js'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { getServerActor } from '@server/models/application/application.js'+import { getCategoryLabel } from '@server/models/video/formatter/index.js'+import { DisplayOnlyForFollowerOptions } from '@server/models/video/sql/video/index.js'+import { VideoModel } from '@server/models/video/video.js'+import { MThumbnail, MUserDefault } from '@server/types/models/index.js'export async function getVideosForFeeds (options: {sort: stringnsfw: booleanisLocal: boolean- include: VideoInclude+ include: VideoIncludeTypeaccountId?: numbervideoChannelId?: numberdiff --git a/server/controllers/feeds/video-feeds.ts b/server/server/controllers/feeds/video-feeds.tssimilarity index 93%rename from server/controllers/feeds/video-feeds.tsrename to server/server/controllers/feeds/video-feeds.tsindex e5941be402..fc0e6e0f76 100644--- a/server/controllers/feeds/video-feeds.ts+++ b/server/server/controllers/feeds/video-feeds.ts@@ -1,11 +1,11 @@import express from 'express'import { extname } from 'path'import { Feed } from '@peertube/feed'-import { cacheRouteFactory } from '@server/middlewares'-import { VideoModel } from '@server/models/video/video'-import { VideoInclude } from '@shared/models'-import { buildNSFWFilter } from '../../helpers/express-utils'-import { MIMETYPES, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants'+import { cacheRouteFactory } from '@server/middlewares/index.js'+import { VideoModel } from '@server/models/video/video.js'+import { VideoInclude } from '@peertube/peertube-models'+import { buildNSFWFilter } from '../../helpers/express-utils.js'+import { MIMETYPES, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants.js'import {asyncMiddleware,commonVideosFiltersValidator,@@ -15,8 +15,8 @@ import {feedsAccountOrChannelFiltersValidator,videosSortValidator,videoSubscriptionFeedsValidator-} from '../../middlewares'-import { buildFeedMetadata, getCommonVideoFeedAttributes, getVideosForFeeds, initFeed, sendFeed } from './shared'+} from '../../middlewares/index.js'+import { buildFeedMetadata, getCommonVideoFeedAttributes, getVideosForFeeds, initFeed, sendFeed } from './shared/index.js'const videoFeedsRouter = express.Router()diff --git a/server/controllers/feeds/video-podcast-feeds.ts b/server/server/controllers/feeds/video-podcast-feeds.tssimilarity index 93%rename from server/controllers/feeds/video-podcast-feeds.tsrename to server/server/controllers/feeds/video-podcast-feeds.tsindex fca82ba687..84d5acadd1 100644--- a/server/controllers/feeds/video-podcast-feeds.ts+++ b/server/server/controllers/feeds/video-podcast-feeds.ts@@ -1,20 +1,20 @@import express from 'express'import { extname } from 'path'import { Feed } from '@peertube/feed'-import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings'-import { getBiggestActorImage } from '@server/lib/actor-image'-import { InternalEventEmitter } from '@server/lib/internal-event-emitter'-import { Hooks } from '@server/lib/plugins/hooks'-import { buildPodcastGroupsCache, cacheRouteFactory, videoFeedsPodcastSetCacheKey } from '@server/middlewares'-import { MVideo, MVideoCaptionVideo, MVideoFullLight } from '@server/types/models'-import { sortObjectComparator } from '@shared/core-utils'-import { ActorImageType, VideoFile, VideoInclude, VideoResolution, VideoState } from '@shared/models'-import { buildNSFWFilter } from '../../helpers/express-utils'-import { MIMETYPES, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants'-import { asyncMiddleware, setFeedPodcastContentType, videoFeedsPodcastValidator } from '../../middlewares'-import { VideoModel } from '../../models/video/video'-import { VideoCaptionModel } from '../../models/video/video-caption'-import { buildFeedMetadata, getCommonVideoFeedAttributes, getVideosForFeeds, initFeed } from './shared'+import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings/index.js'+import { getBiggestActorImage } from '@server/lib/actor-image.js'+import { InternalEventEmitter } from '@server/lib/internal-event-emitter.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { buildPodcastGroupsCache, cacheRouteFactory, videoFeedsPodcastSetCacheKey } from '@server/middlewares/index.js'+import { MVideo, MVideoCaptionVideo, MVideoFullLight } from '@server/types/models/index.js'+import { sortObjectComparator } from '@peertube/peertube-core-utils'+import { ActorImageType, VideoFile, VideoInclude, VideoResolution, VideoState } from '@peertube/peertube-models'+import { buildNSFWFilter } from '../../helpers/express-utils.js'+import { MIMETYPES, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants.js'+import { asyncMiddleware, setFeedPodcastContentType, videoFeedsPodcastValidator } from '../../middlewares/index.js'+import { VideoModel } from '../../models/video/video.js'+import { VideoCaptionModel } from '../../models/video/video-caption.js'+import { buildFeedMetadata, getCommonVideoFeedAttributes, getVideosForFeeds, initFeed } from './shared/index.js'const videoPodcastFeedsRouter = express.Router()diff --git a/server/server/controllers/index.ts b/server/server/controllers/index.tsnew file mode 100644index 0000000000..db326c486b--- /dev/null+++ b/server/server/controllers/index.ts@@ -0,0 +1,14 @@+export * from './activitypub/index.js'+export * from './api/index.js'+export * from './sitemap.js'+export * from './client.js'+export * from './download.js'+export * from './feeds/index.js'+export * from './lazy-static.js'+export * from './misc.js'+export * from './object-storage-proxy.js'+export * from './plugins.js'+export * from './services.js'+export * from './static.js'+export * from './tracker.js'+export * from './well-known.js'diff --git a/server/controllers/lazy-static.ts b/server/server/controllers/lazy-static.tssimilarity index 95%rename from server/controllers/lazy-static.tsrename to server/server/controllers/lazy-static.tsindex dad30365c3..69aa549a78 100644--- a/server/controllers/lazy-static.ts+++ b/server/server/controllers/lazy-static.ts@@ -1,8 +1,8 @@import cors from 'cors'import express from 'express'-import { CONFIG } from '@server/initializers/config'-import { HttpStatusCode } from '../../shared/models/http/http-error-codes'-import { FILES_CACHE, LAZY_STATIC_PATHS, STATIC_MAX_AGE } from '../initializers/constants'+import { HttpStatusCode } from '@peertube/peertube-models'+import { CONFIG } from '@server/initializers/config.js'+import { FILES_CACHE, LAZY_STATIC_PATHS, STATIC_MAX_AGE } from '../initializers/constants.js'import {AvatarPermanentFileCache,VideoCaptionsSimpleFileCache,@@ -10,8 +10,8 @@ import {VideoPreviewsSimpleFileCache,VideoStoryboardsSimpleFileCache,VideoTorrentsSimpleFileCache-} from '../lib/files-cache'-import { asyncMiddleware, handleStaticError } from '../middlewares'+} from '../lib/files-cache/index.js'+import { asyncMiddleware, handleStaticError } from '../middlewares/index.js'// ---------------------------------------------------------------------------// Cache initializationsdiff --git a/server/controllers/misc.ts b/server/server/controllers/misc.tssimilarity index 90%rename from server/controllers/misc.tsrename to server/server/controllers/misc.tsindex a7dfc7867e..cf204e9651 100644--- a/server/controllers/misc.ts+++ b/server/server/controllers/misc.ts@@ -1,17 +1,16 @@import cors from 'cors'import express from 'express'-import { CONFIG, isEmailEnabled } from '@server/initializers/config'-import { serveIndexHTML } from '@server/lib/client-html'-import { ServerConfigManager } from '@server/lib/server-config-manager'-import { HttpStatusCode } from '@shared/models'-import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo/nodeinfo.model'-import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION, ROUTE_CACHE_LIFETIME } from '../initializers/constants'-import { getThemeOrDefault } from '../lib/plugins/theme-utils'-import { apiRateLimiter, asyncMiddleware } from '../middlewares'-import { cacheRoute } from '../middlewares/cache/cache'-import { UserModel } from '../models/user/user'-import { VideoModel } from '../models/video/video'-import { VideoCommentModel } from '../models/video/video-comment'+import { HttpNodeinfoDiasporaSoftwareNsSchema20, HttpStatusCode } from '@peertube/peertube-models'+import { CONFIG, isEmailEnabled } from '@server/initializers/config.js'+import { serveIndexHTML } from '@server/lib/client-html.js'+import { ServerConfigManager } from '@server/lib/server-config-manager.js'+import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION, ROUTE_CACHE_LIFETIME } from '../initializers/constants.js'+import { getThemeOrDefault } from '../lib/plugins/theme-utils.js'+import { cacheRoute } from '../middlewares/cache/cache.js'+import { apiRateLimiter, asyncMiddleware } from '../middlewares/index.js'+import { UserModel } from '../models/user/user.js'+import { VideoCommentModel } from '../models/video/video-comment.js'+import { VideoModel } from '../models/video/video.js'const miscRouter = express.Router()diff --git a/server/controllers/object-storage-proxy.ts b/server/server/controllers/object-storage-proxy.tssimilarity index 95%rename from server/controllers/object-storage-proxy.tsrename to server/server/controllers/object-storage-proxy.tsindex d0c59bf93c..957f46198d 100644--- a/server/controllers/object-storage-proxy.ts+++ b/server/server/controllers/object-storage-proxy.ts@@ -1,15 +1,15 @@import cors from 'cors'import express from 'express'-import { OBJECT_STORAGE_PROXY_PATHS } from '@server/initializers/constants'-import { proxifyHLS, proxifyWebVideoFile } from '@server/lib/object-storage'+import { OBJECT_STORAGE_PROXY_PATHS } from '@server/initializers/constants.js'+import { proxifyHLS, proxifyWebVideoFile } from '@server/lib/object-storage/index.js'import {asyncMiddleware,ensureCanAccessPrivateVideoHLSFiles,ensureCanAccessVideoPrivateWebVideoFiles,ensurePrivateObjectStorageProxyIsEnabled,optionalAuthenticate-} from '@server/middlewares'-import { doReinjectVideoFileToken } from './shared/m3u8-playlist'+} from '@server/middlewares/index.js'+import { doReinjectVideoFileToken } from './shared/m3u8-playlist.js'const objectStorageProxyRouter = express.Router()diff --git a/server/controllers/plugins.ts b/server/server/controllers/plugins.tssimilarity index 89%rename from server/controllers/plugins.tsrename to server/server/controllers/plugins.tsindex f0491b16ab..1bcecce0ef 100644--- a/server/controllers/plugins.ts+++ b/server/server/controllers/plugins.ts@@ -1,17 +1,16 @@import express from 'express'import { join } from 'path'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { buildRateLimiter } from '@server/middlewares'-import { optionalAuthenticate } from '@server/middlewares/auth'-import { getCompleteLocale, is18nLocale } from '../../shared/core-utils/i18n'-import { HttpStatusCode } from '../../shared/models/http/http-error-codes'-import { PluginType } from '../../shared/models/plugins/plugin.type'-import { isProdInstance } from '../helpers/core-utils'-import { PLUGIN_GLOBAL_CSS_PATH } from '../initializers/constants'-import { PluginManager, RegisteredPlugin } from '../lib/plugins/plugin-manager'-import { getExternalAuthValidator, getPluginValidator, pluginStaticDirectoryValidator } from '../middlewares/validators/plugins'-import { serveThemeCSSValidator } from '../middlewares/validators/themes'+import { getCompleteLocale, is18nLocale } from '@peertube/peertube-core-utils'+import { HttpStatusCode, PluginType } from '@peertube/peertube-models'+import { isProdInstance } from '@peertube/peertube-node-utils'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { optionalAuthenticate } from '@server/middlewares/auth.js'+import { buildRateLimiter } from '@server/middlewares/index.js'+import { PLUGIN_GLOBAL_CSS_PATH } from '../initializers/constants.js'+import { PluginManager, RegisteredPlugin } from '../lib/plugins/plugin-manager.js'+import { getExternalAuthValidator, getPluginValidator, pluginStaticDirectoryValidator } from '../middlewares/validators/plugins.js'+import { serveThemeCSSValidator } from '../middlewares/validators/themes.js'const sendFileOptions = {maxAge: '30 days',diff --git a/server/controllers/services.ts b/server/server/controllers/services.tssimilarity index 94%rename from server/controllers/services.tsrename to server/server/controllers/services.tsindex 0fd63a30f6..b59f0f3373 100644--- a/server/controllers/services.ts+++ b/server/server/controllers/services.ts@@ -1,10 +1,9 @@import express from 'express'-import { MChannelSummary } from '@server/types/models'-import { escapeHTML } from '@shared/core-utils/renderer'-import { EMBED_SIZE, PREVIEWS_SIZE, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants'-import { apiRateLimiter, asyncMiddleware, oembedValidator } from '../middlewares'-import { accountNameWithHostGetValidator } from '../middlewares/validators'-import { forceNumber } from '@shared/core-utils'+import { escapeHTML, forceNumber } from '@peertube/peertube-core-utils'+import { MChannelSummary } from '@server/types/models/index.js'+import { EMBED_SIZE, PREVIEWS_SIZE, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants.js'+import { apiRateLimiter, asyncMiddleware, oembedValidator } from '../middlewares/index.js'+import { accountNameWithHostGetValidator } from '../middlewares/validators/index.js'const servicesRouter = express.Router()diff --git a/server/controllers/shared/m3u8-playlist.ts b/server/server/controllers/shared/m3u8-playlist.tssimilarity index 100%rename from server/controllers/shared/m3u8-playlist.tsrename to server/server/controllers/shared/m3u8-playlist.tsdiff --git a/server/controllers/sitemap.ts b/server/server/controllers/sitemap.tssimilarity index 87%rename from server/controllers/sitemap.tsrename to server/server/controllers/sitemap.tsindex 07f4c554e3..69aea6167c 100644--- a/server/controllers/sitemap.ts+++ b/server/server/controllers/sitemap.ts@@ -1,15 +1,15 @@import express from 'express'-import { truncate } from 'lodash'+import truncate from 'lodash-es/truncate.js'import { ErrorLevel, SitemapStream, streamToPromise } from 'sitemap'-import { logger } from '@server/helpers/logger'-import { getServerActor } from '@server/models/application/application'-import { buildNSFWFilter } from '../helpers/express-utils'-import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'-import { apiRateLimiter, asyncMiddleware } from '../middlewares'-import { cacheRoute } from '../middlewares/cache/cache'-import { AccountModel } from '../models/account/account'-import { VideoModel } from '../models/video/video'-import { VideoChannelModel } from '../models/video/video-channel'+import { logger } from '@server/helpers/logger.js'+import { getServerActor } from '@server/models/application/application.js'+import { buildNSFWFilter } from '../helpers/express-utils.js'+import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants.js'+import { apiRateLimiter, asyncMiddleware } from '../middlewares/index.js'+import { cacheRoute } from '../middlewares/cache/cache.js'+import { AccountModel } from '../models/account/account.js'+import { VideoModel } from '../models/video/video.js'+import { VideoChannelModel } from '../models/video/video-channel.js'const sitemapRouter = express.Router()diff --git a/server/controllers/static.ts b/server/server/controllers/static.tssimilarity index 92%rename from server/controllers/static.tsrename to server/server/controllers/static.tsindex 97caa8292d..06807a9d5f 100644--- a/server/controllers/static.ts+++ b/server/server/controllers/static.ts@@ -1,19 +1,19 @@import cors from 'cors'import express from 'express'-import { readFile } from 'fs-extra'+import { readFile } from 'fs/promises'import { join } from 'path'-import { injectQueryToPlaylistUrls } from '@server/lib/hls'+import { injectQueryToPlaylistUrls } from '@server/lib/hls.js'import {asyncMiddleware,ensureCanAccessPrivateVideoHLSFiles,ensureCanAccessVideoPrivateWebVideoFiles,handleStaticError,optionalAuthenticate-} from '@server/middlewares'-import { HttpStatusCode } from '@shared/models'-import { CONFIG } from '../initializers/config'-import { DIRECTORIES, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers/constants'-import { buildReinjectVideoFileTokenQuery, doReinjectVideoFileToken } from './shared/m3u8-playlist'+} from '@server/middlewares/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { CONFIG } from '../initializers/config.js'+import { DIRECTORIES, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers/constants.js'+import { buildReinjectVideoFileTokenQuery, doReinjectVideoFileToken } from './shared/m3u8-playlist.js'const staticRouter = express.Router()diff --git a/server/controllers/tracker.ts b/server/server/controllers/tracker.tssimilarity index 95%rename from server/controllers/tracker.tsrename to server/server/controllers/tracker.tsindex 9a8aa88bcb..e8d29f976c 100644--- a/server/controllers/tracker.ts+++ b/server/server/controllers/tracker.ts@@ -4,11 +4,11 @@ import { createServer } from 'http'import { LRUCache } from 'lru-cache'import proxyAddr from 'proxy-addr'import { WebSocketServer } from 'ws'-import { logger } from '../helpers/logger'-import { CONFIG } from '../initializers/config'-import { LRU_CACHE, TRACKER_RATE_LIMITS } from '../initializers/constants'-import { VideoFileModel } from '../models/video/video-file'-import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'+import { logger } from '../helpers/logger.js'+import { CONFIG } from '../initializers/config.js'+import { LRU_CACHE, TRACKER_RATE_LIMITS } from '../initializers/constants.js'+import { VideoFileModel } from '../models/video/video-file.js'+import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist.js'const trackerRouter = express.Router()diff --git a/server/controllers/well-known.ts b/server/server/controllers/well-known.tssimilarity index 93%rename from server/controllers/well-known.tsrename to server/server/controllers/well-known.tsindex 322cf6ea20..b6bcd79efa 100644--- a/server/controllers/well-known.ts+++ b/server/server/controllers/well-known.ts@@ -1,11 +1,11 @@import cors from 'cors'import express from 'express'import { join } from 'path'-import { asyncMiddleware, buildRateLimiter, handleStaticError, webfingerValidator } from '@server/middlewares'-import { root } from '@shared/core-utils'-import { CONFIG } from '../initializers/config'-import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'-import { cacheRoute } from '../middlewares/cache/cache'+import { asyncMiddleware, buildRateLimiter, handleStaticError, webfingerValidator } from '@server/middlewares/index.js'+import { root } from '@peertube/peertube-node-utils'+import { CONFIG } from '../initializers/config.js'+import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants.js'+import { cacheRoute } from '../middlewares/cache/cache.js'const wellKnownRouter = express.Router()diff --git a/server/lib/activitypub/context.ts b/server/server/helpers/activity-pub-utils.tssimilarity index 78%rename from server/lib/activitypub/context.tsrename to server/server/helpers/activity-pub-utils.tsindex 87eb498a35..acc5c304ba 100644--- a/server/lib/activitypub/context.ts+++ b/server/server/helpers/activity-pub-utils.ts@@ -1,17 +1,36 @@-import { ContextType } from '@shared/models'-import { Hooks } from '../plugins/hooks'--async function activityPubContextify <T> (data: T, type: ContextType) {- return { ...await getContextData(type), ...data }+import { ContextType } from '@peertube/peertube-models'+import { ACTIVITY_PUB } from '@server/initializers/constants.js'+import { buildDigest, signJsonLDObject } from './peertube-crypto.js'++type ContextFilter = <T> (arg: T) => Promise<T>++export function buildGlobalHTTPHeaders (body: any) {+ return {+ 'digest': buildDigest(body),+ 'content-type': 'application/activity+json',+ 'accept': ACTIVITY_PUB.ACCEPT_HEADER+ }}-// ---------------------------------------------------------------------------+export async function activityPubContextify <T> (data: T, type: ContextType, contextFilter: ContextFilter) {+ return { ...await getContextData(type, contextFilter), ...data }+}-export {- getContextData,- activityPubContextify+export async function signAndContextify <T> (+ byActor: { url: string, privateKey: string },+ data: T,+ contextType: ContextType | null,+ contextFilter: ContextFilter+) {+ const activity = contextType+ ? await activityPubContextify(data, contextType, contextFilter)+ : data++ return signJsonLDObject(byActor, activity)}+// ---------------------------------------------------------------------------+// Private// ---------------------------------------------------------------------------type ContextValue = { [ id: string ]: (string | { '@type': string, '@id': string }) }@@ -179,11 +198,10 @@ const contextStore: { [ id in ContextType ]: (string | { [ id: string ]: stringRate: buildContext()}-async function getContextData (type: ContextType) {- const contextData = await Hooks.wrapObject(- contextStore[type],- 'filter:activity-pub.activity.context.build.result'- )+async function getContextData (type: ContextType, contextFilter: ContextFilter) {+ const contextData = contextFilter+ ? await contextFilter(contextStore[type])+ : contextStore[type]return { '@context': contextData }}diff --git a/server/helpers/actors.ts b/server/server/helpers/actors.tssimilarity index 84%rename from server/helpers/actors.tsrename to server/server/helpers/actors.tsindex c31fe6f8e2..5be5c9ee79 100644--- a/server/helpers/actors.ts+++ b/server/server/helpers/actors.ts@@ -1,4 +1,4 @@-import { WEBSERVER } from '@server/initializers/constants'+import { WEBSERVER } from '@server/initializers/constants.js'function handleToNameAndHost (handle: string) {let [ name, host ] = handle.split('@')diff --git a/server/helpers/audit-logger.ts b/server/server/helpers/audit-logger.tssimilarity index 86%rename from server/helpers/audit-logger.tsrename to server/server/helpers/audit-logger.tsindex 7e8a03e8fc..bf79ced017 100644--- a/server/helpers/audit-logger.ts+++ b/server/server/helpers/audit-logger.ts@@ -1,13 +1,21 @@+import {+ AdminAbuse,+ CustomConfig,+ User,+ VideoChannel,+ VideoChannelSync,+ VideoComment,+ VideoDetails,+ VideoImport+} from '@peertube/peertube-models'+import { AUDIT_LOG_FILENAME } from '@server/initializers/constants.js'import { diff } from 'deep-object-diff'import express from 'express'import flatten from 'flat'-import { chain } from 'lodash'import { join } from 'path'import { addColors, config, createLogger, format, transports } from 'winston'-import { AUDIT_LOG_FILENAME } from '@server/initializers/constants'-import { AdminAbuse, CustomConfig, User, VideoChannel, VideoChannelSync, VideoComment, VideoDetails, VideoImport } from '@shared/models'-import { CONFIG } from '../initializers/config'-import { jsonLoggerFormat, labelFormatter } from './logger'+import { CONFIG } from '../initializers/config.js'+import { jsonLoggerFormat, labelFormatter } from './logger.js'function getAuditIdFromRes (res: express.Response) {return res.locals.oauth.token.User.username@@ -45,6 +53,7 @@ const auditLogger = createLogger({function auditLoggerWrapper (domain: string, user: string, action: AUDIT_TYPE, entity: EntityAuditView, oldEntity: EntityAuditView = null) {let entityInfos: object+if (action === AUDIT_TYPE.UPDATE && oldEntity) {const oldEntityKeys = oldEntity.toLogKeys()const diffObject = diff(oldEntityKeys, entity.toLogKeys())@@ -56,6 +65,7 @@ function auditLoggerWrapper (domain: string, user: string, action: AUDIT_TYPE, e} else {entityInfos = { ...entity.toLogKeys() }}+auditLogger.log('audit', JSON.stringify({user,domain,@@ -79,17 +89,18 @@ function auditLoggerFactory (domain: string) {}abstract class EntityAuditView {- constructor (private readonly keysToKeep: string[], private readonly prefix: string, private readonly entityInfos: object) { }+ constructor (private readonly keysToKeep: Set<string>, private readonly prefix: string, private readonly entityInfos: object) { }toLogKeys (): object {- return chain(flatten<object, any>(this.entityInfos, { delimiter: '-', safe: true }))- .pick(this.keysToKeep)- .mapKeys((_value, key) => `${this.prefix}-${key}`)- .value()+ const obj = flatten<object, any>(this.entityInfos, { delimiter: '-', safe: true })++ return Object.keys(obj)+ .filter(key => this.keysToKeep.has(key))+ .reduce((p, k) => ({ ...p, [`${this.prefix}-${k}`]: obj[k] }), {})}}-const videoKeysToKeep = [+const videoKeysToKeep = new Set(['tags','uuid','id',@@ -118,25 +129,25 @@ const videoKeysToKeep = ['support','commentsEnabled','downloadEnabled'-]+])class VideoAuditView extends EntityAuditView {constructor (video: VideoDetails) {super(videoKeysToKeep, 'video', video)}}-const videoImportKeysToKeep = [+const videoImportKeysToKeep = new Set(['id','targetUrl','video-name'-]+])class VideoImportAuditView extends EntityAuditView {constructor (videoImport: VideoImport) {super(videoImportKeysToKeep, 'video-import', videoImport)}}-const commentKeysToKeep = [+const commentKeysToKeep = new Set(['id','text','threadId',@@ -148,14 +159,14 @@ const commentKeysToKeep = ['account-id','account-uuid','account-name'-]+])class CommentAuditView extends EntityAuditView {constructor (comment: VideoComment) {super(commentKeysToKeep, 'comment', comment)}}-const userKeysToKeep = [+const userKeysToKeep = new Set(['id','username','email',@@ -177,14 +188,14 @@ const userKeysToKeep = ['account-displayName','account-description','videoChannels'-]+])class UserAuditView extends EntityAuditView {constructor (user: User) {super(userKeysToKeep, 'user', user)}}-const channelKeysToKeep = [+const channelKeysToKeep = new Set(['id','uuid','name',@@ -203,26 +214,26 @@ const channelKeysToKeep = ['ownerAccount-uuid','ownerAccount-name','ownerAccount-displayedName'-]+])class VideoChannelAuditView extends EntityAuditView {constructor (channel: VideoChannel) {super(channelKeysToKeep, 'channel', channel)}}-const abuseKeysToKeep = [+const abuseKeysToKeep = new Set(['id','reason','reporterAccount','createdAt'-]+])class AbuseAuditView extends EntityAuditView {constructor (abuse: AdminAbuse) {super(abuseKeysToKeep, 'abuse', abuse)}}-const customConfigKeysToKeep = [+const customConfigKeysToKeep = new Set(['instance-name','instance-shortDescription','instance-description',@@ -243,7 +254,7 @@ const customConfigKeysToKeep = ['transcoding-enabled','transcoding-threads','transcoding-resolutions'-]+])class CustomConfigAuditView extends EntityAuditView {constructor (customConfig: CustomConfig) {const infos: any = customConfig@@ -260,12 +271,12 @@ class CustomConfigAuditView extends EntityAuditView {}}-const channelSyncKeysToKeep = [+const channelSyncKeysToKeep = new Set(['id','externalChannelUrl','channel-id','channel-name'-]+])class VideoChannelSyncAuditView extends EntityAuditView {constructor (channelSync: VideoChannelSync) {super(channelSyncKeysToKeep, 'channelSync', channelSync)diff --git a/server/helpers/captions-utils.ts b/server/server/helpers/captions-utils.tssimilarity index 78%rename from server/helpers/captions-utils.tsrename to server/server/helpers/captions-utils.tsindex f6e5b9784b..f165cb447b 100644--- a/server/helpers/captions-utils.ts+++ b/server/server/helpers/captions-utils.ts@@ -1,10 +1,10 @@-import { createReadStream, createWriteStream, move, remove } from 'fs-extra'+import { createReadStream, createWriteStream } from 'fs'+import { move, remove } from 'fs-extra/esm'import { join } from 'path'-import srt2vtt from 'srt-to-vtt'import { Transform } from 'stream'-import { MVideoCaption } from '@server/types/models'-import { CONFIG } from '../initializers/config'-import { pipelinePromise } from './core-utils'+import { MVideoCaption } from '@server/types/models/index.js'+import { CONFIG } from '../initializers/config.js'+import { pipelinePromise } from './core-utils.js'async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: MVideoCaption) {const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR@@ -31,7 +31,7 @@ export {// ----------------------------------------------------------------------------function convertSrtToVtt (source: string, destination: string) {+async function convertSrtToVtt (source: string, destination: string) {const fixVTT = new Transform({transform: (chunk, _encoding, cb) => {let block: string = chunk.toString()@@ -44,9 +44,11 @@ function convertSrtToVtt (source: string, destination: string) {}})+ const srt2vtt = await import('srt-to-vtt')+return pipelinePromise(createReadStream(source),- srt2vtt(),+ srt2vtt.default(),fixVTT,createWriteStream(destination))diff --git a/server/helpers/core-utils.ts b/server/server/helpers/core-utils.tssimilarity index 92%rename from server/helpers/core-utils.tsrename to server/server/helpers/core-utils.tsindex 242c49e896..6dc09d317f 100644--- a/server/helpers/core-utils.ts+++ b/server/server/helpers/core-utils.ts@@ -5,13 +5,13 @@Useful to avoid circular dependencies.*/+import { promisify1, promisify2, promisify3 } from '@peertube/peertube-core-utils'import { exec, ExecOptions } from 'child_process'import { ED25519KeyPairOptions, generateKeyPair, randomBytes, RSAKeyPairOptions, scrypt } from 'crypto'-import { truncate } from 'lodash'+import truncate from 'lodash-es/truncate.js'import { pipeline } from 'stream'import { URL } from 'url'import { promisify } from 'util'-import { promisify1, promisify2, promisify3 } from '@shared/core-utils'const objectConverter = (oldObject: any, keyConverter: (e: string) => string, valueConverter: (e: any) => any) => {if (!oldObject || typeof oldObject !== 'object') {@@ -161,28 +161,6 @@ function sanitizeHost (host: string, remoteScheme: string) {// ----------------------------------------------------------------------------function isTestInstance () {- return process.env.NODE_ENV === 'test'-}--function isDevInstance () {- return process.env.NODE_ENV === 'dev'-}--function isTestOrDevInstance () {- return isTestInstance() || isDevInstance()-}--function isProdInstance () {- return process.env.NODE_ENV === 'production'-}--function getAppNumber () {- return process.env.NODE_APP_INSTANCE || ''-}--// ----------------------------------------------------------------------------// Consistent with .length, lodash truncate function is notfunction peertubeTruncate (str: string, options: { length: number, separator?: RegExp, omission?: string }) {const truncatedStr = truncate(str, options)@@ -284,11 +262,6 @@ const pipelinePromise = promisify(pipeline)// ---------------------------------------------------------------------------export {- isTestInstance,- isTestOrDevInstance,- isProdInstance,- getAppNumber,-objectConverter,mapToJSON,diff --git a/server/helpers/custom-jsonld-signature.ts b/server/server/helpers/custom-jsonld-signature.tssimilarity index 93%rename from server/helpers/custom-jsonld-signature.tsrename to server/server/helpers/custom-jsonld-signature.tsindex 3c706e372e..0bbe682daa 100644--- a/server/helpers/custom-jsonld-signature.ts+++ b/server/server/helpers/custom-jsonld-signature.ts@@ -1,7 +1,6 @@import AsyncLRU from 'async-lru'-import { logger } from './logger'--import jsonld = require('jsonld')+import jsonld from 'jsonld'+import { logger } from './logger.js'const CACHE = {'https://w3id.org/security/v1': {@@ -56,7 +55,7 @@ const CACHE = {}}-const nodeDocumentLoader = jsonld.documentLoaders.node()+const nodeDocumentLoader = (jsonld as any).documentLoaders.node()const lru = new AsyncLRU({max: 10,@@ -75,10 +74,10 @@ const lru = new AsyncLRU({.then(value => cb(null, value)).catch(err => cb(err))}-})+});/* eslint-disable no-import-assign */-jsonld.documentLoader = (url) => {+(jsonld as any).documentLoader = (url) => {return new Promise((res, rej) => {lru.get(url, (err, value) => {if (err) return rej(err)diff --git a/server/helpers/custom-validators/abuses.ts b/server/server/helpers/custom-validators/abuses.tssimilarity index 74%rename from server/helpers/custom-validators/abuses.tsrename to server/server/helpers/custom-validators/abuses.tsindex 94719641ab..4c4ae8bf72 100644--- a/server/helpers/custom-validators/abuses.ts+++ b/server/server/helpers/custom-validators/abuses.ts@@ -1,14 +1,14 @@import validator from 'validator'-import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'-import { AbuseCreate, AbuseFilter, AbusePredefinedReasonsString, AbuseVideoIs } from '@shared/models'-import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { exists, isArray } from './misc'+import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils'+import { AbuseCreate, AbuseFilter, AbusePredefinedReasonsString, AbuseVideoIs } from '@peertube/peertube-models'+import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { exists, isArray } from './misc.js'const ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.ABUSESconst ABUSE_MESSAGES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.ABUSE_MESSAGESfunction isAbuseReasonValid (value: string) {- return exists(value) && validator.isLength(value, ABUSES_CONSTRAINTS_FIELDS.REASON)+ return exists(value) && validator.default.isLength(value, ABUSES_CONSTRAINTS_FIELDS.REASON)}function isAbusePredefinedReasonValid (value: AbusePredefinedReasonsString) {@@ -24,7 +24,7 @@ function areAbusePredefinedReasonsValid (value: AbusePredefinedReasonsString[])}function isAbuseTimestampValid (value: number) {- return value === null || (exists(value) && validator.isInt('' + value, { min: 0 }))+ return value === null || (exists(value) && validator.default.isInt('' + value, { min: 0 }))}function isAbuseTimestampCoherent (endAt: number, { req }) {@@ -34,7 +34,7 @@ function isAbuseTimestampCoherent (endAt: number, { req }) {}function isAbuseModerationCommentValid (value: string) {- return exists(value) && validator.isLength(value, ABUSES_CONSTRAINTS_FIELDS.MODERATION_COMMENT)+ return exists(value) && validator.default.isLength(value, ABUSES_CONSTRAINTS_FIELDS.MODERATION_COMMENT)}function isAbuseStateValid (value: string) {@@ -49,7 +49,7 @@ function isAbuseVideoIsValid (value: AbuseVideoIs) {}function isAbuseMessageValid (value: string) {- return exists(value) && validator.isLength(value, ABUSE_MESSAGES_CONSTRAINTS_FIELDS.MESSAGE)+ return exists(value) && validator.default.isLength(value, ABUSE_MESSAGES_CONSTRAINTS_FIELDS.MESSAGE)}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/accounts.ts b/server/server/helpers/custom-validators/accounts.tssimilarity index 91%rename from server/helpers/custom-validators/accounts.tsrename to server/server/helpers/custom-validators/accounts.tsindex f676669ea6..48fa1594e7 100644--- a/server/helpers/custom-validators/accounts.ts+++ b/server/server/helpers/custom-validators/accounts.ts@@ -1,5 +1,5 @@-import { isUserDescriptionValid, isUserUsernameValid } from './users'-import { exists } from './misc'+import { isUserDescriptionValid, isUserUsernameValid } from './users.js'+import { exists } from './misc.js'function isAccountNameValid (value: string) {return isUserUsernameValid(value)diff --git a/server/helpers/custom-validators/activitypub/activity.ts b/server/server/helpers/custom-validators/activitypub/activity.tssimilarity index 88%rename from server/helpers/custom-validators/activitypub/activity.tsrename to server/server/helpers/custom-validators/activitypub/activity.tsindex 90a9185234..05399ebdf6 100644--- a/server/helpers/custom-validators/activitypub/activity.ts+++ b/server/server/helpers/custom-validators/activitypub/activity.ts@@ -1,14 +1,14 @@import validator from 'validator'-import { Activity, ActivityType } from '../../../../shared/models/activitypub'-import { isAbuseReasonValid } from '../abuses'-import { exists } from '../misc'-import { sanitizeAndCheckActorObject } from './actor'-import { isCacheFileObjectValid } from './cache-file'-import { isActivityPubUrlValid, isBaseActivityValid, isObjectValid } from './misc'-import { isPlaylistObjectValid } from './playlist'-import { sanitizeAndCheckVideoCommentObject } from './video-comments'-import { sanitizeAndCheckVideoTorrentObject } from './videos'-import { isWatchActionObjectValid } from './watch-action'+import { Activity, ActivityType } from '@peertube/peertube-models'+import { isAbuseReasonValid } from '../abuses.js'+import { exists } from '../misc.js'+import { sanitizeAndCheckActorObject } from './actor.js'+import { isCacheFileObjectValid } from './cache-file.js'+import { isActivityPubUrlValid, isBaseActivityValid, isObjectValid } from './misc.js'+import { isPlaylistObjectValid } from './playlist.js'+import { sanitizeAndCheckVideoCommentObject } from './video-comments.js'+import { sanitizeAndCheckVideoTorrentObject } from './videos.js'+import { isWatchActionObjectValid } from './watch-action.js'function isRootActivityValid (activity: any) {return isCollection(activity) || isActivity(activity)@@ -16,7 +16,7 @@ function isRootActivityValid (activity: any) {function isCollection (activity: any) {return (activity.type === 'Collection' || activity.type === 'OrderedCollection') &&- validator.isInt(activity.totalItems, { min: 0 }) &&+ validator.default.isInt(activity.totalItems, { min: 0 }) &&Array.isArray(activity.items)}diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/server/helpers/custom-validators/activitypub/actor.tssimilarity index 87%rename from server/helpers/custom-validators/activitypub/actor.tsrename to server/server/helpers/custom-validators/activitypub/actor.tsindex f43c35b239..71ddbc323e 100644--- a/server/helpers/custom-validators/activitypub/actor.ts+++ b/server/server/helpers/custom-validators/activitypub/actor.ts@@ -1,9 +1,9 @@import validator from 'validator'-import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'-import { exists, isArray, isDateValid } from '../misc'-import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc'-import { isHostValid } from '../servers'-import { peertubeTruncate } from '@server/helpers/core-utils'+import { CONSTRAINTS_FIELDS } from '../../../initializers/constants.js'+import { exists, isArray, isDateValid } from '../misc.js'+import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc.js'+import { isHostValid } from '../servers.js'+import { peertubeTruncate } from '@server/helpers/core-utils.js'function isActorEndpointsObjectValid (endpointObject: any) {if (endpointObject?.sharedInbox) {@@ -29,13 +29,13 @@ function isActorPublicKeyValid (publicKey: string) {typeof publicKey === 'string' &&publicKey.startsWith('-----BEGIN PUBLIC KEY-----') &&publicKey.includes('-----END PUBLIC KEY-----') &&- validator.isLength(publicKey, CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY)+ validator.default.isLength(publicKey, CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY)}const actorNameAlphabet = '[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\\-_.:]'const actorNameRegExp = new RegExp(`^${actorNameAlphabet}+$`)function isActorPreferredUsernameValid (preferredUsername: string) {- return exists(preferredUsername) && validator.matches(preferredUsername, actorNameRegExp)+ return exists(preferredUsername) && validator.default.matches(preferredUsername, actorNameRegExp)}function isActorPrivateKeyValid (privateKey: string) {@@ -44,15 +44,15 @@ function isActorPrivateKeyValid (privateKey: string) {(privateKey.startsWith('-----BEGIN RSA PRIVATE KEY-----') || privateKey.startsWith('-----BEGIN PRIVATE KEY-----')) &&// Sometimes there is a \n at the end, so just assert the string contains the end mark(privateKey.includes('-----END RSA PRIVATE KEY-----') || privateKey.includes('-----END PRIVATE KEY-----')) &&- validator.isLength(privateKey, CONSTRAINTS_FIELDS.ACTORS.PRIVATE_KEY)+ validator.default.isLength(privateKey, CONSTRAINTS_FIELDS.ACTORS.PRIVATE_KEY)}function isActorFollowingCountValid (value: string) {- return exists(value) && validator.isInt('' + value, { min: 0 })+ return exists(value) && validator.default.isInt('' + value, { min: 0 })}function isActorFollowersCountValid (value: string) {- return exists(value) && validator.isInt('' + value, { min: 0 })+ return exists(value) && validator.default.isInt('' + value, { min: 0 })}function isActorDeleteActivityValid (activity: any) {diff --git a/server/helpers/custom-validators/activitypub/cache-file.ts b/server/server/helpers/custom-validators/activitypub/cache-file.tssimilarity index 76%rename from server/helpers/custom-validators/activitypub/cache-file.tsrename to server/server/helpers/custom-validators/activitypub/cache-file.tsindex c5b3b4d9fd..2b1408eb7a 100644--- a/server/helpers/custom-validators/activitypub/cache-file.ts+++ b/server/server/helpers/custom-validators/activitypub/cache-file.ts@@ -1,7 +1,7 @@-import { isActivityPubUrlValid } from './misc'-import { isRemoteVideoUrlValid } from './videos'-import { exists, isDateValid } from '../misc'-import { CacheFileObject } from '../../../../shared/models/activitypub/objects'+import { CacheFileObject } from '@peertube/peertube-models'+import { exists, isDateValid } from '../misc.js'+import { isActivityPubUrlValid } from './misc.js'+import { isRemoteVideoUrlValid } from './videos.js'function isCacheFileObjectValid (object: CacheFileObject) {return exists(object) &&diff --git a/server/helpers/custom-validators/activitypub/misc.ts b/server/server/helpers/custom-validators/activitypub/misc.tssimilarity index 87%rename from server/helpers/custom-validators/activitypub/misc.tsrename to server/server/helpers/custom-validators/activitypub/misc.tsindex 7df47cf15b..0daa824f66 100644--- a/server/helpers/custom-validators/activitypub/misc.ts+++ b/server/server/helpers/custom-validators/activitypub/misc.ts@@ -1,7 +1,7 @@import validator from 'validator'-import { CONFIG } from '@server/initializers/config'-import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'-import { exists } from '../misc'+import { CONFIG } from '@server/initializers/config.js'+import { CONSTRAINTS_FIELDS } from '../../../initializers/constants.js'+import { exists } from '../misc.js'function isUrlValid (url: string) {const isURLOptions = {@@ -17,11 +17,11 @@ function isUrlValid (url: string) {isURLOptions.require_tld = false}- return exists(url) && validator.isURL('' + url, isURLOptions)+ return exists(url) && validator.default.isURL('' + url, isURLOptions)}function isActivityPubUrlValid (url: string) {- return isUrlValid(url) && validator.isLength('' + url, CONSTRAINTS_FIELDS.ACTORS.URL)+ return isUrlValid(url) && validator.default.isLength('' + url, CONSTRAINTS_FIELDS.ACTORS.URL)}function isBaseActivityValid (activity: any, type: string) {diff --git a/server/helpers/custom-validators/activitypub/playlist.ts b/server/server/helpers/custom-validators/activitypub/playlist.tssimilarity index 63%rename from server/helpers/custom-validators/activitypub/playlist.tsrename to server/server/helpers/custom-validators/activitypub/playlist.tsindex 49bcadcfd8..7c338992b9 100644--- a/server/helpers/custom-validators/activitypub/playlist.ts+++ b/server/server/helpers/custom-validators/activitypub/playlist.ts@@ -1,13 +1,13 @@import validator from 'validator'-import { PlaylistElementObject, PlaylistObject } from '@shared/models'-import { exists, isDateValid, isUUIDValid } from '../misc'-import { isVideoPlaylistNameValid } from '../video-playlists'-import { isActivityPubUrlValid } from './misc'+import { PlaylistElementObject, PlaylistObject } from '@peertube/peertube-models'+import { exists, isDateValid, isUUIDValid } from '../misc.js'+import { isVideoPlaylistNameValid } from '../video-playlists.js'+import { isActivityPubUrlValid } from './misc.js'function isPlaylistObjectValid (object: PlaylistObject) {return exists(object) &&object.type === 'Playlist' &&- validator.isInt(object.totalItems + '') &&+ validator.default.isInt(object.totalItems + '') &&isVideoPlaylistNameValid(object.name) &&isUUIDValid(object.uuid) &&isDateValid(object.published) &&@@ -17,7 +17,7 @@ function isPlaylistObjectValid (object: PlaylistObject) {function isPlaylistElementObjectValid (object: PlaylistElementObject) {return exists(object) &&object.type === 'PlaylistElement' &&- validator.isInt(object.position + '') &&+ validator.default.isInt(object.position + '') &&isActivityPubUrlValid(object.url)}diff --git a/server/helpers/custom-validators/activitypub/signature.ts b/server/server/helpers/custom-validators/activitypub/signature.tssimilarity index 86%rename from server/helpers/custom-validators/activitypub/signature.tsrename to server/server/helpers/custom-validators/activitypub/signature.tsindex cfb65361eb..2ce67875d1 100644--- a/server/helpers/custom-validators/activitypub/signature.ts+++ b/server/server/helpers/custom-validators/activitypub/signature.ts@@ -1,5 +1,5 @@-import { exists } from '../misc'-import { isActivityPubUrlValid } from './misc'+import { exists } from '../misc.js'+import { isActivityPubUrlValid } from './misc.js'function isSignatureTypeValid (signatureType: string) {return exists(signatureType) && signatureType === 'RsaSignature2017'diff --git a/server/helpers/custom-validators/activitypub/video-comments.ts b/server/server/helpers/custom-validators/activitypub/video-comments.tssimilarity index 85%rename from server/helpers/custom-validators/activitypub/video-comments.tsrename to server/server/helpers/custom-validators/activitypub/video-comments.tsindex ea852c4910..a024476dc0 100644--- a/server/helpers/custom-validators/activitypub/video-comments.ts+++ b/server/server/helpers/custom-validators/activitypub/video-comments.ts@@ -1,7 +1,7 @@import validator from 'validator'-import { ACTIVITY_PUB } from '../../../initializers/constants'-import { exists, isArray, isDateValid } from '../misc'-import { isActivityPubUrlValid } from './misc'+import { ACTIVITY_PUB } from '../../../initializers/constants.js'+import { exists, isArray, isDateValid } from '../misc.js'+import { isActivityPubUrlValid } from './misc.js'function sanitizeAndCheckVideoCommentObject (comment: any) {if (!comment) return false@@ -38,7 +38,7 @@ export {// ---------------------------------------------------------------------------function isCommentContentValid (content: any) {- return exists(content) && validator.isLength('' + content, { min: 1 })+ return exists(content) && validator.default.isLength('' + content, { min: 1 })}function normalizeComment (comment: any) {diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/server/helpers/custom-validators/activitypub/videos.tssimilarity index 84%rename from server/helpers/custom-validators/activitypub/videos.tsrename to server/server/helpers/custom-validators/activitypub/videos.tsindex 07e25b8baf..b7298c4742 100644--- a/server/helpers/custom-validators/activitypub/videos.ts+++ b/server/server/helpers/custom-validators/activitypub/videos.ts@@ -1,11 +1,17 @@import validator from 'validator'-import { logger } from '@server/helpers/logger'-import { ActivityPubStoryboard, ActivityTrackerUrlObject, ActivityVideoFileMetadataUrlObject, VideoObject } from '@shared/models'-import { LiveVideoLatencyMode, VideoState } from '../../../../shared/models/videos'-import { ACTIVITY_PUB, CONSTRAINTS_FIELDS } from '../../../initializers/constants'-import { peertubeTruncate } from '../../core-utils'-import { isArray, isBooleanValid, isDateValid, isUUIDValid } from '../misc'-import { isLiveLatencyModeValid } from '../video-lives'+import {+ ActivityPubStoryboard,+ ActivityTrackerUrlObject,+ ActivityVideoFileMetadataUrlObject,+ LiveVideoLatencyMode,+ VideoObject,+ VideoState+} from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { ACTIVITY_PUB, CONSTRAINTS_FIELDS } from '../../../initializers/constants.js'+import { peertubeTruncate } from '../../core-utils.js'+import { isArray, isBooleanValid, isDateValid, isUUIDValid } from '../misc.js'+import { isLiveLatencyModeValid } from '../video-lives.js'import {isVideoDescriptionValid,isVideoDurationValid,@@ -13,8 +19,8 @@ import {isVideoStateValid,isVideoTagValid,isVideoViewsValid-} from '../videos'-import { isActivityPubUrlValid, isActivityPubVideoDurationValid, isBaseActivityValid, setValidAttributedTo } from './misc'+} from '../videos.js'+import { isActivityPubUrlValid, isActivityPubVideoDurationValid, isBaseActivityValid, setValidAttributedTo } from './misc.js'function sanitizeAndCheckVideoTorrentUpdateActivity (activity: any) {return isBaseActivityValid(activity, 'Update') &&@@ -87,21 +93,21 @@ function isRemoteVideoUrlValid (url: any) {(ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.includes(url.mediaType) &&isActivityPubUrlValid(url.href) &&- validator.isInt(url.height + '', { min: 0 }) &&- validator.isInt(url.size + '', { min: 0 }) &&- (!url.fps || validator.isInt(url.fps + '', { min: -1 }))+ validator.default.isInt(url.height + '', { min: 0 }) &&+ validator.default.isInt(url.size + '', { min: 0 }) &&+ (!url.fps || validator.default.isInt(url.fps + '', { min: -1 }))) ||// Torrent link(ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.includes(url.mediaType) &&isActivityPubUrlValid(url.href) &&- validator.isInt(url.height + '', { min: 0 })+ validator.default.isInt(url.height + '', { min: 0 })) ||// Magnet link(ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.includes(url.mediaType) &&- validator.isLength(url.href, { min: 5 }) &&- validator.isInt(url.height + '', { min: 0 })+ validator.default.isLength(url.href, { min: 5 }) &&+ validator.default.isInt(url.height + '', { min: 0 })) ||// HLS playlist link(@@ -165,7 +171,7 @@ function setValidRemoteCaptions (video: any) {}function isRemoteNumberIdentifierValid (data: any) {- return validator.isInt(data.identifier, { min: 0 })+ return validator.default.isInt(data.identifier, { min: 0 })}function isRemoteStringIdentifierValid (data: any) {@@ -184,8 +190,8 @@ function setValidRemoteIcon (video: any) {return icon.type === 'Image' &&isActivityPubUrlValid(icon.url) &&icon.mediaType === 'image/jpeg' &&- validator.isInt(icon.width + '', { min: 0 }) &&- validator.isInt(icon.height + '', { min: 0 })+ validator.default.isInt(icon.width + '', { min: 0 }) &&+ validator.default.isInt(icon.height + '', { min: 0 })})return video.icon.length !== 0@@ -230,10 +236,10 @@ function isStorybordValid (preview: ActivityPubStoryboard) {preview.url = preview.url.filter(u => {return u.mediaType === 'image/jpeg' &&isActivityPubUrlValid(u.href) &&- validator.isInt(u.width + '', { min: 0 }) &&- validator.isInt(u.height + '', { min: 0 }) &&- validator.isInt(u.tileWidth + '', { min: 0 }) &&- validator.isInt(u.tileHeight + '', { min: 0 }) &&+ validator.default.isInt(u.width + '', { min: 0 }) &&+ validator.default.isInt(u.height + '', { min: 0 }) &&+ validator.default.isInt(u.tileWidth + '', { min: 0 }) &&+ validator.default.isInt(u.tileHeight + '', { min: 0 }) &&isActivityPubVideoDurationValid(u.tileDuration)})diff --git a/server/helpers/custom-validators/activitypub/watch-action.ts b/server/server/helpers/custom-validators/activitypub/watch-action.tssimilarity index 85%rename from server/helpers/custom-validators/activitypub/watch-action.tsrename to server/server/helpers/custom-validators/activitypub/watch-action.tsindex b9ffa63f6f..426aa38056 100644--- a/server/helpers/custom-validators/activitypub/watch-action.ts+++ b/server/server/helpers/custom-validators/activitypub/watch-action.ts@@ -1,7 +1,7 @@-import { WatchActionObject } from '@shared/models'-import { exists, isDateValid, isUUIDValid } from '../misc'-import { isVideoTimeValid } from '../video-view'-import { isActivityPubVideoDurationValid, isObjectValid } from './misc'+import { WatchActionObject } from '@peertube/peertube-models'+import { exists, isDateValid, isUUIDValid } from '../misc.js'+import { isVideoTimeValid } from '../video-view.js'+import { isActivityPubVideoDurationValid, isObjectValid } from './misc.js'function isWatchActionObjectValid (action: WatchActionObject) {return exists(action) &&diff --git a/server/helpers/custom-validators/actor-images.ts b/server/server/helpers/custom-validators/actor-images.tssimilarity index 93%rename from server/helpers/custom-validators/actor-images.tsrename to server/server/helpers/custom-validators/actor-images.tsindex 89f5a22621..5d30003c59 100644--- a/server/helpers/custom-validators/actor-images.ts+++ b/server/server/helpers/custom-validators/actor-images.ts@@ -1,7 +1,7 @@import { UploadFilesForCheck } from 'express'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { isFileValid } from './misc'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { isFileValid } from './misc.js'const imageMimeTypes = CONSTRAINTS_FIELDS.ACTORS.IMAGE.EXTNAME.map(v => v.replace('.', ''))diff --git a/server/helpers/custom-validators/bulk.ts b/server/server/helpers/custom-validators/bulk.tssimilarity index 100%rename from server/helpers/custom-validators/bulk.tsrename to server/server/helpers/custom-validators/bulk.tsdiff --git a/server/helpers/custom-validators/feeds.ts b/server/server/helpers/custom-validators/feeds.tssimilarity index 90%rename from server/helpers/custom-validators/feeds.tsrename to server/server/helpers/custom-validators/feeds.tsindex fa35a7da6c..c597b889f6 100644--- a/server/helpers/custom-validators/feeds.ts+++ b/server/server/helpers/custom-validators/feeds.ts@@ -1,4 +1,4 @@-import { exists } from './misc'+import { exists } from './misc.js'function isValidRSSFeed (value: string) {if (!exists(value)) return falsediff --git a/server/helpers/custom-validators/follows.ts b/server/server/helpers/custom-validators/follows.tssimilarity index 87%rename from server/helpers/custom-validators/follows.tsrename to server/server/helpers/custom-validators/follows.tsindex 0bec683c16..8e354dc25e 100644--- a/server/helpers/custom-validators/follows.ts+++ b/server/server/helpers/custom-validators/follows.ts@@ -1,5 +1,5 @@-import { exists, isArray } from './misc'-import { FollowState } from '@shared/models'+import { exists, isArray } from './misc.js'+import { FollowState } from '@peertube/peertube-models'function isFollowStateValid (value: FollowState) {if (!exists(value)) return falsediff --git a/server/helpers/custom-validators/jobs.ts b/server/server/helpers/custom-validators/jobs.tssimilarity index 75%rename from server/helpers/custom-validators/jobs.tsrename to server/server/helpers/custom-validators/jobs.tsindex c168b3e919..1da32c76a9 100644--- a/server/helpers/custom-validators/jobs.ts+++ b/server/server/helpers/custom-validators/jobs.ts@@ -1,6 +1,6 @@-import { JobState } from '../../../shared/models'-import { exists } from './misc'-import { jobTypes } from '@server/lib/job-queue/job-queue'+import { JobState } from '@peertube/peertube-models'+import { jobTypes } from '@server/lib/job-queue/job-queue.js'+import { exists } from './misc.js'const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed', 'paused', 'waiting-children' ]diff --git a/server/helpers/custom-validators/logs.ts b/server/server/helpers/custom-validators/logs.tssimilarity index 61%rename from server/helpers/custom-validators/logs.tsrename to server/server/helpers/custom-validators/logs.tsindex 215dbb0e13..989ba09e52 100644--- a/server/helpers/custom-validators/logs.ts+++ b/server/server/helpers/custom-validators/logs.ts@@ -1,7 +1,7 @@import validator from 'validator'-import { CONSTRAINTS_FIELDS } from '@server/initializers/constants'-import { ClientLogLevel, ServerLogLevel } from '@shared/models'-import { exists } from './misc'+import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'+import { ClientLogLevel, ServerLogLevel } from '@peertube/peertube-models'+import { exists } from './misc.js'const serverLogLevels = new Set<ServerLogLevel>([ 'debug', 'info', 'warn', 'error' ])const clientLogLevels = new Set<ClientLogLevel>([ 'warn', 'error' ])@@ -11,7 +11,7 @@ function isValidLogLevel (value: any) {}function isValidClientLogMessage (value: any) {- return typeof value === 'string' && validator.isLength(value, CONSTRAINTS_FIELDS.LOGS.CLIENT_MESSAGE)+ return typeof value === 'string' && validator.default.isLength(value, CONSTRAINTS_FIELDS.LOGS.CLIENT_MESSAGE)}function isValidClientLogLevel (value: any) {@@ -19,15 +19,15 @@ function isValidClientLogLevel (value: any) {}function isValidClientLogStackTrace (value: any) {- return typeof value === 'string' && validator.isLength(value, CONSTRAINTS_FIELDS.LOGS.CLIENT_STACK_TRACE)+ return typeof value === 'string' && validator.default.isLength(value, CONSTRAINTS_FIELDS.LOGS.CLIENT_STACK_TRACE)}function isValidClientLogMeta (value: any) {- return typeof value === 'string' && validator.isLength(value, CONSTRAINTS_FIELDS.LOGS.CLIENT_META)+ return typeof value === 'string' && validator.default.isLength(value, CONSTRAINTS_FIELDS.LOGS.CLIENT_META)}function isValidClientLogUserAgent (value: any) {- return typeof value === 'string' && validator.isLength(value, CONSTRAINTS_FIELDS.LOGS.CLIENT_USER_AGENT)+ return typeof value === 'string' && validator.default.isLength(value, CONSTRAINTS_FIELDS.LOGS.CLIENT_USER_AGENT)}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/metrics.ts b/server/server/helpers/custom-validators/metrics.tssimilarity index 100%rename from server/helpers/custom-validators/metrics.tsrename to server/server/helpers/custom-validators/metrics.tsdiff --git a/server/helpers/custom-validators/misc.ts b/server/server/helpers/custom-validators/misc.tssimilarity index 85%rename from server/helpers/custom-validators/misc.tsrename to server/server/helpers/custom-validators/misc.tsindex 937ae06329..0be9ce2a37 100644--- a/server/helpers/custom-validators/misc.ts+++ b/server/server/helpers/custom-validators/misc.ts@@ -2,7 +2,7 @@ import 'multer'import { UploadFilesForCheck } from 'express'import { sep } from 'path'import validator from 'validator'-import { isShortUUID, shortToUUID } from '@shared/extra-utils'+import { isShortUUID, shortToUUID } from '@peertube/peertube-node-utils'function exists (value: any) {return value !== undefined && value !== null@@ -32,7 +32,7 @@ function isArray (value: any): value is any[] {}function isNotEmptyIntArray (value: any) {- return Array.isArray(value) && value.every(v => validator.isInt('' + v)) && value.length !== 0+ return Array.isArray(value) && value.every(v => validator.default.isInt('' + v)) && value.length !== 0}function isNotEmptyStringArray (value: any) {@@ -44,15 +44,15 @@ function isArrayOf (value: any, validator: (value: any) => boolean) {}function isDateValid (value: string) {- return exists(value) && validator.isISO8601(value)+ return exists(value) && validator.default.isISO8601(value)}function isIdValid (value: string) {- return exists(value) && validator.isInt('' + value)+ return exists(value) && validator.default.isInt('' + value)}function isUUIDValid (value: string) {- return exists(value) && validator.isUUID('' + value, 4)+ return exists(value) && validator.default.isUUID('' + value, 4)}function areUUIDsValid (values: string[]) {@@ -64,11 +64,11 @@ function isIdOrUUIDValid (value: string) {}function isBooleanValid (value: any) {- return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value))+ return typeof value === 'boolean' || (typeof value === 'string' && validator.default.isBoolean(value))}function isIntOrNull (value: any) {- return value === null || validator.isInt('' + value)+ return value === null || validator.default.isInt('' + value)}// ---------------------------------------------------------------------------@@ -136,7 +136,7 @@ function toIntOrNull (value: string) {if (v === null || v === undefined) return vif (typeof v === 'number') return v- return validator.toInt('' + v)+ return validator.default.toInt('' + v)}function toBooleanOrNull (value: any) {@@ -145,7 +145,7 @@ function toBooleanOrNull (value: any) {if (v === null || v === undefined) return vif (typeof v === 'boolean') return v- return validator.toBoolean('' + v)+ return validator.default.toBoolean('' + v)}function toValueOrNull (value: string) {@@ -156,9 +156,9 @@ function toValueOrNull (value: string) {function toIntArray (value: any) {if (!value) return []- if (isArray(value) === false) return [ validator.toInt(value) ]+ if (isArray(value) === false) return [ validator.default.toInt(value) ]- return value.map(v => validator.toInt(v))+ return value.map(v => validator.default.toInt(v))}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/plugins.ts b/server/server/helpers/custom-validators/plugins.tssimilarity index 85%rename from server/helpers/custom-validators/plugins.tsrename to server/server/helpers/custom-validators/plugins.tsindex a20de0c4a6..875482f53c 100644--- a/server/helpers/custom-validators/plugins.ts+++ b/server/server/helpers/custom-validators/plugins.ts@@ -1,9 +1,8 @@import validator from 'validator'-import { PluginPackageJSON } from '../../../shared/models/plugins/plugin-package-json.model'-import { PluginType } from '../../../shared/models/plugins/plugin.type'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { isUrlValid } from './activitypub/misc'-import { exists, isArray, isSafePath } from './misc'+import { PluginPackageJSON, PluginType, PluginType_Type } from '@peertube/peertube-models'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { isUrlValid } from './activitypub/misc.js'+import { exists, isArray, isSafePath } from './misc.js'const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS@@ -14,19 +13,19 @@ function isPluginTypeValid (value: any) {function isPluginNameValid (value: string) {return exists(value) &&- validator.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&- validator.matches(value, /^[a-z-0-9]+$/)+ validator.default.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&+ validator.default.matches(value, /^[a-z-0-9]+$/)}function isNpmPluginNameValid (value: string) {return exists(value) &&- validator.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&- validator.matches(value, /^[a-z\-._0-9]+$/) &&+ validator.default.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&+ validator.default.matches(value, /^[a-z\-._0-9]+$/) &&(value.startsWith('peertube-plugin-') || value.startsWith('peertube-theme-'))}function isPluginDescriptionValid (value: string) {- return exists(value) && validator.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.DESCRIPTION)+ return exists(value) && validator.default.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.DESCRIPTION)}function isPluginStableVersionValid (value: string) {@@ -34,7 +33,7 @@ function isPluginStableVersionValid (value: string) {const parts = (value + '').split('.')- return parts.length === 3 && parts.every(p => validator.isInt(p))+ return parts.length === 3 && parts.every(p => validator.default.isInt(p))}function isPluginStableOrUnstableVersionValid (value: string) {@@ -97,7 +96,7 @@ function isThemeNameValid (name: string) {return isPluginNameValid(name)}-function isPackageJSONValid (packageJSON: PluginPackageJSON, pluginType: PluginType) {+function isPackageJSONValid (packageJSON: PluginPackageJSON, pluginType: PluginType_Type) {let result = trueconst badFields: string[] = []diff --git a/server/helpers/custom-validators/runners/jobs.ts b/server/server/helpers/custom-validators/runners/jobs.tssimilarity index 93%rename from server/helpers/custom-validators/runners/jobs.tsrename to server/server/helpers/custom-validators/runners/jobs.tsindex 6349e79baa..78c6c2e1e0 100644--- a/server/helpers/custom-validators/runners/jobs.ts+++ b/server/server/helpers/custom-validators/runners/jobs.ts@@ -1,6 +1,6 @@import { UploadFilesForCheck } from 'express'import validator from 'validator'-import { CONSTRAINTS_FIELDS, RUNNER_JOB_STATES } from '@server/initializers/constants'+import { CONSTRAINTS_FIELDS, RUNNER_JOB_STATES } from '@server/initializers/constants.js'import {LiveRTMPHLSTranscodingSuccess,RunnerJobSuccessPayload,@@ -10,8 +10,8 @@ import {VODAudioMergeTranscodingSuccess,VODHLSTranscodingSuccess,VODWebVideoTranscodingSuccess-} from '@shared/models'-import { exists, isArray, isFileValid, isSafeFilename } from '../misc'+} from '@peertube/peertube-models'+import { exists, isArray, isFileValid, isSafeFilename } from '../misc.js'const RUNNER_JOBS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.RUNNER_JOBS@@ -31,7 +31,7 @@ function isRunnerJobSuccessPayloadValid (value: RunnerJobSuccessPayload, type: R// ---------------------------------------------------------------------------function isRunnerJobProgressValid (value: string) {- return validator.isInt(value + '', RUNNER_JOBS_CONSTRAINTS_FIELDS.PROGRESS)+ return validator.default.isInt(value + '', RUNNER_JOBS_CONSTRAINTS_FIELDS.PROGRESS)}function isRunnerJobUpdatePayloadValid (value: RunnerJobUpdatePayload, type: RunnerJobType, files: UploadFilesForCheck) {@@ -45,15 +45,15 @@ function isRunnerJobUpdatePayloadValid (value: RunnerJobUpdatePayload, type: Run// ---------------------------------------------------------------------------function isRunnerJobTokenValid (value: string) {- return exists(value) && validator.isLength(value, RUNNER_JOBS_CONSTRAINTS_FIELDS.TOKEN)+ return exists(value) && validator.default.isLength(value, RUNNER_JOBS_CONSTRAINTS_FIELDS.TOKEN)}function isRunnerJobAbortReasonValid (value: string) {- return validator.isLength(value, RUNNER_JOBS_CONSTRAINTS_FIELDS.REASON)+ return validator.default.isLength(value, RUNNER_JOBS_CONSTRAINTS_FIELDS.REASON)}function isRunnerJobErrorMessageValid (value: string) {- return validator.isLength(value, RUNNER_JOBS_CONSTRAINTS_FIELDS.ERROR_MESSAGE)+ return validator.default.isLength(value, RUNNER_JOBS_CONSTRAINTS_FIELDS.ERROR_MESSAGE)}function isRunnerJobStateValid (value: any) {diff --git a/server/helpers/custom-validators/runners/runners.ts b/server/server/helpers/custom-validators/runners/runners.tssimilarity index 57%rename from server/helpers/custom-validators/runners/runners.tsrename to server/server/helpers/custom-validators/runners/runners.tsindex 953fac3b5d..821622a2b0 100644--- a/server/helpers/custom-validators/runners/runners.ts+++ b/server/server/helpers/custom-validators/runners/runners.ts@@ -1,23 +1,23 @@import validator from 'validator'-import { CONSTRAINTS_FIELDS } from '@server/initializers/constants'-import { exists } from '../misc'+import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'+import { exists } from '../misc.js'const RUNNERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.RUNNERSfunction isRunnerRegistrationTokenValid (value: string) {- return exists(value) && validator.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.TOKEN)+ return exists(value) && validator.default.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.TOKEN)}function isRunnerTokenValid (value: string) {- return exists(value) && validator.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.TOKEN)+ return exists(value) && validator.default.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.TOKEN)}function isRunnerNameValid (value: string) {- return exists(value) && validator.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.NAME)+ return exists(value) && validator.default.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.NAME)}function isRunnerDescriptionValid (value: string) {- return exists(value) && validator.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.DESCRIPTION)+ return exists(value) && validator.default.isLength(value, RUNNERS_CONSTRAINTS_FIELDS.DESCRIPTION)}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/search.ts b/server/server/helpers/custom-validators/search.tssimilarity index 75%rename from server/helpers/custom-validators/search.tsrename to server/server/helpers/custom-validators/search.tsindex 6dba5d14e2..cb950c8ddc 100644--- a/server/helpers/custom-validators/search.ts+++ b/server/server/helpers/custom-validators/search.ts@@ -1,10 +1,10 @@import validator from 'validator'-import { SearchTargetType } from '@shared/models/search/search-target-query.model'-import { isArray, exists } from './misc'-import { CONFIG } from '@server/initializers/config'+import { SearchTargetType } from '@peertube/peertube-models'+import { CONFIG } from '@server/initializers/config.js'+import { exists, isArray } from './misc.js'function isNumberArray (value: any) {- return isArray(value) && value.every(v => validator.isInt('' + v))+ return isArray(value) && value.every(v => validator.default.isInt('' + v))}function isStringArray (value: any) {diff --git a/server/helpers/custom-validators/servers.ts b/server/server/helpers/custom-validators/servers.tssimilarity index 68%rename from server/helpers/custom-validators/servers.tsrename to server/server/helpers/custom-validators/servers.tsindex b2aa03b77c..5f884e9110 100644--- a/server/helpers/custom-validators/servers.ts+++ b/server/server/helpers/custom-validators/servers.ts@@ -1,7 +1,7 @@import validator from 'validator'-import { CONFIG } from '@server/initializers/config'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { exists, isArray } from './misc'+import { CONFIG } from '@server/initializers/config.js'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { exists, isArray } from './misc.js'function isHostValid (host: string) {const isURLOptions = {@@ -14,7 +14,7 @@ function isHostValid (host: string) {isURLOptions.require_tld = false}- return exists(host) && validator.isURL(host, isURLOptions) && host.split('://').length === 1+ return exists(host) && validator.default.isURL(host, isURLOptions) && host.split('://').length === 1}function isEachUniqueHostValid (hosts: string[]) {@@ -25,11 +25,11 @@ function isEachUniqueHostValid (hosts: string[]) {}function isValidContactBody (value: any) {- return exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.BODY)+ return exists(value) && validator.default.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.BODY)}function isValidContactFromName (value: any) {- return exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.FROM_NAME)+ return exists(value) && validator.default.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.FROM_NAME)}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/user-notifications.ts b/server/server/helpers/custom-validators/user-notifications.tssimilarity index 70%rename from server/helpers/custom-validators/user-notifications.tsrename to server/server/helpers/custom-validators/user-notifications.tsindex 2de13ca09c..151f965221 100644--- a/server/helpers/custom-validators/user-notifications.ts+++ b/server/server/helpers/custom-validators/user-notifications.ts@@ -1,14 +1,14 @@import validator from 'validator'-import { UserNotificationSettingValue } from '@shared/models'-import { exists } from './misc'+import { UserNotificationSettingValue } from '@peertube/peertube-models'+import { exists } from './misc.js'function isUserNotificationTypeValid (value: any) {- return exists(value) && validator.isInt('' + value)+ return exists(value) && validator.default.isInt('' + value)}function isUserNotificationSettingValid (value: any) {return exists(value) &&- validator.isInt('' + value) &&+ validator.default.isInt('' + value) &&(value === UserNotificationSettingValue.NONE ||value === UserNotificationSettingValue.WEB ||diff --git a/server/helpers/custom-validators/user-registration.ts b/server/server/helpers/custom-validators/user-registration.tssimilarity index 67%rename from server/helpers/custom-validators/user-registration.tsrename to server/server/helpers/custom-validators/user-registration.tsindex 9da0bb08a6..7d8c8e5927 100644--- a/server/helpers/custom-validators/user-registration.ts+++ b/server/server/helpers/custom-validators/user-registration.ts@@ -1,6 +1,6 @@import validator from 'validator'-import { CONSTRAINTS_FIELDS, USER_REGISTRATION_STATES } from '../../initializers/constants'-import { exists } from './misc'+import { CONSTRAINTS_FIELDS, USER_REGISTRATION_STATES } from '../../initializers/constants.js'+import { exists } from './misc.js'const USER_REGISTRATIONS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USER_REGISTRATIONS@@ -9,11 +9,11 @@ function isRegistrationStateValid (value: string) {}function isRegistrationModerationResponseValid (value: string) {- return exists(value) && validator.isLength(value, USER_REGISTRATIONS_CONSTRAINTS_FIELDS.MODERATOR_MESSAGE)+ return exists(value) && validator.default.isLength(value, USER_REGISTRATIONS_CONSTRAINTS_FIELDS.MODERATOR_MESSAGE)}function isRegistrationReasonValid (value: string) {- return exists(value) && validator.isLength(value, USER_REGISTRATIONS_CONSTRAINTS_FIELDS.REASON_MESSAGE)+ return exists(value) && validator.default.isLength(value, USER_REGISTRATIONS_CONSTRAINTS_FIELDS.REASON_MESSAGE)}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/users.ts b/server/server/helpers/custom-validators/users.tssimilarity index 67%rename from server/helpers/custom-validators/users.tsrename to server/server/helpers/custom-validators/users.tsindex f02b3ba656..84c49ff665 100644--- a/server/helpers/custom-validators/users.ts+++ b/server/server/helpers/custom-validators/users.ts@@ -1,13 +1,13 @@import validator from 'validator'-import { UserRole } from '@shared/models'-import { isEmailEnabled } from '../../initializers/config'-import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants'-import { exists, isArray, isBooleanValid } from './misc'+import { UserRole } from '@peertube/peertube-models'+import { isEmailEnabled } from '../../initializers/config.js'+import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants.js'+import { exists, isArray, isBooleanValid } from './misc.js'const USERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USERSfunction isUserPasswordValid (value: string) {- return validator.isLength(value, USERS_CONSTRAINTS_FIELDS.PASSWORD)+ return validator.default.isLength(value, USERS_CONSTRAINTS_FIELDS.PASSWORD)}function isUserPasswordValidOrEmpty (value: string) {@@ -18,25 +18,25 @@ function isUserPasswordValidOrEmpty (value: string) {}function isUserVideoQuotaValid (value: string) {- return exists(value) && validator.isInt(value + '', USERS_CONSTRAINTS_FIELDS.VIDEO_QUOTA)+ return exists(value) && validator.default.isInt(value + '', USERS_CONSTRAINTS_FIELDS.VIDEO_QUOTA)}function isUserVideoQuotaDailyValid (value: string) {- return exists(value) && validator.isInt(value + '', USERS_CONSTRAINTS_FIELDS.VIDEO_QUOTA_DAILY)+ return exists(value) && validator.default.isInt(value + '', USERS_CONSTRAINTS_FIELDS.VIDEO_QUOTA_DAILY)}function isUserUsernameValid (value: string) {return exists(value) &&- validator.matches(value, new RegExp(`^[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?$`)) &&- validator.isLength(value, USERS_CONSTRAINTS_FIELDS.USERNAME)+ validator.default.matches(value, new RegExp(`^[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?$`)) &&+ validator.default.isLength(value, USERS_CONSTRAINTS_FIELDS.USERNAME)}function isUserDisplayNameValid (value: string) {- return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.NAME))+ return value === null || (exists(value) && validator.default.isLength(value, CONSTRAINTS_FIELDS.USERS.NAME))}function isUserDescriptionValid (value: string) {- return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.DESCRIPTION))+ return value === null || (exists(value) && validator.default.isLength(value, CONSTRAINTS_FIELDS.USERS.DESCRIPTION))}function isUserEmailVerifiedValid (value: any) {@@ -65,7 +65,7 @@ function isUserVideoLanguages (value: any) {}function isUserAdminFlagsValid (value: any) {- return exists(value) && validator.isInt('' + value)+ return exists(value) && validator.default.isInt('' + value)}function isUserBlockedValid (value: any) {@@ -89,11 +89,13 @@ function isUserNoModal (value: any) {}function isUserBlockedReasonValid (value: any) {- return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.BLOCKED_REASON))+ return value === null || (exists(value) && validator.default.isLength(value, CONSTRAINTS_FIELDS.USERS.BLOCKED_REASON))}function isUserRoleValid (value: any) {- return exists(value) && validator.isInt('' + value) && [ UserRole.ADMINISTRATOR, UserRole.MODERATOR, UserRole.USER ].includes(value)+ return exists(value) &&+ validator.default.isInt('' + value) &&+ [ UserRole.ADMINISTRATOR, UserRole.MODERATOR, UserRole.USER ].includes(value)}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/video-blacklist.ts b/server/server/helpers/custom-validators/video-blacklist.tssimilarity index 73%rename from server/helpers/custom-validators/video-blacklist.tsrename to server/server/helpers/custom-validators/video-blacklist.tsindex 34fcec38e3..15a13ae5f0 100644--- a/server/helpers/custom-validators/video-blacklist.ts+++ b/server/server/helpers/custom-validators/video-blacklist.ts@@ -1,12 +1,12 @@import validator from 'validator'-import { exists } from './misc'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { VideoBlacklistType } from '../../../shared/models/videos'+import { VideoBlacklistType } from '@peertube/peertube-models'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { exists } from './misc.js'const VIDEO_BLACKLIST_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_BLACKLISTfunction isVideoBlacklistReasonValid (value: string) {- return value === null || validator.isLength(value, VIDEO_BLACKLIST_CONSTRAINTS_FIELDS.REASON)+ return value === null || validator.default.isLength(value, VIDEO_BLACKLIST_CONSTRAINTS_FIELDS.REASON)}function isVideoBlacklistTypeValid (value: any) {diff --git a/server/helpers/custom-validators/video-captions.ts b/server/server/helpers/custom-validators/video-captions.tssimilarity index 84%rename from server/helpers/custom-validators/video-captions.tsrename to server/server/helpers/custom-validators/video-captions.tsindex 0e24655a08..dcd9fc2c15 100644--- a/server/helpers/custom-validators/video-captions.ts+++ b/server/server/helpers/custom-validators/video-captions.ts@@ -1,9 +1,9 @@import { UploadFilesForCheck } from 'express'-import { readFile } from 'fs-extra'-import { getFileSize } from '@shared/extra-utils'-import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_LANGUAGES } from '../../initializers/constants'-import { logger } from '../logger'-import { exists, isFileValid } from './misc'+import { readFile } from 'fs/promises'+import { getFileSize } from '@peertube/peertube-node-utils'+import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_LANGUAGES } from '../../initializers/constants.js'+import { logger } from '../logger.js'+import { exists, isFileValid } from './misc.js'function isVideoCaptionLanguageValid (value: any) {return exists(value) && VIDEO_LANGUAGES[value] !== undefineddiff --git a/server/helpers/custom-validators/video-channel-syncs.ts b/server/server/helpers/custom-validators/video-channel-syncs.tssimilarity index 80%rename from server/helpers/custom-validators/video-channel-syncs.tsrename to server/server/helpers/custom-validators/video-channel-syncs.tsindex c5a9afa967..a07d8ed529 100644--- a/server/helpers/custom-validators/video-channel-syncs.ts+++ b/server/server/helpers/custom-validators/video-channel-syncs.ts@@ -1,5 +1,5 @@-import { VIDEO_CHANNEL_SYNC_STATE } from '@server/initializers/constants'-import { exists } from './misc'+import { VIDEO_CHANNEL_SYNC_STATE } from '@server/initializers/constants.js'+import { exists } from './misc.js'export function isVideoChannelSyncStateValid (value: any) {return exists(value) && VIDEO_CHANNEL_SYNC_STATE[value] !== undefineddiff --git a/server/helpers/custom-validators/video-channels.ts b/server/server/helpers/custom-validators/video-channels.tssimilarity index 63%rename from server/helpers/custom-validators/video-channels.tsrename to server/server/helpers/custom-validators/video-channels.tsindex 249083f39a..2ea3afd2db 100644--- a/server/helpers/custom-validators/video-channels.ts+++ b/server/server/helpers/custom-validators/video-channels.ts@@ -1,7 +1,7 @@import validator from 'validator'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { exists } from './misc'-import { isUserUsernameValid } from './users'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { exists } from './misc.js'+import { isUserUsernameValid } from './users.js'const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS@@ -11,15 +11,15 @@ function isVideoChannelUsernameValid (value: string) {}function isVideoChannelDescriptionValid (value: string) {- return value === null || validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION)+ return value === null || validator.default.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION)}function isVideoChannelDisplayNameValid (value: string) {- return exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.NAME)+ return exists(value) && validator.default.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.NAME)}function isVideoChannelSupportValid (value: string) {- return value === null || (exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT))+ return value === null || (exists(value) && validator.default.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT))}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/video-comments.ts b/server/server/helpers/custom-validators/video-comments.tssimilarity index 76%rename from server/helpers/custom-validators/video-comments.tsrename to server/server/helpers/custom-validators/video-comments.tsindex 94bdf237a9..104583663e 100644--- a/server/helpers/custom-validators/video-comments.ts+++ b/server/server/helpers/custom-validators/video-comments.ts@@ -1,10 +1,10 @@import validator from 'validator'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'const VIDEO_COMMENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_COMMENTSfunction isValidVideoCommentText (value: string) {- return value === null || validator.isLength(value, VIDEO_COMMENTS_CONSTRAINTS_FIELDS.TEXT)+ return value === null || validator.default.isLength(value, VIDEO_COMMENTS_CONSTRAINTS_FIELDS.TEXT)}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/video-imports.ts b/server/server/helpers/custom-validators/video-imports.tssimilarity index 84%rename from server/helpers/custom-validators/video-imports.tsrename to server/server/helpers/custom-validators/video-imports.tsindex da8962cb6d..7d6bba9321 100644--- a/server/helpers/custom-validators/video-imports.ts+++ b/server/server/helpers/custom-validators/video-imports.ts@@ -1,8 +1,8 @@import 'multer'import { UploadFilesForCheck } from 'express'import validator from 'validator'-import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_IMPORT_STATES } from '../../initializers/constants'-import { exists, isFileValid } from './misc'+import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_IMPORT_STATES } from '../../initializers/constants.js'+import { exists, isFileValid } from './misc.js'function isVideoImportTargetUrlValid (url: string) {const isURLOptions = {@@ -14,8 +14,8 @@ function isVideoImportTargetUrlValid (url: string) {}return exists(url) &&- validator.isURL('' + url, isURLOptions) &&- validator.isLength('' + url, CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL)+ validator.default.isURL('' + url, isURLOptions) &&+ validator.default.isLength('' + url, CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL)}function isVideoImportStateValid (value: any) {diff --git a/server/helpers/custom-validators/video-lives.ts b/server/server/helpers/custom-validators/video-lives.tssimilarity index 81%rename from server/helpers/custom-validators/video-lives.tsrename to server/server/helpers/custom-validators/video-lives.tsindex 69d08ae688..1a92681130 100644--- a/server/helpers/custom-validators/video-lives.ts+++ b/server/server/helpers/custom-validators/video-lives.ts@@ -1,4 +1,4 @@-import { LiveVideoLatencyMode } from '@shared/models'+import { LiveVideoLatencyMode } from '@peertube/peertube-models'function isLiveLatencyModeValid (value: any) {return [ LiveVideoLatencyMode.DEFAULT, LiveVideoLatencyMode.SMALL_LATENCY, LiveVideoLatencyMode.HIGH_LATENCY ].includes(value)diff --git a/server/helpers/custom-validators/video-ownership.ts b/server/server/helpers/custom-validators/video-ownership.tssimilarity index 76%rename from server/helpers/custom-validators/video-ownership.tsrename to server/server/helpers/custom-validators/video-ownership.tsindex cf15b385a7..5961ed97cd 100644--- a/server/helpers/custom-validators/video-ownership.ts+++ b/server/server/helpers/custom-validators/video-ownership.ts@@ -1,7 +1,7 @@import { Response } from 'express'-import { MUserId } from '@server/types/models'-import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'+import { HttpStatusCode } from '@peertube/peertube-models'+import { MUserId } from '@server/types/models/index.js'+import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership.js'function checkUserCanTerminateOwnershipChange (user: MUserId, videoChangeOwnership: MVideoChangeOwnershipFull, res: Response) {if (videoChangeOwnership.NextOwner.userId === user.id) {diff --git a/server/helpers/custom-validators/video-playlists.ts b/server/server/helpers/custom-validators/video-playlists.tssimilarity index 60%rename from server/helpers/custom-validators/video-playlists.tsrename to server/server/helpers/custom-validators/video-playlists.tsindex 180018fc54..f3b30bf50d 100644--- a/server/helpers/custom-validators/video-playlists.ts+++ b/server/server/helpers/custom-validators/video-playlists.ts@@ -1,23 +1,23 @@-import { exists } from './misc'+import { exists } from './misc.js'import validator from 'validator'-import { CONSTRAINTS_FIELDS, VIDEO_PLAYLIST_PRIVACIES, VIDEO_PLAYLIST_TYPES } from '../../initializers/constants'+import { CONSTRAINTS_FIELDS, VIDEO_PLAYLIST_PRIVACIES, VIDEO_PLAYLIST_TYPES } from '../../initializers/constants.js'const PLAYLISTS_CONSTRAINT_FIELDS = CONSTRAINTS_FIELDS.VIDEO_PLAYLISTSfunction isVideoPlaylistNameValid (value: any) {- return exists(value) && validator.isLength(value, PLAYLISTS_CONSTRAINT_FIELDS.NAME)+ return exists(value) && validator.default.isLength(value, PLAYLISTS_CONSTRAINT_FIELDS.NAME)}function isVideoPlaylistDescriptionValid (value: any) {- return value === null || (exists(value) && validator.isLength(value, PLAYLISTS_CONSTRAINT_FIELDS.DESCRIPTION))+ return value === null || (exists(value) && validator.default.isLength(value, PLAYLISTS_CONSTRAINT_FIELDS.DESCRIPTION))}function isVideoPlaylistPrivacyValid (value: number) {- return validator.isInt(value + '') && VIDEO_PLAYLIST_PRIVACIES[value] !== undefined+ return validator.default.isInt(value + '') && VIDEO_PLAYLIST_PRIVACIES[value] !== undefined}function isVideoPlaylistTimestampValid (value: any) {- return value === null || (exists(value) && validator.isInt('' + value, { min: 0 }))+ return value === null || (exists(value) && validator.default.isInt('' + value, { min: 0 }))}function isVideoPlaylistTypeValid (value: any) {diff --git a/server/helpers/custom-validators/video-rates.ts b/server/server/helpers/custom-validators/video-rates.tssimilarity index 100%rename from server/helpers/custom-validators/video-rates.tsrename to server/server/helpers/custom-validators/video-rates.tsdiff --git a/server/helpers/custom-validators/video-redundancies.ts b/server/server/helpers/custom-validators/video-redundancies.tssimilarity index 87%rename from server/helpers/custom-validators/video-redundancies.tsrename to server/server/helpers/custom-validators/video-redundancies.tsindex 50a559c4fc..91ab35f4c5 100644--- a/server/helpers/custom-validators/video-redundancies.ts+++ b/server/server/helpers/custom-validators/video-redundancies.ts@@ -1,4 +1,4 @@-import { exists } from './misc'+import { exists } from './misc.js'function isVideoRedundancyTarget (value: any) {return exists(value) &&diff --git a/server/helpers/custom-validators/video-stats.ts b/server/server/helpers/custom-validators/video-stats.tssimilarity index 82%rename from server/helpers/custom-validators/video-stats.tsrename to server/server/helpers/custom-validators/video-stats.tsindex 1e22f06546..7bd30c8e22 100644--- a/server/helpers/custom-validators/video-stats.ts+++ b/server/server/helpers/custom-validators/video-stats.ts@@ -1,4 +1,4 @@-import { VideoStatsTimeserieMetric } from '@shared/models'+import { VideoStatsTimeserieMetric } from '@peertube/peertube-models'const validMetrics = new Set<VideoStatsTimeserieMetric>(['viewers',diff --git a/server/helpers/custom-validators/video-studio.ts b/server/server/helpers/custom-validators/video-studio.tssimilarity index 80%rename from server/helpers/custom-validators/video-studio.tsrename to server/server/helpers/custom-validators/video-studio.tsindex 68dfec8dd0..de94673203 100644--- a/server/helpers/custom-validators/video-studio.ts+++ b/server/server/helpers/custom-validators/video-studio.ts@@ -1,10 +1,10 @@import validator from 'validator'-import { CONSTRAINTS_FIELDS } from '@server/initializers/constants'-import { buildTaskFileFieldname } from '@server/lib/video-studio'-import { VideoStudioTask } from '@shared/models'-import { isArray } from './misc'-import { isVideoFileMimeTypeValid, isVideoImageValid } from './videos'-import { forceNumber } from '@shared/core-utils'+import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'+import { buildTaskFileFieldname } from '@server/lib/video-studio.js'+import { VideoStudioTask } from '@peertube/peertube-models'+import { isArray } from './misc.js'+import { isVideoFileMimeTypeValid, isVideoImageValid } from './videos.js'+import { forceNumber } from '@peertube/peertube-core-utils'function isValidStudioTasksArray (tasks: any) {if (!isArray(tasks)) return false@@ -20,8 +20,8 @@ function isStudioCutTaskValid (task: VideoStudioTask) {const { start, end } = task.optionsif (!start && !end) return false- if (start && !validator.isInt(start + '', CONSTRAINTS_FIELDS.VIDEO_STUDIO.CUT_TIME)) return false- if (end && !validator.isInt(end + '', CONSTRAINTS_FIELDS.VIDEO_STUDIO.CUT_TIME)) return false+ if (start && !validator.default.isInt(start + '', CONSTRAINTS_FIELDS.VIDEO_STUDIO.CUT_TIME)) return false+ if (end && !validator.default.isInt(end + '', CONSTRAINTS_FIELDS.VIDEO_STUDIO.CUT_TIME)) return falseif (!start || !end) return truediff --git a/server/helpers/custom-validators/video-transcoding.ts b/server/server/helpers/custom-validators/video-transcoding.tssimilarity index 89%rename from server/helpers/custom-validators/video-transcoding.tsrename to server/server/helpers/custom-validators/video-transcoding.tsindex 220530de42..aa09d273e0 100644--- a/server/helpers/custom-validators/video-transcoding.ts+++ b/server/server/helpers/custom-validators/video-transcoding.ts@@ -1,4 +1,4 @@-import { exists } from './misc'+import { exists } from './misc.js'function isValidCreateTranscodingType (value: any) {return exists(value) &&diff --git a/server/helpers/custom-validators/video-view.ts b/server/server/helpers/custom-validators/video-view.tssimilarity index 85%rename from server/helpers/custom-validators/video-view.tsrename to server/server/helpers/custom-validators/video-view.tsindex 091c920836..2edd47ec96 100644--- a/server/helpers/custom-validators/video-view.ts+++ b/server/server/helpers/custom-validators/video-view.ts@@ -1,4 +1,4 @@-import { exists } from './misc'+import { exists } from './misc.js'function isVideoTimeValid (value: number, videoDuration?: number) {if (value < 0) return falsediff --git a/server/helpers/custom-validators/videos.ts b/server/server/helpers/custom-validators/videos.tssimilarity index 78%rename from server/helpers/custom-validators/videos.tsrename to server/server/helpers/custom-validators/videos.tsindex 00c6deed42..0dede6c85d 100644--- a/server/helpers/custom-validators/videos.ts+++ b/server/server/helpers/custom-validators/videos.ts@@ -1,8 +1,8 @@import { Request, Response, UploadFilesForCheck } from 'express'import { decode as magnetUriDecode } from 'magnet-uri'import validator from 'validator'-import { getVideoWithAttributes } from '@server/helpers/video'-import { HttpStatusCode, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models'+import { HttpStatusCode, VideoIncludeType, VideoPrivacy, VideoPrivacyType, VideoRateType } from '@peertube/peertube-models'+import { getVideoWithAttributes } from '@server/helpers/video.js'import {CONSTRAINTS_FIELDS,MIMETYPES,@@ -12,13 +12,13 @@ import {VIDEO_PRIVACIES,VIDEO_RATE_TYPES,VIDEO_STATES-} from '../../initializers/constants'-import { exists, isArray, isDateValid, isFileValid } from './misc'+} from '../../initializers/constants.js'+import { exists, isArray, isDateValid, isFileValid } from './misc.js'const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS-function isVideoIncludeValid (include: VideoInclude) {- return exists(include) && validator.isInt('' + include)+function isVideoIncludeValid (include: VideoIncludeType) {+ return exists(include) && validator.default.isInt('' + include)}function isVideoCategoryValid (value: any) {@@ -35,39 +35,39 @@ function isVideoLicenceValid (value: any) {function isVideoLanguageValid (value: any) {return value === null ||- (typeof value === 'string' && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.LANGUAGE))+ (typeof value === 'string' && validator.default.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.LANGUAGE))}function isVideoDurationValid (value: string) {- return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION)+ return exists(value) && validator.default.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION)}function isVideoDescriptionValid (value: string) {- return value === null || (exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION))+ return value === null || (exists(value) && validator.default.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION))}function isVideoSupportValid (value: string) {- return value === null || (exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.SUPPORT))+ return value === null || (exists(value) && validator.default.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.SUPPORT))}function isVideoNameValid (value: string) {- return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.NAME)+ return exists(value) && validator.default.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.NAME)}function isVideoTagValid (tag: string) {- return exists(tag) && validator.isLength(tag, VIDEOS_CONSTRAINTS_FIELDS.TAG)+ return exists(tag) && validator.default.isLength(tag, VIDEOS_CONSTRAINTS_FIELDS.TAG)}function areVideoTagsValid (tags: string[]) {return tags === null || (isArray(tags) &&- validator.isInt(tags.length.toString(), VIDEOS_CONSTRAINTS_FIELDS.TAGS) &&+ validator.default.isInt(tags.length.toString(), VIDEOS_CONSTRAINTS_FIELDS.TAGS) &&tags.every(tag => isVideoTagValid(tag)))}function isVideoViewsValid (value: string) {- return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.VIEWS)+ return exists(value) && validator.default.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.VIEWS)}const ratingTypes = new Set(Object.values(VIDEO_RATE_TYPES))@@ -120,19 +120,19 @@ function isVideoOriginallyPublishedAtValid (value: string | null) {}function isVideoFileInfoHashValid (value: string | null | undefined) {- return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.INFO_HASH)+ return exists(value) && validator.default.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.INFO_HASH)}function isVideoFileResolutionValid (value: string) {- return exists(value) && validator.isInt(value + '')+ return exists(value) && validator.default.isInt(value + '')}function isVideoFPSResolutionValid (value: string) {- return value === null || validator.isInt(value + '')+ return value === null || validator.default.isInt(value + '')}function isVideoFileSizeValid (value: string) {- return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.FILE_SIZE)+ return exists(value) && validator.default.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.FILE_SIZE)}function isVideoMagnetUriValid (value: string) {@@ -156,7 +156,7 @@ function isValidPasswordProtectedPrivacy (req: Request, res: Response) {return false}- let privacy: VideoPrivacy+ let privacy: VideoPrivacyTypeconst video = getVideoWithAttributes(res)if (exists(req.body?.privacy)) privacy = req.body.privacydiff --git a/server/helpers/custom-validators/webfinger.ts b/server/server/helpers/custom-validators/webfinger.tssimilarity index 85%rename from server/helpers/custom-validators/webfinger.tsrename to server/server/helpers/custom-validators/webfinger.tsindex dd914341e8..ce10c2247a 100644--- a/server/helpers/custom-validators/webfinger.ts+++ b/server/server/helpers/custom-validators/webfinger.ts@@ -1,6 +1,6 @@-import { REMOTE_SCHEME, WEBSERVER } from '../../initializers/constants'-import { sanitizeHost } from '../core-utils'-import { exists } from './misc'+import { REMOTE_SCHEME, WEBSERVER } from '../../initializers/constants.js'+import { sanitizeHost } from '../core-utils.js'+import { exists } from './misc.js'function isWebfingerLocalResourceValid (value: string) {if (!exists(value)) return falsediff --git a/server/helpers/database-utils.ts b/server/server/helpers/database-utils.tssimilarity index 97%rename from server/helpers/database-utils.tsrename to server/server/helpers/database-utils.tsindex b6ba7fd75a..b7276bb84a 100644--- a/server/helpers/database-utils.ts+++ b/server/server/helpers/database-utils.ts@@ -1,9 +1,9 @@-import retry from 'async/retry'+import retry from 'async/retry.js'import Bluebird from 'bluebird'import { Transaction } from 'sequelize'import { Model } from 'sequelize-typescript'-import { sequelizeTypescript } from '@server/initializers/database'-import { logger } from './logger'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { logger } from './logger.js'function retryTransactionWrapper <T, A, B, C, D> (functionToRetry: (arg1: A, arg2: B, arg3: C, arg4: D) => Promise<T>,diff --git a/server/helpers/debounce.ts b/server/server/helpers/debounce.tssimilarity index 100%rename from server/helpers/debounce.tsrename to server/server/helpers/debounce.tsdiff --git a/server/helpers/decache.ts b/server/server/helpers/decache.tssimilarity index 69%rename from server/helpers/decache.tsrename to server/server/helpers/decache.tsindex 6be446ff64..cef3d639c1 100644--- a/server/helpers/decache.ts+++ b/server/server/helpers/decache.ts@@ -1,26 +1,27 @@// Thanks: https://github.com/dwyl/decache// We reuse this file to also uncache plugin base path+import { Module } from 'module'import { extname } from 'path'-function decachePlugin (libraryPath: string) {- const moduleName = find(libraryPath)+function decachePlugin (require: NodeRequire, libraryPath: string) {+ const moduleName = find(require, libraryPath)if (!moduleName) return- searchCache(moduleName, function (mod) {+ searchCache(require, moduleName, function (mod) {delete require.cache[mod.id]removeCachedPath(mod.path)})}-function decacheModule (name: string) {- const moduleName = find(name)+function decacheModule (require: NodeRequire, name: string) {+ const moduleName = find(require, name)if (!moduleName) return- searchCache(moduleName, function (mod) {+ searchCache(require, moduleName, function (mod) {delete require.cache[mod.id]removeCachedPath(mod.path)@@ -36,7 +37,7 @@ export {// ----------------------------------------------------------------------------function find (moduleName: string) {+function find (require: NodeRequire, moduleName: string) {try {return require.resolve(moduleName)} catch {@@ -44,7 +45,7 @@ function find (moduleName: string) {}}-function searchCache (moduleName: string, callback: (current: NodeModule) => void) {+function searchCache (require: NodeRequire, moduleName: string, callback: (current: NodeModule) => void) {const resolvedModule = require.resolve(moduleName)let mod: NodeModuleconst visited = {}@@ -68,7 +69,7 @@ function searchCache (moduleName: string, callback: (current: NodeModule) => voi};function removeCachedPath (pluginPath: string) {- const pathCache = (module.constructor as any)._pathCache as { [ id: string ]: string[] }+ const pathCache = (Module as any)._pathCache as { [ id: string ]: string[] }Object.keys(pathCache).forEach(function (cacheKey) {if (cacheKey.includes(pluginPath)) {diff --git a/server/helpers/dns.ts b/server/server/helpers/dns.tssimilarity index 87%rename from server/helpers/dns.tsrename to server/server/helpers/dns.tsindex da8b666c2d..52a0654d96 100644--- a/server/helpers/dns.ts+++ b/server/server/helpers/dns.ts@@ -1,5 +1,5 @@import { lookup } from 'dns'-import { parse as parseIP } from 'ipaddr.js'+import ipaddr from 'ipaddr.js'function dnsLookupAll (hostname: string) {return new Promise<string[]>((res, rej) => {@@ -15,7 +15,7 @@ async function isResolvingToUnicastOnly (hostname: string) {const addresses = await dnsLookupAll(hostname)for (const address of addresses) {- const parsed = parseIP(address)+ const parsed = ipaddr.parse(address)if (parsed.range() !== 'unicast') return false}diff --git a/server/helpers/express-utils.ts b/server/server/helpers/express-utils.tssimilarity index 92%rename from server/helpers/express-utils.tsrename to server/server/helpers/express-utils.tsindex 783097e551..773cad2b29 100644--- a/server/helpers/express-utils.ts+++ b/server/server/helpers/express-utils.ts@@ -1,12 +1,12 @@import express, { RequestHandler } from 'express'import multer, { diskStorage } from 'multer'-import { getLowercaseExtension } from '@shared/core-utils'-import { CONFIG } from '../initializers/config'-import { REMOTE_SCHEME } from '../initializers/constants'-import { isArray } from './custom-validators/misc'-import { logger } from './logger'-import { deleteFileAndCatch, generateRandomString } from './utils'-import { getExtFromMimetype } from './video'+import { getLowercaseExtension } from '@peertube/peertube-node-utils'+import { CONFIG } from '../initializers/config.js'+import { REMOTE_SCHEME } from '../initializers/constants.js'+import { isArray } from './custom-validators/misc.js'+import { logger } from './logger.js'+import { deleteFileAndCatch, generateRandomString } from './utils.js'+import { getExtFromMimetype } from './video.js'function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {if (paramNSFW === 'true') return truediff --git a/server/helpers/ffmpeg/codecs.ts b/server/server/helpers/ffmpeg/codecs.tssimilarity index 90%rename from server/helpers/ffmpeg/codecs.tsrename to server/server/helpers/ffmpeg/codecs.tsindex 3bd7db396d..ff98b8f990 100644--- a/server/helpers/ffmpeg/codecs.ts+++ b/server/server/helpers/ffmpeg/codecs.ts@@ -1,7 +1,7 @@import { FfprobeData } from 'fluent-ffmpeg'-import { getAudioStream, getVideoStream } from '@shared/ffmpeg'-import { logger } from '../logger'-import { forceNumber } from '@shared/core-utils'+import { getAudioStream, getVideoStream } from '@peertube/peertube-ffmpeg'+import { logger } from '../logger.js'+import { forceNumber } from '@peertube/peertube-core-utils'export async function getVideoStreamCodec (path: string) {const videoStream = await getVideoStream(path)diff --git a/server/helpers/ffmpeg/ffmpeg-image.ts b/server/server/helpers/ffmpeg/ffmpeg-image.tssimilarity index 91%rename from server/helpers/ffmpeg/ffmpeg-image.tsrename to server/server/helpers/ffmpeg/ffmpeg-image.tsindex 0bb0ff2c09..1f6c6a3c32 100644--- a/server/helpers/ffmpeg/ffmpeg-image.ts+++ b/server/server/helpers/ffmpeg/ffmpeg-image.ts@@ -1,5 +1,5 @@-import { FFmpegImage } from '@shared/ffmpeg'-import { getFFmpegCommandWrapperOptions } from './ffmpeg-options'+import { FFmpegImage } from '@peertube/peertube-ffmpeg'+import { getFFmpegCommandWrapperOptions } from './ffmpeg-options.js'export function processGIF (options: Parameters<FFmpegImage['processGIF']>[0]) {return new FFmpegImage(getFFmpegCommandWrapperOptions('thumbnail')).processGIF(options)diff --git a/server/helpers/ffmpeg/ffmpeg-options.ts b/server/server/helpers/ffmpeg/ffmpeg-options.tssimilarity index 78%rename from server/helpers/ffmpeg/ffmpeg-options.tsrename to server/server/helpers/ffmpeg/ffmpeg-options.tsindex 64d7c41799..ec1b91f869 100644--- a/server/helpers/ffmpeg/ffmpeg-options.ts+++ b/server/server/helpers/ffmpeg/ffmpeg-options.ts@@ -1,8 +1,8 @@-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { FFMPEG_NICE } from '@server/initializers/constants'-import { FFmpegCommandWrapperOptions } from '@shared/ffmpeg'-import { AvailableEncoders } from '@shared/models'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { FFMPEG_NICE } from '@server/initializers/constants.js'+import { FFmpegCommandWrapperOptions } from '@peertube/peertube-ffmpeg'+import { AvailableEncoders } from '@peertube/peertube-models'type CommandType = 'live' | 'vod' | 'thumbnail'diff --git a/server/helpers/ffmpeg/framerate.ts b/server/server/helpers/ffmpeg/framerate.tssimilarity index 93%rename from server/helpers/ffmpeg/framerate.tsrename to server/server/helpers/ffmpeg/framerate.tsindex 18cb0e0e2f..8aef6f021d 100644--- a/server/helpers/ffmpeg/framerate.ts+++ b/server/server/helpers/ffmpeg/framerate.ts@@ -1,9 +1,8 @@-import { VIDEO_TRANSCODING_FPS } from '@server/initializers/constants'-import { VideoResolution } from '@shared/models'+import { VIDEO_TRANSCODING_FPS } from '@server/initializers/constants.js'export function computeOutputFPS (options: {inputFPS: number- resolution: VideoResolution+ resolution: number}) {const { resolution } = optionsdiff --git a/server/server/helpers/ffmpeg/index.ts b/server/server/helpers/ffmpeg/index.tsnew file mode 100644index 0000000000..69864926e0--- /dev/null+++ b/server/server/helpers/ffmpeg/index.ts@@ -0,0 +1,4 @@+export * from './codecs.js'+export * from './ffmpeg-image.js'+export * from './ffmpeg-options.js'+export * from './framerate.js'diff --git a/server/helpers/geo-ip.ts b/server/server/helpers/geo-ip.tssimilarity index 87%rename from server/helpers/geo-ip.tsrename to server/server/helpers/geo-ip.tsindex 9e44d660f2..6a9cd21240 100644--- a/server/helpers/geo-ip.ts+++ b/server/server/helpers/geo-ip.ts@@ -1,9 +1,10 @@-import { pathExists, writeFile } from 'fs-extra'+import { pathExists } from 'fs-extra/esm'+import { writeFile } from 'fs/promises'import maxmind, { CountryResponse, Reader } from 'maxmind'import { join } from 'path'-import { CONFIG } from '@server/initializers/config'-import { logger, loggerTagsFactory } from './logger'-import { isBinaryResponse, peertubeGot } from './requests'+import { CONFIG } from '@server/initializers/config.js'+import { logger, loggerTagsFactory } from './logger.js'+import { isBinaryResponse, peertubeGot } from './requests.js'const lTags = loggerTagsFactory('geo-ip')diff --git a/server/helpers/image-utils.ts b/server/server/helpers/image-utils.tssimilarity index 90%rename from server/helpers/image-utils.tsrename to server/server/helpers/image-utils.tsindex 2a8bb6e6ee..7c732235d3 100644--- a/server/helpers/image-utils.ts+++ b/server/server/helpers/image-utils.ts@@ -1,11 +1,12 @@-import { copy, readFile, remove, rename } from 'fs-extra'-import Jimp, { read as jimpRead } from 'jimp'+import { copy, remove } from 'fs-extra/esm'+import { readFile, rename } from 'fs/promises'import { join } from 'path'import { ColorActionName } from '@jimp/plugin-color'-import { getLowercaseExtension } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { convertWebPToJPG, generateThumbnailFromVideo, processGIF } from './ffmpeg'-import { logger, loggerTagsFactory } from './logger'+import { buildUUID, getLowercaseExtension } from '@peertube/peertube-node-utils'+import { convertWebPToJPG, generateThumbnailFromVideo, processGIF } from './ffmpeg/index.js'+import { logger, loggerTagsFactory } from './logger.js'++import type Jimp from 'jimp'const lTags = loggerTagsFactory('image-utils')@@ -71,7 +72,9 @@ async function generateImageFromVideoFile (options: {async function getImageSize (path: string) {const inputBuffer = await readFile(path)- const image = await jimpRead(inputBuffer)+ const Jimp = await import('jimp')++ const image = await Jimp.default.read(inputBuffer)return {width: image.getWidth(),@@ -96,8 +99,10 @@ async function jimpProcessor (path: string, destination: string, newSize: { widtlet sourceImage: Jimpconst inputBuffer = await readFile(path)+ const Jimp = await import('jimp')+try {- sourceImage = await jimpRead(inputBuffer)+ sourceImage = await Jimp.default.read(inputBuffer)} catch (err) {logger.debug('Cannot read %s with jimp. Try to convert the image using ffmpeg first.', path, { err })@@ -105,7 +110,7 @@ async function jimpProcessor (path: string, destination: string, newSize: { widtawait convertWebPToJPG({ path, destination: newName })await rename(newName, path)- sourceImage = await jimpRead(path)+ sourceImage = await Jimp.default.read(path)}await remove(destination)diff --git a/server/helpers/logger.ts b/server/server/helpers/logger.tssimilarity index 95%rename from server/helpers/logger.tsrename to server/server/helpers/logger.tsindex 6649db40f4..1379d4864c 100644--- a/server/helpers/logger.ts+++ b/server/server/helpers/logger.ts@@ -1,13 +1,13 @@-import { stat } from 'fs-extra'+import { stat } from 'fs/promises'import { join } from 'path'import { format as sqlFormat } from 'sql-formatter'import { createLogger, format, transports } from 'winston'import { FileTransportOptions } from 'winston/lib/winston/transports'import { context } from '@opentelemetry/api'-import { getSpanContext } from '@opentelemetry/api/build/src/trace/context-utils'-import { omit } from '@shared/core-utils'-import { CONFIG } from '../initializers/config'-import { LOG_FILENAME } from '../initializers/constants'+import { getSpanContext } from '@opentelemetry/api/build/src/trace/context-utils.js'+import { omit } from '@peertube/peertube-core-utils'+import { CONFIG } from '../initializers/config.js'+import { LOG_FILENAME } from '../initializers/constants.js'const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT@@ -153,7 +153,7 @@ async function mtimeSortFilesDesc (files: string[], basePath: string) {// ---------------------------------------------------------------------------export {- LoggerTagsFn,+ type LoggerTagsFn,buildLogger,timestampFormatter,diff --git a/server/helpers/markdown.ts b/server/server/helpers/markdown.tssimilarity index 91%rename from server/helpers/markdown.tsrename to server/server/helpers/markdown.tsindex a20ac22d44..e38e55502b 100644--- a/server/helpers/markdown.ts+++ b/server/server/helpers/markdown.ts@@ -1,12 +1,11 @@-import { getDefaultSanitizeOptions, getTextOnlySanitizeOptions, TEXT_WITH_HTML_RULES } from '@shared/core-utils'+import MarkdownItClass from 'markdown-it'+import markdownItEmoji from 'markdown-it-emoji/light.js'+import sanitizeHtml from 'sanitize-html'+import { getDefaultSanitizeOptions, getTextOnlySanitizeOptions, TEXT_WITH_HTML_RULES } from '@peertube/peertube-core-utils'const defaultSanitizeOptions = getDefaultSanitizeOptions()const textOnlySanitizeOptions = getTextOnlySanitizeOptions()-const sanitizeHtml = require('sanitize-html')-const markdownItEmoji = require('markdown-it-emoji/light')-const MarkdownItClass = require('markdown-it')-const markdownItForSafeHtml = new MarkdownItClass('default', { linkify: true, breaks: true, html: true }).enable(TEXT_WITH_HTML_RULES).use(markdownItEmoji)diff --git a/server/helpers/memoize.ts b/server/server/helpers/memoize.tssimilarity index 100%rename from server/helpers/memoize.tsrename to server/server/helpers/memoize.tsdiff --git a/server/server/helpers/mentions.ts b/server/server/helpers/mentions.tsnew file mode 100644index 0000000000..238e468eaa--- /dev/null+++ b/server/server/helpers/mentions.ts@@ -0,0 +1,42 @@+import { uniqify } from '@peertube/peertube-core-utils'+import { WEBSERVER } from '@server/initializers/constants.js'+import { actorNameAlphabet } from './custom-validators/activitypub/actor.js'+import { regexpCapture } from './regexp.js'++export function extractMentions (text: string, isOwned: boolean) {+ let result: string[] = []++ const localMention = `@(${actorNameAlphabet}+)`+ const remoteMention = `${localMention}@${WEBSERVER.HOST}`++ const mentionRegex = isOwned+ ? '(?:(?:' + remoteMention + ')|(?:' + localMention + '))' // Include local mentions?+ : '(?:' + remoteMention + ')'++ const firstMentionRegex = new RegExp(`^${mentionRegex} `, 'g')+ const endMentionRegex = new RegExp(` ${mentionRegex}$`, 'g')+ const remoteMentionsRegex = new RegExp(' ' + remoteMention + ' ', 'g')++ result = result.concat(+ regexpCapture(text, firstMentionRegex)+ .map(([ , username1, username2 ]) => username1 || username2),++ regexpCapture(text, endMentionRegex)+ .map(([ , username1, username2 ]) => username1 || username2),++ regexpCapture(text, remoteMentionsRegex)+ .map(([ , username ]) => username)+ )++ // Include local mentions+ if (isOwned) {+ const localMentionsRegex = new RegExp(' ' + localMention + ' ', 'g')++ result = result.concat(+ regexpCapture(text, localMentionsRegex)+ .map(([ , username ]) => username)+ )+ }++ return uniqify(result)+}diff --git a/server/helpers/otp.ts b/server/server/helpers/otp.tssimilarity index 84%rename from server/helpers/otp.tsrename to server/server/helpers/otp.tsindex a32cc96210..673a043f6e 100644--- a/server/helpers/otp.ts+++ b/server/server/helpers/otp.ts@@ -1,7 +1,7 @@import { Secret, TOTP } from 'otpauth'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { decrypt } from './peertube-crypto'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { decrypt } from './peertube-crypto.js'async function isOTPValid (options: {encryptedSecret: stringdiff --git a/server/helpers/peertube-crypto.ts b/server/server/helpers/peertube-crypto.tssimilarity index 83%rename from server/helpers/peertube-crypto.tsrename to server/server/helpers/peertube-crypto.tsindex 95e78a9048..45f2da6bfe 100644--- a/server/helpers/peertube-crypto.ts+++ b/server/server/helpers/peertube-crypto.ts@@ -1,20 +1,12 @@-import { compare, genSalt, hash } from 'bcrypt'+import httpSignature from '@peertube/http-signature'+import { sha256 } from '@peertube/peertube-node-utils'import { createCipheriv, createDecipheriv, createSign, createVerify } from 'crypto'import { Request } from 'express'-import { cloneDeep } from 'lodash'-import { promisify1, promisify2 } from '@shared/core-utils'-import { sha256 } from '@shared/extra-utils'-import { BCRYPT_SALT_SIZE, ENCRYPTION, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants'-import { MActor } from '../types/models'-import { generateRSAKeyPairPromise, randomBytesPromise, scryptPromise } from './core-utils'-import { jsonld } from './custom-jsonld-signature'-import { logger } from './logger'--const bcryptComparePromise = promisify2<any, string, boolean>(compare)-const bcryptGenSaltPromise = promisify1<number, string>(genSalt)-const bcryptHashPromise = promisify2<any, string | number, string>(hash)--const httpSignature = require('@peertube/http-signature')+import cloneDeep from 'lodash-es/cloneDeep.js'+import { BCRYPT_SALT_SIZE, ENCRYPTION, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants.js'+import { MActor } from '../types/models/index.js'+import { generateRSAKeyPairPromise, randomBytesPromise, scryptPromise } from './core-utils.js'+import { logger } from './logger.js'function createPrivateAndPublicKeys () {logger.info('Generating a RSA key...')@@ -26,16 +18,20 @@ function createPrivateAndPublicKeys () {// User password checks// ----------------------------------------------------------------------------function comparePassword (plainPassword: string, hashPassword: string) {- if (!plainPassword) return Promise.resolve(false)+async function comparePassword (plainPassword: string, hashPassword: string) {+ if (!plainPassword) return false- return bcryptComparePromise(plainPassword, hashPassword)+ const { compare } = await import('bcrypt')++ return compare(plainPassword, hashPassword)}async function cryptPassword (password: string) {- const salt = await bcryptGenSaltPromise(BCRYPT_SALT_SIZE)+ const { genSalt, hash } = await import('bcrypt')++ const salt = await genSalt(BCRYPT_SALT_SIZE)- return bcryptHashPromise(password, salt)+ return hash(password, salt)}// ---------------------------------------------------------------------------@@ -98,7 +94,7 @@ async function isJsonLDRSA2017Verified (fromActor: MActor, signedDocument: any)return verify.verify(fromActor.publicKey, signedDocument.signature.signatureValue, 'base64')}-async function signJsonLDObject <T> (byActor: MActor, data: T) {+async function signJsonLDObject <T> (byActor: { url: string, privateKey: string }, data: T) {const signature = {type: 'RsaSignature2017',creator: byActor.url,@@ -176,12 +172,16 @@ export {// ----------------------------------------------------------------------------function hashObject (obj: any): Promise<any> {- return jsonld.promises.normalize(obj, {+async function hashObject (obj: any): Promise<any> {+ const { jsonld } = await import('./custom-jsonld-signature.js')++ const res = await (jsonld as any).promises.normalize(obj, {safe: false,algorithm: 'URDNA2015',format: 'application/n-quads'- }).then(res => sha256(res))+ })++ return sha256(res)}function createSignatureHash (signature: any) {diff --git a/server/helpers/promise-cache.ts b/server/server/helpers/promise-cache.tssimilarity index 100%rename from server/helpers/promise-cache.tsrename to server/server/helpers/promise-cache.tsdiff --git a/server/helpers/proxy.ts b/server/server/helpers/proxy.tssimilarity index 100%rename from server/helpers/proxy.tsrename to server/server/helpers/proxy.tsdiff --git a/server/helpers/query.ts b/server/server/helpers/query.tssimilarity index 94%rename from server/helpers/query.tsrename to server/server/helpers/query.tsindex c0f78368fc..7bd63f40e3 100644--- a/server/helpers/query.ts+++ b/server/server/helpers/query.ts@@ -1,10 +1,10 @@-import { pick } from '@shared/core-utils'+import { pick } from '@peertube/peertube-core-utils'import {VideoChannelsSearchQueryAfterSanitize,VideoPlaylistsSearchQueryAfterSanitize,VideosCommonQueryAfterSanitize,VideosSearchQueryAfterSanitize-} from '@shared/models'+} from '@peertube/peertube-models'function pickCommonVideoQuery (query: VideosCommonQueryAfterSanitize) {return pick(query, [diff --git a/server/helpers/regexp.ts b/server/server/helpers/regexp.tssimilarity index 100%rename from server/helpers/regexp.tsrename to server/server/helpers/regexp.tsdiff --git a/server/helpers/requests.ts b/server/server/helpers/requests.tssimilarity index 82%rename from server/helpers/requests.tsrename to server/server/helpers/requests.tsindex 1625d6e49d..c7dd1172bc 100644--- a/server/helpers/requests.ts+++ b/server/server/helpers/requests.ts@@ -1,15 +1,15 @@-import { createWriteStream, remove } from 'fs-extra'-import got, { CancelableRequest, NormalizedOptions, Options as GotOptions, RequestError, Response } from 'got'+import httpSignature from '@peertube/http-signature'+import { createWriteStream } from 'fs'+import { remove } from 'fs-extra/esm'+import got, { CancelableRequest, OptionsInit, OptionsOfTextResponseBody, OptionsOfUnknownResponseBody, RequestError, Response } from 'got'import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent'-import { ACTIVITY_PUB, BINARY_CONTENT_TYPES, PEERTUBE_VERSION, REQUEST_TIMEOUTS, WEBSERVER } from '../initializers/constants'-import { pipelinePromise } from './core-utils'-import { logger, loggerTagsFactory } from './logger'-import { getProxy, isProxyEnabled } from './proxy'+import { ACTIVITY_PUB, BINARY_CONTENT_TYPES, PEERTUBE_VERSION, REQUEST_TIMEOUTS, WEBSERVER } from '../initializers/constants.js'+import { pipelinePromise } from './core-utils.js'+import { logger, loggerTagsFactory } from './logger.js'+import { getProxy, isProxyEnabled } from './proxy.js'const lTags = loggerTagsFactory('request')-const httpSignature = require('@peertube/http-signature')-export interface PeerTubeRequestError extends Error {statusCode?: numberresponseBody?: any@@ -33,7 +33,7 @@ type PeerTubeRequestOptions = {jsonResponse?: booleanfollowRedirect?: boolean-} & Pick<GotOptions, 'headers' | 'json' | 'method' | 'searchParams'>+} & Pick<OptionsInit, 'headers' | 'json' | 'method' | 'searchParams'>const peertubeGot = got.extend({...getAgent(),@@ -75,7 +75,7 @@ const peertubeGot = got.extend({beforeRequest: [options => {const headers = options.headers || {}- headers['host'] = options.url.host+ headers['host'] = buildUrl(options.url).host},options => {@@ -83,7 +83,7 @@ const peertubeGot = got.extend({if (httpSignatureOptions) {const method = options.method ?? 'GET'- const path = options.path ?? options.url.pathname+ const path = buildUrl(options.url).pathnameif (!method || !path) {throw new Error(`Cannot sign request without method (${method}) or path (${path}) ${options}`)@@ -109,7 +109,7 @@ const peertubeGot = got.extend({],beforeRetry: [- (_options: NormalizedOptions, error: RequestError, retryCount: number) => {+ (error: RequestError, retryCount: number) => {logger.debug('Retrying request to %s.', error.request.requestUrl, { retryCount, error: buildRequestError(error), ...lTags() })}]@@ -117,7 +117,7 @@ const peertubeGot = got.extend({})function doRequest (url: string, options: PeerTubeRequestOptions = {}) {- const gotOptions = buildGotOptions(options)+ const gotOptions = buildGotOptions(options) as OptionsOfTextResponseBodyreturn peertubeGot(url, gotOptions).catch(err => { throw buildRequestError(err) })@@ -141,7 +141,7 @@ async function doRequestAndSaveToFile (try {await pipelinePromise(- peertubeGot.stream(url, gotOptions),+ peertubeGot.stream(url, { ...gotOptions, isStream: true }),outFile)} catch (err) {@@ -187,7 +187,7 @@ function isBinaryResponse (result: Response<any>) {// ---------------------------------------------------------------------------export {- PeerTubeRequestOptions,+ type PeerTubeRequestOptions,doRequest,doJSONRequest,@@ -199,7 +199,7 @@ export {// ----------------------------------------------------------------------------function buildGotOptions (options: PeerTubeRequestOptions) {+function buildGotOptions (options: PeerTubeRequestOptions): OptionsOfUnknownResponseBody {const { activityPub, bodyKBLimit = 1000 } = optionsconst context = { bodyKBLimit, httpSignature: options.httpSignature }@@ -217,11 +217,15 @@ function buildGotOptions (options: PeerTubeRequestOptions) {return {method: options.method,dnsCache: true,- timeout: options.timeout ?? REQUEST_TIMEOUTS.DEFAULT,+ timeout: {+ request: options.timeout ?? REQUEST_TIMEOUTS.DEFAULT+ },json: options.json,searchParams: options.searchParams,followRedirect: options.followRedirect,- retry: 2,+ retry: {+ limit: 2+ },headers,context}@@ -244,3 +248,11 @@ function buildRequestError (error: RequestError) {return newError}++function buildUrl (url: string | URL) {+ if (typeof url === 'string') {+ return new URL(url)+ }++ return url+}diff --git a/server/helpers/stream-replacer.ts b/server/server/helpers/stream-replacer.tssimilarity index 100%rename from server/helpers/stream-replacer.tsrename to server/server/helpers/stream-replacer.tsdiff --git a/server/helpers/token-generator.ts b/server/server/helpers/token-generator.tssimilarity index 84%rename from server/helpers/token-generator.tsrename to server/server/helpers/token-generator.tsindex 16313b8182..c7d52c41ad 100644--- a/server/helpers/token-generator.ts+++ b/server/server/helpers/token-generator.ts@@ -1,4 +1,4 @@-import { buildUUID } from '@shared/extra-utils'+import { buildUUID } from '@peertube/peertube-node-utils'function generateRunnerRegistrationToken () {return 'ptrrt-' + buildUUID()diff --git a/server/helpers/upload.ts b/server/server/helpers/upload.tssimilarity index 82%rename from server/helpers/upload.tsrename to server/server/helpers/upload.tsindex f5f476913e..1a182a1f68 100644--- a/server/helpers/upload.ts+++ b/server/server/helpers/upload.ts@@ -1,5 +1,5 @@import { join } from 'path'-import { DIRECTORIES } from '@server/initializers/constants'+import { DIRECTORIES } from '@server/initializers/constants.js'function getResumableUploadPath (filename?: string) {if (filename) return join(DIRECTORIES.RESUMABLE_UPLOAD, filename)diff --git a/server/helpers/utils.ts b/server/server/helpers/utils.tssimilarity index 86%rename from server/helpers/utils.tsrename to server/server/helpers/utils.tsindex 5a4fe4fdd5..850286b614 100644--- a/server/helpers/utils.ts+++ b/server/server/helpers/utils.ts@@ -1,11 +1,11 @@-import { remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'import { Instance as ParseTorrent } from 'parse-torrent'import { join } from 'path'-import { sha256 } from '@shared/extra-utils'-import { ResultList } from '@shared/models'-import { CONFIG } from '../initializers/config'-import { randomBytesPromise } from './core-utils'-import { logger } from './logger'+import { sha256 } from '@peertube/peertube-node-utils'+import { ResultList } from '@peertube/peertube-models'+import { CONFIG } from '../initializers/config.js'+import { randomBytesPromise } from './core-utils.js'+import { logger } from './logger.js'function deleteFileAndCatch (path: string) {remove(path)diff --git a/server/helpers/version.ts b/server/server/helpers/version.tssimilarity index 88%rename from server/helpers/version.tsrename to server/server/helpers/version.tsindex 5b3bf59dd7..2608a36b70 100644--- a/server/helpers/version.ts+++ b/server/server/helpers/version.ts@@ -1,5 +1,5 @@-import { execPromise, execPromise2 } from './core-utils'-import { logger } from './logger'+import { execPromise, execPromise2 } from './core-utils.js'+import { logger } from './logger.js'async function getServerCommit () {try {diff --git a/server/helpers/video.ts b/server/server/helpers/video.tssimilarity index 78%rename from server/helpers/video.tsrename to server/server/helpers/video.tsindex c688ef1e3b..dc56a66972 100644--- a/server/helpers/video.ts+++ b/server/server/helpers/video.ts@@ -1,8 +1,8 @@import { Response } from 'express'-import { CONFIG } from '@server/initializers/config'-import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models'-import { VideoPrivacy, VideoState } from '@shared/models'-import { forceNumber } from '@shared/core-utils'+import { forceNumber } from '@peertube/peertube-core-utils'+import { VideoPrivacy, VideoPrivacyType, VideoState, VideoStateType } from '@peertube/peertube-models'+import { CONFIG } from '@server/initializers/config.js'+import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models/index.js'function getVideoWithAttributes (res: Response) {return res.locals.videoAPI || res.locals.videoAll || res.locals.onlyVideo@@ -14,14 +14,14 @@ function extractVideo (videoOrPlaylist: MVideo | MStreamingPlaylistVideo) {: videoOrPlaylist}-function isPrivacyForFederation (privacy: VideoPrivacy) {+function isPrivacyForFederation (privacy: VideoPrivacyType) {const castedPrivacy = forceNumber(privacy)return castedPrivacy === VideoPrivacy.PUBLIC ||(CONFIG.FEDERATION.VIDEOS.FEDERATE_UNLISTED === true && castedPrivacy === VideoPrivacy.UNLISTED)}-function isStateForFederation (state: VideoState) {+function isStateForFederation (state: VideoStateType) {const castedState = forceNumber(state)return castedState === VideoState.PUBLISHED || castedState === VideoState.WAITING_FOR_LIVE || castedState === VideoState.LIVE_ENDEDdiff --git a/server/helpers/webtorrent.ts b/server/server/helpers/webtorrent.tssimilarity index 87%rename from server/helpers/webtorrent.tsrename to server/server/helpers/webtorrent.tsindex f33a7bccdb..29062dae31 100644--- a/server/helpers/webtorrent.ts+++ b/server/server/helpers/webtorrent.ts@@ -1,24 +1,27 @@-import { decode, encode } from 'bencode'+import bencode from 'bencode'import createTorrent from 'create-torrent'-import { createWriteStream, ensureDir, pathExists, readFile, remove, writeFile } from 'fs-extra'+import { createWriteStream } from 'fs'+import { ensureDir, pathExists, remove } from 'fs-extra/esm'+import { readFile, writeFile } from 'fs/promises'import { encode as magnetUriEncode } from 'magnet-uri'import parseTorrent from 'parse-torrent'import { dirname, join } from 'path'import { pipeline } from 'stream'-import WebTorrent, { Instance, TorrentFile } from 'webtorrent'-import { isArray } from '@server/helpers/custom-validators/misc'-import { WEBSERVER } from '@server/initializers/constants'-import { generateTorrentFileName } from '@server/lib/paths'-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 { promisify2 } from '@shared/core-utils'-import { sha1 } from '@shared/extra-utils'-import { CONFIG } from '../initializers/config'-import { logger } from './logger'-import { generateVideoImportTmpPath } from './utils'-import { extractVideo } from './video'+import { promisify2 } from '@peertube/peertube-core-utils'+import { isArray } from '@server/helpers/custom-validators/misc.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { generateTorrentFileName } from '@server/lib/paths.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file.js'+import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist.js'+import { MVideo } from '@server/types/models/video/video.js'+import { sha1 } from '@peertube/peertube-node-utils'+import { CONFIG } from '../initializers/config.js'+import { logger } from './logger.js'+import { generateVideoImportTmpPath } from './utils.js'+import { extractVideo } from './video.js'++import type { Instance, TorrentFile } from 'webtorrent'const createTorrentPromise = promisify2<string, any, any>(createTorrent)@@ -32,8 +35,10 @@ async function downloadWebTorrentVideo (target: { uri: string, torrentName?: strconst directoryPath = join(CONFIG.STORAGE.TMP_DIR, 'webtorrent')await ensureDir(directoryPath)+ // eslint-disable-next-line new-cap+ const webtorrent = new (await import('webtorrent')).default()+return new Promise<string>((res, rej) => {- const webtorrent = new WebTorrent()let file: TorrentFileconst torrentId = target.uri || join(CONFIG.STORAGE.TORRENTS_DIR, target.torrentName)@@ -140,7 +145,7 @@ async function updateTorrentMetadata (videoOrPlaylist: MVideo | MStreamingPlayli}const torrentContent = await readFile(oldTorrentPath)- const decoded = decode(torrentContent)+ const decoded = bencode.decode(torrentContent)decoded['announce-list'] = buildAnnounceList()decoded.announce = decoded['announce-list'][0][0]@@ -155,11 +160,11 @@ async function updateTorrentMetadata (videoOrPlaylist: MVideo | MStreamingPlaylilogger.info('Updating torrent metadata %s -> %s.', oldTorrentPath, newTorrentPath)- await writeFile(newTorrentPath, encode(decoded))+ await writeFile(newTorrentPath, bencode.encode(decoded))await remove(oldTorrentPath)videoFile.torrentFilename = newTorrentFilename- videoFile.infoHash = sha1(encode(decoded.info))+ videoFile.infoHash = sha1(bencode.encode(decoded.info))}function generateMagnetUri (diff --git a/server/server/helpers/youtube-dl/index.ts b/server/server/helpers/youtube-dl/index.tsnew file mode 100644index 0000000000..29a07d93f3--- /dev/null+++ b/server/server/helpers/youtube-dl/index.ts@@ -0,0 +1,3 @@+export * from './youtube-dl-cli.js'+export * from './youtube-dl-info-builder.js'+export * from './youtube-dl-wrapper.js'diff --git a/server/helpers/youtube-dl/youtube-dl-cli.ts b/server/server/helpers/youtube-dl/youtube-dl-cli.tssimilarity index 93%rename from server/helpers/youtube-dl/youtube-dl-cli.tsrename to server/server/helpers/youtube-dl/youtube-dl-cli.tsindex 765038cea2..007f061c6d 100644--- a/server/helpers/youtube-dl/youtube-dl-cli.ts+++ b/server/server/helpers/youtube-dl/youtube-dl-cli.ts@@ -1,12 +1,13 @@import execa from 'execa'-import { ensureDir, pathExists, writeFile } from 'fs-extra'+import { ensureDir, pathExists } from 'fs-extra/esm'+import { writeFile } from 'fs/promises'+import { OptionsOfBufferResponseBody } from 'got'import { dirname, join } from 'path'-import { CONFIG } from '@server/initializers/config'-import { VideoResolution } from '@shared/models'-import { logger, loggerTagsFactory } from '../logger'-import { getProxy, isProxyEnabled } from '../proxy'-import { isBinaryResponse, peertubeGot } from '../requests'-import { OptionsOfBufferResponseBody } from 'got/dist/source'+import { VideoResolution, VideoResolutionType } from '@peertube/peertube-models'+import { CONFIG } from '@server/initializers/config.js'+import { logger, loggerTagsFactory } from '../logger.js'+import { getProxy, isProxyEnabled } from '../proxy.js'+import { isBinaryResponse, peertubeGot } from '../requests.js'const lTags = loggerTagsFactory('youtube-dl')@@ -67,7 +68,7 @@ export class YoutubeDLCLI {}}- static getYoutubeDLVideoFormat (enabledResolutions: VideoResolution[], useBestFormat: boolean) {+ static getYoutubeDLVideoFormat (enabledResolutions: VideoResolutionType[], useBestFormat: boolean) {/*** list of format selectors in order or preference* see https://github.com/ytdl-org/youtube-dl#format-selectiondiff --git a/server/helpers/youtube-dl/youtube-dl-info-builder.ts b/server/server/helpers/youtube-dl/youtube-dl-info-builder.tssimilarity index 94%rename from server/helpers/youtube-dl/youtube-dl-info-builder.tsrename to server/server/helpers/youtube-dl/youtube-dl-info-builder.tsindex a74904e439..0287f6183a 100644--- a/server/helpers/youtube-dl/youtube-dl-info-builder.ts+++ b/server/server/helpers/youtube-dl/youtube-dl-info-builder.ts@@ -1,8 +1,8 @@-import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES } from '../../initializers/constants'-import { peertubeTruncate } from '../core-utils'-import { isUrlValid } from '../custom-validators/activitypub/misc'+import { CONSTRAINTS_FIELDS, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES } from '../../initializers/constants.js'+import { peertubeTruncate } from '../core-utils.js'+import { isUrlValid } from '../custom-validators/activitypub/misc.js'-type YoutubeDLInfo = {+export type YoutubeDLInfo = {name?: stringdescription?: stringcategory?: number@@ -18,7 +18,7 @@ type YoutubeDLInfo = {urls?: string[]}-class YoutubeDLInfoBuilder {+export class YoutubeDLInfoBuilder {private readonly info: anyconstructor (info: any) {@@ -196,10 +196,3 @@ class YoutubeDLInfoBuilder {return VIDEO_LANGUAGES[language] ? language : undefined}}--// -----------------------------------------------------------------------------export {- YoutubeDLInfo,- YoutubeDLInfoBuilder-}diff --git a/server/helpers/youtube-dl/youtube-dl-wrapper.ts b/server/server/helpers/youtube-dl/youtube-dl-wrapper.tssimilarity index 90%rename from server/helpers/youtube-dl/youtube-dl-wrapper.tsrename to server/server/helpers/youtube-dl/youtube-dl-wrapper.tsindex ac3cd190e1..d5acb371a7 100644--- a/server/helpers/youtube-dl/youtube-dl-wrapper.ts+++ b/server/server/helpers/youtube-dl/youtube-dl-wrapper.ts@@ -1,12 +1,14 @@-import { move, pathExists, readdir, remove } from 'fs-extra'+import { move, pathExists, remove } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { dirname, join } from 'path'import { inspect } from 'util'-import { CONFIG } from '@server/initializers/config'-import { isVideoFileExtnameValid } from '../custom-validators/videos'-import { logger, loggerTagsFactory } from '../logger'-import { generateVideoImportTmpPath } from '../utils'-import { YoutubeDLCLI } from './youtube-dl-cli'-import { YoutubeDLInfo, YoutubeDLInfoBuilder } from './youtube-dl-info-builder'+import { VideoResolutionType } from '@peertube/peertube-models'+import { CONFIG } from '@server/initializers/config.js'+import { isVideoFileExtnameValid } from '../custom-validators/videos.js'+import { logger, loggerTagsFactory } from '../logger.js'+import { generateVideoImportTmpPath } from '../utils.js'+import { YoutubeDLCLI } from './youtube-dl-cli.js'+import { YoutubeDLInfo, YoutubeDLInfoBuilder } from './youtube-dl-info-builder.js'const lTags = loggerTagsFactory('youtube-dl')@@ -24,7 +26,7 @@ class YoutubeDLWrapper {constructor (private readonly url: string,- private readonly enabledResolutions: number[],+ private readonly enabledResolutions: VideoResolutionType[],private readonly useBestFormat: boolean) {diff --git a/server/initializers/checker-after-init.ts b/server/server/initializers/checker-after-init.tssimilarity index 93%rename from server/initializers/checker-after-init.tsrename to server/server/initializers/checker-after-init.tsindex 4281e2bb51..afcf6176b6 100644--- a/server/initializers/checker-after-init.ts+++ b/server/server/initializers/checker-after-init.ts@@ -1,18 +1,18 @@import config from 'config'-import { readFileSync, writeFileSync } from 'fs-extra'+import { readFileSync, writeFileSync } from 'fs'import { URL } from 'url'-import { uniqify } from '@shared/core-utils'-import { getFFmpegVersion } from '@shared/ffmpeg'-import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type'-import { RecentlyAddedStrategy } from '../../shared/models/redundancy'-import { isProdInstance, parseBytes, parseSemVersion } from '../helpers/core-utils'-import { isArray } from '../helpers/custom-validators/misc'-import { logger } from '../helpers/logger'-import { ApplicationModel, getServerActor } from '../models/application/application'-import { OAuthClientModel } from '../models/oauth/oauth-client'-import { UserModel } from '../models/user/user'-import { CONFIG, getLocalConfigFilePath, isEmailEnabled, reloadConfig } from './config'-import { WEBSERVER } from './constants'+import { uniqify } from '@peertube/peertube-core-utils'+import { getFFmpegVersion } from '@peertube/peertube-ffmpeg'+import { RecentlyAddedStrategy, VideoRedundancyConfigFilter } from '@peertube/peertube-models'+import { isProdInstance } from '@peertube/peertube-node-utils'+import { parseBytes, parseSemVersion } from '../helpers/core-utils.js'+import { isArray } from '../helpers/custom-validators/misc.js'+import { logger } from '../helpers/logger.js'+import { ApplicationModel, getServerActor } from '../models/application/application.js'+import { OAuthClientModel } from '../models/oauth/oauth-client.js'+import { UserModel } from '../models/user/user.js'+import { CONFIG, getLocalConfigFilePath, isEmailEnabled, reloadConfig } from './config.js'+import { WEBSERVER } from './constants.js'async function checkActivityPubUrls () {const actor = await getServerActor()@@ -124,6 +124,7 @@ function checkRemovedConfigKeys () {writeFileSync(localConfigPath, content.replace('"webtorrent"', '"web_videos"'), { encoding: 'utf-8' })reloadConfig()+ .catch(err => logger.error('Cannot reload configuration', { err }))} catch (err) {logger.error('Cannot write new configuration to file ' + localConfigPath, { err })}diff --git a/server/initializers/checker-before-init.ts b/server/server/initializers/checker-before-init.tssimilarity index 96%rename from server/initializers/checker-before-init.tsrename to server/server/initializers/checker-before-init.tsindex 0139ded4f0..f33da0914a 100644--- a/server/initializers/checker-before-init.ts+++ b/server/server/initializers/checker-before-init.ts@@ -1,10 +1,7 @@-import { IConfig } from 'config'-import { promisify0 } from '@shared/core-utils'-import { parseSemVersion } from '../helpers/core-utils'-import { logger } from '../helpers/logger'--// Special behaviour for config because we can reload it-const config: IConfig = require('config')+import config from 'config'+import { promisify0 } from '@peertube/peertube-core-utils'+import { parseSemVersion } from '../helpers/core-utils.js'+import { logger } from '../helpers/logger.js'// ONLY USE CORE MODULES IN THIS FILE!@@ -126,7 +123,7 @@ function checkMissedConfig () {async function checkFFmpeg (CONFIG: { TRANSCODING: { ENABLED: boolean } }) {if (CONFIG.TRANSCODING.ENABLED === false) return undefined- const Ffmpeg = require('fluent-ffmpeg')+ const Ffmpeg = (await import('fluent-ffmpeg')).defaultconst getAvailableCodecsPromise = promisify0(Ffmpeg.getAvailableCodecs)const codecs = await getAvailableCodecsPromise()const canEncode = [ 'libx264' ]diff --git a/server/initializers/config.ts b/server/server/initializers/config.tssimilarity index 97%rename from server/initializers/config.tsrename to server/server/initializers/config.tsindex 3e3b8ad1f1..dd196ea0cf 100644--- a/server/initializers/config.ts+++ b/server/server/initializers/config.ts@@ -1,15 +1,19 @@import bytes from 'bytes'import { IConfig } from 'config'+import { createRequire } from 'module'import { dirname, join } from 'path'-import { decacheModule } from '@server/helpers/decache'-import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type'-import { BroadcastMessageLevel } from '@shared/models/server'-import { buildPath, root } from '../../shared/core-utils'-import { VideoPrivacy, VideosRedundancyStrategy } from '../../shared/models'-import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'-import { parseBytes, parseDurationToMs } from '../helpers/core-utils'--// Use a variable to reload the configuration if we need+import {+ BroadcastMessageLevel,+ NSFWPolicyType,+ VideoPrivacyType,+ VideoRedundancyConfigFilter,+ VideosRedundancyStrategy+} from '@peertube/peertube-models'+import { decacheModule } from '@server/helpers/decache.js'+import { buildPath, root } from '@peertube/peertube-node-utils'+import { parseBytes, parseDurationToMs } from '../helpers/core-utils.js'++const require = createRequire(import.meta.url)let config: IConfig = require('config')const configChangedHandlers: Function[] = []@@ -89,7 +93,7 @@ const CONFIG = {PUBLISH: {DOWNLOAD_ENABLED: config.get<boolean>('defaults.publish.download_enabled'),COMMENTS_ENABLED: config.get<boolean>('defaults.publish.comments_enabled'),- PRIVACY: config.get<VideoPrivacy>('defaults.publish.privacy'),+ PRIVACY: config.get<VideoPrivacyType>('defaults.publish.privacy'),LICENCE: config.get<number>('defaults.publish.licence')},P2P: {@@ -620,10 +624,15 @@ function getLocalConfigFilePath () {return join(localConfigDir, filename + '.json')}+function getConfigModule () {+ return config+}+// ---------------------------------------------------------------------------export {CONFIG,+ getConfigModule,getLocalConfigFilePath,registerConfigChangedHandler,isEmailEnabled@@ -675,7 +684,7 @@ export function reloadConfig () {delete require.cache[fileName]}- decacheModule('config')+ decacheModule(require, 'config')}purge()@@ -685,4 +694,6 @@ export function reloadConfig () {for (const configChangedHandler of configChangedHandlers) {configChangedHandler()}++ return Promise.resolve()}diff --git a/server/initializers/constants.ts b/server/server/initializers/constants.tssimilarity index 95%rename from server/initializers/constants.tsrename to server/server/initializers/constants.tsindex de5f11f8f9..34392dbc81 100644--- a/server/initializers/constants.ts+++ b/server/server/initializers/constants.ts@@ -1,29 +1,42 @@-import { RepeatOptions } from 'bullmq'-import { Encoding, randomBytes } from 'crypto'-import { invert } from 'lodash'-import { join } from 'path'-import { randomInt, root } from '@shared/core-utils'+import { randomInt } from '@peertube/peertube-core-utils'import {AbuseState,+ AbuseStateType,+ ActivityPubActorType,+ ActorImageType,+ ActorImageType_Type,+ FollowState,JobType,+ NSFWPolicyType,RunnerJobState,+ RunnerJobStateType,UserRegistrationState,+ UserRegistrationStateType,VideoChannelSyncState,+ VideoChannelSyncStateType,VideoImportState,+ VideoImportStateType,+ VideoPlaylistPrivacy,+ VideoPlaylistPrivacyType,+ VideoPlaylistType,+ VideoPlaylistType_Type,VideoPrivacy,+ VideoPrivacyType,VideoRateType,VideoResolution,VideoState,+ VideoStateType,VideoTranscodingFPS-} from '../../shared/models'-import { ActivityPubActorType } from '../../shared/models/activitypub'-import { ActorImageType, FollowState } from '../../shared/models/actors'-import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'-import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'-import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'+} from '@peertube/peertube-models'+import { isTestInstance, isTestOrDevInstance, root } from '@peertube/peertube-node-utils'+import { RepeatOptions } from 'bullmq'+import { Encoding, randomBytes } from 'crypto'+import { readJsonSync } from 'fs-extra/esm'+import invert from 'lodash-es/invert.js'+import { join } from 'path'// Do not use barrels, remain constants as independent as possible-import { isTestInstance, isTestOrDevInstance, parseDurationToMs, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'-import { CONFIG, registerConfigChangedHandler } from './config'+import { parseDurationToMs, sanitizeHost, sanitizeUrl } from '../helpers/core-utils.js'+import { CONFIG, registerConfigChangedHandler } from './config.js'// ---------------------------------------------------------------------------@@ -32,7 +45,7 @@ const LAST_MIGRATION_VERSION = 800// ---------------------------------------------------------------------------const API_VERSION = 'v1'-const PEERTUBE_VERSION: string = require(join(root(), 'package.json')).version+const PEERTUBE_VERSION: string = readJsonSync(join(root(), 'package.json')).versionconst PAGINATION = {GLOBAL: {@@ -524,7 +537,7 @@ const VIDEO_LICENCES = {const VIDEO_LANGUAGES: { [id: string]: string } = {}-const VIDEO_PRIVACIES: { [ id in VideoPrivacy ]: string } = {+const VIDEO_PRIVACIES: { [ id in VideoPrivacyType ]: string } = {[VideoPrivacy.PUBLIC]: 'Public',[VideoPrivacy.UNLISTED]: 'Unlisted',[VideoPrivacy.PRIVATE]: 'Private',@@ -532,7 +545,7 @@ const VIDEO_PRIVACIES: { [ id in VideoPrivacy ]: string } = {[VideoPrivacy.PASSWORD_PROTECTED]: 'Password protected'}-const VIDEO_STATES: { [ id in VideoState ]: string } = {+const VIDEO_STATES: { [ id in VideoStateType ]: string } = {[VideoState.PUBLISHED]: 'Published',[VideoState.TO_TRANSCODE]: 'To transcode',[VideoState.TO_IMPORT]: 'To import',@@ -544,7 +557,7 @@ const VIDEO_STATES: { [ id in VideoState ]: string } = {[VideoState.TO_EDIT]: 'To edit*'}-const VIDEO_IMPORT_STATES: { [ id in VideoImportState ]: string } = {+const VIDEO_IMPORT_STATES: { [ id in VideoImportStateType ]: string } = {[VideoImportState.FAILED]: 'Failed',[VideoImportState.PENDING]: 'Pending',[VideoImportState.SUCCESS]: 'Success',@@ -553,37 +566,37 @@ const VIDEO_IMPORT_STATES: { [ id in VideoImportState ]: string } = {[VideoImportState.PROCESSING]: 'Processing'}-const VIDEO_CHANNEL_SYNC_STATE: { [ id in VideoChannelSyncState ]: string } = {+const VIDEO_CHANNEL_SYNC_STATE: { [ id in VideoChannelSyncStateType ]: string } = {[VideoChannelSyncState.FAILED]: 'Failed',[VideoChannelSyncState.SYNCED]: 'Synchronized',[VideoChannelSyncState.PROCESSING]: 'Processing',[VideoChannelSyncState.WAITING_FIRST_RUN]: 'Waiting first run'}-const ABUSE_STATES: { [ id in AbuseState ]: string } = {+const ABUSE_STATES: { [ id in AbuseStateType ]: string } = {[AbuseState.PENDING]: 'Pending',[AbuseState.REJECTED]: 'Rejected',[AbuseState.ACCEPTED]: 'Accepted'}-const USER_REGISTRATION_STATES: { [ id in UserRegistrationState ]: string } = {+const USER_REGISTRATION_STATES: { [ id in UserRegistrationStateType ]: string } = {[UserRegistrationState.PENDING]: 'Pending',[UserRegistrationState.REJECTED]: 'Rejected',[UserRegistrationState.ACCEPTED]: 'Accepted'}-const VIDEO_PLAYLIST_PRIVACIES: { [ id in VideoPlaylistPrivacy ]: string } = {+const VIDEO_PLAYLIST_PRIVACIES: { [ id in VideoPlaylistPrivacyType ]: string } = {[VideoPlaylistPrivacy.PUBLIC]: 'Public',[VideoPlaylistPrivacy.UNLISTED]: 'Unlisted',[VideoPlaylistPrivacy.PRIVATE]: 'Private'}-const VIDEO_PLAYLIST_TYPES: { [ id in VideoPlaylistType ]: string } = {+const VIDEO_PLAYLIST_TYPES: { [ id in VideoPlaylistType_Type ]: string } = {[VideoPlaylistType.REGULAR]: 'Regular',[VideoPlaylistType.WATCH_LATER]: 'Watch later'}-const RUNNER_JOB_STATES: { [ id in RunnerJobState ]: string } = {+const RUNNER_JOB_STATES: { [ id in RunnerJobStateType ]: string } = {[RunnerJobState.PROCESSING]: 'Processing',[RunnerJobState.COMPLETED]: 'Completed',[RunnerJobState.COMPLETING]: 'Completing',@@ -808,7 +821,7 @@ const PREVIEWS_SIZE = {height: 480,minWidth: 400}-const ACTOR_IMAGES_SIZE: { [key in ActorImageType]: { width: number, height: number }[] } = {+const ACTOR_IMAGES_SIZE: { [key in ActorImageType_Type]: { width: number, height: number }[] } = {[ActorImageType.AVATAR]: [{width: 120,@@ -1326,12 +1339,14 @@ function buildMimetypesRegex (obj: { [id: string]: string | string[] }) {.join('|')}-function loadLanguages () {- Object.assign(VIDEO_LANGUAGES, buildLanguages())+async function loadLanguages () {+ if (Object.keys(VIDEO_LANGUAGES).length !== 0) return++ Object.assign(VIDEO_LANGUAGES, await buildLanguages())}-function buildLanguages () {- const iso639 = require('iso-639-3')+async function buildLanguages () {+ const { iso6393 } = await import('iso-639-3')const languages: { [id: string]: string } = {}@@ -1366,7 +1381,7 @@ function buildLanguages () {}// Only add ISO639-1 languages and some sign languages (ISO639-3)- iso639+ iso6393.filter(l => {return (l.iso6391 !== undefined && l.type === 'living') ||additionalLanguages[l.iso6393] === truediff --git a/server/initializers/database.ts b/server/server/initializers/database.tssimilarity index 75%rename from server/initializers/database.tsrename to server/server/initializers/database.tsindex bc120e3985..fe399a6336 100644--- a/server/initializers/database.ts+++ b/server/server/initializers/database.ts@@ -1,65 +1,66 @@+import pg from 'pg'import { QueryTypes, Transaction } from 'sequelize'import { Sequelize as SequelizeTypescript } from 'sequelize-typescript'-import { ActorCustomPageModel } from '@server/models/account/actor-custom-page'-import { RunnerModel } from '@server/models/runner/runner'-import { RunnerJobModel } from '@server/models/runner/runner-job'-import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token'-import { TrackerModel } from '@server/models/server/tracker'-import { VideoTrackerModel } from '@server/models/server/video-tracker'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { UserRegistrationModel } from '@server/models/user/user-registration'-import { UserVideoHistoryModel } from '@server/models/user/user-video-history'-import { StoryboardModel } from '@server/models/video/storyboard'-import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting'-import { VideoLiveSessionModel } from '@server/models/video/video-live-session'-import { VideoSourceModel } from '@server/models/video/video-source'-import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'-import { LocalVideoViewerWatchSectionModel } from '@server/models/view/local-video-viewer-watch-section'-import { isTestOrDevInstance } from '../helpers/core-utils'-import { logger } from '../helpers/logger'-import { AbuseModel } from '../models/abuse/abuse'-import { AbuseMessageModel } from '../models/abuse/abuse-message'-import { VideoAbuseModel } from '../models/abuse/video-abuse'-import { VideoCommentAbuseModel } from '../models/abuse/video-comment-abuse'-import { AccountModel } from '../models/account/account'-import { AccountBlocklistModel } from '../models/account/account-blocklist'-import { AccountVideoRateModel } from '../models/account/account-video-rate'-import { ActorModel } from '../models/actor/actor'-import { ActorFollowModel } from '../models/actor/actor-follow'-import { ActorImageModel } from '../models/actor/actor-image'-import { ApplicationModel } from '../models/application/application'-import { OAuthClientModel } from '../models/oauth/oauth-client'-import { OAuthTokenModel } from '../models/oauth/oauth-token'-import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'-import { PluginModel } from '../models/server/plugin'-import { ServerModel } from '../models/server/server'-import { ServerBlocklistModel } from '../models/server/server-blocklist'-import { UserNotificationSettingModel } from '../models/user/user-notification-setting'-import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update'-import { TagModel } from '../models/video/tag'-import { ThumbnailModel } from '../models/video/thumbnail'-import { VideoModel } from '../models/video/video'-import { VideoBlacklistModel } from '../models/video/video-blacklist'-import { VideoCaptionModel } from '../models/video/video-caption'-import { VideoChangeOwnershipModel } from '../models/video/video-change-ownership'-import { VideoChannelModel } from '../models/video/video-channel'-import { VideoCommentModel } from '../models/video/video-comment'-import { VideoFileModel } from '../models/video/video-file'-import { VideoImportModel } from '../models/video/video-import'-import { VideoLiveModel } from '../models/video/video-live'-import { VideoPlaylistModel } from '../models/video/video-playlist'-import { VideoPlaylistElementModel } from '../models/video/video-playlist-element'-import { VideoShareModel } from '../models/video/video-share'-import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'-import { VideoTagModel } from '../models/video/video-tag'-import { VideoViewModel } from '../models/view/video-view'-import { CONFIG } from './config'-import { VideoPasswordModel } from '@server/models/video/video-password'--require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string+import { isTestOrDevInstance } from '@peertube/peertube-node-utils'+import { ActorCustomPageModel } from '@server/models/account/actor-custom-page.js'+import { RunnerJobModel } from '@server/models/runner/runner-job.js'+import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token.js'+import { RunnerModel } from '@server/models/runner/runner.js'+import { TrackerModel } from '@server/models/server/tracker.js'+import { VideoTrackerModel } from '@server/models/server/video-tracker.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { UserRegistrationModel } from '@server/models/user/user-registration.js'+import { UserVideoHistoryModel } from '@server/models/user/user-video-history.js'+import { UserModel } from '@server/models/user/user.js'+import { StoryboardModel } from '@server/models/video/storyboard.js'+import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting.js'+import { VideoLiveSessionModel } from '@server/models/video/video-live-session.js'+import { VideoPasswordModel } from '@server/models/video/video-password.js'+import { VideoSourceModel } from '@server/models/video/video-source.js'+import { LocalVideoViewerWatchSectionModel } from '@server/models/view/local-video-viewer-watch-section.js'+import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer.js'+import { logger } from '../helpers/logger.js'+import { AbuseMessageModel } from '../models/abuse/abuse-message.js'+import { AbuseModel } from '../models/abuse/abuse.js'+import { VideoAbuseModel } from '../models/abuse/video-abuse.js'+import { VideoCommentAbuseModel } from '../models/abuse/video-comment-abuse.js'+import { AccountBlocklistModel } from '../models/account/account-blocklist.js'+import { AccountVideoRateModel } from '../models/account/account-video-rate.js'+import { AccountModel } from '../models/account/account.js'+import { ActorFollowModel } from '../models/actor/actor-follow.js'+import { ActorImageModel } from '../models/actor/actor-image.js'+import { ActorModel } from '../models/actor/actor.js'+import { ApplicationModel } from '../models/application/application.js'+import { OAuthClientModel } from '../models/oauth/oauth-client.js'+import { OAuthTokenModel } from '../models/oauth/oauth-token.js'+import { VideoRedundancyModel } from '../models/redundancy/video-redundancy.js'+import { PluginModel } from '../models/server/plugin.js'+import { ServerBlocklistModel } from '../models/server/server-blocklist.js'+import { ServerModel } from '../models/server/server.js'+import { UserNotificationSettingModel } from '../models/user/user-notification-setting.js'+import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update.js'+import { TagModel } from '../models/video/tag.js'+import { ThumbnailModel } from '../models/video/thumbnail.js'+import { VideoBlacklistModel } from '../models/video/video-blacklist.js'+import { VideoCaptionModel } from '../models/video/video-caption.js'+import { VideoChangeOwnershipModel } from '../models/video/video-change-ownership.js'+import { VideoChannelModel } from '../models/video/video-channel.js'+import { VideoCommentModel } from '../models/video/video-comment.js'+import { VideoFileModel } from '../models/video/video-file.js'+import { VideoImportModel } from '../models/video/video-import.js'+import { VideoLiveModel } from '../models/video/video-live.js'+import { VideoPlaylistElementModel } from '../models/video/video-playlist-element.js'+import { VideoPlaylistModel } from '../models/video/video-playlist.js'+import { VideoShareModel } from '../models/video/video-share.js'+import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist.js'+import { VideoTagModel } from '../models/video/video-tag.js'+import { VideoModel } from '../models/video/video.js'+import { VideoViewModel } from '../models/view/video-view.js'+import { CONFIG } from './config.js'++pg.defaults.parseInt8 = true // Avoid BIGINT to be converted to stringconst dbname = CONFIG.DATABASE.DBNAMEconst username = CONFIG.DATABASE.USERNAMEdiff --git a/server/initializers/installer.ts b/server/server/initializers/installer.tssimilarity index 89%rename from server/initializers/installer.tsrename to server/server/initializers/installer.tsindex 2406a59367..ff25f19093 100644--- a/server/initializers/installer.ts+++ b/server/server/initializers/installer.ts@@ -1,19 +1,20 @@-import { ensureDir, readdir, remove } from 'fs-extra'+import { ensureDir, remove } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import passwordGenerator from 'password-generator'import { join } from 'path'-import { isTestOrDevInstance } from '@server/helpers/core-utils'-import { generateRunnerRegistrationToken } from '@server/helpers/token-generator'-import { getNodeABIVersion } from '@server/helpers/version'-import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token'-import { UserRole } from '@shared/models'-import { logger } from '../helpers/logger'-import { buildUser, createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user'-import { ApplicationModel } from '../models/application/application'-import { OAuthClientModel } from '../models/oauth/oauth-client'-import { applicationExist, clientsExist, usersExist } from './checker-after-init'-import { CONFIG } from './config'-import { DIRECTORIES, FILES_CACHE, LAST_MIGRATION_VERSION } from './constants'-import { sequelizeTypescript } from './database'+import { UserRole } from '@peertube/peertube-models'+import { isTestOrDevInstance } from '@peertube/peertube-node-utils'+import { generateRunnerRegistrationToken } from '@server/helpers/token-generator.js'+import { getNodeABIVersion } from '@server/helpers/version.js'+import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token.js'+import { logger } from '../helpers/logger.js'+import { buildUser, createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user.js'+import { ApplicationModel } from '../models/application/application.js'+import { OAuthClientModel } from '../models/oauth/oauth-client.js'+import { applicationExist, clientsExist, usersExist } from './checker-after-init.js'+import { CONFIG } from './config.js'+import { DIRECTORIES, FILES_CACHE, LAST_MIGRATION_VERSION } from './constants.js'+import { sequelizeTypescript } from './database.js'async function installApplication () {try {diff --git a/server/initializers/migrations/0505-user-last-login-date.ts b/server/server/initializers/migrations/0505-user-last-login-date.tssimilarity index 100%rename from server/initializers/migrations/0505-user-last-login-date.tsrename to server/server/initializers/migrations/0505-user-last-login-date.tsdiff --git a/server/initializers/migrations/0510-video-file-metadata.ts b/server/server/initializers/migrations/0510-video-file-metadata.tssimilarity index 100%rename from server/initializers/migrations/0510-video-file-metadata.tsrename to server/server/initializers/migrations/0510-video-file-metadata.tsdiff --git a/server/initializers/migrations/0515-video-abuse-reason-timestamps.ts b/server/server/initializers/migrations/0515-video-abuse-reason-timestamps.tssimilarity index 100%rename from server/initializers/migrations/0515-video-abuse-reason-timestamps.tsrename to server/server/initializers/migrations/0515-video-abuse-reason-timestamps.tsdiff --git a/server/initializers/migrations/0520-abuses-split.ts b/server/server/initializers/migrations/0520-abuses-split.tssimilarity index 100%rename from server/initializers/migrations/0520-abuses-split.tsrename to server/server/initializers/migrations/0520-abuses-split.tsdiff --git a/server/initializers/migrations/0525-abuse-messages.ts b/server/server/initializers/migrations/0525-abuse-messages.tssimilarity index 100%rename from server/initializers/migrations/0525-abuse-messages.tsrename to server/server/initializers/migrations/0525-abuse-messages.tsdiff --git a/server/initializers/migrations/0530-playlist-multiple-video.ts b/server/server/initializers/migrations/0530-playlist-multiple-video.tssimilarity index 96%rename from server/initializers/migrations/0530-playlist-multiple-video.tsrename to server/server/initializers/migrations/0530-playlist-multiple-video.tsindex 51a8c06b04..a53b93fd76 100644--- a/server/initializers/migrations/0530-playlist-multiple-video.ts+++ b/server/server/initializers/migrations/0530-playlist-multiple-video.ts@@ -1,5 +1,5 @@import * as Sequelize from 'sequelize'-import { WEBSERVER } from '../constants'+import { WEBSERVER } from '../constants.js'async function up (utils: {transaction: Sequelize.Transactiondiff --git a/server/initializers/migrations/0535-video-live.ts b/server/server/initializers/migrations/0535-video-live.tssimilarity index 100%rename from server/initializers/migrations/0535-video-live.tsrename to server/server/initializers/migrations/0535-video-live.tsdiff --git a/server/initializers/migrations/0540-video-file-infohash.ts b/server/server/initializers/migrations/0540-video-file-infohash.tssimilarity index 100%rename from server/initializers/migrations/0540-video-file-infohash.tsrename to server/server/initializers/migrations/0540-video-file-infohash.tsdiff --git a/server/initializers/migrations/0545-video-live-save-replay.ts b/server/server/initializers/migrations/0545-video-live-save-replay.tssimilarity index 100%rename from server/initializers/migrations/0545-video-live-save-replay.tsrename to server/server/initializers/migrations/0545-video-live-save-replay.tsdiff --git a/server/initializers/migrations/0550-actor-follow-cleanup.ts b/server/server/initializers/migrations/0550-actor-follow-cleanup.tssimilarity index 100%rename from server/initializers/migrations/0550-actor-follow-cleanup.tsrename to server/server/initializers/migrations/0550-actor-follow-cleanup.tsdiff --git a/server/initializers/migrations/0555-actor-follow-url.ts b/server/server/initializers/migrations/0555-actor-follow-url.tssimilarity index 100%rename from server/initializers/migrations/0555-actor-follow-url.tsrename to server/server/initializers/migrations/0555-actor-follow-url.tsdiff --git a/server/initializers/migrations/0560-user-feed-token.ts b/server/server/initializers/migrations/0560-user-feed-token.tssimilarity index 95%rename from server/initializers/migrations/0560-user-feed-token.tsrename to server/server/initializers/migrations/0560-user-feed-token.tsindex 4c85b04f79..f2ec9c91d0 100644--- a/server/initializers/migrations/0560-user-feed-token.ts+++ b/server/server/initializers/migrations/0560-user-feed-token.ts@@ -1,5 +1,5 @@import * as Sequelize from 'sequelize'-import { buildUUID } from '@shared/extra-utils'+import { buildUUID } from '@peertube/peertube-node-utils'async function up (utils: {transaction: Sequelize.Transactiondiff --git a/server/initializers/migrations/0565-actor-follow-local-url.ts b/server/server/initializers/migrations/0565-actor-follow-local-url.tssimilarity index 100%rename from server/initializers/migrations/0565-actor-follow-local-url.tsrename to server/server/initializers/migrations/0565-actor-follow-local-url.tsdiff --git a/server/initializers/migrations/0570-permanent-live.ts b/server/server/initializers/migrations/0570-permanent-live.tssimilarity index 100%rename from server/initializers/migrations/0570-permanent-live.tsrename to server/server/initializers/migrations/0570-permanent-live.tsdiff --git a/server/initializers/migrations/0575-duplicate-thumbnail.ts b/server/server/initializers/migrations/0575-duplicate-thumbnail.tssimilarity index 100%rename from server/initializers/migrations/0575-duplicate-thumbnail.tsrename to server/server/initializers/migrations/0575-duplicate-thumbnail.tsdiff --git a/server/initializers/migrations/0580-caption-filename.ts b/server/server/initializers/migrations/0580-caption-filename.tssimilarity index 100%rename from server/initializers/migrations/0580-caption-filename.tsrename to server/server/initializers/migrations/0580-caption-filename.tsdiff --git a/server/initializers/migrations/0585-video-file-names.ts b/server/server/initializers/migrations/0585-video-file-names.tssimilarity index 100%rename from server/initializers/migrations/0585-video-file-names.tsrename to server/server/initializers/migrations/0585-video-file-names.tsdiff --git a/server/initializers/migrations/0590-trackers.ts b/server/server/initializers/migrations/0590-trackers.tssimilarity index 100%rename from server/initializers/migrations/0590-trackers.tsrename to server/server/initializers/migrations/0590-trackers.tsdiff --git a/server/initializers/migrations/0595-remote-url.ts b/server/server/initializers/migrations/0595-remote-url.tssimilarity index 100%rename from server/initializers/migrations/0595-remote-url.tsrename to server/server/initializers/migrations/0595-remote-url.tsdiff --git a/server/initializers/migrations/0600-duplicate-video-files.ts b/server/server/initializers/migrations/0600-duplicate-video-files.tssimilarity index 100%rename from server/initializers/migrations/0600-duplicate-video-files.tsrename to server/server/initializers/migrations/0600-duplicate-video-files.tsdiff --git a/server/initializers/migrations/0605-actor-missing-keys.ts b/server/server/initializers/migrations/0605-actor-missing-keys.tssimilarity index 93%rename from server/initializers/migrations/0605-actor-missing-keys.tsrename to server/server/initializers/migrations/0605-actor-missing-keys.tsindex aa89a500ca..3ef95ea226 100644--- a/server/initializers/migrations/0605-actor-missing-keys.ts+++ b/server/server/initializers/migrations/0605-actor-missing-keys.ts@@ -1,6 +1,6 @@import * as Sequelize from 'sequelize'-import { generateRSAKeyPairPromise } from '../../helpers/core-utils'-import { PRIVATE_RSA_KEY_SIZE } from '../constants'+import { generateRSAKeyPairPromise } from '../../helpers/core-utils.js'+import { PRIVATE_RSA_KEY_SIZE } from '../constants.js'async function up (utils: {transaction: Sequelize.Transactiondiff --git a/server/initializers/migrations/0610-views-index copy.ts b/server/server/initializers/migrations/0610-views-index copy.tssimilarity index 100%rename from server/initializers/migrations/0610-views-index copy.tsrename to server/server/initializers/migrations/0610-views-index copy.tsdiff --git a/server/initializers/migrations/0612-captions-unique.ts b/server/server/initializers/migrations/0612-captions-unique.tssimilarity index 100%rename from server/initializers/migrations/0612-captions-unique.tsrename to server/server/initializers/migrations/0612-captions-unique.tsdiff --git a/server/initializers/migrations/0615-latest-versions-notification-settings.ts b/server/server/initializers/migrations/0615-latest-versions-notification-settings.tssimilarity index 100%rename from server/initializers/migrations/0615-latest-versions-notification-settings.tsrename to server/server/initializers/migrations/0615-latest-versions-notification-settings.tsdiff --git a/server/initializers/migrations/0620-latest-versions-application.ts b/server/server/initializers/migrations/0620-latest-versions-application.tssimilarity index 100%rename from server/initializers/migrations/0620-latest-versions-application.tsrename to server/server/initializers/migrations/0620-latest-versions-application.tsdiff --git a/server/initializers/migrations/0625-latest-versions-notification.ts b/server/server/initializers/migrations/0625-latest-versions-notification.tssimilarity index 100%rename from server/initializers/migrations/0625-latest-versions-notification.tsrename to server/server/initializers/migrations/0625-latest-versions-notification.tsdiff --git a/server/initializers/migrations/0630-banner.ts b/server/server/initializers/migrations/0630-banner.tssimilarity index 100%rename from server/initializers/migrations/0630-banner.tsrename to server/server/initializers/migrations/0630-banner.tsdiff --git a/server/initializers/migrations/0635-actor-image-size.ts b/server/server/initializers/migrations/0635-actor-image-size.tssimilarity index 100%rename from server/initializers/migrations/0635-actor-image-size.tsrename to server/server/initializers/migrations/0635-actor-image-size.tsdiff --git a/server/initializers/migrations/0640-unique-keys.ts b/server/server/initializers/migrations/0640-unique-keys.tssimilarity index 100%rename from server/initializers/migrations/0640-unique-keys.tsrename to server/server/initializers/migrations/0640-unique-keys.tsdiff --git a/server/initializers/migrations/0645-actor-remote-creation-date.ts b/server/server/initializers/migrations/0645-actor-remote-creation-date.tssimilarity index 100%rename from server/initializers/migrations/0645-actor-remote-creation-date.tsrename to server/server/initializers/migrations/0645-actor-remote-creation-date.tsdiff --git a/server/initializers/migrations/0650-actor-custom-pages.ts b/server/server/initializers/migrations/0650-actor-custom-pages.tssimilarity index 100%rename from server/initializers/migrations/0650-actor-custom-pages.tsrename to server/server/initializers/migrations/0650-actor-custom-pages.tsdiff --git a/server/initializers/migrations/0655-streaming-playlist-filenames.ts b/server/server/initializers/migrations/0655-streaming-playlist-filenames.tssimilarity index 100%rename from server/initializers/migrations/0655-streaming-playlist-filenames.tsrename to server/server/initializers/migrations/0655-streaming-playlist-filenames.tsdiff --git a/server/initializers/migrations/0660-object-storage.ts b/server/server/initializers/migrations/0660-object-storage.tssimilarity index 96%rename from server/initializers/migrations/0660-object-storage.tsrename to server/server/initializers/migrations/0660-object-storage.tsindex 53cb89ce67..c9dc7780e5 100644--- a/server/initializers/migrations/0660-object-storage.ts+++ b/server/server/initializers/migrations/0660-object-storage.ts@@ -1,5 +1,5 @@import * as Sequelize from 'sequelize'-import { VideoStorage } from '@shared/models'+import { VideoStorage } from '@peertube/peertube-models'async function up (utils: {transaction: Sequelize.Transactiondiff --git a/server/initializers/migrations/0665-no-account-warning-modal.ts b/server/server/initializers/migrations/0665-no-account-warning-modal.tssimilarity index 100%rename from server/initializers/migrations/0665-no-account-warning-modal.tsrename to server/server/initializers/migrations/0665-no-account-warning-modal.tsdiff --git a/server/initializers/migrations/0670-pending-job-default.ts b/server/server/initializers/migrations/0670-pending-job-default.tssimilarity index 100%rename from server/initializers/migrations/0670-pending-job-default.tsrename to server/server/initializers/migrations/0670-pending-job-default.tsdiff --git a/server/initializers/migrations/0675-p2p-enabled.ts b/server/server/initializers/migrations/0675-p2p-enabled.tssimilarity index 100%rename from server/initializers/migrations/0675-p2p-enabled.tsrename to server/server/initializers/migrations/0675-p2p-enabled.tsdiff --git a/server/initializers/migrations/0680-files-storage-default.ts b/server/server/initializers/migrations/0680-files-storage-default.tssimilarity index 100%rename from server/initializers/migrations/0680-files-storage-default.tsrename to server/server/initializers/migrations/0680-files-storage-default.tsdiff --git a/server/initializers/migrations/0685-multiple-actor-images.ts b/server/server/initializers/migrations/0685-multiple-actor-images.tssimilarity index 100%rename from server/initializers/migrations/0685-multiple-actor-images.tsrename to server/server/initializers/migrations/0685-multiple-actor-images.tsdiff --git a/server/initializers/migrations/0690-live-latency-mode.ts b/server/server/initializers/migrations/0690-live-latency-mode.tssimilarity index 93%rename from server/initializers/migrations/0690-live-latency-mode.tsrename to server/server/initializers/migrations/0690-live-latency-mode.tsindex c31a613641..b7f50cf4bf 100644--- a/server/initializers/migrations/0690-live-latency-mode.ts+++ b/server/server/initializers/migrations/0690-live-latency-mode.ts@@ -1,4 +1,4 @@-import { LiveVideoLatencyMode } from '@shared/models'+import { LiveVideoLatencyMode } from '@peertube/peertube-models'import * as Sequelize from 'sequelize'async function up (utils: {diff --git a/server/initializers/migrations/0695-remove-remote-rates.ts b/server/server/initializers/migrations/0695-remove-remote-rates.tssimilarity index 100%rename from server/initializers/migrations/0695-remove-remote-rates.tsrename to server/server/initializers/migrations/0695-remove-remote-rates.tsdiff --git a/server/initializers/migrations/0700-edition-finished-notification.ts b/server/server/initializers/migrations/0700-edition-finished-notification.tssimilarity index 100%rename from server/initializers/migrations/0700-edition-finished-notification.tsrename to server/server/initializers/migrations/0700-edition-finished-notification.tsdiff --git a/server/initializers/migrations/0705-local-video-viewers.ts b/server/server/initializers/migrations/0705-local-video-viewers.tssimilarity index 100%rename from server/initializers/migrations/0705-local-video-viewers.tsrename to server/server/initializers/migrations/0705-local-video-viewers.tsdiff --git a/server/initializers/migrations/0710-live-sessions.ts b/server/server/initializers/migrations/0710-live-sessions.tssimilarity index 100%rename from server/initializers/migrations/0710-live-sessions.tsrename to server/server/initializers/migrations/0710-live-sessions.tsdiff --git a/server/initializers/migrations/0715-video-source.ts b/server/server/initializers/migrations/0715-video-source.tssimilarity index 100%rename from server/initializers/migrations/0715-video-source.tsrename to server/server/initializers/migrations/0715-video-source.tsdiff --git a/server/initializers/migrations/0720-session-ending-processed.ts b/server/server/initializers/migrations/0720-session-ending-processed.tssimilarity index 100%rename from server/initializers/migrations/0720-session-ending-processed.tsrename to server/server/initializers/migrations/0720-session-ending-processed.tsdiff --git a/server/initializers/migrations/0725-node-version.ts b/server/server/initializers/migrations/0725-node-version.tssimilarity index 100%rename from server/initializers/migrations/0725-node-version.tsrename to server/server/initializers/migrations/0725-node-version.tsdiff --git a/server/initializers/migrations/0730-video-channel-sync.ts b/server/server/initializers/migrations/0730-video-channel-sync.tssimilarity index 100%rename from server/initializers/migrations/0730-video-channel-sync.tsrename to server/server/initializers/migrations/0730-video-channel-sync.tsdiff --git a/server/initializers/migrations/0735-video-channel-sync-import-foreign-key.ts b/server/server/initializers/migrations/0735-video-channel-sync-import-foreign-key.tssimilarity index 100%rename from server/initializers/migrations/0735-video-channel-sync-import-foreign-key.tsrename to server/server/initializers/migrations/0735-video-channel-sync-import-foreign-key.tsdiff --git a/server/initializers/migrations/0740-fix-old-enums.ts b/server/server/initializers/migrations/0740-fix-old-enums.tssimilarity index 100%rename from server/initializers/migrations/0740-fix-old-enums.tsrename to server/server/initializers/migrations/0740-fix-old-enums.tsdiff --git a/server/initializers/migrations/0745-user-otp.ts b/server/server/initializers/migrations/0745-user-otp.tssimilarity index 100%rename from server/initializers/migrations/0745-user-otp.tsrename to server/server/initializers/migrations/0745-user-otp.tsdiff --git a/server/initializers/migrations/0750-user-registration.ts b/server/server/initializers/migrations/0750-user-registration.tssimilarity index 100%rename from server/initializers/migrations/0750-user-registration.tsrename to server/server/initializers/migrations/0750-user-registration.tsdiff --git a/server/initializers/migrations/0755-unique-viewer-url.ts b/server/server/initializers/migrations/0755-unique-viewer-url.tssimilarity index 100%rename from server/initializers/migrations/0755-unique-viewer-url.tsrename to server/server/initializers/migrations/0755-unique-viewer-url.tsdiff --git a/server/initializers/migrations/0760-video-live-replay-setting.ts b/server/server/initializers/migrations/0760-video-live-replay-setting.tssimilarity index 100%rename from server/initializers/migrations/0760-video-live-replay-setting.tsrename to server/server/initializers/migrations/0760-video-live-replay-setting.tsdiff --git a/server/initializers/migrations/0765-remote-transcoding.ts b/server/server/initializers/migrations/0765-remote-transcoding.tssimilarity index 100%rename from server/initializers/migrations/0765-remote-transcoding.tsrename to server/server/initializers/migrations/0765-remote-transcoding.tsdiff --git a/server/initializers/migrations/0770-actor-preferred-username.ts b/server/server/initializers/migrations/0770-actor-preferred-username.tssimilarity index 100%rename from server/initializers/migrations/0770-actor-preferred-username.tsrename to server/server/initializers/migrations/0770-actor-preferred-username.tsdiff --git a/server/initializers/migrations/0775-add-user-is-email-public.ts b/server/server/initializers/migrations/0775-add-user-is-email-public.tssimilarity index 100%rename from server/initializers/migrations/0775-add-user-is-email-public.tsrename to server/server/initializers/migrations/0775-add-user-is-email-public.tsdiff --git a/server/initializers/migrations/0780-notification-registration.ts b/server/server/initializers/migrations/0780-notification-registration.tssimilarity index 100%rename from server/initializers/migrations/0780-notification-registration.tsrename to server/server/initializers/migrations/0780-notification-registration.tsdiff --git a/server/initializers/migrations/0785-video-password-protection.ts b/server/server/initializers/migrations/0785-video-password-protection.tssimilarity index 100%rename from server/initializers/migrations/0785-video-password-protection.tsrename to server/server/initializers/migrations/0785-video-password-protection.tsdiff --git a/server/initializers/migrations/0790-thumbnail-disk.ts b/server/server/initializers/migrations/0790-thumbnail-disk.tssimilarity index 100%rename from server/initializers/migrations/0790-thumbnail-disk.tsrename to server/server/initializers/migrations/0790-thumbnail-disk.tsdiff --git a/server/initializers/migrations/0795-duplicate-runner-name.ts b/server/server/initializers/migrations/0795-duplicate-runner-name.tssimilarity index 100%rename from server/initializers/migrations/0795-duplicate-runner-name.tsrename to server/server/initializers/migrations/0795-duplicate-runner-name.tsdiff --git a/server/initializers/migrations/0800-video-replace-file.ts b/server/server/initializers/migrations/0800-video-replace-file.tssimilarity index 100%rename from server/initializers/migrations/0800-video-replace-file.tsrename to server/server/initializers/migrations/0800-video-replace-file.tsdiff --git a/server/initializers/migrator.ts b/server/server/initializers/migrator.tssimilarity index 86%rename from server/initializers/migrator.tsrename to server/server/initializers/migrator.tsindex 7ac20127e8..a6494fb162 100644--- a/server/initializers/migrator.ts+++ b/server/server/initializers/migrator.ts@@ -1,9 +1,10 @@-import { readdir } from 'fs-extra'+import { readdir } from 'fs/promises'import { join } from 'path'import { QueryTypes } from 'sequelize'-import { logger } from '../helpers/logger'-import { LAST_MIGRATION_VERSION } from './constants'-import { sequelizeTypescript } from './database'+import { currentDir } from '@peertube/peertube-node-utils'+import { logger } from '../helpers/logger.js'+import { LAST_MIGRATION_VERSION } from './constants.js'+import { sequelizeTypescript } from './database.js'async function migrate () {const tables = await sequelizeTypescript.getQueryInterface().showAllTables()@@ -58,7 +59,7 @@ export {// ---------------------------------------------------------------------------async function getMigrationScripts () {- const files = await readdir(join(__dirname, 'migrations'))+ const files = await readdir(join(currentDir(import.meta.url), 'migrations'))const filesToMigrate: {version: stringscript: string@@ -88,7 +89,7 @@ async function executeMigration (actualVersion: number, entity: { version: strinconst migrationScriptName = entity.scriptlogger.info('Executing %s migration script.', migrationScriptName)- const migrationScript = require(join(__dirname, 'migrations', migrationScriptName))+ const migrationScript = await import(join(currentDir(import.meta.url), 'migrations', migrationScriptName))return sequelizeTypescript.transaction(async t => {const options = {diff --git a/server/lib/activitypub/activity.ts b/server/server/lib/activitypub/activity.tssimilarity index 91%rename from server/lib/activitypub/activity.tsrename to server/server/lib/activitypub/activity.tsindex 391bcd9c6f..ea4b3bd638 100644--- a/server/lib/activitypub/activity.ts+++ b/server/server/lib/activitypub/activity.ts@@ -1,7 +1,7 @@-import { doJSONRequest, PeerTubeRequestOptions } from '@server/helpers/requests'-import { CONFIG } from '@server/initializers/config'-import { ActivityObject, ActivityPubActor, ActivityType, APObjectId } from '@shared/models'-import { buildSignedRequestOptions } from './send'+import { doJSONRequest, PeerTubeRequestOptions } from '@server/helpers/requests.js'+import { CONFIG } from '@server/initializers/config.js'+import { ActivityObject, ActivityPubActor, ActivityType, APObjectId } from '@peertube/peertube-models'+import { buildSignedRequestOptions } from './send/index.js'export function getAPId (object: string | { id: string }) {if (typeof object === 'string') return objectdiff --git a/server/lib/activitypub/actors/get.ts b/server/server/lib/activitypub/actors/get.tssimilarity index 88%rename from server/lib/activitypub/actors/get.tsrename to server/server/lib/activitypub/actors/get.tsindex dd2bc9f039..d301aa8f1f 100644--- a/server/lib/activitypub/actors/get.ts+++ b/server/server/lib/activitypub/actors/get.ts@@ -1,14 +1,20 @@-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { logger } from '@server/helpers/logger'-import { JobQueue } from '@server/lib/job-queue'-import { ActorLoadByUrlType, loadActorByUrl } from '@server/lib/model-loaders'-import { MActor, MActorAccountChannelId, MActorAccountChannelIdActor, MActorAccountId, MActorFullActor } from '@server/types/models'-import { arrayify } from '@shared/core-utils'-import { ActivityPubActor, APObjectId } from '@shared/models'-import { fetchAPObjectIfNeeded, getAPId } from '../activity'-import { checkUrlsSameHost } from '../url'-import { refreshActorIfNeeded } from './refresh'-import { APActorCreator, fetchRemoteActor } from './shared'+import { arrayify } from '@peertube/peertube-core-utils'+import { ActivityPubActor, APObjectId } from '@peertube/peertube-models'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { logger } from '@server/helpers/logger.js'+import { JobQueue } from '@server/lib/job-queue/index.js'+import { ActorLoadByUrlType, loadActorByUrl } from '@server/lib/model-loaders/index.js'+import {+ MActor,+ MActorAccountChannelId,+ MActorAccountChannelIdActor,+ MActorAccountId,+ MActorFullActor+} from '@server/types/models/index.js'+import { fetchAPObjectIfNeeded, getAPId } from '../activity.js'+import { checkUrlsSameHost } from '../url.js'+import { refreshActorIfNeeded } from './refresh.js'+import { APActorCreator, fetchRemoteActor } from './shared/index.js'function getOrCreateAPActor (activityActor: string | ActivityPubActor,diff --git a/server/lib/activitypub/actors/image.ts b/server/server/lib/activitypub/actors/image.tssimilarity index 83%rename from server/lib/activitypub/actors/image.tsrename to server/server/lib/activitypub/actors/image.tsindex e1d29af5bc..290f967b7a 100644--- a/server/lib/activitypub/actors/image.ts+++ b/server/server/lib/activitypub/actors/image.ts@@ -1,8 +1,8 @@-import { Transaction } from 'sequelize/types'-import { logger } from '@server/helpers/logger'-import { ActorImageModel } from '@server/models/actor/actor-image'-import { MActorImage, MActorImages } from '@server/types/models'-import { ActorImageType } from '@shared/models'+import { ActorImageType, ActorImageType_Type } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { ActorImageModel } from '@server/models/actor/actor-image.js'+import { MActorImage, MActorImages } from '@server/types/models/index.js'+import { Transaction } from 'sequelize'type ImageInfo = {name: string@@ -12,7 +12,7 @@ type ImageInfo = {onDisk?: boolean}-async function updateActorImages (actor: MActorImages, type: ActorImageType, imagesInfo: ImageInfo[], t: Transaction) {+async function updateActorImages (actor: MActorImages, type: ActorImageType_Type, imagesInfo: ImageInfo[], t: Transaction) {const getAvatarsOrBanners = () => {const result = type === ActorImageType.AVATAR? actor.Avatars@@ -60,7 +60,7 @@ async function updateActorImages (actor: MActorImages, type: ActorImageType, imareturn actor}-async function deleteActorImages (actor: MActorImages, type: ActorImageType, t: Transaction) {+async function deleteActorImages (actor: MActorImages, type: ActorImageType_Type, t: Transaction) {try {const association = buildAssociationName(type)@@ -76,7 +76,7 @@ async function deleteActorImages (actor: MActorImages, type: ActorImageType, t:return actor}-async function safeDeleteActorImage (actor: MActorImages, toDelete: MActorImage, type: ActorImageType, t: Transaction) {+async function safeDeleteActorImage (actor: MActorImages, toDelete: MActorImage, type: ActorImageType_Type, t: Transaction) {try {await toDelete.destroy({ transaction: t })@@ -90,7 +90,7 @@ async function safeDeleteActorImage (actor: MActorImages, toDelete: MActorImage,// ---------------------------------------------------------------------------export {- ImageInfo,+ type ImageInfo,updateActorImages,deleteActorImages@@ -98,14 +98,14 @@ export {// ----------------------------------------------------------------------------function addActorImage (actor: MActorImages, type: ActorImageType, imageModel: MActorImage) {+function addActorImage (actor: MActorImages, type: ActorImageType_Type, imageModel: MActorImage) {const association = buildAssociationName(type)if (!actor[association]) actor[association] = []actor[association].push(imageModel)}-function buildAssociationName (type: ActorImageType) {+function buildAssociationName (type: ActorImageType_Type) {return type === ActorImageType.AVATAR? 'Avatars': 'Banners'diff --git a/server/server/lib/activitypub/actors/index.ts b/server/server/lib/activitypub/actors/index.tsnew file mode 100644index 0000000000..9062e1394d--- /dev/null+++ b/server/server/lib/activitypub/actors/index.ts@@ -0,0 +1,6 @@+export * from './get.js'+export * from './image.js'+export * from './keys.js'+export * from './refresh.js'+export * from './updater.js'+export * from './webfinger.js'diff --git a/server/lib/activitypub/actors/keys.ts b/server/server/lib/activitypub/actors/keys.tssimilarity index 86%rename from server/lib/activitypub/actors/keys.tsrename to server/server/lib/activitypub/actors/keys.tsindex c3d18abd84..bf7973756c 100644--- a/server/lib/activitypub/actors/keys.ts+++ b/server/server/lib/activitypub/actors/keys.ts@@ -1,5 +1,5 @@-import { createPrivateAndPublicKeys } from '@server/helpers/peertube-crypto'-import { MActor } from '@server/types/models'+import { createPrivateAndPublicKeys } from '@server/helpers/peertube-crypto.js'+import { MActor } from '@server/types/models/index.js'// Set account keys, this could be long so process after the account creation and do not block the clientasync function generateAndSaveActorKeys <T extends MActor> (actor: T) {diff --git a/server/lib/activitypub/actors/refresh.ts b/server/server/lib/activitypub/actors/refresh.tssimilarity index 85%rename from server/lib/activitypub/actors/refresh.tsrename to server/server/lib/activitypub/actors/refresh.tsindex d15cb5e906..87f017ae8a 100644--- a/server/lib/activitypub/actors/refresh.ts+++ b/server/server/lib/activitypub/actors/refresh.ts@@ -1,13 +1,13 @@-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { CachePromiseFactory } from '@server/helpers/promise-cache'-import { PeerTubeRequestError } from '@server/helpers/requests'-import { ActorLoadByUrlType } from '@server/lib/model-loaders'-import { ActorModel } from '@server/models/actor/actor'-import { MActorAccountChannelId, MActorFull } from '@server/types/models'-import { HttpStatusCode } from '@shared/models'-import { fetchRemoteActor } from './shared'-import { APActorUpdater } from './updater'-import { getUrlFromWebfinger } from './webfinger'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { CachePromiseFactory } from '@server/helpers/promise-cache.js'+import { PeerTubeRequestError } from '@server/helpers/requests.js'+import { ActorLoadByUrlType } from '@server/lib/model-loaders/index.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { MActorAccountChannelId, MActorFull } from '@server/types/models/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { fetchRemoteActor } from './shared/index.js'+import { APActorUpdater } from './updater.js'+import { getUrlFromWebfinger } from './webfinger.js'type RefreshResult <T> = Promise<{ actor: T | MActorFull, refreshed: boolean }>diff --git a/server/lib/activitypub/actors/shared/creator.ts b/server/server/lib/activitypub/actors/shared/creator.tssimilarity index 88%rename from server/lib/activitypub/actors/shared/creator.tsrename to server/server/lib/activitypub/actors/shared/creator.tsindex 500bc99121..426f918fbc 100644--- a/server/lib/activitypub/actors/shared/creator.ts+++ b/server/server/lib/activitypub/actors/shared/creator.ts@@ -1,14 +1,23 @@import { Op, Transaction } from 'sequelize'-import { sequelizeTypescript } from '@server/initializers/database'-import { AccountModel } from '@server/models/account/account'-import { ActorModel } from '@server/models/actor/actor'-import { ServerModel } from '@server/models/server/server'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { MAccount, MAccountDefault, MActor, MActorFullActor, MActorId, MActorImages, MChannel, MServer } from '@server/types/models'-import { ActivityPubActor, ActorImageType } from '@shared/models'-import { updateActorImages } from '../image'-import { getActorAttributesFromObject, getActorDisplayNameFromObject, getImagesInfoFromObject } from './object-to-model-attributes'-import { fetchActorFollowsCount } from './url-to-object'+import { ActivityPubActor, ActorImageType, ActorImageType_Type } from '@peertube/peertube-models'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { AccountModel } from '@server/models/account/account.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { ServerModel } from '@server/models/server/server.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import {+ MAccount,+ MAccountDefault,+ MActor,+ MActorFullActor,+ MActorId,+ MActorImages,+ MChannel,+ MServer+} from '@server/types/models/index.js'+import { updateActorImages } from '../image.js'+import { getActorAttributesFromObject, getActorDisplayNameFromObject, getImagesInfoFromObject } from './object-to-model-attributes.js'+import { fetchActorFollowsCount } from './url-to-object.js'export class APActorCreator {@@ -70,7 +79,7 @@ export class APActorCreator {return server as MServer}- private async setImageIfNeeded (actor: MActor, type: ActorImageType, t: Transaction) {+ private async setImageIfNeeded (actor: MActor, type: ActorImageType_Type, t: Transaction) {const imagesInfo = getImagesInfoFromObject(this.actorObject, type)if (imagesInfo.length === 0) returndiff --git a/server/server/lib/activitypub/actors/shared/index.ts b/server/server/lib/activitypub/actors/shared/index.tsnew file mode 100644index 0000000000..d213a79860--- /dev/null+++ b/server/server/lib/activitypub/actors/shared/index.ts@@ -0,0 +1,3 @@+export * from './creator.js'+export * from './object-to-model-attributes.js'+export * from './url-to-object.js'diff --git a/server/lib/activitypub/actors/shared/object-to-model-attributes.ts b/server/server/lib/activitypub/actors/shared/object-to-model-attributes.tssimilarity index 82%rename from server/lib/activitypub/actors/shared/object-to-model-attributes.tsrename to server/server/lib/activitypub/actors/shared/object-to-model-attributes.tsindex 3ce332681e..987c480850 100644--- a/server/lib/activitypub/actors/shared/object-to-model-attributes.ts+++ b/server/server/lib/activitypub/actors/shared/object-to-model-attributes.ts@@ -1,10 +1,9 @@-import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc'-import { MIMETYPES } from '@server/initializers/constants'-import { ActorModel } from '@server/models/actor/actor'-import { FilteredModelAttributes } from '@server/types'-import { getLowercaseExtension } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { ActivityIconObject, ActivityPubActor, ActorImageType } from '@shared/models'+import { ActivityIconObject, ActivityPubActor, ActorImageType, ActorImageType_Type } from '@peertube/peertube-models'+import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc.js'+import { MIMETYPES } from '@server/initializers/constants.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { FilteredModelAttributes } from '@server/types/index.js'+import { buildUUID, getLowercaseExtension } from '@peertube/peertube-node-utils'function getActorAttributesFromObject (actorObject: ActivityPubActor,@@ -30,7 +29,7 @@ function getActorAttributesFromObject (}}-function getImagesInfoFromObject (actorObject: ActivityPubActor, type: ActorImageType) {+function getImagesInfoFromObject (actorObject: ActivityPubActor, type: ActorImageType_Type) {const iconsOrImages = type === ActorImageType.AVATAR? actorObject.icon: actorObject.imagediff --git a/server/lib/activitypub/actors/shared/url-to-object.ts b/server/server/lib/activitypub/actors/shared/url-to-object.tssimilarity index 88%rename from server/lib/activitypub/actors/shared/url-to-object.tsrename to server/server/lib/activitypub/actors/shared/url-to-object.tsindex 73766bd509..6dc04e396e 100644--- a/server/lib/activitypub/actors/shared/url-to-object.ts+++ b/server/server/lib/activitypub/actors/shared/url-to-object.ts@@ -1,8 +1,8 @@-import { sanitizeAndCheckActorObject } from '@server/helpers/custom-validators/activitypub/actor'-import { logger } from '@server/helpers/logger'-import { ActivityPubActor, ActivityPubOrderedCollection } from '@shared/models'-import { fetchAP } from '../../activity'-import { checkUrlsSameHost } from '../../url'+import { sanitizeAndCheckActorObject } from '@server/helpers/custom-validators/activitypub/actor.js'+import { logger } from '@server/helpers/logger.js'+import { ActivityPubActor, ActivityPubOrderedCollection } from '@peertube/peertube-models'+import { fetchAP } from '../../activity.js'+import { checkUrlsSameHost } from '../../url.js'async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode: number, actorObject: ActivityPubActor }> {logger.info('Fetching remote actor %s.', actorUrl)diff --git a/server/lib/activitypub/actors/updater.ts b/server/server/lib/activitypub/actors/updater.tssimilarity index 88%rename from server/lib/activitypub/actors/updater.tsrename to server/server/lib/activitypub/actors/updater.tsindex 5a92e7a224..81953611af 100644--- a/server/lib/activitypub/actors/updater.ts+++ b/server/server/lib/activitypub/actors/updater.ts@@ -1,13 +1,13 @@-import { resetSequelizeInstance, runInReadCommittedTransaction } from '@server/helpers/database-utils'-import { logger } from '@server/helpers/logger'-import { AccountModel } from '@server/models/account/account'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { MAccount, MActor, MActorFull, MChannel } from '@server/types/models'-import { ActivityPubActor, ActorImageType } from '@shared/models'-import { getOrCreateAPOwner } from './get'-import { updateActorImages } from './image'-import { fetchActorFollowsCount } from './shared'-import { getImagesInfoFromObject } from './shared/object-to-model-attributes'+import { resetSequelizeInstance, runInReadCommittedTransaction } from '@server/helpers/database-utils.js'+import { logger } from '@server/helpers/logger.js'+import { AccountModel } from '@server/models/account/account.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import { MAccount, MActor, MActorFull, MChannel } from '@server/types/models/index.js'+import { ActivityPubActor, ActorImageType } from '@peertube/peertube-models'+import { getOrCreateAPOwner } from './get.js'+import { updateActorImages } from './image.js'+import { fetchActorFollowsCount } from './shared/index.js'+import { getImagesInfoFromObject } from './shared/object-to-model-attributes.js'export class APActorUpdater {diff --git a/server/lib/activitypub/actors/webfinger.ts b/server/server/lib/activitypub/actors/webfinger.tssimilarity index 86%rename from server/lib/activitypub/actors/webfinger.tsrename to server/server/lib/activitypub/actors/webfinger.tsindex b20a724dad..21d148a611 100644--- a/server/lib/activitypub/actors/webfinger.ts+++ b/server/server/lib/activitypub/actors/webfinger.ts@@ -1,10 +1,10 @@import WebFinger from 'webfinger.js'-import { isProdInstance } from '@server/helpers/core-utils'-import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc'-import { REQUEST_TIMEOUTS, WEBSERVER } from '@server/initializers/constants'-import { ActorModel } from '@server/models/actor/actor'-import { MActorFull } from '@server/types/models'-import { WebFingerData } from '@shared/models'+import { WebFingerData } from '@peertube/peertube-models'+import { isProdInstance } from '@peertube/peertube-node-utils'+import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc.js'+import { REQUEST_TIMEOUTS, WEBSERVER } from '@server/initializers/constants.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { MActorFull } from '@server/types/models/index.js'const webfinger = new WebFinger({webfist_fallback: false,diff --git a/server/lib/activitypub/audience.ts b/server/server/lib/activitypub/audience.tssimilarity index 77%rename from server/lib/activitypub/audience.tsrename to server/server/lib/activitypub/audience.tsindex 6f54913875..197acdb85f 100644--- a/server/lib/activitypub/audience.ts+++ b/server/server/lib/activitypub/audience.ts@@ -1,6 +1,6 @@-import { ActivityAudience } from '../../../shared/models/activitypub'-import { ACTIVITY_PUB } from '../../initializers/constants'-import { MActorFollowersUrl } from '../../types/models'+import { ActivityAudience } from '@peertube/peertube-models'+import { ACTIVITY_PUB } from '../../initializers/constants.js'+import { MActorFollowersUrl } from '../../types/models/index.js'function getAudience (actorSender: MActorFollowersUrl, isPublic = true) {return buildAudience([ actorSender.followersUrl ], isPublic)diff --git a/server/lib/activitypub/cache-file.ts b/server/server/lib/activitypub/cache-file.tssimilarity index 95%rename from server/lib/activitypub/cache-file.tsrename to server/server/lib/activitypub/cache-file.tsindex c3acd7112a..ef8bbace8b 100644--- a/server/lib/activitypub/cache-file.ts+++ b/server/server/lib/activitypub/cache-file.ts@@ -1,7 +1,7 @@import { Transaction } from 'sequelize'-import { MActorId, MVideoRedundancy, MVideoWithAllFiles } from '@server/types/models'-import { CacheFileObject, VideoStreamingPlaylistType } from '@shared/models'-import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'+import { MActorId, MVideoRedundancy, MVideoWithAllFiles } from '@server/types/models/index.js'+import { CacheFileObject, VideoStreamingPlaylistType } from '@peertube/peertube-models'+import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy.js'async function createOrUpdateCacheFile (cacheFileObject: CacheFileObject, video: MVideoWithAllFiles, byActor: MActorId, t: Transaction) {const redundancyModel = await VideoRedundancyModel.loadByUrl(cacheFileObject.id, t)diff --git a/server/lib/activitypub/collection.ts b/server/server/lib/activitypub/collection.tssimilarity index 82%rename from server/lib/activitypub/collection.tsrename to server/server/lib/activitypub/collection.tsindex a176cab51a..280c3a5e98 100644--- a/server/lib/activitypub/collection.ts+++ b/server/server/lib/activitypub/collection.ts@@ -1,9 +1,9 @@import Bluebird from 'bluebird'import validator from 'validator'-import { pageToStartAndCount } from '@server/helpers/core-utils'-import { ACTIVITY_PUB } from '@server/initializers/constants'-import { ResultList } from '@shared/models'-import { forceNumber } from '@shared/core-utils'+import { pageToStartAndCount } from '@server/helpers/core-utils.js'+import { ACTIVITY_PUB } from '@server/initializers/constants.js'+import { ResultList } from '@peertube/peertube-models'+import { forceNumber } from '@peertube/peertube-core-utils'type ActivityPubCollectionPaginationHandler = (start: number, count: number) => Bluebird<ResultList<any>> | Promise<ResultList<any>>@@ -13,7 +13,7 @@ async function activityPubCollectionPagination (page?: any,size = ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) {- if (!page || !validator.isInt(page)) {+ if (!page || !validator.default.isInt(page)) {// We just display the first page URL, we only need the total itemsconst result = await handler(0, 1)diff --git a/server/server/lib/activitypub/context.ts b/server/server/lib/activitypub/context.tsnew file mode 100644index 0000000000..8de565976b--- /dev/null+++ b/server/server/lib/activitypub/context.ts@@ -0,0 +1,10 @@+import { Hooks } from '../plugins/hooks.js'++export function getContextFilter <T> () {+ return (contextData: T) => {+ return Hooks.wrapObject(+ contextData,+ 'filter:activity-pub.activity.context.build.result'+ )+ }+}diff --git a/server/lib/activitypub/crawl.ts b/server/server/lib/activitypub/crawl.tssimilarity index 89%rename from server/lib/activitypub/crawl.tsrename to server/server/lib/activitypub/crawl.tsindex b8348e8cf5..bc773279ac 100644--- a/server/lib/activitypub/crawl.ts+++ b/server/server/lib/activitypub/crawl.ts@@ -1,10 +1,10 @@import Bluebird from 'bluebird'import { URL } from 'url'-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub'-import { logger } from '../../helpers/logger'-import { ACTIVITY_PUB, WEBSERVER } from '../../initializers/constants'-import { fetchAP } from './activity'+import { ActivityPubOrderedCollection } from '@peertube/peertube-models'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { logger } from '../../helpers/logger.js'+import { ACTIVITY_PUB, WEBSERVER } from '../../initializers/constants.js'+import { fetchAP } from './activity.js'type HandlerFunction<T> = (items: T[]) => (Promise<any> | Bluebird<any>)type CleanerFunction = (startedDate: Date) => Promise<any>diff --git a/server/lib/activitypub/follow.ts b/server/server/lib/activitypub/follow.tssimilarity index 77%rename from server/lib/activitypub/follow.tsrename to server/server/lib/activitypub/follow.tsindex f6e2a48fde..d6c60602bf 100644--- a/server/lib/activitypub/follow.ts+++ b/server/server/lib/activitypub/follow.ts@@ -1,11 +1,11 @@import { Transaction } from 'sequelize'-import { getServerActor } from '@server/models/application/application'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { SERVER_ACTOR_NAME } from '../../initializers/constants'-import { ServerModel } from '../../models/server/server'-import { MActorFollowActors } from '../../types/models'-import { JobQueue } from '../job-queue'+import { getServerActor } from '@server/models/application/application.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { SERVER_ACTOR_NAME } from '../../initializers/constants.js'+import { ServerModel } from '../../models/server/server.js'+import { MActorFollowActors } from '../../types/models/index.js'+import { JobQueue } from '../job-queue/index.js'async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors, transaction?: Transaction) {if (!CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_BACK.ENABLED) returndiff --git a/server/lib/activitypub/inbox-manager.ts b/server/server/lib/activitypub/inbox-manager.tssimilarity index 83%rename from server/lib/activitypub/inbox-manager.tsrename to server/server/lib/activitypub/inbox-manager.tsindex 27778cc9dc..ecf95d1ee2 100644--- a/server/lib/activitypub/inbox-manager.ts+++ b/server/server/lib/activitypub/inbox-manager.ts@@ -1,10 +1,10 @@import PQueue from 'p-queue'-import { logger } from '@server/helpers/logger'-import { SCHEDULER_INTERVALS_MS } from '@server/initializers/constants'-import { MActorDefault, MActorSignature } from '@server/types/models'-import { Activity } from '@shared/models'-import { StatsManager } from '../stat-manager'-import { processActivities } from './process'+import { logger } from '@server/helpers/logger.js'+import { SCHEDULER_INTERVALS_MS } from '@server/initializers/constants.js'+import { MActorDefault, MActorSignature } from '@server/types/models/index.js'+import { Activity } from '@peertube/peertube-models'+import { StatsManager } from '../stat-manager.js'+import { processActivities } from './process/index.js'class InboxManager {diff --git a/server/lib/activitypub/local-video-viewer.ts b/server/server/lib/activitypub/local-video-viewer.tssimilarity index 83%rename from server/lib/activitypub/local-video-viewer.tsrename to server/server/lib/activitypub/local-video-viewer.tsindex bdd7467912..accd0c894d 100644--- a/server/lib/activitypub/local-video-viewer.ts+++ b/server/server/lib/activitypub/local-video-viewer.ts@@ -1,9 +1,9 @@import { Transaction } from 'sequelize'-import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'-import { LocalVideoViewerWatchSectionModel } from '@server/models/view/local-video-viewer-watch-section'-import { MVideo } from '@server/types/models'-import { WatchActionObject } from '@shared/models'-import { getDurationFromActivityStream } from './activity'+import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer.js'+import { LocalVideoViewerWatchSectionModel } from '@server/models/view/local-video-viewer-watch-section.js'+import { MVideo } from '@server/types/models/index.js'+import { WatchActionObject } from '@peertube/peertube-models'+import { getDurationFromActivityStream } from './activity.js'async function createOrUpdateLocalVideoViewer (watchAction: WatchActionObject, video: MVideo, t: Transaction) {const stats = await LocalVideoViewerModel.loadByUrl(watchAction.id)diff --git a/server/lib/activitypub/outbox.ts b/server/server/lib/activitypub/outbox.tssimilarity index 76%rename from server/lib/activitypub/outbox.tsrename to server/server/lib/activitypub/outbox.tsindex 5eef768711..8e3cf68159 100644--- a/server/lib/activitypub/outbox.ts+++ b/server/server/lib/activitypub/outbox.ts@@ -1,7 +1,7 @@-import { logger } from '@server/helpers/logger'-import { ActorModel } from '@server/models/actor/actor'-import { getServerActor } from '@server/models/application/application'-import { JobQueue } from '../job-queue'+import { logger } from '@server/helpers/logger.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { getServerActor } from '@server/models/application/application.js'+import { JobQueue } from '../job-queue/index.js'async function addFetchOutboxJob (actor: Pick<ActorModel, 'id' | 'outboxUrl'>) {// Don't fetch ourselvesdiff --git a/server/lib/activitypub/playlists/create-update.ts b/server/server/lib/activitypub/playlists/create-update.tssimilarity index 87%rename from server/lib/activitypub/playlists/create-update.tsrename to server/server/lib/activitypub/playlists/create-update.tsindex b24299f294..05fef5df13 100644--- a/server/lib/activitypub/playlists/create-update.ts+++ b/server/server/lib/activitypub/playlists/create-update.ts@@ -1,31 +1,31 @@-import { map } from 'bluebird'-import { isArray } from '@server/helpers/custom-validators/misc'-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { CRAWL_REQUEST_CONCURRENCY } from '@server/initializers/constants'-import { sequelizeTypescript } from '@server/initializers/database'-import { updateRemotePlaylistMiniatureFromUrl } from '@server/lib/thumbnail'-import { VideoPlaylistModel } from '@server/models/video/video-playlist'-import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'-import { FilteredModelAttributes } from '@server/types'-import { MThumbnail, MVideoPlaylist, MVideoPlaylistFull, MVideoPlaylistVideosLength } from '@server/types/models'-import { PlaylistObject } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { getAPId } from '../activity'-import { getOrCreateAPActor } from '../actors'-import { crawlCollectionPage } from '../crawl'-import { getOrCreateAPVideo } from '../videos'+import Bluebird from 'bluebird'+import { isArray } from '@server/helpers/custom-validators/misc.js'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { CRAWL_REQUEST_CONCURRENCY } from '@server/initializers/constants.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { updateRemotePlaylistMiniatureFromUrl } from '@server/lib/thumbnail.js'+import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element.js'+import { VideoPlaylistModel } from '@server/models/video/video-playlist.js'+import { FilteredModelAttributes } from '@server/types/index.js'+import { MThumbnail, MVideoPlaylist, MVideoPlaylistFull, MVideoPlaylistVideosLength } from '@server/types/models/index.js'+import { PlaylistObject } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { getAPId } from '../activity.js'+import { getOrCreateAPActor } from '../actors/index.js'+import { crawlCollectionPage } from '../crawl.js'+import { getOrCreateAPVideo } from '../videos/index.js'import {fetchRemotePlaylistElement,fetchRemoteVideoPlaylist,playlistElementObjectToDBAttributes,playlistObjectToDBAttributes-} from './shared'+} from './shared/index.js'const lTags = loggerTagsFactory('ap', 'video-playlist')async function createAccountPlaylists (playlistUrls: string[]) {- await map(playlistUrls, async playlistUrl => {+ await Bluebird.map(playlistUrls, async playlistUrl => {try {const exists = await VideoPlaylistModel.doesPlaylistExist(playlistUrl)if (exists === true) return@@ -141,7 +141,7 @@ async function rebuildVideoPlaylistElements (elementUrls: string[], playlist: MVasync function buildElementsDBAttributes (elementUrls: string[], playlist: MVideoPlaylist) {const elementsToCreate: FilteredModelAttributes<VideoPlaylistElementModel>[] = []- await map(elementUrls, async elementUrl => {+ await Bluebird.map(elementUrls, async elementUrl => {try {const { elementObject } = await fetchRemotePlaylistElement(elementUrl)diff --git a/server/lib/activitypub/playlists/get.ts b/server/server/lib/activitypub/playlists/get.tssimilarity index 73%rename from server/lib/activitypub/playlists/get.tsrename to server/server/lib/activitypub/playlists/get.tsindex c34554d69c..645ab5cdb9 100644--- a/server/lib/activitypub/playlists/get.ts+++ b/server/server/lib/activitypub/playlists/get.ts@@ -1,10 +1,10 @@-import { VideoPlaylistModel } from '@server/models/video/video-playlist'-import { MVideoPlaylistFullSummary } from '@server/types/models'-import { APObjectId } from '@shared/models'-import { getAPId } from '../activity'-import { createOrUpdateVideoPlaylist } from './create-update'-import { scheduleRefreshIfNeeded } from './refresh'-import { fetchRemoteVideoPlaylist } from './shared'+import { VideoPlaylistModel } from '@server/models/video/video-playlist.js'+import { MVideoPlaylistFullSummary } from '@server/types/models/index.js'+import { APObjectId } from '@peertube/peertube-models'+import { getAPId } from '../activity.js'+import { createOrUpdateVideoPlaylist } from './create-update.js'+import { scheduleRefreshIfNeeded } from './refresh.js'+import { fetchRemoteVideoPlaylist } from './shared/index.js'async function getOrCreateAPVideoPlaylist (playlistObjectArg: APObjectId): Promise<MVideoPlaylistFullSummary> {const playlistUrl = getAPId(playlistObjectArg)diff --git a/server/server/lib/activitypub/playlists/index.ts b/server/server/lib/activitypub/playlists/index.tsnew file mode 100644index 0000000000..5c0864ab4f--- /dev/null+++ b/server/server/lib/activitypub/playlists/index.ts@@ -0,0 +1,3 @@+export * from './get.js'+export * from './create-update.js'+export * from './refresh.js'diff --git a/server/lib/activitypub/playlists/refresh.ts b/server/server/lib/activitypub/playlists/refresh.tssimilarity index 82%rename from server/lib/activitypub/playlists/refresh.tsrename to server/server/lib/activitypub/playlists/refresh.tsindex 33260ea024..033a5b64a3 100644--- a/server/lib/activitypub/playlists/refresh.ts+++ b/server/server/lib/activitypub/playlists/refresh.ts@@ -1,10 +1,10 @@-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { PeerTubeRequestError } from '@server/helpers/requests'-import { JobQueue } from '@server/lib/job-queue'-import { MVideoPlaylist, MVideoPlaylistOwner } from '@server/types/models'-import { HttpStatusCode } from '@shared/models'-import { createOrUpdateVideoPlaylist } from './create-update'-import { fetchRemoteVideoPlaylist } from './shared'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { PeerTubeRequestError } from '@server/helpers/requests.js'+import { JobQueue } from '@server/lib/job-queue/index.js'+import { MVideoPlaylist, MVideoPlaylistOwner } from '@server/types/models/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { createOrUpdateVideoPlaylist } from './create-update.js'+import { fetchRemoteVideoPlaylist } from './shared/index.js'function scheduleRefreshIfNeeded (playlist: MVideoPlaylist) {if (!playlist.isOutdated()) returndiff --git a/server/server/lib/activitypub/playlists/shared/index.ts b/server/server/lib/activitypub/playlists/shared/index.tsnew file mode 100644index 0000000000..af333ce18f--- /dev/null+++ b/server/server/lib/activitypub/playlists/shared/index.ts@@ -0,0 +1,2 @@+export * from './object-to-model-attributes.js'+export * from './url-to-object.js'diff --git a/server/lib/activitypub/playlists/shared/object-to-model-attributes.ts b/server/server/lib/activitypub/playlists/shared/object-to-model-attributes.tssimilarity index 85%rename from server/lib/activitypub/playlists/shared/object-to-model-attributes.tsrename to server/server/lib/activitypub/playlists/shared/object-to-model-attributes.tsindex 753b5e6603..1964e04dfc 100644--- a/server/lib/activitypub/playlists/shared/object-to-model-attributes.ts+++ b/server/server/lib/activitypub/playlists/shared/object-to-model-attributes.ts@@ -1,9 +1,9 @@-import { ACTIVITY_PUB } from '@server/initializers/constants'-import { VideoPlaylistModel } from '@server/models/video/video-playlist'-import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'-import { MVideoId, MVideoPlaylistId } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { PlaylistElementObject, PlaylistObject, VideoPlaylistPrivacy } from '@shared/models'+import { ACTIVITY_PUB } from '@server/initializers/constants.js'+import { VideoPlaylistModel } from '@server/models/video/video-playlist.js'+import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element.js'+import { MVideoId, MVideoPlaylistId } from '@server/types/models/index.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { PlaylistElementObject, PlaylistObject, VideoPlaylistPrivacy } from '@peertube/peertube-models'function playlistObjectToDBAttributes (playlistObject: PlaylistObject, to: string[]) {const privacy = to.includes(ACTIVITY_PUB.PUBLIC)diff --git a/server/lib/activitypub/playlists/shared/url-to-object.ts b/server/server/lib/activitypub/playlists/shared/url-to-object.tssimilarity index 84%rename from server/lib/activitypub/playlists/shared/url-to-object.tsrename to server/server/lib/activitypub/playlists/shared/url-to-object.tsindex fd9fe55584..3e6adbcb0e 100644--- a/server/lib/activitypub/playlists/shared/url-to-object.ts+++ b/server/server/lib/activitypub/playlists/shared/url-to-object.ts@@ -1,9 +1,9 @@-import { isPlaylistElementObjectValid, isPlaylistObjectValid } from '@server/helpers/custom-validators/activitypub/playlist'-import { isArray } from '@server/helpers/custom-validators/misc'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { PlaylistElementObject, PlaylistObject } from '@shared/models'-import { fetchAP } from '../../activity'-import { checkUrlsSameHost } from '../../url'+import { isPlaylistElementObjectValid, isPlaylistObjectValid } from '@server/helpers/custom-validators/activitypub/playlist.js'+import { isArray } from '@server/helpers/custom-validators/misc.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { PlaylistElementObject, PlaylistObject } from '@peertube/peertube-models'+import { fetchAP } from '../../activity.js'+import { checkUrlsSameHost } from '../../url.js'async function fetchRemoteVideoPlaylist (playlistUrl: string): Promise<{ statusCode: number, playlistObject: PlaylistObject }> {const lTags = loggerTagsFactory('ap', 'video-playlist', playlistUrl)diff --git a/server/server/lib/activitypub/process/index.ts b/server/server/lib/activitypub/process/index.tsnew file mode 100644index 0000000000..47160b9cb8--- /dev/null+++ b/server/server/lib/activitypub/process/index.ts@@ -0,0 +1 @@+export * from './process.js'diff --git a/server/lib/activitypub/process/process-accept.ts b/server/server/lib/activitypub/process/process-accept.tssimilarity index 87%rename from server/lib/activitypub/process/process-accept.tsrename to server/server/lib/activitypub/process/process-accept.tsindex 077b01eda8..11092caaa6 100644--- a/server/lib/activitypub/process/process-accept.ts+++ b/server/server/lib/activitypub/process/process-accept.ts@@ -1,8 +1,8 @@-import { ActivityAccept } from '../../../../shared/models/activitypub'-import { ActorFollowModel } from '../../../models/actor/actor-follow'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorDefault, MActorSignature } from '../../../types/models'-import { addFetchOutboxJob } from '../outbox'+import { ActivityAccept } from '@peertube/peertube-models'+import { ActorFollowModel } from '../../../models/actor/actor-follow.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorDefault, MActorSignature } from '../../../types/models/index.js'+import { addFetchOutboxJob } from '../outbox.js'async function processAcceptActivity (options: APProcessorOptions<ActivityAccept>) {const { byActor: targetActor, inboxActor } = optionsdiff --git a/server/lib/activitypub/process/process-announce.ts b/server/server/lib/activitypub/process/process-announce.tssimilarity index 85%rename from server/lib/activitypub/process/process-announce.tsrename to server/server/lib/activitypub/process/process-announce.tsindex 9cc87ee27a..ed178f73c7 100644--- a/server/lib/activitypub/process/process-announce.ts+++ b/server/server/lib/activitypub/process/process-announce.ts@@ -1,14 +1,14 @@-import { getAPId } from '@server/lib/activitypub/activity'-import { ActivityAnnounce } from '../../../../shared/models/activitypub'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { logger } from '../../../helpers/logger'-import { sequelizeTypescript } from '../../../initializers/database'-import { VideoShareModel } from '../../../models/video/video-share'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../types/models'-import { Notifier } from '../../notifier'-import { forwardVideoRelatedActivity } from '../send/shared/send-utils'-import { getOrCreateAPVideo } from '../videos'+import { ActivityAnnounce } from '@peertube/peertube-models'+import { getAPId } from '@server/lib/activitypub/activity.js'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { logger } from '../../../helpers/logger.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { VideoShareModel } from '../../../models/video/video-share.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../types/models/index.js'+import { Notifier } from '../../notifier/index.js'+import { forwardVideoRelatedActivity } from '../send/shared/send-utils.js'+import { getOrCreateAPVideo } from '../videos/index.js'async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) {const { activity, byActor: actorAnnouncer } = optionsdiff --git a/server/lib/activitypub/process/process-create.ts b/server/server/lib/activitypub/process/process-create.tssimilarity index 88%rename from server/lib/activitypub/process/process-create.tsrename to server/server/lib/activitypub/process/process-create.tsindex 5f980de658..7366fe935e 100644--- a/server/lib/activitypub/process/process-create.ts+++ b/server/server/lib/activitypub/process/process-create.ts@@ -1,6 +1,6 @@-import { isBlockedByServerOrAccount } from '@server/lib/blocklist'-import { isRedundancyAccepted } from '@server/lib/redundancy'-import { VideoModel } from '@server/models/video/video'+import { isBlockedByServerOrAccount } from '@server/lib/blocklist.js'+import { isRedundancyAccepted } from '@server/lib/redundancy.js'+import { VideoModel } from '@server/models/video/video.js'import {AbuseObject,ActivityCreate,@@ -11,20 +11,20 @@ import {VideoCommentObject,VideoObject,WatchActionObject-} from '@shared/models'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { logger } from '../../../helpers/logger'-import { sequelizeTypescript } from '../../../initializers/database'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../types/models'-import { Notifier } from '../../notifier'-import { fetchAPObjectIfNeeded } from '../activity'-import { createOrUpdateCacheFile } from '../cache-file'-import { createOrUpdateLocalVideoViewer } from '../local-video-viewer'-import { createOrUpdateVideoPlaylist } from '../playlists'-import { forwardVideoRelatedActivity } from '../send/shared/send-utils'-import { resolveThread } from '../video-comments'-import { getOrCreateAPVideo } from '../videos'+} from '@peertube/peertube-models'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { logger } from '../../../helpers/logger.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../types/models/index.js'+import { Notifier } from '../../notifier/index.js'+import { fetchAPObjectIfNeeded } from '../activity.js'+import { createOrUpdateCacheFile } from '../cache-file.js'+import { createOrUpdateLocalVideoViewer } from '../local-video-viewer.js'+import { createOrUpdateVideoPlaylist } from '../playlists/index.js'+import { forwardVideoRelatedActivity } from '../send/shared/send-utils.js'+import { resolveThread } from '../video-comments.js'+import { getOrCreateAPVideo } from '../videos/index.js'async function processCreateActivity (options: APProcessorOptions<ActivityCreate<ActivityCreateObject>>) {const { activity, byActor } = optionsdiff --git a/server/lib/activitypub/process/process-delete.ts b/server/server/lib/activitypub/process/process-delete.tssimilarity index 94%rename from server/lib/activitypub/process/process-delete.tsrename to server/server/lib/activitypub/process/process-delete.tsindex ac0e7e235a..932e4cf94f 100644--- a/server/lib/activitypub/process/process-delete.ts+++ b/server/server/lib/activitypub/process/process-delete.ts@@ -1,12 +1,12 @@-import { ActivityDelete } from '../../../../shared/models/activitypub'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { logger } from '../../../helpers/logger'-import { sequelizeTypescript } from '../../../initializers/database'-import { ActorModel } from '../../../models/actor/actor'-import { VideoModel } from '../../../models/video/video'-import { VideoCommentModel } from '../../../models/video/video-comment'-import { VideoPlaylistModel } from '../../../models/video/video-playlist'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'+import { ActivityDelete } from '@peertube/peertube-models'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { logger } from '../../../helpers/logger.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { ActorModel } from '../../../models/actor/actor.js'+import { VideoCommentModel } from '../../../models/video/video-comment.js'+import { VideoPlaylistModel } from '../../../models/video/video-playlist.js'+import { VideoModel } from '../../../models/video/video.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'import {MAccountActor,MActor,@@ -15,8 +15,8 @@ import {MChannelAccountActor,MChannelActor,MCommentOwnerVideo-} from '../../../types/models'-import { forwardVideoRelatedActivity } from '../send/shared/send-utils'+} from '../../../types/models/index.js'+import { forwardVideoRelatedActivity } from '../send/shared/send-utils.js'async function processDeleteActivity (options: APProcessorOptions<ActivityDelete>) {const { activity, byActor } = optionsdiff --git a/server/lib/activitypub/process/process-dislike.ts b/server/server/lib/activitypub/process/process-dislike.tssimilarity index 88%rename from server/lib/activitypub/process/process-dislike.tsrename to server/server/lib/activitypub/process/process-dislike.tsindex 4e270f9175..8040cad93b 100644--- a/server/lib/activitypub/process/process-dislike.ts+++ b/server/server/lib/activitypub/process/process-dislike.ts@@ -1,11 +1,11 @@-import { VideoModel } from '@server/models/video/video'-import { ActivityDislike } from '@shared/models'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { sequelizeTypescript } from '../../../initializers/database'-import { AccountVideoRateModel } from '../../../models/account/account-video-rate'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorSignature } from '../../../types/models'-import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos'+import { VideoModel } from '@server/models/video/video.js'+import { ActivityDislike } from '@peertube/peertube-models'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { AccountVideoRateModel } from '../../../models/account/account-video-rate.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorSignature } from '../../../types/models/index.js'+import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos/index.js'async function processDislikeActivity (options: APProcessorOptions<ActivityDislike>) {const { activity, byActor } = optionsdiff --git a/server/lib/activitypub/process/process-flag.ts b/server/server/lib/activitypub/process/process-flag.tssimilarity index 85%rename from server/lib/activitypub/process/process-flag.tsrename to server/server/lib/activitypub/process/process-flag.tsindex bea285670d..348eaebc2c 100644--- a/server/lib/activitypub/process/process-flag.ts+++ b/server/server/lib/activitypub/process/process-flag.ts@@ -1,15 +1,15 @@-import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@server/lib/moderation'-import { AccountModel } from '@server/models/account/account'-import { VideoModel } from '@server/models/video/video'-import { VideoCommentModel } from '@server/models/video/video-comment'-import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'-import { AbuseState, ActivityFlag } from '@shared/models'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { logger } from '../../../helpers/logger'-import { sequelizeTypescript } from '../../../initializers/database'-import { getAPId } from '../../../lib/activitypub/activity'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MAccountDefault, MActorSignature, MCommentOwnerVideo } from '../../../types/models'+import { createAccountAbuse, createVideoAbuse, createVideoCommentAbuse } from '@server/lib/moderation.js'+import { AccountModel } from '@server/models/account/account.js'+import { VideoCommentModel } from '@server/models/video/video-comment.js'+import { VideoModel } from '@server/models/video/video.js'+import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils'+import { AbuseState, ActivityFlag } from '@peertube/peertube-models'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { logger } from '../../../helpers/logger.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { getAPId } from '../../../lib/activitypub/activity.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MAccountDefault, MActorSignature, MCommentOwnerVideo } from '../../../types/models/index.js'async function processFlagActivity (options: APProcessorOptions<ActivityFlag>) {const { activity, byActor } = optionsdiff --git a/server/lib/activitypub/process/process-follow.ts b/server/server/lib/activitypub/process/process-follow.tssimilarity index 88%rename from server/lib/activitypub/process/process-follow.tsrename to server/server/lib/activitypub/process/process-follow.tsindex 7def753d52..1723080485 100644--- a/server/lib/activitypub/process/process-follow.ts+++ b/server/server/lib/activitypub/process/process-follow.ts@@ -1,20 +1,20 @@-import { Transaction } from 'sequelize/types'-import { isBlockedByServerOrAccount } from '@server/lib/blocklist'-import { AccountModel } from '@server/models/account/account'-import { getServerActor } from '@server/models/application/application'-import { ActivityFollow } from '../../../../shared/models/activitypub'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { logger } from '../../../helpers/logger'-import { CONFIG } from '../../../initializers/config'-import { sequelizeTypescript } from '../../../initializers/database'-import { getAPId } from '../../../lib/activitypub/activity'-import { ActorModel } from '../../../models/actor/actor'-import { ActorFollowModel } from '../../../models/actor/actor-follow'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorFollow, MActorFull, MActorId, MActorSignature } from '../../../types/models'-import { Notifier } from '../../notifier'-import { autoFollowBackIfNeeded } from '../follow'-import { sendAccept, sendReject } from '../send'+import { Transaction } from 'sequelize'+import { ActivityFollow } from '@peertube/peertube-models'+import { isBlockedByServerOrAccount } from '@server/lib/blocklist.js'+import { AccountModel } from '@server/models/account/account.js'+import { getServerActor } from '@server/models/application/application.js'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { logger } from '../../../helpers/logger.js'+import { CONFIG } from '../../../initializers/config.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { getAPId } from '../../../lib/activitypub/activity.js'+import { ActorFollowModel } from '../../../models/actor/actor-follow.js'+import { ActorModel } from '../../../models/actor/actor.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorFollow, MActorFull, MActorId, MActorSignature } from '../../../types/models/index.js'+import { Notifier } from '../../notifier/index.js'+import { autoFollowBackIfNeeded } from '../follow.js'+import { sendAccept, sendReject } from '../send/index.js'async function processFollowActivity (options: APProcessorOptions<ActivityFollow>) {const { activity, byActor } = optionsdiff --git a/server/lib/activitypub/process/process-like.ts b/server/server/lib/activitypub/process/process-like.tssimilarity index 85%rename from server/lib/activitypub/process/process-like.tsrename to server/server/lib/activitypub/process/process-like.tsindex 580a05bcdd..03637f9a70 100644--- a/server/lib/activitypub/process/process-like.ts+++ b/server/server/lib/activitypub/process/process-like.ts@@ -1,12 +1,12 @@-import { VideoModel } from '@server/models/video/video'-import { ActivityLike } from '../../../../shared/models/activitypub'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { sequelizeTypescript } from '../../../initializers/database'-import { getAPId } from '../../../lib/activitypub/activity'-import { AccountVideoRateModel } from '../../../models/account/account-video-rate'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorSignature } from '../../../types/models'-import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos'+import { ActivityLike } from '@peertube/peertube-models'+import { VideoModel } from '@server/models/video/video.js'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { getAPId } from '../../../lib/activitypub/activity.js'+import { AccountVideoRateModel } from '../../../models/account/account-video-rate.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorSignature } from '../../../types/models/index.js'+import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos/index.js'async function processLikeActivity (options: APProcessorOptions<ActivityLike>) {const { activity, byActor } = optionsdiff --git a/server/lib/activitypub/process/process-reject.ts b/server/server/lib/activitypub/process/process-reject.tssimilarity index 87%rename from server/lib/activitypub/process/process-reject.tsrename to server/server/lib/activitypub/process/process-reject.tsindex db7ff24d8d..76dc14489a 100644--- a/server/lib/activitypub/process/process-reject.ts+++ b/server/server/lib/activitypub/process/process-reject.ts@@ -1,8 +1,8 @@-import { ActivityReject } from '../../../../shared/models/activitypub/activity'-import { sequelizeTypescript } from '../../../initializers/database'-import { ActorFollowModel } from '../../../models/actor/actor-follow'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActor } from '../../../types/models'+import { ActivityReject } from '@peertube/peertube-models'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { ActorFollowModel } from '../../../models/actor/actor-follow.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActor } from '../../../types/models/index.js'async function processRejectActivity (options: APProcessorOptions<ActivityReject>) {const { byActor: targetActor, inboxActor } = optionsdiff --git a/server/lib/activitypub/process/process-undo.ts b/server/server/lib/activitypub/process/process-undo.tssimilarity index 93%rename from server/lib/activitypub/process/process-undo.tsrename to server/server/lib/activitypub/process/process-undo.tsindex a9d8199deb..20a167f7b2 100644--- a/server/lib/activitypub/process/process-undo.ts+++ b/server/server/lib/activitypub/process/process-undo.ts@@ -1,4 +1,3 @@-import { VideoModel } from '@server/models/video/video'import {ActivityAnnounce,ActivityCreate,@@ -8,20 +7,21 @@ import {ActivityUndo,ActivityUndoObject,CacheFileObject-} from '../../../../shared/models/activitypub'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { logger } from '../../../helpers/logger'-import { sequelizeTypescript } from '../../../initializers/database'-import { AccountVideoRateModel } from '../../../models/account/account-video-rate'-import { ActorModel } from '../../../models/actor/actor'-import { ActorFollowModel } from '../../../models/actor/actor-follow'-import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'-import { VideoShareModel } from '../../../models/video/video-share'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorSignature } from '../../../types/models'-import { fetchAPObjectIfNeeded } from '../activity'-import { forwardVideoRelatedActivity } from '../send/shared/send-utils'-import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos'+} from '@peertube/peertube-models'+import { VideoModel } from '@server/models/video/video.js'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { logger } from '../../../helpers/logger.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { AccountVideoRateModel } from '../../../models/account/account-video-rate.js'+import { ActorFollowModel } from '../../../models/actor/actor-follow.js'+import { ActorModel } from '../../../models/actor/actor.js'+import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy.js'+import { VideoShareModel } from '../../../models/video/video-share.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorSignature } from '../../../types/models/index.js'+import { fetchAPObjectIfNeeded } from '../activity.js'+import { forwardVideoRelatedActivity } from '../send/shared/send-utils.js'+import { federateVideoIfNeeded, getOrCreateAPVideo } from '../videos/index.js'async function processUndoActivity (options: APProcessorOptions<ActivityUndo<ActivityUndoObject>>) {const { activity, byActor } = optionsdiff --git a/server/lib/activitypub/process/process-update.ts b/server/server/lib/activitypub/process/process-update.tssimilarity index 80%rename from server/lib/activitypub/process/process-update.tsrename to server/server/lib/activitypub/process/process-update.tsindex 304ed9de6a..d92b347abc 100644--- a/server/lib/activitypub/process/process-update.ts+++ b/server/server/lib/activitypub/process/process-update.ts@@ -1,21 +1,26 @@-import { isRedundancyAccepted } from '@server/lib/redundancy'-import { ActivityUpdate, ActivityUpdateObject, CacheFileObject, VideoObject } from '../../../../shared/models/activitypub'-import { ActivityPubActor } from '../../../../shared/models/activitypub/activitypub-actor'-import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'-import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file'-import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { logger } from '../../../helpers/logger'-import { sequelizeTypescript } from '../../../initializers/database'-import { ActorModel } from '../../../models/actor/actor'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorFull, MActorSignature } from '../../../types/models'-import { fetchAPObjectIfNeeded } from '../activity'-import { APActorUpdater } from '../actors/updater'-import { createOrUpdateCacheFile } from '../cache-file'-import { createOrUpdateVideoPlaylist } from '../playlists'-import { forwardVideoRelatedActivity } from '../send/shared/send-utils'-import { APVideoUpdater, getOrCreateAPVideo } from '../videos'+import {+ ActivityPubActor,+ ActivityUpdate,+ ActivityUpdateObject,+ CacheFileObject,+ PlaylistObject,+ VideoObject+} from '@peertube/peertube-models'+import { isRedundancyAccepted } from '@server/lib/redundancy.js'+import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file.js'+import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos.js'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { logger } from '../../../helpers/logger.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { ActorModel } from '../../../models/actor/actor.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorFull, MActorSignature } from '../../../types/models/index.js'+import { fetchAPObjectIfNeeded } from '../activity.js'+import { APActorUpdater } from '../actors/updater.js'+import { createOrUpdateCacheFile } from '../cache-file.js'+import { createOrUpdateVideoPlaylist } from '../playlists/index.js'+import { forwardVideoRelatedActivity } from '../send/shared/send-utils.js'+import { APVideoUpdater, getOrCreateAPVideo } from '../videos/index.js'async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate<ActivityUpdateObject>>) {const { activity, byActor } = optionsdiff --git a/server/lib/activitypub/process/process-view.ts b/server/server/lib/activitypub/process/process-view.tssimilarity index 84%rename from server/lib/activitypub/process/process-view.tsrename to server/server/lib/activitypub/process/process-view.tsindex e49506d827..c96948e85b 100644--- a/server/lib/activitypub/process/process-view.ts+++ b/server/server/lib/activitypub/process/process-view.ts@@ -1,9 +1,9 @@-import { VideoViewsManager } from '@server/lib/views/video-views-manager'-import { ActivityView } from '../../../../shared/models/activitypub'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorSignature } from '../../../types/models'-import { forwardVideoRelatedActivity } from '../send/shared/send-utils'-import { getOrCreateAPVideo } from '../videos'+import { VideoViewsManager } from '@server/lib/views/video-views-manager.js'+import { ActivityView } from '@peertube/peertube-models'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorSignature } from '../../../types/models/index.js'+import { forwardVideoRelatedActivity } from '../send/shared/send-utils.js'+import { getOrCreateAPVideo } from '../videos/index.js'async function processViewActivity (options: APProcessorOptions<ActivityView>) {const { activity, byActor } = optionsdiff --git a/server/lib/activitypub/process/process.ts b/server/server/lib/activitypub/process/process.tssimilarity index 69%rename from server/lib/activitypub/process/process.tsrename to server/server/lib/activitypub/process/process.tsindex 2bc3dce03e..abc1ebf6f7 100644--- a/server/lib/activitypub/process/process.ts+++ b/server/server/lib/activitypub/process/process.ts@@ -1,23 +1,23 @@-import { StatsManager } from '@server/lib/stat-manager'-import { Activity, ActivityType } from '../../../../shared/models/activitypub'-import { logger } from '../../../helpers/logger'-import { APProcessorOptions } from '../../../types/activitypub-processor.model'-import { MActorDefault, MActorSignature } from '../../../types/models'-import { getAPId } from '../activity'-import { getOrCreateAPActor } from '../actors'-import { checkUrlsSameHost } from '../url'-import { processAcceptActivity } from './process-accept'-import { processAnnounceActivity } from './process-announce'-import { processCreateActivity } from './process-create'-import { processDeleteActivity } from './process-delete'-import { processDislikeActivity } from './process-dislike'-import { processFlagActivity } from './process-flag'-import { processFollowActivity } from './process-follow'-import { processLikeActivity } from './process-like'-import { processRejectActivity } from './process-reject'-import { processUndoActivity } from './process-undo'-import { processUpdateActivity } from './process-update'-import { processViewActivity } from './process-view'+import { StatsManager } from '@server/lib/stat-manager.js'+import { Activity, ActivityType } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { APProcessorOptions } from '../../../types/activitypub-processor.model.js'+import { MActorDefault, MActorSignature } from '../../../types/models/index.js'+import { getAPId } from '../activity.js'+import { getOrCreateAPActor } from '../actors/index.js'+import { checkUrlsSameHost } from '../url.js'+import { processAcceptActivity } from './process-accept.js'+import { processAnnounceActivity } from './process-announce.js'+import { processCreateActivity } from './process-create.js'+import { processDeleteActivity } from './process-delete.js'+import { processDislikeActivity } from './process-dislike.js'+import { processFlagActivity } from './process-flag.js'+import { processFollowActivity } from './process-follow.js'+import { processLikeActivity } from './process-like.js'+import { processRejectActivity } from './process-reject.js'+import { processUndoActivity } from './process-undo.js'+import { processUpdateActivity } from './process-update.js'+import { processViewActivity } from './process-view.js'const processActivity: { [ P in ActivityType ]: (options: APProcessorOptions<Activity>) => Promise<any> } = {Create: processCreateActivity,diff --git a/server/lib/activitypub/send/http.ts b/server/server/lib/activitypub/send/http.tssimilarity index 54%rename from server/lib/activitypub/send/http.tsrename to server/server/lib/activitypub/send/http.tsindex b461aa55d1..8d15b970d2 100644--- a/server/lib/activitypub/send/http.ts+++ b/server/server/lib/activitypub/send/http.ts@@ -1,14 +1,14 @@-import { buildDigest, signJsonLDObject } from '@server/helpers/peertube-crypto'-import { ACTIVITY_PUB, HTTP_SIGNATURE } from '@server/initializers/constants'-import { ActorModel } from '@server/models/actor/actor'-import { getServerActor } from '@server/models/application/application'-import { MActor } from '@server/types/models'-import { ContextType } from '@shared/models/activitypub/context'-import { activityPubContextify } from '../context'+import { ContextType } from '@peertube/peertube-models'+import { signAndContextify } from '@server/helpers/activity-pub-utils.js'+import { HTTP_SIGNATURE } from '@server/initializers/constants.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { getServerActor } from '@server/models/application/application.js'+import { MActor } from '@server/types/models/index.js'+import { getContextFilter } from '../context.js'type Payload <T> = { body: T, contextType: ContextType, signatureActorId?: number }-async function computeBody <T> (+export async function computeBody <T> (payload: Payload<T>): Promise<T | T & { type: 'RsaSignature2017', creator: string, created: string }> {let body = payload.body@@ -17,13 +17,13 @@ async function computeBody <T> (const actorSignature = await ActorModel.load(payload.signatureActorId)if (!actorSignature) throw new Error('Unknown signature actor id.')- body = await signAndContextify(actorSignature, payload.body, payload.contextType)+ body = await signAndContextify(actorSignature, payload.body, payload.contextType, getContextFilter())}return body}-async function buildSignedRequestOptions (options: {+export async function buildSignedRequestOptions (options: {signatureActorId?: numberhasPayload: boolean}) {@@ -48,26 +48,3 @@ async function buildSignedRequestOptions (options: {: HTTP_SIGNATURE.HEADERS_TO_SIGN_WITHOUT_PAYLOAD}}--function buildGlobalHeaders (body: any) {- return {- 'digest': buildDigest(body),- 'content-type': 'application/activity+json',- 'accept': ACTIVITY_PUB.ACCEPT_HEADER- }-}--async function signAndContextify <T> (byActor: MActor, data: T, contextType: ContextType | null) {- const activity = contextType- ? await activityPubContextify(data, contextType)- : data-- return signJsonLDObject(byActor, activity)-}--export {- buildGlobalHeaders,- computeBody,- buildSignedRequestOptions,- signAndContextify-}diff --git a/server/server/lib/activitypub/send/index.ts b/server/server/lib/activitypub/send/index.tsnew file mode 100644index 0000000000..8711cb17b2--- /dev/null+++ b/server/server/lib/activitypub/send/index.ts@@ -0,0 +1,10 @@+export * from './http.js'+export * from './send-accept.js'+export * from './send-announce.js'+export * from './send-create.js'+export * from './send-delete.js'+export * from './send-follow.js'+export * from './send-like.js'+export * from './send-reject.js'+export * from './send-undo.js'+export * from './send-update.js'diff --git a/server/lib/activitypub/send/send-accept.ts b/server/server/lib/activitypub/send/send-accept.tssimilarity index 78%rename from server/lib/activitypub/send/send-accept.tsrename to server/server/lib/activitypub/send/send-accept.tsindex 4c9bcbb0b3..8486564b8e 100644--- a/server/lib/activitypub/send/send-accept.ts+++ b/server/server/lib/activitypub/send/send-accept.ts@@ -1,9 +1,9 @@-import { ActivityAccept, ActivityFollow } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { MActor, MActorFollowActors } from '../../../types/models'-import { getLocalActorFollowAcceptActivityPubUrl } from '../url'-import { buildFollowActivity } from './send-follow'-import { unicastTo } from './shared/send-utils'+import { ActivityAccept, ActivityFollow } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { MActor, MActorFollowActors } from '../../../types/models/index.js'+import { getLocalActorFollowAcceptActivityPubUrl } from '../url.js'+import { buildFollowActivity } from './send-follow.js'+import { unicastTo } from './shared/send-utils.js'function sendAccept (actorFollow: MActorFollowActors) {const follower = actorFollow.ActorFollowerdiff --git a/server/lib/activitypub/send/send-announce.ts b/server/server/lib/activitypub/send/send-announce.tssimilarity index 79%rename from server/lib/activitypub/send/send-announce.tsrename to server/server/lib/activitypub/send/send-announce.tsindex 6c078b0475..ab7da2c86a 100644--- a/server/lib/activitypub/send/send-announce.ts+++ b/server/server/lib/activitypub/send/send-announce.ts@@ -1,11 +1,11 @@import { Transaction } from 'sequelize'-import { ActivityAnnounce, ActivityAudience } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { MActorLight, MVideo } from '../../../types/models'-import { MVideoShare } from '../../../types/models/video'-import { audiencify, getAudience } from '../audience'-import { getActorsInvolvedInVideo, getAudienceFromFollowersOf } from './shared'-import { broadcastToFollowers } from './shared/send-utils'+import { ActivityAnnounce, ActivityAudience } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { MActorLight, MVideo } from '../../../types/models/index.js'+import { MVideoShare } from '../../../types/models/video/index.js'+import { audiencify, getAudience } from '../audience.js'+import { getActorsInvolvedInVideo, getAudienceFromFollowersOf } from './shared/index.js'+import { broadcastToFollowers } from './shared/send-utils.js'async function buildAnnounceWithVideoAudience (byActor: MActorLight,diff --git a/server/lib/activitypub/send/send-create.ts b/server/server/lib/activitypub/send/send-create.tssimilarity index 97%rename from server/lib/activitypub/send/send-create.tsrename to server/server/lib/activitypub/send/send-create.tsindex 2cd4db14d1..7f9721be31 100644--- a/server/lib/activitypub/send/send-create.ts+++ b/server/server/lib/activitypub/send/send-create.ts@@ -1,5 +1,5 @@import { Transaction } from 'sequelize'-import { getServerActor } from '@server/models/application/application'+import { getServerActor } from '@server/models/application/application.js'import {ActivityAudience,ActivityCreate,@@ -8,9 +8,9 @@ import {VideoCommentObject,VideoPlaylistPrivacy,VideoPrivacy-} from '@shared/models'-import { logger, loggerTagsFactory } from '../../../helpers/logger'-import { VideoCommentModel } from '../../../models/video/video-comment'+} from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '../../../helpers/logger.js'+import { VideoCommentModel } from '../../../models/video/video-comment.js'import {MActorLight,MCommentOwnerVideo,@@ -20,8 +20,8 @@ import {MVideoPlaylistFull,MVideoRedundancyFileVideo,MVideoRedundancyStreamingPlaylistVideo-} from '../../../types/models'-import { audiencify, getAudience } from '../audience'+} from '../../../types/models/index.js'+import { audiencify, getAudience } from '../audience.js'import {broadcastToActors,broadcastToFollowers,@@ -31,7 +31,7 @@ import {sendVideoActivityToOrigin,sendVideoRelatedActivity,unicastTo-} from './shared'+} from './shared/index.js'const lTags = loggerTagsFactory('ap', 'create')diff --git a/server/lib/activitypub/send/send-delete.ts b/server/server/lib/activitypub/send/send-delete.tssimilarity index 90%rename from server/lib/activitypub/send/send-delete.tsrename to server/server/lib/activitypub/send/send-delete.tsindex 0d85d90012..2f83da15d5 100644--- a/server/lib/activitypub/send/send-delete.ts+++ b/server/server/lib/activitypub/send/send-delete.ts@@ -1,16 +1,16 @@import { Transaction } from 'sequelize'-import { getServerActor } from '@server/models/application/application'-import { ActivityAudience, ActivityDelete } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { ActorModel } from '../../../models/actor/actor'-import { VideoCommentModel } from '../../../models/video/video-comment'-import { VideoShareModel } from '../../../models/video/video-share'-import { MActorUrl } from '../../../types/models'-import { MCommentOwnerVideo, MVideoAccountLight, MVideoPlaylistFullSummary } from '../../../types/models/video'-import { audiencify } from '../audience'-import { getDeleteActivityPubUrl } from '../url'-import { getActorsInvolvedInVideo, getVideoCommentAudience } from './shared'-import { broadcastToActors, broadcastToFollowers, sendVideoRelatedActivity, unicastTo } from './shared/send-utils'+import { getServerActor } from '@server/models/application/application.js'+import { ActivityAudience, ActivityDelete } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { ActorModel } from '../../../models/actor/actor.js'+import { VideoCommentModel } from '../../../models/video/video-comment.js'+import { VideoShareModel } from '../../../models/video/video-share.js'+import { MActorUrl } from '../../../types/models/index.js'+import { MCommentOwnerVideo, MVideoAccountLight, MVideoPlaylistFullSummary } from '../../../types/models/video/index.js'+import { audiencify } from '../audience.js'+import { getDeleteActivityPubUrl } from '../url.js'+import { getActorsInvolvedInVideo, getVideoCommentAudience } from './shared/index.js'+import { broadcastToActors, broadcastToFollowers, sendVideoRelatedActivity, unicastTo } from './shared/send-utils.js'async function sendDeleteVideo (video: MVideoAccountLight, transaction: Transaction) {logger.info('Creating job to broadcast delete of video %s.', video.url)diff --git a/server/lib/activitypub/send/send-dislike.ts b/server/server/lib/activitypub/send/send-dislike.tssimilarity index 78%rename from server/lib/activitypub/send/send-dislike.tsrename to server/server/lib/activitypub/send/send-dislike.tsindex 959e74823f..0c4dcca5fd 100644--- a/server/lib/activitypub/send/send-dislike.ts+++ b/server/server/lib/activitypub/send/send-dislike.ts@@ -1,10 +1,10 @@import { Transaction } from 'sequelize'-import { ActivityAudience, ActivityDislike } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../types/models'-import { audiencify, getAudience } from '../audience'-import { getVideoDislikeActivityPubUrlByLocalActor } from '../url'-import { sendVideoActivityToOrigin } from './shared/send-utils'+import { ActivityAudience, ActivityDislike } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../types/models/index.js'+import { audiencify, getAudience } from '../audience.js'+import { getVideoDislikeActivityPubUrlByLocalActor } from '../url.js'+import { sendVideoActivityToOrigin } from './shared/send-utils.js'function sendDislike (byActor: MActor, video: MVideoAccountLight, transaction: Transaction) {logger.info('Creating job to dislike %s.', video.url)diff --git a/server/lib/activitypub/send/send-flag.ts b/server/server/lib/activitypub/send/send-flag.tssimilarity index 79%rename from server/lib/activitypub/send/send-flag.tsrename to server/server/lib/activitypub/send/send-flag.tsindex 138eb5adc8..bc9ba91e0a 100644--- a/server/lib/activitypub/send/send-flag.ts+++ b/server/server/lib/activitypub/send/send-flag.ts@@ -1,10 +1,10 @@import { Transaction } from 'sequelize'-import { ActivityAudience, ActivityFlag } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { MAbuseAP, MAccountLight, MActor } from '../../../types/models'-import { audiencify, getAudience } from '../audience'-import { getLocalAbuseActivityPubUrl } from '../url'-import { unicastTo } from './shared/send-utils'+import { ActivityAudience, ActivityFlag } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { MAbuseAP, MAccountLight, MActor } from '../../../types/models/index.js'+import { audiencify, getAudience } from '../audience.js'+import { getLocalAbuseActivityPubUrl } from '../url.js'+import { unicastTo } from './shared/send-utils.js'function sendAbuse (byActor: MActor, abuse: MAbuseAP, flaggedAccount: MAccountLight, t: Transaction) {if (!flaggedAccount.Actor.serverId) return // Local userdiff --git a/server/lib/activitypub/send/send-follow.ts b/server/server/lib/activitypub/send/send-follow.tssimilarity index 84%rename from server/lib/activitypub/send/send-follow.tsrename to server/server/lib/activitypub/send/send-follow.tsindex 57501dadb0..26ea030ce5 100644--- a/server/lib/activitypub/send/send-follow.ts+++ b/server/server/lib/activitypub/send/send-follow.ts@@ -1,8 +1,8 @@import { Transaction } from 'sequelize'-import { ActivityFollow } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { MActor, MActorFollowActors } from '../../../types/models'-import { unicastTo } from './shared/send-utils'+import { ActivityFollow } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { MActor, MActorFollowActors } from '../../../types/models/index.js'+import { unicastTo } from './shared/send-utils.js'function sendFollow (actorFollow: MActorFollowActors, t: Transaction) {const me = actorFollow.ActorFollowerdiff --git a/server/lib/activitypub/send/send-like.ts b/server/server/lib/activitypub/send/send-like.tssimilarity index 73%rename from server/lib/activitypub/send/send-like.tsrename to server/server/lib/activitypub/send/send-like.tsindex 46c9fdec9d..701c9325da 100644--- a/server/lib/activitypub/send/send-like.ts+++ b/server/server/lib/activitypub/send/send-like.ts@@ -1,10 +1,10 @@import { Transaction } from 'sequelize'-import { ActivityAudience, ActivityLike } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../types/models'-import { audiencify, getAudience } from '../audience'-import { getVideoLikeActivityPubUrlByLocalActor } from '../url'-import { sendVideoActivityToOrigin } from './shared/send-utils'+import { ActivityAudience, ActivityLike } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../types/models/index.js'+import { audiencify, getAudience } from '../audience.js'+import { getVideoLikeActivityPubUrlByLocalActor } from '../url.js'+import { sendVideoActivityToOrigin } from './shared/send-utils.js'function sendLike (byActor: MActor, video: MVideoAccountLight, transaction: Transaction) {logger.info('Creating job to like %s.', video.url)diff --git a/server/lib/activitypub/send/send-reject.ts b/server/server/lib/activitypub/send/send-reject.tssimilarity index 73%rename from server/lib/activitypub/send/send-reject.tsrename to server/server/lib/activitypub/send/send-reject.tsindex a5f8c2ecfc..4076d4d738 100644--- a/server/lib/activitypub/send/send-reject.ts+++ b/server/server/lib/activitypub/send/send-reject.ts@@ -1,9 +1,9 @@-import { ActivityFollow, ActivityReject } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { MActor } from '../../../types/models'-import { getLocalActorFollowRejectActivityPubUrl } from '../url'-import { buildFollowActivity } from './send-follow'-import { unicastTo } from './shared/send-utils'+import { ActivityFollow, ActivityReject } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { MActor } from '../../../types/models/index.js'+import { getLocalActorFollowRejectActivityPubUrl } from '../url.js'+import { buildFollowActivity } from './send-follow.js'+import { unicastTo } from './shared/send-utils.js'function sendReject (followUrl: string, follower: MActor, following: MActor) {if (!follower.serverId) { // This should never happendiff --git a/server/lib/activitypub/send/send-undo.ts b/server/server/lib/activitypub/send/send-undo.tssimilarity index 88%rename from server/lib/activitypub/send/send-undo.tsrename to server/server/lib/activitypub/send/send-undo.tsindex b0b48c9c45..6db1657348 100644--- a/server/lib/activitypub/send/send-undo.ts+++ b/server/server/lib/activitypub/send/send-undo.ts@@ -1,7 +1,7 @@import { Transaction } from 'sequelize'-import { ActivityAudience, ActivityDislike, ActivityLike, ActivityUndo, ActivityUndoObject, ContextType } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { VideoModel } from '../../../models/video/video'+import { ActivityAudience, ActivityDislike, ActivityLike, ActivityUndo, ActivityUndoObject, ContextType } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { VideoModel } from '../../../models/video/video.js'import {MActor,MActorAudience,@@ -11,15 +11,15 @@ import {MVideoAccountLight,MVideoRedundancyVideo,MVideoShare-} from '../../../types/models'-import { audiencify, getAudience } from '../audience'-import { getUndoActivityPubUrl, getVideoDislikeActivityPubUrlByLocalActor, getVideoLikeActivityPubUrlByLocalActor } from '../url'-import { buildAnnounceWithVideoAudience } from './send-announce'-import { buildCreateActivity } from './send-create'-import { buildDislikeActivity } from './send-dislike'-import { buildFollowActivity } from './send-follow'-import { buildLikeActivity } from './send-like'-import { broadcastToFollowers, sendVideoActivityToOrigin, sendVideoRelatedActivity, unicastTo } from './shared/send-utils'+} from '../../../types/models/index.js'+import { audiencify, getAudience } from '../audience.js'+import { getUndoActivityPubUrl, getVideoDislikeActivityPubUrlByLocalActor, getVideoLikeActivityPubUrlByLocalActor } from '../url.js'+import { buildAnnounceWithVideoAudience } from './send-announce.js'+import { buildCreateActivity } from './send-create.js'+import { buildDislikeActivity } from './send-dislike.js'+import { buildFollowActivity } from './send-follow.js'+import { buildLikeActivity } from './send-like.js'+import { broadcastToFollowers, sendVideoActivityToOrigin, sendVideoRelatedActivity, unicastTo } from './shared/send-utils.js'function sendUndoFollow (actorFollow: MActorFollowActors, t: Transaction) {const me = actorFollow.ActorFollowerdiff --git a/server/lib/activitypub/send/send-update.ts b/server/server/lib/activitypub/send/send-update.tssimilarity index 90%rename from server/lib/activitypub/send/send-update.tsrename to server/server/lib/activitypub/send/send-update.tsindex f3fb741c6c..f6b714c16c 100644--- a/server/lib/activitypub/send/send-update.ts+++ b/server/server/lib/activitypub/send/send-update.ts@@ -1,10 +1,10 @@import { Transaction } from 'sequelize'-import { getServerActor } from '@server/models/application/application'-import { ActivityAudience, ActivityUpdate, ActivityUpdateObject, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { AccountModel } from '../../../models/account/account'-import { VideoModel } from '../../../models/video/video'-import { VideoShareModel } from '../../../models/video/video-share'+import { getServerActor } from '@server/models/application/application.js'+import { ActivityAudience, ActivityUpdate, ActivityUpdateObject, VideoPlaylistPrivacy, VideoPrivacy } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { AccountModel } from '../../../models/account/account.js'+import { VideoModel } from '../../../models/video/video.js'+import { VideoShareModel } from '../../../models/video/video-share.js'import {MAccountDefault,MActor,@@ -13,11 +13,11 @@ import {MVideoAPLight,MVideoPlaylistFull,MVideoRedundancyVideo-} from '../../../types/models'-import { audiencify, getAudience } from '../audience'-import { getUpdateActivityPubUrl } from '../url'-import { getActorsInvolvedInVideo } from './shared'-import { broadcastToFollowers, sendVideoRelatedActivity } from './shared/send-utils'+} from '../../../types/models/index.js'+import { audiencify, getAudience } from '../audience.js'+import { getUpdateActivityPubUrl } from '../url.js'+import { getActorsInvolvedInVideo } from './shared/index.js'+import { broadcastToFollowers, sendVideoRelatedActivity } from './shared/send-utils.js'async function sendUpdateVideo (videoArg: MVideoAPLight, transaction: Transaction, overriddenByActor?: MActor) {if (!videoArg.hasPrivacyForFederation()) return undefineddiff --git a/server/lib/activitypub/send/send-view.ts b/server/server/lib/activitypub/send/send-view.tssimilarity index 81%rename from server/lib/activitypub/send/send-view.tsrename to server/server/lib/activitypub/send/send-view.tsindex bf3451603d..10cd9508f7 100644--- a/server/lib/activitypub/send/send-view.ts+++ b/server/server/lib/activitypub/send/send-view.ts@@ -1,11 +1,11 @@import { Transaction } from 'sequelize'-import { VideoViewsManager } from '@server/lib/views/video-views-manager'-import { MActorAudience, MActorLight, MVideoImmutable, MVideoUrl } from '@server/types/models'-import { ActivityAudience, ActivityView } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { audiencify, getAudience } from '../audience'-import { getLocalVideoViewActivityPubUrl } from '../url'-import { sendVideoRelatedActivity } from './shared/send-utils'+import { VideoViewsManager } from '@server/lib/views/video-views-manager.js'+import { MActorAudience, MActorLight, MVideoImmutable, MVideoUrl } from '@server/types/models/index.js'+import { ActivityAudience, ActivityView } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { audiencify, getAudience } from '../audience.js'+import { getLocalVideoViewActivityPubUrl } from '../url.js'+import { sendVideoRelatedActivity } from './shared/send-utils.js'type ViewType = 'view' | 'viewer'diff --git a/server/lib/activitypub/send/shared/audience-utils.ts b/server/server/lib/activitypub/send/shared/audience-utils.tssimilarity index 86%rename from server/lib/activitypub/send/shared/audience-utils.tsrename to server/server/lib/activitypub/send/shared/audience-utils.tsindex 2f6b0741d8..ac88c45672 100644--- a/server/lib/activitypub/send/shared/audience-utils.ts+++ b/server/server/lib/activitypub/send/shared/audience-utils.ts@@ -1,10 +1,10 @@import { Transaction } from 'sequelize'-import { ACTIVITY_PUB } from '@server/initializers/constants'-import { ActorModel } from '@server/models/actor/actor'-import { VideoModel } from '@server/models/video/video'-import { VideoShareModel } from '@server/models/video/video-share'-import { MActorFollowersUrl, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '@server/types/models'-import { ActivityAudience } from '@shared/models'+import { ACTIVITY_PUB } from '@server/initializers/constants.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { VideoModel } from '@server/models/video/video.js'+import { VideoShareModel } from '@server/models/video/video-share.js'+import { MActorFollowersUrl, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '@server/types/models/index.js'+import { ActivityAudience } from '@peertube/peertube-models'function getOriginVideoAudience (accountActor: MActorUrl, actorsInvolvedInVideo: MActorFollowersUrl[] = []): ActivityAudience {return {diff --git a/server/server/lib/activitypub/send/shared/index.ts b/server/server/lib/activitypub/send/shared/index.tsnew file mode 100644index 0000000000..25beeafbfc--- /dev/null+++ b/server/server/lib/activitypub/send/shared/index.ts@@ -0,0 +1,2 @@+export * from './audience-utils.js'+export * from './send-utils.js'diff --git a/server/lib/activitypub/send/shared/send-utils.ts b/server/server/lib/activitypub/send/shared/send-utils.tssimilarity index 94%rename from server/lib/activitypub/send/shared/send-utils.tsrename to server/server/lib/activitypub/send/shared/send-utils.tsindex 2bc1ef8f56..29e22ef586 100644--- a/server/lib/activitypub/send/shared/send-utils.ts+++ b/server/server/lib/activitypub/send/shared/send-utils.ts@@ -1,15 +1,22 @@import { Transaction } from 'sequelize'-import { ActorFollowHealthCache } from '@server/lib/actor-follow-health-cache'-import { getServerActor } from '@server/models/application/application'-import { Activity, ActivityAudience, ActivitypubHttpBroadcastPayload } from '@shared/models'-import { ContextType } from '@shared/models/activitypub/context'-import { afterCommitIfTransaction } from '../../../../helpers/database-utils'-import { logger } from '../../../../helpers/logger'-import { ActorModel } from '../../../../models/actor/actor'-import { ActorFollowModel } from '../../../../models/actor/actor-follow'-import { MActor, MActorId, MActorLight, MActorWithInboxes, MVideoAccountLight, MVideoId, MVideoImmutable } from '../../../../types/models'-import { JobQueue } from '../../../job-queue'-import { getActorsInvolvedInVideo, getAudienceFromFollowersOf, getOriginVideoAudience } from './audience-utils'+import { Activity, ActivityAudience, ActivitypubHttpBroadcastPayload, ContextType } from '@peertube/peertube-models'+import { ActorFollowHealthCache } from '@server/lib/actor-follow-health-cache.js'+import { getServerActor } from '@server/models/application/application.js'+import { afterCommitIfTransaction } from '../../../../helpers/database-utils.js'+import { logger } from '../../../../helpers/logger.js'+import { ActorFollowModel } from '../../../../models/actor/actor-follow.js'+import { ActorModel } from '../../../../models/actor/actor.js'+import {+ MActor,+ MActorId,+ MActorLight,+ MActorWithInboxes,+ MVideoAccountLight,+ MVideoId,+ MVideoImmutable+} from '../../../../types/models/index.js'+import { JobQueue } from '../../../job-queue/index.js'+import { getActorsInvolvedInVideo, getAudienceFromFollowersOf, getOriginVideoAudience } from './audience-utils.js'async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAudience) => Activity, options: {byActor: MActorLightdiff --git a/server/lib/activitypub/share.ts b/server/server/lib/activitypub/share.tssimilarity index 87%rename from server/lib/activitypub/share.tsrename to server/server/lib/activitypub/share.tsindex 792a73f2ac..b1e49861e2 100644--- a/server/lib/activitypub/share.ts+++ b/server/server/lib/activitypub/share.ts@@ -1,14 +1,14 @@-import { map } from 'bluebird'+import Bluebird from 'bluebird'import { Transaction } from 'sequelize'-import { getServerActor } from '@server/models/application/application'-import { logger, loggerTagsFactory } from '../../helpers/logger'-import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'-import { VideoShareModel } from '../../models/video/video-share'-import { MChannelActorLight, MVideo, MVideoAccountLight, MVideoId } from '../../types/models/video'-import { fetchAP, getAPId } from './activity'-import { getOrCreateAPActor } from './actors'-import { sendUndoAnnounce, sendVideoAnnounce } from './send'-import { checkUrlsSameHost, getLocalVideoAnnounceActivityPubUrl } from './url'+import { getServerActor } from '@server/models/application/application.js'+import { logger, loggerTagsFactory } from '../../helpers/logger.js'+import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants.js'+import { VideoShareModel } from '../../models/video/video-share.js'+import { MChannelActorLight, MVideo, MVideoAccountLight, MVideoId } from '../../types/models/video/index.js'+import { fetchAP, getAPId } from './activity.js'+import { getOrCreateAPActor } from './actors/index.js'+import { sendUndoAnnounce, sendVideoAnnounce } from './send/index.js'+import { checkUrlsSameHost, getLocalVideoAnnounceActivityPubUrl } from './url.js'const lTags = loggerTagsFactory('share')@@ -37,7 +37,7 @@ async function changeVideoChannelShare (}async function addVideoShares (shareUrls: string[], video: MVideoId) {- await map(shareUrls, async shareUrl => {+ await Bluebird.map(shareUrls, async shareUrl => {try {await addVideoShare(shareUrl, video)} catch (err) {diff --git a/server/lib/activitypub/url.ts b/server/server/lib/activitypub/url.tssimilarity index 97%rename from server/lib/activitypub/url.tsrename to server/server/lib/activitypub/url.tsindex 5cdac71bf0..73f6f4849a 100644--- a/server/lib/activitypub/url.ts+++ b/server/server/lib/activitypub/url.ts@@ -1,4 +1,4 @@-import { REMOTE_SCHEME, WEBSERVER } from '../../initializers/constants'+import { REMOTE_SCHEME, WEBSERVER } from '../../initializers/constants.js'import {MAbuseFull,MAbuseId,@@ -13,10 +13,10 @@ import {MVideoUrl,MVideoUUID,MVideoWithHost-} from '../../types/models'-import { MVideoFileVideoUUID } from '../../types/models/video/video-file'-import { MVideoPlaylist, MVideoPlaylistUUID } from '../../types/models/video/video-playlist'-import { MStreamingPlaylist } from '../../types/models/video/video-streaming-playlist'+} from '../../types/models/index.js'+import { MVideoFileVideoUUID } from '../../types/models/video/video-file.js'+import { MVideoPlaylist, MVideoPlaylistUUID } from '../../types/models/video/video-playlist.js'+import { MStreamingPlaylist } from '../../types/models/video/video-streaming-playlist.js'function getLocalVideoActivityPubUrl (video: MVideoUUID) {return WEBSERVER.URL + '/videos/watch/' + video.uuiddiff --git a/server/lib/activitypub/video-comments.ts b/server/server/lib/activitypub/video-comments.tssimilarity index 91%rename from server/lib/activitypub/video-comments.tsrename to server/server/lib/activitypub/video-comments.tsindex b861be5bd8..9da89ef0c3 100644--- a/server/lib/activitypub/video-comments.ts+++ b/server/server/lib/activitypub/video-comments.ts@@ -1,16 +1,15 @@-import { map } from 'bluebird'--import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments'-import { logger } from '../../helpers/logger'-import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'-import { VideoCommentModel } from '../../models/video/video-comment'-import { MComment, MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../types/models/video'-import { isRemoteVideoCommentAccepted } from '../moderation'-import { Hooks } from '../plugins/hooks'-import { fetchAP } from './activity'-import { getOrCreateAPActor } from './actors'-import { checkUrlsSameHost } from './url'-import { getOrCreateAPVideo } from './videos'+import Bluebird from 'bluebird'+import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments.js'+import { logger } from '../../helpers/logger.js'+import { ACTIVITY_PUB, CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants.js'+import { VideoCommentModel } from '../../models/video/video-comment.js'+import { MComment, MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../types/models/video/index.js'+import { isRemoteVideoCommentAccepted } from '../moderation.js'+import { Hooks } from '../plugins/hooks.js'+import { fetchAP } from './activity.js'+import { getOrCreateAPActor } from './actors/index.js'+import { checkUrlsSameHost } from './url.js'+import { getOrCreateAPVideo } from './videos/index.js'type ResolveThreadParams = {url: string@@ -21,7 +20,7 @@ type ResolveThreadParams = {type ResolveThreadResult = Promise<{ video: MVideoAccountLightBlacklistAllFiles, comment: MCommentOwnerVideo, commentCreated: boolean }>async function addVideoComments (commentUrls: string[]) {- return map(commentUrls, async commentUrl => {+ return Bluebird.map(commentUrls, async commentUrl => {try {await resolveThread({ url: commentUrl, isVideo: false })} catch (err) {diff --git a/server/lib/activitypub/video-rates.ts b/server/server/lib/activitypub/video-rates.tssimilarity index 81%rename from server/lib/activitypub/video-rates.tsrename to server/server/lib/activitypub/video-rates.tsindex 2e7920f4e2..1c0d5ec14c 100644--- a/server/lib/activitypub/video-rates.ts+++ b/server/server/lib/activitypub/video-rates.ts@@ -1,10 +1,10 @@import { Transaction } from 'sequelize'-import { VideoRateType } from '../../../shared/models/videos'-import { MAccountActor, MActorUrl, MVideoAccountLight, MVideoFullLight, MVideoId } from '../../types/models'-import { sendLike, sendUndoDislike, sendUndoLike } from './send'-import { sendDislike } from './send/send-dislike'-import { getVideoDislikeActivityPubUrlByLocalActor, getVideoLikeActivityPubUrlByLocalActor } from './url'-import { federateVideoIfNeeded } from './videos'+import { VideoRateType } from '@peertube/peertube-models'+import { MAccountActor, MActorUrl, MVideoAccountLight, MVideoFullLight, MVideoId } from '../../types/models/index.js'+import { sendLike, sendUndoDislike, sendUndoLike } from './send/index.js'+import { sendDislike } from './send/send-dislike.js'+import { getVideoDislikeActivityPubUrlByLocalActor, getVideoLikeActivityPubUrlByLocalActor } from './url.js'+import { federateVideoIfNeeded } from './videos/index.js'async function sendVideoRateChange (account: MAccountActor,diff --git a/server/lib/activitypub/videos/federate.ts b/server/server/lib/activitypub/videos/federate.tssimilarity index 77%rename from server/lib/activitypub/videos/federate.tsrename to server/server/lib/activitypub/videos/federate.tsindex d7e2511532..76b9030f10 100644--- a/server/lib/activitypub/videos/federate.ts+++ b/server/server/lib/activitypub/videos/federate.ts@@ -1,7 +1,7 @@-import { Transaction } from 'sequelize/types'-import { MVideoAP, MVideoAPLight } from '@server/types/models'-import { sendCreateVideo, sendUpdateVideo } from '../send'-import { shareVideoByServerAndChannel } from '../share'+import { Transaction } from 'sequelize'+import { MVideoAP, MVideoAPLight } from '@server/types/models/index.js'+import { sendCreateVideo, sendUpdateVideo } from '../send/index.js'+import { shareVideoByServerAndChannel } from '../share.js'async function federateVideoIfNeeded (videoArg: MVideoAPLight, isNewVideo: boolean, transaction?: Transaction) {const video = videoArg as MVideoAPdiff --git a/server/lib/activitypub/videos/get.ts b/server/server/lib/activitypub/videos/get.tssimilarity index 90%rename from server/lib/activitypub/videos/get.tsrename to server/server/lib/activitypub/videos/get.tsindex 288c506ee7..6d70a490f2 100644--- a/server/lib/activitypub/videos/get.ts+++ b/server/server/lib/activitypub/videos/get.ts@@ -1,12 +1,12 @@-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { logger } from '@server/helpers/logger'-import { JobQueue } from '@server/lib/job-queue'-import { loadVideoByUrl, VideoLoadByUrlType } from '@server/lib/model-loaders'-import { MVideoAccountLightBlacklistAllFiles, MVideoImmutable, MVideoThumbnail } from '@server/types/models'-import { APObjectId } from '@shared/models'-import { getAPId } from '../activity'-import { refreshVideoIfNeeded } from './refresh'-import { APVideoCreator, fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { logger } from '@server/helpers/logger.js'+import { JobQueue } from '@server/lib/job-queue/index.js'+import { loadVideoByUrl, VideoLoadByUrlType } from '@server/lib/model-loaders/index.js'+import { MVideoAccountLightBlacklistAllFiles, MVideoImmutable, MVideoThumbnail } from '@server/types/models/index.js'+import { APObjectId } from '@peertube/peertube-models'+import { getAPId } from '../activity.js'+import { refreshVideoIfNeeded } from './refresh.js'+import { APVideoCreator, fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared/index.js'type GetVideoResult <T> = Promise<{video: Tdiff --git a/server/server/lib/activitypub/videos/index.ts b/server/server/lib/activitypub/videos/index.tsnew file mode 100644index 0000000000..05af1431ce--- /dev/null+++ b/server/server/lib/activitypub/videos/index.ts@@ -0,0 +1,4 @@+export * from './federate.js'+export * from './get.js'+export * from './refresh.js'+export * from './updater.js'diff --git a/server/lib/activitypub/videos/refresh.ts b/server/server/lib/activitypub/videos/refresh.tssimilarity index 84%rename from server/lib/activitypub/videos/refresh.tsrename to server/server/lib/activitypub/videos/refresh.tsindex 9f952a2182..961bdf71cd 100644--- a/server/lib/activitypub/videos/refresh.ts+++ b/server/server/lib/activitypub/videos/refresh.ts@@ -1,12 +1,12 @@-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { PeerTubeRequestError } from '@server/helpers/requests'-import { VideoLoadByUrlType } from '@server/lib/model-loaders'-import { VideoModel } from '@server/models/video/video'-import { MVideoAccountLightBlacklistAllFiles, MVideoThumbnail } from '@server/types/models'-import { HttpStatusCode } from '@shared/models'-import { ActorFollowHealthCache } from '../../actor-follow-health-cache'-import { fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared'-import { APVideoUpdater } from './updater'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { PeerTubeRequestError } from '@server/helpers/requests.js'+import { VideoLoadByUrlType } from '@server/lib/model-loaders/index.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideoAccountLightBlacklistAllFiles, MVideoThumbnail } from '@server/types/models/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { ActorFollowHealthCache } from '../../actor-follow-health-cache.js'+import { fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared/index.js'+import { APVideoUpdater } from './updater.js'async function refreshVideoIfNeeded (options: {video: MVideoThumbnaildiff --git a/server/lib/activitypub/videos/shared/abstract-builder.ts b/server/server/lib/activitypub/videos/shared/abstract-builder.tssimilarity index 90%rename from server/lib/activitypub/videos/shared/abstract-builder.tsrename to server/server/lib/activitypub/videos/shared/abstract-builder.tsindex 98c2f58eb4..4397e578f0 100644--- a/server/lib/activitypub/videos/shared/abstract-builder.ts+++ b/server/server/lib/activitypub/videos/shared/abstract-builder.ts@@ -1,13 +1,14 @@-import { CreationAttributes, Transaction } from 'sequelize/types'-import { deleteAllModels, filterNonExistingModels } from '@server/helpers/database-utils'-import { logger, LoggerTagsFn } from '@server/helpers/logger'-import { updateRemoteVideoThumbnail } from '@server/lib/thumbnail'-import { setVideoTags } from '@server/lib/video'-import { StoryboardModel } from '@server/models/video/storyboard'-import { VideoCaptionModel } from '@server/models/video/video-caption'-import { VideoFileModel } from '@server/models/video/video-file'-import { VideoLiveModel } from '@server/models/video/video-live'-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'+import { CreationAttributes, Transaction } from 'sequelize'+import { ActivityTagObject, ThumbnailType, VideoObject, VideoStreamingPlaylistType_Type } from '@peertube/peertube-models'+import { deleteAllModels, filterNonExistingModels } from '@server/helpers/database-utils.js'+import { logger, LoggerTagsFn } from '@server/helpers/logger.js'+import { updateRemoteVideoThumbnail } from '@server/lib/thumbnail.js'+import { setVideoTags } from '@server/lib/video.js'+import { StoryboardModel } from '@server/models/video/storyboard.js'+import { VideoCaptionModel } from '@server/models/video/video-caption.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoLiveModel } from '@server/models/video/video-live.js'+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'import {MStreamingPlaylistFiles,MStreamingPlaylistFilesVideo,@@ -15,9 +16,8 @@ import {MVideoFile,MVideoFullLight,MVideoThumbnail-} from '@server/types/models'-import { ActivityTagObject, ThumbnailType, VideoObject, VideoStreamingPlaylistType } from '@shared/models'-import { findOwner, getOrCreateAPActor } from '../../actors'+} from '@server/types/models/index.js'+import { findOwner, getOrCreateAPActor } from '../../actors/index.js'import {getCaptionAttributesFromObject,getFileAttributesFromUrl,@@ -27,8 +27,8 @@ import {getStreamingPlaylistAttributesFromObject,getTagsFromObject,getThumbnailFromIcons-} from './object-to-model-attributes'-import { getTrackerUrls, setVideoTrackers } from './trackers'+} from './object-to-model-attributes.js'+import { getTrackerUrls, setVideoTrackers } from './trackers.js'export abstract class APVideoAbstractBuilder {protected abstract videoObject: VideoObject@@ -164,7 +164,7 @@ export abstract class APVideoAbstractBuilder {return streamingPlaylist as MStreamingPlaylistFilesVideo}- private getStreamingPlaylistFiles (oldPlaylists: MStreamingPlaylistFiles[], type: VideoStreamingPlaylistType) {+ private getStreamingPlaylistFiles (oldPlaylists: MStreamingPlaylistFiles[], type: VideoStreamingPlaylistType_Type) {const playlist = oldPlaylists.find(s => s.type === type)if (!playlist) return []diff --git a/server/lib/activitypub/videos/shared/creator.ts b/server/server/lib/activitypub/videos/shared/creator.tssimilarity index 88%rename from server/lib/activitypub/videos/shared/creator.tsrename to server/server/lib/activitypub/videos/shared/creator.tsindex e44fd0d52f..5a3a462824 100644--- a/server/lib/activitypub/videos/shared/creator.ts+++ b/server/server/lib/activitypub/videos/shared/creator.ts@@ -1,13 +1,13 @@-import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger'-import { sequelizeTypescript } from '@server/initializers/database'-import { Hooks } from '@server/lib/plugins/hooks'-import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist'-import { VideoModel } from '@server/models/video/video'-import { MVideoFullLight, MVideoThumbnail } from '@server/types/models'-import { VideoObject } from '@shared/models'-import { APVideoAbstractBuilder } from './abstract-builder'-import { getVideoAttributesFromObject } from './object-to-model-attributes'+import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideoFullLight, MVideoThumbnail } from '@server/types/models/index.js'+import { VideoObject } from '@peertube/peertube-models'+import { APVideoAbstractBuilder } from './abstract-builder.js'+import { getVideoAttributesFromObject } from './object-to-model-attributes.js'export class APVideoCreator extends APVideoAbstractBuilder {protected lTags: LoggerTagsFndiff --git a/server/server/lib/activitypub/videos/shared/index.ts b/server/server/lib/activitypub/videos/shared/index.tsnew file mode 100644index 0000000000..6792af7dab--- /dev/null+++ b/server/server/lib/activitypub/videos/shared/index.ts@@ -0,0 +1,6 @@+export * from './abstract-builder.js'+export * from './creator.js'+export * from './object-to-model-attributes.js'+export * from './trackers.js'+export * from './url-to-object.js'+export * from './video-sync-attributes.js'diff --git a/server/lib/activitypub/videos/shared/object-to-model-attributes.ts b/server/server/lib/activitypub/videos/shared/object-to-model-attributes.tssimilarity index 91%rename from server/lib/activitypub/videos/shared/object-to-model-attributes.tsrename to server/server/lib/activitypub/videos/shared/object-to-model-attributes.tsindex 6cbe72e27c..c0a9453312 100644--- a/server/lib/activitypub/videos/shared/object-to-model-attributes.ts+++ b/server/server/lib/activitypub/videos/shared/object-to-model-attributes.ts@@ -1,17 +1,4 @@-import { maxBy, minBy } from 'lodash'-import { decode as magnetUriDecode } from 'magnet-uri'-import { basename, extname } from 'path'-import { isAPVideoFileUrlMetadataObject } from '@server/helpers/custom-validators/activitypub/videos'-import { isVideoFileInfoHashValid } from '@server/helpers/custom-validators/videos'-import { logger } from '@server/helpers/logger'-import { getExtFromMimetype } from '@server/helpers/video'-import { ACTIVITY_PUB, MIMETYPES, P2P_MEDIA_LOADER_PEER_VERSION, PREVIEWS_SIZE, THUMBNAILS_SIZE } from '@server/initializers/constants'-import { generateTorrentFileName } from '@server/lib/paths'-import { VideoCaptionModel } from '@server/models/video/video-caption'-import { VideoFileModel } from '@server/models/video/video-file'-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'-import { FilteredModelAttributes } from '@server/types'-import { isStreamingPlaylist, MChannelId, MStreamingPlaylistVideo, MVideo, MVideoId } from '@server/types/models'+import { arrayify } from '@peertube/peertube-core-utils'import {ActivityHashTagObject,ActivityMagnetUrlObject,@@ -23,11 +10,25 @@ import {VideoObject,VideoPrivacy,VideoStreamingPlaylistType-} from '@shared/models'-import { getDurationFromActivityStream } from '../../activity'-import { isArray } from '@server/helpers/custom-validators/misc'-import { generateImageFilename } from '@server/helpers/image-utils'-import { arrayify } from '@shared/core-utils'+} from '@peertube/peertube-models'+import { isAPVideoFileUrlMetadataObject } from '@server/helpers/custom-validators/activitypub/videos.js'+import { isArray } from '@server/helpers/custom-validators/misc.js'+import { isVideoFileInfoHashValid } from '@server/helpers/custom-validators/videos.js'+import { generateImageFilename } from '@server/helpers/image-utils.js'+import { logger } from '@server/helpers/logger.js'+import { getExtFromMimetype } from '@server/helpers/video.js'+import { ACTIVITY_PUB, MIMETYPES, P2P_MEDIA_LOADER_PEER_VERSION, PREVIEWS_SIZE, THUMBNAILS_SIZE } from '@server/initializers/constants.js'+import { generateTorrentFileName } from '@server/lib/paths.js'+import { VideoCaptionModel } from '@server/models/video/video-caption.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'+import { FilteredModelAttributes } from '@server/types/index.js'+import { MChannelId, MStreamingPlaylistVideo, MVideo, MVideoId, isStreamingPlaylist } from '@server/types/models/index.js'+import maxBy from 'lodash-es/maxBy.js'+import minBy from 'lodash-es/minBy.js'+import { decode as magnetUriDecode } from 'magnet-uri'+import { basename, extname } from 'path'+import { getDurationFromActivityStream } from '../../activity.js'function getThumbnailFromIcons (videoObject: VideoObject) {let validIcons = videoObject.icon.filter(i => i.width > THUMBNAILS_SIZE.minWidth)diff --git a/server/lib/activitypub/videos/shared/trackers.ts b/server/server/lib/activitypub/videos/shared/trackers.tssimilarity index 65%rename from server/lib/activitypub/videos/shared/trackers.tsrename to server/server/lib/activitypub/videos/shared/trackers.tsindex 2418f45c2d..a7ce6f4adb 100644--- a/server/lib/activitypub/videos/shared/trackers.ts+++ b/server/server/lib/activitypub/videos/shared/trackers.ts@@ -1,11 +1,11 @@-import { Transaction } from 'sequelize/types'-import { isAPVideoTrackerUrlObject } from '@server/helpers/custom-validators/activitypub/videos'-import { isArray } from '@server/helpers/custom-validators/misc'-import { REMOTE_SCHEME } from '@server/initializers/constants'-import { TrackerModel } from '@server/models/server/tracker'-import { MVideo, MVideoWithHost } from '@server/types/models'-import { ActivityTrackerUrlObject, VideoObject } from '@shared/models'-import { buildRemoteVideoBaseUrl } from '../../url'+import { Transaction } from 'sequelize'+import { isAPVideoTrackerUrlObject } from '@server/helpers/custom-validators/activitypub/videos.js'+import { isArray } from '@server/helpers/custom-validators/misc.js'+import { REMOTE_SCHEME } from '@server/initializers/constants.js'+import { TrackerModel } from '@server/models/server/tracker.js'+import { MVideo, MVideoWithHost } from '@server/types/models/index.js'+import { ActivityTrackerUrlObject, VideoObject } from '@peertube/peertube-models'+import { buildRemoteVideoBaseUrl } from '../../url.js'function getTrackerUrls (object: VideoObject, video: MVideoWithHost) {let wsFound = falsediff --git a/server/lib/activitypub/videos/shared/url-to-object.ts b/server/server/lib/activitypub/videos/shared/url-to-object.tssimilarity index 78%rename from server/lib/activitypub/videos/shared/url-to-object.tsrename to server/server/lib/activitypub/videos/shared/url-to-object.tsindex 7fe008419b..f27f24971a 100644--- a/server/lib/activitypub/videos/shared/url-to-object.ts+++ b/server/server/lib/activitypub/videos/shared/url-to-object.ts@@ -1,8 +1,8 @@-import { sanitizeAndCheckVideoTorrentObject } from '@server/helpers/custom-validators/activitypub/videos'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { VideoObject } from '@shared/models'-import { fetchAP } from '../../activity'-import { checkUrlsSameHost } from '../../url'+import { sanitizeAndCheckVideoTorrentObject } from '@server/helpers/custom-validators/activitypub/videos.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { VideoObject } from '@peertube/peertube-models'+import { fetchAP } from '../../activity.js'+import { checkUrlsSameHost } from '../../url.js'const lTags = loggerTagsFactory('ap', 'video')diff --git a/server/lib/activitypub/videos/shared/video-sync-attributes.ts b/server/server/lib/activitypub/videos/shared/video-sync-attributes.tssimilarity index 81%rename from server/lib/activitypub/videos/shared/video-sync-attributes.tsrename to server/server/lib/activitypub/videos/shared/video-sync-attributes.tsindex 7fb9335598..a07f519fca 100644--- a/server/lib/activitypub/videos/shared/video-sync-attributes.ts+++ b/server/server/lib/activitypub/videos/shared/video-sync-attributes.ts@@ -1,26 +1,26 @@-import { runInReadCommittedTransaction } from '@server/helpers/database-utils'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { JobQueue } from '@server/lib/job-queue'-import { VideoModel } from '@server/models/video/video'-import { VideoCommentModel } from '@server/models/video/video-comment'-import { VideoShareModel } from '@server/models/video/video-share'-import { MVideo } from '@server/types/models'-import { ActivitypubHttpFetcherPayload, ActivityPubOrderedCollection, VideoObject } from '@shared/models'-import { fetchAP } from '../../activity'-import { crawlCollectionPage } from '../../crawl'-import { addVideoShares } from '../../share'-import { addVideoComments } from '../../video-comments'+import { ActivityPubOrderedCollection, ActivitypubHttpFetcherPayload, VideoObject } from '@peertube/peertube-models'+import { runInReadCommittedTransaction } from '@server/helpers/database-utils.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { JobQueue } from '@server/lib/job-queue/index.js'+import { VideoCommentModel } from '@server/models/video/video-comment.js'+import { VideoShareModel } from '@server/models/video/video-share.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideo } from '@server/types/models/index.js'+import { fetchAP } from '../../activity.js'+import { crawlCollectionPage } from '../../crawl.js'+import { addVideoShares } from '../../share.js'+import { addVideoComments } from '../../video-comments.js'const lTags = loggerTagsFactory('ap', 'video')-type SyncParam = {+export type SyncParam = {rates: booleanshares: booleancomments: booleanrefreshVideo?: boolean}-async function syncVideoExternalAttributes (+export async function syncVideoExternalAttributes (video: MVideo,fetchedVideo: VideoObject,syncParam: Pick<SyncParam, 'rates' | 'shares' | 'comments'>@@ -35,7 +35,7 @@ async function syncVideoExternalAttributes (await syncComments(video, fetchedVideo, syncParam.comments)}-async function updateVideoRates (video: MVideo, fetchedVideo: VideoObject) {+export async function updateVideoRates (video: MVideo, fetchedVideo: VideoObject) {const [ likes, dislikes ] = await Promise.all([getRatesCount('like', video, fetchedVideo),getRatesCount('dislike', video, fetchedVideo)@@ -48,13 +48,7 @@ async function updateVideoRates (video: MVideo, fetchedVideo: VideoObject) {}// -----------------------------------------------------------------------------export {- SyncParam,- syncVideoExternalAttributes,- updateVideoRates-}-+// Private// ---------------------------------------------------------------------------async function getRatesCount (type: 'like' | 'dislike', video: MVideo, fetchedVideo: VideoObject) {diff --git a/server/lib/activitypub/videos/updater.ts b/server/server/lib/activitypub/videos/updater.tssimilarity index 91%rename from server/lib/activitypub/videos/updater.tsrename to server/server/lib/activitypub/videos/updater.tsindex acb087895a..37bf7411ac 100644--- a/server/lib/activitypub/videos/updater.ts+++ b/server/server/lib/activitypub/videos/updater.ts@@ -1,14 +1,20 @@-import { Transaction } from 'sequelize/types'-import { resetSequelizeInstance, runInReadCommittedTransaction } from '@server/helpers/database-utils'-import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger'-import { Notifier } from '@server/lib/notifier'-import { PeerTubeSocket } from '@server/lib/peertube-socket'-import { Hooks } from '@server/lib/plugins/hooks'-import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist'-import { VideoLiveModel } from '@server/models/video/video-live'-import { MActor, MChannelAccountLight, MChannelId, MVideoAccountLightBlacklistAllFiles, MVideoFullLight } from '@server/types/models'-import { VideoObject, VideoPrivacy } from '@shared/models'-import { APVideoAbstractBuilder, getVideoAttributesFromObject, updateVideoRates } from './shared'+import { Transaction } from 'sequelize'+import { VideoObject, VideoPrivacy } from '@peertube/peertube-models'+import { resetSequelizeInstance, runInReadCommittedTransaction } from '@server/helpers/database-utils.js'+import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger.js'+import { Notifier } from '@server/lib/notifier/index.js'+import { PeerTubeSocket } from '@server/lib/peertube-socket.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist.js'+import { VideoLiveModel } from '@server/models/video/video-live.js'+import {+ MActor,+ MChannelAccountLight,+ MChannelId,+ MVideoAccountLightBlacklistAllFiles,+ MVideoFullLight+} from '@server/types/models/index.js'+import { APVideoAbstractBuilder, getVideoAttributesFromObject, updateVideoRates } from './shared/index.js'export class APVideoUpdater extends APVideoAbstractBuilder {private readonly wasPrivateVideo: booleandiff --git a/server/lib/actor-follow-health-cache.ts b/server/server/lib/actor-follow-health-cache.tssimilarity index 95%rename from server/lib/actor-follow-health-cache.tsrename to server/server/lib/actor-follow-health-cache.tsindex 34357a97a6..ec5b03d651 100644--- a/server/lib/actor-follow-health-cache.ts+++ b/server/server/lib/actor-follow-health-cache.ts@@ -1,5 +1,5 @@-import { ACTOR_FOLLOW_SCORE } from '../initializers/constants'-import { logger } from '../helpers/logger'+import { ACTOR_FOLLOW_SCORE } from '../initializers/constants.js'+import { logger } from '../helpers/logger.js'// Cache follows scores, instead of writing them too often in database// Keep data in memory, we don't really need Redis here as we don't really care to loose some scoresdiff --git a/server/lib/actor-image.ts b/server/server/lib/actor-image.tssimilarity index 86%rename from server/lib/actor-image.tsrename to server/server/lib/actor-image.tsindex e9bd148f6e..5b19a740d4 100644--- a/server/lib/actor-image.ts+++ b/server/server/lib/actor-image.ts@@ -1,4 +1,4 @@-import maxBy from 'lodash/maxBy'+import maxBy from 'lodash-es/maxBy.js'function getBiggestActorImage <T extends { width: number }> (images: T[]) {const image = maxBy(images, 'width')diff --git a/server/lib/auth/external-auth.ts b/server/server/lib/auth/external-auth.tssimilarity index 94%rename from server/lib/auth/external-auth.tsrename to server/server/lib/auth/external-auth.tsindex bc5b74257a..e1879aa013 100644--- a/server/lib/auth/external-auth.ts+++ b/server/server/lib/auth/external-auth.ts@@ -1,4 +1,3 @@-import {isUserAdminFlagsValid,isUserDisplayNameValid,@@ -6,20 +5,20 @@ import {isUserUsernameValid,isUserVideoQuotaDailyValid,isUserVideoQuotaValid-} from '@server/helpers/custom-validators/users'-import { logger } from '@server/helpers/logger'-import { generateRandomString } from '@server/helpers/utils'-import { PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME } from '@server/initializers/constants'-import { PluginManager } from '@server/lib/plugins/plugin-manager'-import { OAuthTokenModel } from '@server/models/oauth/oauth-token'-import { MUser } from '@server/types/models'+} from '@server/helpers/custom-validators/users.js'+import { logger } from '@server/helpers/logger.js'+import { generateRandomString } from '@server/helpers/utils.js'+import { PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME } from '@server/initializers/constants.js'+import { PluginManager } from '@server/lib/plugins/plugin-manager.js'+import { OAuthTokenModel } from '@server/models/oauth/oauth-token.js'+import { MUser } from '@server/types/models/index.js'import {RegisterServerAuthenticatedResult,RegisterServerAuthPassOptions,RegisterServerExternalAuthenticatedResult-} from '@server/types/plugins/register-server-auth.model'-import { UserAdminFlag, UserRole } from '@shared/models'-import { BypassLogin } from './oauth-model'+} from '@server/types/plugins/register-server-auth.model.js'+import { UserAdminFlag, UserRole } from '@peertube/peertube-models'+import { BypassLogin } from './oauth-model.js'export type ExternalUser =Pick<MUser, 'username' | 'email' | 'role' | 'adminFlags' | 'videoQuotaDaily' | 'videoQuota'> &diff --git a/server/lib/auth/oauth-model.ts b/server/server/lib/auth/oauth-model.tssimilarity index 92%rename from server/lib/auth/oauth-model.tsrename to server/server/lib/auth/oauth-model.tsindex d3a5eccd5c..26a9f89961 100644--- a/server/lib/auth/oauth-model.ts+++ b/server/server/lib/auth/oauth-model.ts@@ -1,22 +1,22 @@import express from 'express'import { AccessDeniedError } from '@node-oauth/oauth2-server'-import { PluginManager } from '@server/lib/plugins/plugin-manager'-import { AccountModel } from '@server/models/account/account'-import { AuthenticatedResultUpdaterFieldName, RegisterServerAuthenticatedResult } from '@server/types'-import { MOAuthClient } from '@server/types/models'-import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'-import { MUser, MUserDefault } from '@server/types/models/user/user'-import { pick } from '@shared/core-utils'-import { AttributesOnly } from '@shared/typescript-utils'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { OAuthClientModel } from '../../models/oauth/oauth-client'-import { OAuthTokenModel } from '../../models/oauth/oauth-token'-import { UserModel } from '../../models/user/user'-import { findAvailableLocalActorName } from '../local-actor'-import { buildUser, createUserAccountAndChannelAndPlaylist } from '../user'-import { ExternalUser } from './external-auth'-import { TokensCache } from './tokens-cache'+import { PluginManager } from '@server/lib/plugins/plugin-manager.js'+import { AccountModel } from '@server/models/account/account.js'+import { AuthenticatedResultUpdaterFieldName, RegisterServerAuthenticatedResult } from '@server/types/index.js'+import { MOAuthClient } from '@server/types/models/index.js'+import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token.js'+import { MUser, MUserDefault } from '@server/types/models/user/user.js'+import { pick } from '@peertube/peertube-core-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { OAuthClientModel } from '../../models/oauth/oauth-client.js'+import { OAuthTokenModel } from '../../models/oauth/oauth-token.js'+import { UserModel } from '../../models/user/user.js'+import { findAvailableLocalActorName } from '../local-actor.js'+import { buildUser, createUserAccountAndChannelAndPlaylist } from '../user.js'+import { ExternalUser } from './external-auth.js'+import { TokensCache } from './tokens-cache.js'type TokenInfo = {accessToken: stringdiff --git a/server/lib/auth/oauth.ts b/server/server/lib/auth/oauth.tssimilarity index 90%rename from server/lib/auth/oauth.tsrename to server/server/lib/auth/oauth.tsindex 887c4f7c94..d91bfc37a5 100644--- a/server/lib/auth/oauth.ts+++ b/server/server/lib/auth/oauth.ts@@ -8,15 +8,15 @@ import OAuth2Server, {UnauthorizedClientError,UnsupportedGrantTypeError} from '@node-oauth/oauth2-server'-import { randomBytesPromise } from '@server/helpers/core-utils'-import { isOTPValid } from '@server/helpers/otp'-import { CONFIG } from '@server/initializers/config'-import { UserRegistrationModel } from '@server/models/user/user-registration'-import { MOAuthClient } from '@server/types/models'-import { sha1 } from '@shared/extra-utils'-import { HttpStatusCode, ServerErrorCode, UserRegistrationState } from '@shared/models'-import { OTP } from '../../initializers/constants'-import { BypassLogin, getClient, getRefreshToken, getUser, revokeToken, saveToken } from './oauth-model'+import { randomBytesPromise } from '@server/helpers/core-utils.js'+import { isOTPValid } from '@server/helpers/otp.js'+import { CONFIG } from '@server/initializers/config.js'+import { UserRegistrationModel } from '@server/models/user/user-registration.js'+import { MOAuthClient } from '@server/types/models/index.js'+import { sha1 } from '@peertube/peertube-node-utils'+import { HttpStatusCode, ServerErrorCode, UserRegistrationState } from '@peertube/peertube-models'+import { OTP } from '../../initializers/constants.js'+import { BypassLogin, getAccessToken, getClient, getRefreshToken, getUser, revokeToken, saveToken } from './oauth-model.js'class MissingTwoFactorError extends Error {code = HttpStatusCode.UNAUTHORIZED_401@@ -49,7 +49,14 @@ const oAuthServer = new OAuth2Server({refreshTokenLifetime: CONFIG.OAUTH2.TOKEN_LIFETIME.REFRESH_TOKEN / 1000,// See https://github.com/oauthjs/node-oauth2-server/wiki/Model-specification for the model specifications- model: require('./oauth-model')+ model: {+ getAccessToken,+ getClient,+ getRefreshToken,+ getUser,+ revokeToken,+ saveToken+ } as any // FIXME: typings})// ---------------------------------------------------------------------------diff --git a/server/lib/auth/tokens-cache.ts b/server/server/lib/auth/tokens-cache.tssimilarity index 91%rename from server/lib/auth/tokens-cache.tsrename to server/server/lib/auth/tokens-cache.tsindex e7b12159b7..45d62bcafe 100644--- a/server/lib/auth/tokens-cache.ts+++ b/server/server/lib/auth/tokens-cache.ts@@ -1,6 +1,6 @@import { LRUCache } from 'lru-cache'-import { MOAuthTokenUser } from '@server/types/models'-import { LRU_CACHE } from '../../initializers/constants'+import { MOAuthTokenUser } from '@server/types/models/index.js'+import { LRU_CACHE } from '../../initializers/constants.js'export class TokensCache {diff --git a/server/lib/blocklist.ts b/server/server/lib/blocklist.tssimilarity index 95%rename from server/lib/blocklist.tsrename to server/server/lib/blocklist.tsindex 009e229ced..7491d92d78 100644--- a/server/lib/blocklist.ts+++ b/server/server/lib/blocklist.ts@@ -1,8 +1,8 @@-import { sequelizeTypescript } from '@server/initializers/database'-import { getServerActor } from '@server/models/application/application'-import { MAccountBlocklist, MAccountId, MAccountHost, MServerBlocklist } from '@server/types/models'-import { AccountBlocklistModel } from '../models/account/account-blocklist'-import { ServerBlocklistModel } from '../models/server/server-blocklist'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { getServerActor } from '@server/models/application/application.js'+import { MAccountBlocklist, MAccountId, MAccountHost, MServerBlocklist } from '@server/types/models/index.js'+import { AccountBlocklistModel } from '../models/account/account-blocklist.js'+import { ServerBlocklistModel } from '../models/server/server-blocklist.js'function addAccountInBlocklist (byAccountId: number, targetAccountId: number) {return sequelizeTypescript.transaction(async t => {diff --git a/server/lib/client-html.ts b/server/server/lib/client-html.tssimilarity index 93%rename from server/lib/client-html.tsrename to server/server/lib/client-html.tsindex 8e0c9e3282..f00b05fabc 100644--- a/server/lib/client-html.ts+++ b/server/server/lib/client-html.ts@@ -1,21 +1,17 @@+import { buildFileLocale, escapeHTML, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '@peertube/peertube-core-utils'+import { HTMLServerConfig, HttpStatusCode, VideoPlaylistPrivacy, VideoPrivacy } from '@peertube/peertube-models'+import { isTestOrDevInstance, root, sha256 } from '@peertube/peertube-node-utils'+import { toCompleteUUID } from '@server/helpers/custom-validators/misc.js'+import { mdToOneLinePlainText } from '@server/helpers/markdown.js'+import { ActorImageModel } from '@server/models/actor/actor-image.js'import express from 'express'-import { pathExists, readFile } from 'fs-extra'-import { truncate } from 'lodash'+import { pathExists } from 'fs-extra/esm'+import { readFile } from 'fs/promises'+import truncate from 'lodash-es/truncate.js'import { join } from 'path'import validator from 'validator'-import { isTestOrDevInstance } from '@server/helpers/core-utils'-import { toCompleteUUID } from '@server/helpers/custom-validators/misc'-import { mdToOneLinePlainText } from '@server/helpers/markdown'-import { ActorImageModel } from '@server/models/actor/actor-image'-import { root } from '@shared/core-utils'-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 { logger } from '../helpers/logger'-import { CONFIG } from '../initializers/config'+import { logger } from '../helpers/logger.js'+import { CONFIG } from '../initializers/config.js'import {ACCEPT_HEADERS,CUSTOM_HTML_TAG_COMMENTS,@@ -23,17 +19,17 @@ import {FILES_CONTENT_HASH,PLUGIN_GLOBAL_CSS_PATH,WEBSERVER-} from '../initializers/constants'-import { AccountModel } from '../models/account/account'-import { VideoModel } from '../models/video/video'-import { VideoChannelModel } from '../models/video/video-channel'-import { VideoPlaylistModel } from '../models/video/video-playlist'-import { MAccountHost, MChannelHost, MVideo, MVideoPlaylist } from '../types/models'-import { getActivityStreamDuration } from './activitypub/activity'-import { getBiggestActorImage } from './actor-image'-import { Hooks } from './plugins/hooks'-import { ServerConfigManager } from './server-config-manager'-import { isVideoInPrivateDirectory } from './video-privacy'+} from '../initializers/constants.js'+import { AccountModel } from '../models/account/account.js'+import { VideoChannelModel } from '../models/video/video-channel.js'+import { VideoPlaylistModel } from '../models/video/video-playlist.js'+import { VideoModel } from '../models/video/video.js'+import { MAccountHost, MChannelHost, MVideo, MVideoPlaylist } from '../types/models/index.js'+import { getActivityStreamDuration } from './activitypub/activity.js'+import { getBiggestActorImage } from './actor-image.js'+import { Hooks } from './plugins/hooks.js'+import { ServerConfigManager } from './server-config-manager.js'+import { isVideoInPrivateDirectory } from './video-privacy.js'type Tags = {ogType: string@@ -97,7 +93,7 @@ class ClientHtml {const videoId = toCompleteUUID(videoIdArg)// Let Angular application handle errors- if (!validator.isInt(videoId) && !validator.isUUID(videoId, 4)) {+ if (!validator.default.isInt(videoId) && !validator.default.isUUID(videoId, 4)) {res.status(HttpStatusCode.NOT_FOUND_404)return ClientHtml.getIndexHTML(req, res)}@@ -158,7 +154,7 @@ class ClientHtml {const videoPlaylistId = toCompleteUUID(videoPlaylistIdArg)// Let Angular application handle errors- if (!validator.isInt(videoPlaylistId) && !validator.isUUID(videoPlaylistId, 4)) {+ if (!validator.default.isInt(videoPlaylistId) && !validator.default.isUUID(videoPlaylistId, 4)) {res.status(HttpStatusCode.NOT_FOUND_404)return ClientHtml.getIndexHTML(req, res)}diff --git a/server/lib/emailer.ts b/server/server/lib/emailer.tssimilarity index 90%rename from server/lib/emailer.tsrename to server/server/lib/emailer.tsindex f5c3e47459..eea722d9db 100644--- a/server/lib/emailer.ts+++ b/server/server/lib/emailer.ts@@ -1,18 +1,15 @@-import { readFileSync } from 'fs-extra'-import { merge } from 'lodash'-import { createTransport, Transporter } from 'nodemailer'+import { arrayify } from '@peertube/peertube-core-utils'+import { EmailPayload, SendEmailDefaultOptions, UserRegistrationState } from '@peertube/peertube-models'+import { isTestOrDevInstance, root } from '@peertube/peertube-node-utils'+import { readFileSync } from 'fs'+import merge from 'lodash-es/merge.js'+import { Transporter, createTransport } from 'nodemailer'import { join } from 'path'-import { arrayify, root } from '@shared/core-utils'-import { EmailPayload, UserRegistrationState } from '@shared/models'-import { SendEmailDefaultOptions } from '../../shared/models/server/emailer.model'-import { isTestOrDevInstance } from '../helpers/core-utils'-import { bunyanLogger, logger } from '../helpers/logger'-import { CONFIG, isEmailEnabled } from '../initializers/config'-import { WEBSERVER } from '../initializers/constants'-import { MRegistration, MUser } from '../types/models'-import { JobQueue } from './job-queue'--const Email = require('email-templates')+import { bunyanLogger, logger } from '../helpers/logger.js'+import { CONFIG, isEmailEnabled } from '../initializers/config.js'+import { WEBSERVER } from '../initializers/constants.js'+import { MRegistration, MUser } from '../types/models/index.js'+import { JobQueue } from './job-queue/index.js'class Emailer {@@ -180,7 +177,9 @@ class Emailer {? options.from: CONFIG.INSTANCE.NAME- const email = new Email({+ const EmailTemplates = (await import('email-templates')).default++ const email = new EmailTemplates({send: true,htmlToText: {selectors: [diff --git a/server/lib/emails/abuse-new-message/html.pug b/server/server/lib/emails/abuse-new-message/html.pugsimilarity index 100%rename from server/lib/emails/abuse-new-message/html.pugrename to server/server/lib/emails/abuse-new-message/html.pugdiff --git a/server/lib/emails/abuse-state-change/html.pug b/server/server/lib/emails/abuse-state-change/html.pugsimilarity index 100%rename from server/lib/emails/abuse-state-change/html.pugrename to server/server/lib/emails/abuse-state-change/html.pugdiff --git a/server/lib/emails/account-abuse-new/html.pug b/server/server/lib/emails/account-abuse-new/html.pugsimilarity index 100%rename from server/lib/emails/account-abuse-new/html.pugrename to server/server/lib/emails/account-abuse-new/html.pugdiff --git a/server/lib/emails/common/base.pug b/server/server/lib/emails/common/base.pugsimilarity index 100%rename from server/lib/emails/common/base.pugrename to server/server/lib/emails/common/base.pugdiff --git a/server/lib/emails/common/greetings.pug b/server/server/lib/emails/common/greetings.pugsimilarity index 100%rename from server/lib/emails/common/greetings.pugrename to server/server/lib/emails/common/greetings.pugdiff --git a/server/lib/emails/common/html.pug b/server/server/lib/emails/common/html.pugsimilarity index 100%rename from server/lib/emails/common/html.pugrename to server/server/lib/emails/common/html.pugdiff --git a/server/lib/emails/common/mixins.pug b/server/server/lib/emails/common/mixins.pugsimilarity index 100%rename from server/lib/emails/common/mixins.pugrename to server/server/lib/emails/common/mixins.pugdiff --git a/server/lib/emails/contact-form/html.pug b/server/server/lib/emails/contact-form/html.pugsimilarity index 100%rename from server/lib/emails/contact-form/html.pugrename to server/server/lib/emails/contact-form/html.pugdiff --git a/server/lib/emails/follower-on-channel/html.pug b/server/server/lib/emails/follower-on-channel/html.pugsimilarity index 100%rename from server/lib/emails/follower-on-channel/html.pugrename to server/server/lib/emails/follower-on-channel/html.pugdiff --git a/server/lib/emails/password-create/html.pug b/server/server/lib/emails/password-create/html.pugsimilarity index 100%rename from server/lib/emails/password-create/html.pugrename to server/server/lib/emails/password-create/html.pugdiff --git a/server/lib/emails/password-reset/html.pug b/server/server/lib/emails/password-reset/html.pugsimilarity index 100%rename from server/lib/emails/password-reset/html.pugrename to server/server/lib/emails/password-reset/html.pugdiff --git a/server/lib/emails/peertube-version-new/html.pug b/server/server/lib/emails/peertube-version-new/html.pugsimilarity index 100%rename from server/lib/emails/peertube-version-new/html.pugrename to server/server/lib/emails/peertube-version-new/html.pugdiff --git a/server/lib/emails/plugin-version-new/html.pug b/server/server/lib/emails/plugin-version-new/html.pugsimilarity index 100%rename from server/lib/emails/plugin-version-new/html.pugrename to server/server/lib/emails/plugin-version-new/html.pugdiff --git a/server/lib/emails/user-registered/html.pug b/server/server/lib/emails/user-registered/html.pugsimilarity index 100%rename from server/lib/emails/user-registered/html.pugrename to server/server/lib/emails/user-registered/html.pugdiff --git a/server/lib/emails/user-registration-request-accepted/html.pug b/server/server/lib/emails/user-registration-request-accepted/html.pugsimilarity index 100%rename from server/lib/emails/user-registration-request-accepted/html.pugrename to server/server/lib/emails/user-registration-request-accepted/html.pugdiff --git a/server/lib/emails/user-registration-request-rejected/html.pug b/server/server/lib/emails/user-registration-request-rejected/html.pugsimilarity index 100%rename from server/lib/emails/user-registration-request-rejected/html.pugrename to server/server/lib/emails/user-registration-request-rejected/html.pugdiff --git a/server/lib/emails/user-registration-request/html.pug b/server/server/lib/emails/user-registration-request/html.pugsimilarity index 100%rename from server/lib/emails/user-registration-request/html.pugrename to server/server/lib/emails/user-registration-request/html.pugdiff --git a/server/lib/emails/verify-email/html.pug b/server/server/lib/emails/verify-email/html.pugsimilarity index 100%rename from server/lib/emails/verify-email/html.pugrename to server/server/lib/emails/verify-email/html.pugdiff --git a/server/lib/emails/video-abuse-new/html.pug b/server/server/lib/emails/video-abuse-new/html.pugsimilarity index 100%rename from server/lib/emails/video-abuse-new/html.pugrename to server/server/lib/emails/video-abuse-new/html.pugdiff --git a/server/lib/emails/video-auto-blacklist-new/html.pug b/server/server/lib/emails/video-auto-blacklist-new/html.pugsimilarity index 100%rename from server/lib/emails/video-auto-blacklist-new/html.pugrename to server/server/lib/emails/video-auto-blacklist-new/html.pugdiff --git a/server/lib/emails/video-comment-abuse-new/html.pug b/server/server/lib/emails/video-comment-abuse-new/html.pugsimilarity index 100%rename from server/lib/emails/video-comment-abuse-new/html.pugrename to server/server/lib/emails/video-comment-abuse-new/html.pugdiff --git a/server/lib/emails/video-comment-mention/html.pug b/server/server/lib/emails/video-comment-mention/html.pugsimilarity index 100%rename from server/lib/emails/video-comment-mention/html.pugrename to server/server/lib/emails/video-comment-mention/html.pugdiff --git a/server/lib/emails/video-comment-new/html.pug b/server/server/lib/emails/video-comment-new/html.pugsimilarity index 100%rename from server/lib/emails/video-comment-new/html.pugrename to server/server/lib/emails/video-comment-new/html.pugdiff --git a/server/lib/files-cache/avatar-permanent-file-cache.ts b/server/server/lib/files-cache/avatar-permanent-file-cache.tssimilarity index 77%rename from server/lib/files-cache/avatar-permanent-file-cache.tsrename to server/server/lib/files-cache/avatar-permanent-file-cache.tsindex 0c508b0636..7103e0c7f7 100644--- a/server/lib/files-cache/avatar-permanent-file-cache.ts+++ b/server/server/lib/files-cache/avatar-permanent-file-cache.ts@@ -1,8 +1,8 @@-import { CONFIG } from '@server/initializers/config'-import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'-import { ActorImageModel } from '@server/models/actor/actor-image'-import { MActorImage } from '@server/types/models'-import { AbstractPermanentFileCache } from './shared'+import { CONFIG } from '@server/initializers/config.js'+import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants.js'+import { ActorImageModel } from '@server/models/actor/actor-image.js'+import { MActorImage } from '@server/types/models/index.js'+import { AbstractPermanentFileCache } from './shared/index.js'export class AvatarPermanentFileCache extends AbstractPermanentFileCache<MActorImage> {diff --git a/server/server/lib/files-cache/index.ts b/server/server/lib/files-cache/index.tsnew file mode 100644index 0000000000..219baed52d--- /dev/null+++ b/server/server/lib/files-cache/index.ts@@ -0,0 +1,6 @@+export * from './avatar-permanent-file-cache.js'+export * from './video-miniature-permanent-file-cache.js'+export * from './video-captions-simple-file-cache.js'+export * from './video-previews-simple-file-cache.js'+export * from './video-storyboards-simple-file-cache.js'+export * from './video-torrents-simple-file-cache.js'diff --git a/server/lib/files-cache/shared/abstract-permanent-file-cache.ts b/server/server/lib/files-cache/shared/abstract-permanent-file-cache.tssimilarity index 94%rename from server/lib/files-cache/shared/abstract-permanent-file-cache.tsrename to server/server/lib/files-cache/shared/abstract-permanent-file-cache.tsindex f990e98726..f9e9878a8a 100644--- a/server/lib/files-cache/shared/abstract-permanent-file-cache.ts+++ b/server/server/lib/files-cache/shared/abstract-permanent-file-cache.ts@@ -1,11 +1,11 @@import express from 'express'import { LRUCache } from 'lru-cache'import { Model } from 'sequelize'-import { logger } from '@server/helpers/logger'-import { CachePromise } from '@server/helpers/promise-cache'-import { LRU_CACHE, STATIC_MAX_AGE } from '@server/initializers/constants'-import { downloadImageFromWorker } from '@server/lib/worker/parent-process'-import { HttpStatusCode } from '@shared/models'+import { logger } from '@server/helpers/logger.js'+import { CachePromise } from '@server/helpers/promise-cache.js'+import { LRU_CACHE, STATIC_MAX_AGE } from '@server/initializers/constants.js'+import { downloadImageFromWorker } from '@server/lib/worker/parent-process.js'+import { HttpStatusCode } from '@peertube/peertube-models'type ImageModel = {fileUrl: stringdiff --git a/server/lib/files-cache/shared/abstract-simple-file-cache.ts b/server/server/lib/files-cache/shared/abstract-simple-file-cache.tssimilarity index 91%rename from server/lib/files-cache/shared/abstract-simple-file-cache.tsrename to server/server/lib/files-cache/shared/abstract-simple-file-cache.tsindex 6fab322cdf..1dd45d221c 100644--- a/server/lib/files-cache/shared/abstract-simple-file-cache.ts+++ b/server/server/lib/files-cache/shared/abstract-simple-file-cache.ts@@ -1,5 +1,5 @@-import { remove } from 'fs-extra'-import { logger } from '../../../helpers/logger'+import { remove } from 'fs-extra/esm'+import { logger } from '../../../helpers/logger.js'import memoizee from 'memoizee'type GetFilePathResult = { isOwned: boolean, path: string, downloadName?: string } | undefineddiff --git a/server/server/lib/files-cache/shared/index.ts b/server/server/lib/files-cache/shared/index.tsnew file mode 100644index 0000000000..4dc4d8c4db--- /dev/null+++ b/server/server/lib/files-cache/shared/index.ts@@ -0,0 +1,2 @@+export * from './abstract-permanent-file-cache.js'+export * from './abstract-simple-file-cache.js'diff --git a/server/lib/files-cache/video-captions-simple-file-cache.ts b/server/server/lib/files-cache/video-captions-simple-file-cache.tssimilarity index 87%rename from server/lib/files-cache/video-captions-simple-file-cache.tsrename to server/server/lib/files-cache/video-captions-simple-file-cache.tsindex cbeeff732f..26853706e8 100644--- a/server/lib/files-cache/video-captions-simple-file-cache.ts+++ b/server/server/lib/files-cache/video-captions-simple-file-cache.ts@@ -1,11 +1,11 @@import { join } from 'path'-import { logger } from '@server/helpers/logger'-import { doRequestAndSaveToFile } from '@server/helpers/requests'-import { CONFIG } from '../../initializers/config'-import { FILES_CACHE } from '../../initializers/constants'-import { VideoModel } from '../../models/video/video'-import { VideoCaptionModel } from '../../models/video/video-caption'-import { AbstractSimpleFileCache } from './shared/abstract-simple-file-cache'+import { logger } from '@server/helpers/logger.js'+import { doRequestAndSaveToFile } from '@server/helpers/requests.js'+import { CONFIG } from '../../initializers/config.js'+import { FILES_CACHE } from '../../initializers/constants.js'+import { VideoModel } from '../../models/video/video.js'+import { VideoCaptionModel } from '../../models/video/video-caption.js'+import { AbstractSimpleFileCache } from './shared/abstract-simple-file-cache.js'class VideoCaptionsSimpleFileCache extends AbstractSimpleFileCache <string> {diff --git a/server/lib/files-cache/video-miniature-permanent-file-cache.ts b/server/server/lib/files-cache/video-miniature-permanent-file-cache.tssimilarity index 58%rename from server/lib/files-cache/video-miniature-permanent-file-cache.tsrename to server/server/lib/files-cache/video-miniature-permanent-file-cache.tsindex 35d9466f70..d3366ba437 100644--- a/server/lib/files-cache/video-miniature-permanent-file-cache.ts+++ b/server/server/lib/files-cache/video-miniature-permanent-file-cache.ts@@ -1,9 +1,9 @@-import { CONFIG } from '@server/initializers/config'-import { THUMBNAILS_SIZE } from '@server/initializers/constants'-import { ThumbnailModel } from '@server/models/video/thumbnail'-import { MThumbnail } from '@server/types/models'-import { ThumbnailType } from '@shared/models'-import { AbstractPermanentFileCache } from './shared'+import { CONFIG } from '@server/initializers/config.js'+import { THUMBNAILS_SIZE } from '@server/initializers/constants.js'+import { ThumbnailModel } from '@server/models/video/thumbnail.js'+import { MThumbnail } from '@server/types/models/index.js'+import { ThumbnailType } from '@peertube/peertube-models'+import { AbstractPermanentFileCache } from './shared/index.js'export class VideoMiniaturePermanentFileCache extends AbstractPermanentFileCache<MThumbnail> {diff --git a/server/lib/files-cache/video-previews-simple-file-cache.ts b/server/server/lib/files-cache/video-previews-simple-file-cache.tssimilarity index 82%rename from server/lib/files-cache/video-previews-simple-file-cache.tsrename to server/server/lib/files-cache/video-previews-simple-file-cache.tsindex a05e80e168..4dd0fd1483 100644--- a/server/lib/files-cache/video-previews-simple-file-cache.ts+++ b/server/server/lib/files-cache/video-previews-simple-file-cache.ts@@ -1,11 +1,11 @@import { join } from 'path'-import { FILES_CACHE } from '../../initializers/constants'-import { VideoModel } from '../../models/video/video'-import { AbstractSimpleFileCache } from './shared/abstract-simple-file-cache'-import { doRequestAndSaveToFile } from '@server/helpers/requests'-import { ThumbnailModel } from '@server/models/video/thumbnail'-import { ThumbnailType } from '@shared/models'-import { logger } from '@server/helpers/logger'+import { FILES_CACHE } from '../../initializers/constants.js'+import { VideoModel } from '../../models/video/video.js'+import { AbstractSimpleFileCache } from './shared/abstract-simple-file-cache.js'+import { doRequestAndSaveToFile } from '@server/helpers/requests.js'+import { ThumbnailModel } from '@server/models/video/thumbnail.js'+import { ThumbnailType } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'class VideoPreviewsSimpleFileCache extends AbstractSimpleFileCache <string> {diff --git a/server/lib/files-cache/video-storyboards-simple-file-cache.ts b/server/server/lib/files-cache/video-storyboards-simple-file-cache.tssimilarity index 91%rename from server/lib/files-cache/video-storyboards-simple-file-cache.tsrename to server/server/lib/files-cache/video-storyboards-simple-file-cache.tsindex 4cd96e70ce..7991b8d592 100644--- a/server/lib/files-cache/video-storyboards-simple-file-cache.ts+++ b/server/server/lib/files-cache/video-storyboards-simple-file-cache.ts@@ -1,9 +1,9 @@import { join } from 'path'-import { logger } from '@server/helpers/logger'-import { doRequestAndSaveToFile } from '@server/helpers/requests'-import { StoryboardModel } from '@server/models/video/storyboard'-import { FILES_CACHE } from '../../initializers/constants'-import { AbstractSimpleFileCache } from './shared/abstract-simple-file-cache'+import { logger } from '@server/helpers/logger.js'+import { doRequestAndSaveToFile } from '@server/helpers/requests.js'+import { StoryboardModel } from '@server/models/video/storyboard.js'+import { FILES_CACHE } from '../../initializers/constants.js'+import { AbstractSimpleFileCache } from './shared/abstract-simple-file-cache.js'class VideoStoryboardsSimpleFileCache extends AbstractSimpleFileCache <string> {diff --git a/server/lib/files-cache/video-torrents-simple-file-cache.ts b/server/server/lib/files-cache/video-torrents-simple-file-cache.tssimilarity index 83%rename from server/lib/files-cache/video-torrents-simple-file-cache.tsrename to server/server/lib/files-cache/video-torrents-simple-file-cache.tsindex 8bcd0b9bf3..5a1ef34676 100644--- a/server/lib/files-cache/video-torrents-simple-file-cache.ts+++ b/server/server/lib/files-cache/video-torrents-simple-file-cache.ts@@ -1,12 +1,12 @@import { join } from 'path'-import { logger } from '@server/helpers/logger'-import { doRequestAndSaveToFile } from '@server/helpers/requests'-import { VideoFileModel } from '@server/models/video/video-file'-import { MVideo, MVideoFile } from '@server/types/models'-import { CONFIG } from '../../initializers/config'-import { FILES_CACHE } from '../../initializers/constants'-import { VideoModel } from '../../models/video/video'-import { AbstractSimpleFileCache } from './shared/abstract-simple-file-cache'+import { logger } from '@server/helpers/logger.js'+import { doRequestAndSaveToFile } from '@server/helpers/requests.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { MVideo, MVideoFile } from '@server/types/models/index.js'+import { CONFIG } from '../../initializers/config.js'+import { FILES_CACHE } from '../../initializers/constants.js'+import { VideoModel } from '../../models/video/video.js'+import { AbstractSimpleFileCache } from './shared/abstract-simple-file-cache.js'class VideoTorrentsSimpleFileCache extends AbstractSimpleFileCache <string> {diff --git a/server/lib/hls.ts b/server/server/lib/hls.tssimilarity index 89%rename from server/lib/hls.tsrename to server/server/lib/hls.tsindex 19044d7c2a..9a53593fb3 100644--- a/server/lib/hls.ts+++ b/server/server/lib/hls.ts@@ -1,24 +1,25 @@-import { close, ensureDir, move, open, outputJSON, read, readFile, remove, stat, writeFile } from 'fs-extra'-import { flatten } from 'lodash'+import { uniqify, uuidRegex } from '@peertube/peertube-core-utils'+import { getVideoStreamDimensionsInfo } from '@peertube/peertube-ffmpeg'+import { VideoStorage } from '@peertube/peertube-models'+import { sha256 } from '@peertube/peertube-node-utils'+import { MStreamingPlaylist, MStreamingPlaylistFilesVideo, MVideo } from '@server/types/models/index.js'+import { ensureDir, move, outputJSON, remove } from 'fs-extra/esm'+import { open, readFile, stat, writeFile } from 'fs/promises'+import flatten from 'lodash-es/flatten.js'import PQueue from 'p-queue'import { basename, dirname, join } from 'path'-import { MStreamingPlaylist, MStreamingPlaylistFilesVideo, MVideo } from '@server/types/models'-import { uniqify, uuidRegex } from '@shared/core-utils'-import { sha256 } from '@shared/extra-utils'-import { getVideoStreamDimensionsInfo } from '@shared/ffmpeg'-import { VideoStorage } from '@shared/models'-import { getAudioStreamCodec, getVideoStreamCodec } from '../helpers/ffmpeg'-import { logger, loggerTagsFactory } from '../helpers/logger'-import { doRequest, doRequestAndSaveToFile } from '../helpers/requests'-import { generateRandomString } from '../helpers/utils'-import { CONFIG } from '../initializers/config'-import { P2P_MEDIA_LOADER_PEER_VERSION, REQUEST_TIMEOUTS } from '../initializers/constants'-import { sequelizeTypescript } from '../initializers/database'-import { VideoFileModel } from '../models/video/video-file'-import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'-import { storeHLSFileFromFilename } from './object-storage'-import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getHlsResolutionPlaylistFilename } from './paths'-import { VideoPathManager } from './video-path-manager'+import { getAudioStreamCodec, getVideoStreamCodec } from '../helpers/ffmpeg/index.js'+import { logger, loggerTagsFactory } from '../helpers/logger.js'+import { doRequest, doRequestAndSaveToFile } from '../helpers/requests.js'+import { generateRandomString } from '../helpers/utils.js'+import { CONFIG } from '../initializers/config.js'+import { P2P_MEDIA_LOADER_PEER_VERSION, REQUEST_TIMEOUTS } from '../initializers/constants.js'+import { sequelizeTypescript } from '../initializers/database.js'+import { VideoFileModel } from '../models/video/video-file.js'+import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist.js'+import { storeHLSFileFromFilename } from './object-storage/index.js'+import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getHlsResolutionPlaylistFilename } from './paths.js'+import { VideoPathManager } from './video-path-manager.js'const lTags = loggerTagsFactory('hls')@@ -105,7 +106,7 @@ function updateMasterHLSPlaylist (video: MVideo, playlistArg: MStreamingPlaylist}return playlist.save()- })+ }, { throwOnTimeout: true })}// ---------------------------------------------------------------------------@@ -130,11 +131,11 @@ function updateSha256VODSegments (video: MVideo, playlistArg: MStreamingPlaylistconst fd = await open(videoPath, 'r')for (const range of ranges) {const buf = Buffer.alloc(range.length)- await read(fd, buf, 0, range.length, range.offset)+ await fd.read(buf, 0, range.length, range.offset)rangeHashes[`${range.offset}-${range.offset + range.length - 1}`] = sha256(buf)}- await close(fd)+ await fd.close()const videoFilename = file.filenamejson[videoFilename] = rangeHashes@@ -156,7 +157,7 @@ function updateSha256VODSegments (video: MVideo, playlistArg: MStreamingPlaylist}return playlist.save()- })+ }, { throwOnTimeout: true })}// ---------------------------------------------------------------------------diff --git a/server/lib/internal-event-emitter.ts b/server/server/lib/internal-event-emitter.tssimilarity index 93%rename from server/lib/internal-event-emitter.tsrename to server/server/lib/internal-event-emitter.tsindex 08b46a5c36..54f192982c 100644--- a/server/lib/internal-event-emitter.ts+++ b/server/server/lib/internal-event-emitter.ts@@ -1,4 +1,4 @@-import { MChannel, MVideo } from '@server/types/models'+import { MChannel, MVideo } from '@server/types/models/index.js'import { EventEmitter } from 'events'export interface PeerTubeInternalEvents {diff --git a/server/lib/job-queue/handlers/activitypub-cleaner.ts b/server/server/lib/job-queue/handlers/activitypub-cleaner.tssimilarity index 87%rename from server/lib/job-queue/handlers/activitypub-cleaner.tsrename to server/server/lib/job-queue/handlers/activitypub-cleaner.tsindex 6ee9e2429a..7c8c68fdff 100644--- a/server/lib/job-queue/handlers/activitypub-cleaner.ts+++ b/server/server/lib/job-queue/handlers/activitypub-cleaner.ts@@ -1,22 +1,22 @@-import { map } from 'bluebird'+import Bluebird from 'bluebird'import { Job } from 'bullmq'import {isAnnounceActivityValid,isDislikeActivityValid,isLikeActivityValid-} from '@server/helpers/custom-validators/activitypub/activity'-import { sanitizeAndCheckVideoCommentObject } from '@server/helpers/custom-validators/activitypub/video-comments'-import { PeerTubeRequestError } from '@server/helpers/requests'-import { AP_CLEANER } from '@server/initializers/constants'-import { fetchAP } from '@server/lib/activitypub/activity'-import { checkUrlsSameHost } from '@server/lib/activitypub/url'-import { Redis } from '@server/lib/redis'-import { VideoModel } from '@server/models/video/video'-import { VideoCommentModel } from '@server/models/video/video-comment'-import { VideoShareModel } from '@server/models/video/video-share'-import { HttpStatusCode } from '@shared/models'-import { logger, loggerTagsFactory } from '../../../helpers/logger'-import { AccountVideoRateModel } from '../../../models/account/account-video-rate'+} from '@server/helpers/custom-validators/activitypub/activity.js'+import { sanitizeAndCheckVideoCommentObject } from '@server/helpers/custom-validators/activitypub/video-comments.js'+import { PeerTubeRequestError } from '@server/helpers/requests.js'+import { AP_CLEANER } from '@server/initializers/constants.js'+import { fetchAP } from '@server/lib/activitypub/activity.js'+import { checkUrlsSameHost } from '@server/lib/activitypub/url.js'+import { Redis } from '@server/lib/redis.js'+import { VideoCommentModel } from '@server/models/video/video-comment.js'+import { VideoShareModel } from '@server/models/video/video-share.js'+import { VideoModel } from '@server/models/video/video.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '../../../helpers/logger.js'+import { AccountVideoRateModel } from '../../../models/account/account-video-rate.js'const lTags = loggerTagsFactory('ap-cleaner')@@ -29,7 +29,7 @@ async function processActivityPubCleaner (_job: Job) {const rateUrls = await AccountVideoRateModel.listRemoteRateUrlsOfLocalVideos()const { bodyValidator, deleter, updater } = rateOptionsFactory()- await map(rateUrls, async rateUrl => {+ await Bluebird.map(rateUrls, async rateUrl => {// TODO: remove when https://github.com/mastodon/mastodon/issues/13571 is fixedif (rateUrl.includes('#')) return@@ -47,7 +47,7 @@ async function processActivityPubCleaner (_job: Job) {const shareUrls = await VideoShareModel.listRemoteShareUrlsOfLocalVideos()const { bodyValidator, deleter, updater } = shareOptionsFactory()- await map(shareUrls, async shareUrl => {+ await Bluebird.map(shareUrls, async shareUrl => {await updateObjectIfNeeded({ url: shareUrl, bodyValidator, updater, deleter })}, { concurrency: AP_CLEANER.CONCURRENCY })}@@ -56,7 +56,7 @@ async function processActivityPubCleaner (_job: Job) {const commentUrls = await VideoCommentModel.listRemoteCommentUrlsOfLocalVideos()const { bodyValidator, deleter, updater } = commentOptionsFactory()- await map(commentUrls, async commentUrl => {+ await Bluebird.map(commentUrls, async commentUrl => {await updateObjectIfNeeded({ url: commentUrl, bodyValidator, updater, deleter })}, { concurrency: AP_CLEANER.CONCURRENCY })}diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/server/lib/job-queue/handlers/activitypub-follow.tssimilarity index 83%rename from server/lib/job-queue/handlers/activitypub-follow.tsrename to server/server/lib/job-queue/handlers/activitypub-follow.tsindex a68c32ba06..a5b3a4fd46 100644--- a/server/lib/job-queue/handlers/activitypub-follow.ts+++ b/server/server/lib/job-queue/handlers/activitypub-follow.ts@@ -1,17 +1,17 @@import { Job } from 'bullmq'-import { getLocalActorFollowActivityPubUrl } from '@server/lib/activitypub/url'-import { ActivitypubFollowPayload } from '@shared/models'-import { sanitizeHost } from '../../../helpers/core-utils'-import { retryTransactionWrapper } from '../../../helpers/database-utils'-import { logger } from '../../../helpers/logger'-import { REMOTE_SCHEME, WEBSERVER } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { ActorModel } from '../../../models/actor/actor'-import { ActorFollowModel } from '../../../models/actor/actor-follow'-import { MActor, MActorFull } from '../../../types/models'-import { getOrCreateAPActor, loadActorUrlOrGetFromWebfinger } from '../../activitypub/actors'-import { sendFollow } from '../../activitypub/send'-import { Notifier } from '../../notifier'+import { getLocalActorFollowActivityPubUrl } from '@server/lib/activitypub/url.js'+import { ActivitypubFollowPayload } from '@peertube/peertube-models'+import { sanitizeHost } from '../../../helpers/core-utils.js'+import { retryTransactionWrapper } from '../../../helpers/database-utils.js'+import { logger } from '../../../helpers/logger.js'+import { REMOTE_SCHEME, WEBSERVER } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { ActorModel } from '../../../models/actor/actor.js'+import { ActorFollowModel } from '../../../models/actor/actor-follow.js'+import { MActor, MActorFull } from '../../../types/models/index.js'+import { getOrCreateAPActor, loadActorUrlOrGetFromWebfinger } from '../../activitypub/actors/index.js'+import { sendFollow } from '../../activitypub/send/index.js'+import { Notifier } from '../../notifier/index.js'async function processActivityPubFollow (job: Job) {const payload = job.data as ActivitypubFollowPayloaddiff --git a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts b/server/server/lib/job-queue/handlers/activitypub-http-broadcast.tssimilarity index 80%rename from server/lib/job-queue/handlers/activitypub-http-broadcast.tsrename to server/server/lib/job-queue/handlers/activitypub-http-broadcast.tsindex 8904d086fe..f7307c97df 100644--- a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts+++ b/server/server/lib/job-queue/handlers/activitypub-http-broadcast.ts@@ -1,9 +1,10 @@import { Job } from 'bullmq'-import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from '@server/lib/activitypub/send'-import { ActorFollowHealthCache } from '@server/lib/actor-follow-health-cache'-import { parallelHTTPBroadcastFromWorker, sequentialHTTPBroadcastFromWorker } from '@server/lib/worker/parent-process'-import { ActivitypubHttpBroadcastPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'+import { ActivitypubHttpBroadcastPayload } from '@peertube/peertube-models'+import { buildGlobalHTTPHeaders } from '@server/helpers/activity-pub-utils.js'+import { buildSignedRequestOptions, computeBody } from '@server/lib/activitypub/send/index.js'+import { ActorFollowHealthCache } from '@server/lib/actor-follow-health-cache.js'+import { parallelHTTPBroadcastFromWorker, sequentialHTTPBroadcastFromWorker } from '@server/lib/worker/parent-process.js'+import { logger } from '../../../helpers/logger.js'// Prefer using a worker thread for HTTP requests because on high load we may have to sign many requests, which can be CPU intensive@@ -44,6 +45,6 @@ async function buildRequestOptions (payload: ActivitypubHttpBroadcastPayload) {method: 'POST' as 'POST',json: body,httpSignature: httpSignatureOptions,- headers: buildGlobalHeaders(body)+ headers: buildGlobalHTTPHeaders(body)}}diff --git a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts b/server/server/lib/job-queue/handlers/activitypub-http-fetcher.tssimilarity index 74%rename from server/lib/job-queue/handlers/activitypub-http-fetcher.tsrename to server/server/lib/job-queue/handlers/activitypub-http-fetcher.tsindex b6cb3c4a69..649d236505 100644--- a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts+++ b/server/server/lib/job-queue/handlers/activitypub-http-fetcher.ts@@ -1,15 +1,15 @@import { Job } from 'bullmq'-import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { VideoModel } from '../../../models/video/video'-import { VideoCommentModel } from '../../../models/video/video-comment'-import { VideoShareModel } from '../../../models/video/video-share'-import { MVideoFullLight } from '../../../types/models'-import { crawlCollectionPage } from '../../activitypub/crawl'-import { createAccountPlaylists } from '../../activitypub/playlists'-import { processActivities } from '../../activitypub/process'-import { addVideoShares } from '../../activitypub/share'-import { addVideoComments } from '../../activitypub/video-comments'+import { ActivitypubHttpFetcherPayload, FetchType } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { VideoModel } from '../../../models/video/video.js'+import { VideoCommentModel } from '../../../models/video/video-comment.js'+import { VideoShareModel } from '../../../models/video/video-share.js'+import { MVideoFullLight } from '../../../types/models/index.js'+import { crawlCollectionPage } from '../../activitypub/crawl.js'+import { createAccountPlaylists } from '../../activitypub/playlists/index.js'+import { processActivities } from '../../activitypub/process/index.js'+import { addVideoShares } from '../../activitypub/share.js'+import { addVideoComments } from '../../activitypub/video-comments.js'async function processActivityPubHttpFetcher (job: Job) {logger.info('Processing ActivityPub fetcher in job %s.', job.id)diff --git a/server/lib/job-queue/handlers/activitypub-http-unicast.ts b/server/server/lib/job-queue/handlers/activitypub-http-unicast.tssimilarity index 69%rename from server/lib/job-queue/handlers/activitypub-http-unicast.tsrename to server/server/lib/job-queue/handlers/activitypub-http-unicast.tsindex 50fca3f94f..9b2f542f00 100644--- a/server/lib/job-queue/handlers/activitypub-http-unicast.ts+++ b/server/server/lib/job-queue/handlers/activitypub-http-unicast.ts@@ -1,9 +1,10 @@import { Job } from 'bullmq'-import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from '@server/lib/activitypub/send'-import { ActivitypubHttpUnicastPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { doRequest } from '../../../helpers/requests'-import { ActorFollowHealthCache } from '../../actor-follow-health-cache'+import { ActivitypubHttpUnicastPayload } from '@peertube/peertube-models'+import { buildGlobalHTTPHeaders } from '@server/helpers/activity-pub-utils.js'+import { buildSignedRequestOptions, computeBody } from '@server/lib/activitypub/send/index.js'+import { logger } from '../../../helpers/logger.js'+import { doRequest } from '../../../helpers/requests.js'+import { ActorFollowHealthCache } from '../../actor-follow-health-cache.js'async function processActivityPubHttpUnicast (job: Job) {logger.info('Processing ActivityPub unicast in job %s.', job.id)@@ -18,7 +19,7 @@ async function processActivityPubHttpUnicast (job: Job) {method: 'POST' as 'POST',json: body,httpSignature: httpSignatureOptions,- headers: buildGlobalHeaders(body)+ headers: buildGlobalHTTPHeaders(body)}try {diff --git a/server/lib/job-queue/handlers/activitypub-refresher.ts b/server/server/lib/job-queue/handlers/activitypub-refresher.tssimilarity index 82%rename from server/lib/job-queue/handlers/activitypub-refresher.tsrename to server/server/lib/job-queue/handlers/activitypub-refresher.tsindex 706bf17faf..ae238396e5 100644--- a/server/lib/job-queue/handlers/activitypub-refresher.ts+++ b/server/server/lib/job-queue/handlers/activitypub-refresher.ts@@ -1,12 +1,12 @@import { Job } from 'bullmq'-import { refreshVideoPlaylistIfNeeded } from '@server/lib/activitypub/playlists'-import { refreshVideoIfNeeded } from '@server/lib/activitypub/videos'-import { loadVideoByUrl } from '@server/lib/model-loaders'-import { RefreshPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { ActorModel } from '../../../models/actor/actor'-import { VideoPlaylistModel } from '../../../models/video/video-playlist'-import { refreshActorIfNeeded } from '../../activitypub/actors'+import { refreshVideoPlaylistIfNeeded } from '@server/lib/activitypub/playlists/index.js'+import { refreshVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'+import { loadVideoByUrl } from '@server/lib/model-loaders/index.js'+import { RefreshPayload } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { ActorModel } from '../../../models/actor/actor.js'+import { VideoPlaylistModel } from '../../../models/video/video-playlist.js'+import { refreshActorIfNeeded } from '../../activitypub/actors/index.js'async function refreshAPObject (job: Job) {const payload = job.data as RefreshPayloaddiff --git a/server/lib/job-queue/handlers/actor-keys.ts b/server/server/lib/job-queue/handlers/actor-keys.tssimilarity index 70%rename from server/lib/job-queue/handlers/actor-keys.tsrename to server/server/lib/job-queue/handlers/actor-keys.tsindex 27a2d431b1..40dfc6d49a 100644--- a/server/lib/job-queue/handlers/actor-keys.ts+++ b/server/server/lib/job-queue/handlers/actor-keys.ts@@ -1,8 +1,8 @@import { Job } from 'bullmq'-import { generateAndSaveActorKeys } from '@server/lib/activitypub/actors'-import { ActorModel } from '@server/models/actor/actor'-import { ActorKeysPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'+import { generateAndSaveActorKeys } from '@server/lib/activitypub/actors/index.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { ActorKeysPayload } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'async function processActorKeys (job: Job) {const payload = job.data as ActorKeysPayloaddiff --git a/server/lib/job-queue/handlers/after-video-channel-import.ts b/server/server/lib/job-queue/handlers/after-video-channel-import.tssimilarity index 90%rename from server/lib/job-queue/handlers/after-video-channel-import.tsrename to server/server/lib/job-queue/handlers/after-video-channel-import.tsindex ffdd8c5b59..91d889dcb0 100644--- a/server/lib/job-queue/handlers/after-video-channel-import.ts+++ b/server/server/lib/job-queue/handlers/after-video-channel-import.ts@@ -1,7 +1,7 @@import { Job } from 'bullmq'-import { logger } from '@server/helpers/logger'-import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'-import { AfterVideoChannelImportPayload, VideoChannelSyncState, VideoImportPreventExceptionResult } from '@shared/models'+import { logger } from '@server/helpers/logger.js'+import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync.js'+import { AfterVideoChannelImportPayload, VideoChannelSyncState, VideoImportPreventExceptionResult } from '@peertube/peertube-models'export async function processAfterVideoChannelImport (job: Job) {const payload = job.data as AfterVideoChannelImportPayloaddiff --git a/server/lib/job-queue/handlers/email.ts b/server/server/lib/job-queue/handlers/email.tssimilarity index 67%rename from server/lib/job-queue/handlers/email.tsrename to server/server/lib/job-queue/handlers/email.tsindex 567bcc076b..26b084e03d 100644--- a/server/lib/job-queue/handlers/email.ts+++ b/server/server/lib/job-queue/handlers/email.ts@@ -1,7 +1,7 @@import { Job } from 'bullmq'-import { EmailPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { Emailer } from '../../emailer'+import { EmailPayload } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { Emailer } from '../../emailer.js'async function processEmail (job: Job) {const payload = job.data as EmailPayloaddiff --git a/server/lib/job-queue/handlers/federate-video.ts b/server/server/lib/job-queue/handlers/federate-video.tssimilarity index 78%rename from server/lib/job-queue/handlers/federate-video.tsrename to server/server/lib/job-queue/handlers/federate-video.tsindex 6aac367418..270ce6cc55 100644--- a/server/lib/job-queue/handlers/federate-video.ts+++ b/server/server/lib/job-queue/handlers/federate-video.ts@@ -1,10 +1,10 @@import { Job } from 'bullmq'-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { sequelizeTypescript } from '@server/initializers/database'-import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'-import { VideoModel } from '@server/models/video/video'-import { FederateVideoPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'+import { VideoModel } from '@server/models/video/video.js'+import { FederateVideoPayload } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'function processFederateVideo (job: Job) {const payload = job.data as FederateVideoPayloaddiff --git a/server/lib/job-queue/handlers/generate-storyboard.ts b/server/server/lib/job-queue/handlers/generate-storyboard.tssimilarity index 91%rename from server/lib/job-queue/handlers/generate-storyboard.tsrename to server/server/lib/job-queue/handlers/generate-storyboard.tsindex eea20274ab..6f4d00dc5c 100644--- a/server/lib/job-queue/handlers/generate-storyboard.ts+++ b/server/server/lib/job-queue/handlers/generate-storyboard.ts@@ -1,20 +1,20 @@import { Job } from 'bullmq'import { join } from 'path'-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { getFFmpegCommandWrapperOptions } from '@server/helpers/ffmpeg'-import { generateImageFilename, getImageSize } from '@server/helpers/image-utils'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { deleteFileAndCatch } from '@server/helpers/utils'-import { CONFIG } from '@server/initializers/config'-import { STORYBOARD } from '@server/initializers/constants'-import { sequelizeTypescript } from '@server/initializers/database'-import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { StoryboardModel } from '@server/models/video/storyboard'-import { VideoModel } from '@server/models/video/video'-import { MVideo } from '@server/types/models'-import { FFmpegImage, isAudioFile } from '@shared/ffmpeg'-import { GenerateStoryboardPayload } from '@shared/models'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { getFFmpegCommandWrapperOptions } from '@server/helpers/ffmpeg/index.js'+import { generateImageFilename, getImageSize } from '@server/helpers/image-utils.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { deleteFileAndCatch } from '@server/helpers/utils.js'+import { CONFIG } from '@server/initializers/config.js'+import { STORYBOARD } from '@server/initializers/constants.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { StoryboardModel } from '@server/models/video/storyboard.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideo } from '@server/types/models/index.js'+import { FFmpegImage, isAudioFile } from '@peertube/peertube-ffmpeg'+import { GenerateStoryboardPayload } from '@peertube/peertube-models'const lTagsBase = loggerTagsFactory('storyboard')diff --git a/server/lib/job-queue/handlers/manage-video-torrent.ts b/server/server/lib/job-queue/handlers/manage-video-torrent.tssimilarity index 89%rename from server/lib/job-queue/handlers/manage-video-torrent.tsrename to server/server/lib/job-queue/handlers/manage-video-torrent.tsindex edf52de0cc..24bfc5acb9 100644--- a/server/lib/job-queue/handlers/manage-video-torrent.ts+++ b/server/server/lib/job-queue/handlers/manage-video-torrent.ts@@ -1,12 +1,12 @@import { Job } from 'bullmq'-import { extractVideo } from '@server/helpers/video'-import { createTorrentAndSetInfoHash, updateTorrentMetadata } from '@server/helpers/webtorrent'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { VideoModel } from '@server/models/video/video'-import { VideoFileModel } from '@server/models/video/video-file'-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'-import { ManageVideoTorrentPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'+import { extractVideo } from '@server/helpers/video.js'+import { createTorrentAndSetInfoHash, updateTorrentMetadata } from '@server/helpers/webtorrent.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { VideoModel } from '@server/models/video/video.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'+import { ManageVideoTorrentPayload } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'async function processManageVideoTorrent (job: Job) {const payload = job.data as ManageVideoTorrentPayloaddiff --git a/server/lib/job-queue/handlers/move-to-object-storage.ts b/server/server/lib/job-queue/handlers/move-to-object-storage.tssimilarity index 92%rename from server/lib/job-queue/handlers/move-to-object-storage.tsrename to server/server/lib/job-queue/handlers/move-to-object-storage.tsindex 9a99b67227..be30212472 100644--- a/server/lib/job-queue/handlers/move-to-object-storage.ts+++ b/server/server/lib/job-queue/handlers/move-to-object-storage.ts@@ -1,17 +1,17 @@import { Job } from 'bullmq'-import { remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'import { join } from 'path'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { updateTorrentMetadata } from '@server/helpers/webtorrent'-import { P2P_MEDIA_LOADER_PEER_VERSION } from '@server/initializers/constants'-import { storeHLSFileFromFilename, storeWebVideoFile } from '@server/lib/object-storage'-import { getHLSDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { moveToFailedMoveToObjectStorageState, moveToNextState } from '@server/lib/video-state'-import { VideoModel } from '@server/models/video/video'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoWithAllFiles } from '@server/types/models'-import { MoveObjectStoragePayload, VideoState, VideoStorage } from '@shared/models'+import { MoveObjectStoragePayload, VideoStateType, VideoStorage } from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { updateTorrentMetadata } from '@server/helpers/webtorrent.js'+import { P2P_MEDIA_LOADER_PEER_VERSION } from '@server/initializers/constants.js'+import { storeHLSFileFromFilename, storeWebVideoFile } from '@server/lib/object-storage/index.js'+import { getHLSDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { moveToFailedMoveToObjectStorageState, moveToNextState } from '@server/lib/video-state.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { VideoModel } from '@server/models/video/video.js'+import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoWithAllFiles } from '@server/types/models/index.js'const lTagsBase = loggerTagsFactory('move-object-storage')@@ -109,7 +109,7 @@ async function moveHLSFiles (video: MVideoWithAllFiles) {async function doAfterLastJob (options: {video: MVideoWithAllFiles- previousVideoState: VideoState+ previousVideoState: VideoStateTypeisNewVideo: boolean}) {const { video, previousVideoState, isNewVideo } = optionsdiff --git a/server/lib/job-queue/handlers/notify.ts b/server/server/lib/job-queue/handlers/notify.tssimilarity index 75%rename from server/lib/job-queue/handlers/notify.tsrename to server/server/lib/job-queue/handlers/notify.tsindex 83605396c3..a09f43bf85 100644--- a/server/lib/job-queue/handlers/notify.ts+++ b/server/server/lib/job-queue/handlers/notify.ts@@ -1,8 +1,8 @@import { Job } from 'bullmq'-import { Notifier } from '@server/lib/notifier'-import { VideoModel } from '@server/models/video/video'-import { NotifyPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'+import { Notifier } from '@server/lib/notifier/index.js'+import { VideoModel } from '@server/models/video/video.js'+import { NotifyPayload } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'async function processNotify (job: Job) {const payload = job.data as NotifyPayloaddiff --git a/server/lib/job-queue/handlers/transcoding-job-builder.ts b/server/server/lib/job-queue/handlers/transcoding-job-builder.tssimilarity index 77%rename from server/lib/job-queue/handlers/transcoding-job-builder.tsrename to server/server/lib/job-queue/handlers/transcoding-job-builder.tsindex 8621b109fe..9e29b86da6 100644--- a/server/lib/job-queue/handlers/transcoding-job-builder.ts+++ b/server/server/lib/job-queue/handlers/transcoding-job-builder.ts@@ -1,12 +1,12 @@import { Job } from 'bullmq'-import { createOptimizeOrMergeAudioJobs } from '@server/lib/transcoding/create-transcoding-job'-import { UserModel } from '@server/models/user/user'-import { VideoModel } from '@server/models/video/video'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { pick } from '@shared/core-utils'-import { TranscodingJobBuilderPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { JobQueue } from '../job-queue'+import { createOptimizeOrMergeAudioJobs } from '@server/lib/transcoding/create-transcoding-job.js'+import { UserModel } from '@server/models/user/user.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { VideoModel } from '@server/models/video/video.js'+import { pick } from '@peertube/peertube-core-utils'+import { TranscodingJobBuilderPayload } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'+import { JobQueue } from '../job-queue.js'async function processTranscodingJobBuilder (job: Job) {const payload = job.data as TranscodingJobBuilderPayloaddiff --git a/server/lib/job-queue/handlers/video-channel-import.ts b/server/server/lib/job-queue/handlers/video-channel-import.tssimilarity index 80%rename from server/lib/job-queue/handlers/video-channel-import.tsrename to server/server/lib/job-queue/handlers/video-channel-import.tsindex 035f88e96c..b5f87e11f9 100644--- a/server/lib/job-queue/handlers/video-channel-import.ts+++ b/server/server/lib/job-queue/handlers/video-channel-import.ts@@ -1,11 +1,11 @@import { Job } from 'bullmq'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { synchronizeChannel } from '@server/lib/sync-channel'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'-import { MChannelSync } from '@server/types/models'-import { VideoChannelImportPayload } from '@shared/models'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { synchronizeChannel } from '@server/lib/sync-channel.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync.js'+import { MChannelSync } from '@server/types/models/index.js'+import { VideoChannelImportPayload } from '@peertube/peertube-models'export async function processVideoChannelImport (job: Job) {const payload = job.data as VideoChannelImportPayloaddiff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/server/lib/job-queue/handlers/video-file-import.tssimilarity index 75%rename from server/lib/job-queue/handlers/video-file-import.tsrename to server/server/lib/job-queue/handlers/video-file-import.tsindex d221e89680..899b5dac25 100644--- a/server/lib/job-queue/handlers/video-file-import.ts+++ b/server/server/lib/job-queue/handlers/video-file-import.ts@@ -1,19 +1,20 @@import { Job } from 'bullmq'-import { copy, stat } from 'fs-extra'-import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'-import { CONFIG } from '@server/initializers/config'-import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'-import { generateWebVideoFilename } from '@server/lib/paths'-import { buildMoveToObjectStorageJob } from '@server/lib/video'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { VideoModel } from '@server/models/video/video'-import { VideoFileModel } from '@server/models/video/video-file'-import { MVideoFullLight } from '@server/types/models'-import { getLowercaseExtension } from '@shared/core-utils'-import { getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@shared/ffmpeg'-import { VideoFileImportPayload, VideoStorage } from '@shared/models'-import { logger } from '../../../helpers/logger'-import { JobQueue } from '../job-queue'+import { copy } from 'fs-extra/esm'+import { stat } from 'fs/promises'+import { VideoFileImportPayload, VideoStorage } from '@peertube/peertube-models'+import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent.js'+import { CONFIG } from '@server/initializers/config.js'+import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'+import { generateWebVideoFilename } from '@server/lib/paths.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { buildMoveToObjectStorageJob } from '@server/lib/video.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideoFullLight } from '@server/types/models/index.js'+import { getLowercaseExtension } from '@peertube/peertube-node-utils'+import { getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@peertube/peertube-ffmpeg'+import { logger } from '../../../helpers/logger.js'+import { JobQueue } from '../job-queue.js'async function processVideoFileImport (job: Job) {const payload = job.data as VideoFileImportPayloaddiff --git a/server/lib/job-queue/handlers/video-import.ts b/server/server/lib/job-queue/handlers/video-import.tssimilarity index 87%rename from server/lib/job-queue/handlers/video-import.tsrename to server/server/lib/job-queue/handlers/video-import.tsindex e5cd258d62..7d5435a3b9 100644--- a/server/lib/job-queue/handlers/video-import.ts+++ b/server/server/lib/job-queue/handlers/video-import.ts@@ -1,24 +1,9 @@import { Job } from 'bullmq'-import { move, remove, stat } from 'fs-extra'-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { YoutubeDLWrapper } from '@server/helpers/youtube-dl'-import { CONFIG } from '@server/initializers/config'-import { isPostImportVideoAccepted } from '@server/lib/moderation'-import { generateWebVideoFilename } from '@server/lib/paths'-import { Hooks } from '@server/lib/plugins/hooks'-import { ServerConfigManager } from '@server/lib/server-config-manager'-import { createOptimizeOrMergeAudioJobs } from '@server/lib/transcoding/create-transcoding-job'-import { isAbleToUploadVideo } from '@server/lib/user'-import { buildMoveToObjectStorageJob } from '@server/lib/video'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { buildNextVideoState } from '@server/lib/video-state'-import { ThumbnailModel } from '@server/models/video/thumbnail'-import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models'-import { MVideoImport, MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/types/models/video/video-import'-import { getLowercaseExtension } from '@shared/core-utils'-import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamDuration, getVideoStreamFPS, isAudioFile } from '@shared/ffmpeg'+import { move, remove } from 'fs-extra/esm'+import { stat } from 'fs/promises'import {ThumbnailType,+ ThumbnailType_Type,VideoImportPayload,VideoImportPreventExceptionResult,VideoImportState,@@ -28,19 +13,42 @@ import {VideoImportYoutubeDLPayloadType,VideoResolution,VideoState-} from '@shared/models'-import { logger } from '../../../helpers/logger'-import { getSecureTorrentName } from '../../../helpers/utils'-import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent'-import { JOB_TTL } from '../../../initializers/constants'-import { sequelizeTypescript } from '../../../initializers/database'-import { VideoModel } from '../../../models/video/video'-import { VideoFileModel } from '../../../models/video/video-file'-import { VideoImportModel } from '../../../models/video/video-import'-import { federateVideoIfNeeded } from '../../activitypub/videos'-import { Notifier } from '../../notifier'-import { generateLocalVideoMiniature } from '../../thumbnail'-import { JobQueue } from '../job-queue'+} from '@peertube/peertube-models'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { YoutubeDLWrapper } from '@server/helpers/youtube-dl/index.js'+import { CONFIG } from '@server/initializers/config.js'+import { isPostImportVideoAccepted } from '@server/lib/moderation.js'+import { generateWebVideoFilename } from '@server/lib/paths.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { ServerConfigManager } from '@server/lib/server-config-manager.js'+import { createOptimizeOrMergeAudioJobs } from '@server/lib/transcoding/create-transcoding-job.js'+import { isAbleToUploadVideo } from '@server/lib/user.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { buildNextVideoState } from '@server/lib/video-state.js'+import { buildMoveToObjectStorageJob } from '@server/lib/video.js'+import { ThumbnailModel } from '@server/models/video/thumbnail.js'+import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models/index.js'+import { MVideoImport, MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/types/models/video/video-import.js'+import { getLowercaseExtension } from '@peertube/peertube-node-utils'+import {+ ffprobePromise,+ getVideoStreamDimensionsInfo,+ getVideoStreamDuration,+ getVideoStreamFPS,+ isAudioFile+} from '@peertube/peertube-ffmpeg'+import { logger } from '../../../helpers/logger.js'+import { getSecureTorrentName } from '../../../helpers/utils.js'+import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent.js'+import { JOB_TTL } from '../../../initializers/constants.js'+import { sequelizeTypescript } from '../../../initializers/database.js'+import { VideoFileModel } from '../../../models/video/video-file.js'+import { VideoImportModel } from '../../../models/video/video-import.js'+import { VideoModel } from '../../../models/video/video.js'+import { federateVideoIfNeeded } from '../../activitypub/videos/index.js'+import { Notifier } from '../../notifier/index.js'+import { generateLocalVideoMiniature } from '../../thumbnail.js'+import { JobQueue } from '../job-queue.js'async function processVideoImport (job: Job): Promise<VideoImportPreventExceptionResult> {const payload = job.data as VideoImportPayload@@ -261,7 +269,11 @@ async function refreshVideoImportFromDB (videoImport: MVideoImportDefault, videoreturn Object.assign(videoImport, { Video: videoWithFiles })}-async function generateMiniature (videoImportWithFiles: MVideoImportDefaultFiles, videoFile: MVideoFile, thumbnailType: ThumbnailType) {+async function generateMiniature (+ videoImportWithFiles: MVideoImportDefaultFiles,+ videoFile: MVideoFile,+ thumbnailType: ThumbnailType_Type+) {// Generate miniature if the import did not created itconst needsMiniature = thumbnailType === ThumbnailType.MINIATURE? !videoImportWithFiles.Video.getMiniature()diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/server/lib/job-queue/handlers/video-live-ending.tssimilarity index 91%rename from server/lib/job-queue/handlers/video-live-ending.tsrename to server/server/lib/job-queue/handlers/video-live-ending.tsindex 070d1d7a27..0b4a4fd8be 100644--- a/server/lib/job-queue/handlers/video-live-ending.ts+++ b/server/server/lib/job-queue/handlers/video-live-ending.ts@@ -1,28 +1,29 @@import { Job } from 'bullmq'-import { readdir, remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { join } from 'path'-import { peertubeTruncate } from '@server/helpers/core-utils'-import { CONSTRAINTS_FIELDS } from '@server/initializers/constants'-import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'-import { federateVideoIfNeeded } from '@server/lib/activitypub/videos'-import { cleanupAndDestroyPermanentLive, cleanupTMPLiveFiles, cleanupUnsavedNormalLive } from '@server/lib/live'-import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getLiveReplayBaseDirectory } from '@server/lib/paths'-import { generateLocalVideoMiniature, regenerateMiniaturesIfNeeded } from '@server/lib/thumbnail'-import { generateHlsPlaylistResolutionFromTS } from '@server/lib/transcoding/hls-transcoding'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { moveToNextState } from '@server/lib/video-state'-import { VideoModel } from '@server/models/video/video'-import { VideoBlacklistModel } from '@server/models/video/video-blacklist'-import { VideoFileModel } from '@server/models/video/video-file'-import { VideoLiveModel } from '@server/models/video/video-live'-import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting'-import { VideoLiveSessionModel } from '@server/models/video/video-live-session'-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'-import { MVideo, MVideoLive, MVideoLiveSession, MVideoWithAllFiles } from '@server/types/models'-import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@shared/ffmpeg'-import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models'-import { logger, loggerTagsFactory } from '../../../helpers/logger'-import { JobQueue } from '../job-queue'+import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@peertube/peertube-models'+import { peertubeTruncate } from '@server/helpers/core-utils.js'+import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'+import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url.js'+import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'+import { cleanupAndDestroyPermanentLive, cleanupTMPLiveFiles, cleanupUnsavedNormalLive } from '@server/lib/live/index.js'+import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename, getLiveReplayBaseDirectory } from '@server/lib/paths.js'+import { generateLocalVideoMiniature, regenerateMiniaturesIfNeeded } from '@server/lib/thumbnail.js'+import { generateHlsPlaylistResolutionFromTS } from '@server/lib/transcoding/hls-transcoding.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { moveToNextState } from '@server/lib/video-state.js'+import { VideoBlacklistModel } from '@server/models/video/video-blacklist.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting.js'+import { VideoLiveSessionModel } from '@server/models/video/video-live-session.js'+import { VideoLiveModel } from '@server/models/video/video-live.js'+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideo, MVideoLive, MVideoLiveSession, MVideoWithAllFiles } from '@server/types/models/index.js'+import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@peertube/peertube-ffmpeg'+import { logger, loggerTagsFactory } from '../../../helpers/logger.js'+import { JobQueue } from '../job-queue.js'const lTags = loggerTagsFactory('live', 'job')diff --git a/server/lib/job-queue/handlers/video-redundancy.ts b/server/server/lib/job-queue/handlers/video-redundancy.tssimilarity index 75%rename from server/lib/job-queue/handlers/video-redundancy.tsrename to server/server/lib/job-queue/handlers/video-redundancy.tsindex bac99fdb79..b4c96219c9 100644--- a/server/lib/job-queue/handlers/video-redundancy.ts+++ b/server/server/lib/job-queue/handlers/video-redundancy.ts@@ -1,7 +1,7 @@import { Job } from 'bullmq'-import { VideosRedundancyScheduler } from '@server/lib/schedulers/videos-redundancy-scheduler'-import { VideoRedundancyPayload } from '@shared/models'-import { logger } from '../../../helpers/logger'+import { VideosRedundancyScheduler } from '@server/lib/schedulers/videos-redundancy-scheduler.js'+import { VideoRedundancyPayload } from '@peertube/peertube-models'+import { logger } from '../../../helpers/logger.js'async function processVideoRedundancy (job: Job) {const payload = job.data as VideoRedundancyPayloaddiff --git a/server/lib/job-queue/handlers/video-studio-edition.ts b/server/server/lib/job-queue/handlers/video-studio-edition.tssimilarity index 88%rename from server/lib/job-queue/handlers/video-studio-edition.tsrename to server/server/lib/job-queue/handlers/video-studio-edition.tsindex caf051bfa7..3ddf0fa826 100644--- a/server/lib/job-queue/handlers/video-studio-edition.ts+++ b/server/server/lib/job-queue/handlers/video-studio-edition.ts@@ -1,18 +1,18 @@import { Job } from 'bullmq'-import { remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'import { join } from 'path'-import { getFFmpegCommandWrapperOptions } from '@server/helpers/ffmpeg'-import { CONFIG } from '@server/initializers/config'-import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles'-import { isAbleToUploadVideo } from '@server/lib/user'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { approximateIntroOutroAdditionalSize, onVideoStudioEnded, safeCleanupStudioTMPFiles } from '@server/lib/video-studio'-import { UserModel } from '@server/models/user/user'-import { VideoModel } from '@server/models/video/video'-import { MVideo, MVideoFullLight } from '@server/types/models'-import { pick } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { FFmpegEdition } from '@shared/ffmpeg'+import { getFFmpegCommandWrapperOptions } from '@server/helpers/ffmpeg/index.js'+import { CONFIG } from '@server/initializers/config.js'+import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles.js'+import { isAbleToUploadVideo } from '@server/lib/user.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { approximateIntroOutroAdditionalSize, onVideoStudioEnded, safeCleanupStudioTMPFiles } from '@server/lib/video-studio.js'+import { UserModel } from '@server/models/user/user.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideo, MVideoFullLight } from '@server/types/models/index.js'+import { pick } from '@peertube/peertube-core-utils'+import { buildUUID } from '@peertube/peertube-node-utils'+import { FFmpegEdition } from '@peertube/peertube-ffmpeg'import {VideoStudioEditionPayload,VideoStudioTask,@@ -21,8 +21,8 @@ import {VideoStudioTaskOutroPayload,VideoStudioTaskPayload,VideoStudioTaskWatermarkPayload-} from '@shared/models'-import { logger, loggerTagsFactory } from '../../../helpers/logger'+} from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '../../../helpers/logger.js'const lTagsBase = loggerTagsFactory('video-studio')diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/server/lib/job-queue/handlers/video-transcoding.tssimilarity index 94%rename from server/lib/job-queue/handlers/video-transcoding.tsrename to server/server/lib/job-queue/handlers/video-transcoding.tsindex 1c8f4fd9f4..f46cf9a80d 100644--- a/server/lib/job-queue/handlers/video-transcoding.ts+++ b/server/server/lib/job-queue/handlers/video-transcoding.ts@@ -1,22 +1,22 @@import { Job } from 'bullmq'-import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding'-import { generateHlsPlaylistResolution } from '@server/lib/transcoding/hls-transcoding'-import { mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewWebVideoResolution } from '@server/lib/transcoding/web-transcoding'-import { removeAllWebVideoFiles } from '@server/lib/video-file'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { moveToFailedTranscodingState } from '@server/lib/video-state'-import { UserModel } from '@server/models/user/user'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { MUser, MUserId, MVideoFullLight } from '@server/types/models'+import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding.js'+import { generateHlsPlaylistResolution } from '@server/lib/transcoding/hls-transcoding.js'+import { mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewWebVideoResolution } from '@server/lib/transcoding/web-transcoding.js'+import { removeAllWebVideoFiles } from '@server/lib/video-file.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { moveToFailedTranscodingState } from '@server/lib/video-state.js'+import { UserModel } from '@server/models/user/user.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { MUser, MUserId, MVideoFullLight } from '@server/types/models/index.js'import {HLSTranscodingPayload,MergeAudioTranscodingPayload,NewWebVideoResolutionTranscodingPayload,OptimizeTranscodingPayload,VideoTranscodingPayload-} from '@shared/models'-import { logger, loggerTagsFactory } from '../../../helpers/logger'-import { VideoModel } from '../../../models/video/video'+} from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '../../../helpers/logger.js'+import { VideoModel } from '../../../models/video/video.js'type HandlerFunction = (job: Job, payload: VideoTranscodingPayload, video: MVideoFullLight, user: MUser) => Promise<void>diff --git a/server/lib/job-queue/handlers/video-views-stats.ts b/server/server/lib/job-queue/handlers/video-views-stats.tssimilarity index 85%rename from server/lib/job-queue/handlers/video-views-stats.tsrename to server/server/lib/job-queue/handlers/video-views-stats.tsindex c9aa218e54..479b47ed08 100644--- a/server/lib/job-queue/handlers/video-views-stats.ts+++ b/server/server/lib/job-queue/handlers/video-views-stats.ts@@ -1,8 +1,8 @@-import { VideoViewModel } from '@server/models/view/video-view'-import { isTestOrDevInstance } from '../../../helpers/core-utils'-import { logger } from '../../../helpers/logger'-import { VideoModel } from '../../../models/video/video'-import { Redis } from '../../redis'+import { isTestOrDevInstance } from '@peertube/peertube-node-utils'+import { VideoViewModel } from '@server/models/view/video-view.js'+import { logger } from '../../../helpers/logger.js'+import { VideoModel } from '../../../models/video/video.js'+import { Redis } from '../../redis.js'async function processVideosViewsStats () {const lastHour = new Date()diff --git a/server/server/lib/job-queue/index.ts b/server/server/lib/job-queue/index.tsnew file mode 100644index 0000000000..098d4e7a32--- /dev/null+++ b/server/server/lib/job-queue/index.ts@@ -0,0 +1 @@+export * from './job-queue.js'diff --git a/server/lib/job-queue/job-queue.ts b/server/server/lib/job-queue/job-queue.tssimilarity index 93%rename from server/lib/job-queue/job-queue.tsrename to server/server/lib/job-queue/job-queue.tsindex 177bca285e..390da209ef 100644--- a/server/lib/job-queue/job-queue.ts+++ b/server/server/lib/job-queue/job-queue.ts@@ -10,11 +10,7 @@ import {Worker,WorkerOptions} from 'bullmq'-import { parseDurationToMs } from '@server/helpers/core-utils'-import { jobStates } from '@server/helpers/custom-validators/jobs'-import { CONFIG } from '@server/initializers/config'-import { processVideoRedundancy } from '@server/lib/job-queue/handlers/video-redundancy'-import { pick, timeoutPromise } from '@shared/core-utils'+import { pick, timeoutPromise } from '@peertube/peertube-core-utils'import {ActivitypubFollowPayload,ActivitypubHttpBroadcastPayload,@@ -40,33 +36,40 @@ import {VideoRedundancyPayload,VideoStudioEditionPayload,VideoTranscodingPayload-} from '../../../shared/models'-import { logger } from '../../helpers/logger'-import { JOB_ATTEMPTS, JOB_CONCURRENCY, JOB_REMOVAL_OPTIONS, JOB_TTL, REPEAT_JOBS, WEBSERVER } from '../../initializers/constants'-import { Hooks } from '../plugins/hooks'-import { Redis } from '../redis'-import { processActivityPubCleaner } from './handlers/activitypub-cleaner'-import { processActivityPubFollow } from './handlers/activitypub-follow'-import { processActivityPubHttpSequentialBroadcast, processActivityPubParallelHttpBroadcast } from './handlers/activitypub-http-broadcast'-import { processActivityPubHttpFetcher } from './handlers/activitypub-http-fetcher'-import { processActivityPubHttpUnicast } from './handlers/activitypub-http-unicast'-import { refreshAPObject } from './handlers/activitypub-refresher'-import { processActorKeys } from './handlers/actor-keys'-import { processAfterVideoChannelImport } from './handlers/after-video-channel-import'-import { processEmail } from './handlers/email'-import { processFederateVideo } from './handlers/federate-video'-import { processManageVideoTorrent } from './handlers/manage-video-torrent'-import { onMoveToObjectStorageFailure, processMoveToObjectStorage } from './handlers/move-to-object-storage'-import { processNotify } from './handlers/notify'-import { processTranscodingJobBuilder } from './handlers/transcoding-job-builder'-import { processVideoChannelImport } from './handlers/video-channel-import'-import { processVideoFileImport } from './handlers/video-file-import'-import { processVideoImport } from './handlers/video-import'-import { processVideoLiveEnding } from './handlers/video-live-ending'-import { processVideoStudioEdition } from './handlers/video-studio-edition'-import { processVideoTranscoding } from './handlers/video-transcoding'-import { processVideosViewsStats } from './handlers/video-views-stats'-import { processGenerateStoryboard } from './handlers/generate-storyboard'+} from '@peertube/peertube-models'+import { parseDurationToMs } from '@server/helpers/core-utils.js'+import { jobStates } from '@server/helpers/custom-validators/jobs.js'+import { CONFIG } from '@server/initializers/config.js'+import { processVideoRedundancy } from '@server/lib/job-queue/handlers/video-redundancy.js'+import { logger } from '../../helpers/logger.js'+import { JOB_ATTEMPTS, JOB_CONCURRENCY, JOB_REMOVAL_OPTIONS, JOB_TTL, REPEAT_JOBS, WEBSERVER } from '../../initializers/constants.js'+import { Hooks } from '../plugins/hooks.js'+import { Redis } from '../redis.js'+import { processActivityPubCleaner } from './handlers/activitypub-cleaner.js'+import { processActivityPubFollow } from './handlers/activitypub-follow.js'+import {+ processActivityPubHttpSequentialBroadcast,+ processActivityPubParallelHttpBroadcast+} from './handlers/activitypub-http-broadcast.js'+import { processActivityPubHttpFetcher } from './handlers/activitypub-http-fetcher.js'+import { processActivityPubHttpUnicast } from './handlers/activitypub-http-unicast.js'+import { refreshAPObject } from './handlers/activitypub-refresher.js'+import { processActorKeys } from './handlers/actor-keys.js'+import { processAfterVideoChannelImport } from './handlers/after-video-channel-import.js'+import { processEmail } from './handlers/email.js'+import { processFederateVideo } from './handlers/federate-video.js'+import { processGenerateStoryboard } from './handlers/generate-storyboard.js'+import { processManageVideoTorrent } from './handlers/manage-video-torrent.js'+import { onMoveToObjectStorageFailure, processMoveToObjectStorage } from './handlers/move-to-object-storage.js'+import { processNotify } from './handlers/notify.js'+import { processTranscodingJobBuilder } from './handlers/transcoding-job-builder.js'+import { processVideoChannelImport } from './handlers/video-channel-import.js'+import { processVideoFileImport } from './handlers/video-file-import.js'+import { processVideoImport } from './handlers/video-import.js'+import { processVideoLiveEnding } from './handlers/video-live-ending.js'+import { processVideoStudioEdition } from './handlers/video-studio-edition.js'+import { processVideoTranscoding } from './handlers/video-transcoding.js'+import { processVideosViewsStats } from './handlers/video-views-stats.js'export type CreateJobArgument ={ type: 'activitypub-http-broadcast', payload: ActivitypubHttpBroadcastPayload } |diff --git a/server/server/lib/live/index.ts b/server/server/lib/live/index.tsnew file mode 100644index 0000000000..d770aeb4bd--- /dev/null+++ b/server/server/lib/live/index.ts@@ -0,0 +1,4 @@+export * from './live-manager.js'+export * from './live-quota-store.js'+export * from './live-segment-sha-store.js'+export * from './live-utils.js'diff --git a/server/lib/live/live-manager.ts b/server/server/lib/live/live-manager.tssimilarity index 91%rename from server/lib/live/live-manager.tsrename to server/server/lib/live/live-manager.tsindex acb7af2745..d003379c98 100644--- a/server/lib/live/live-manager.ts+++ b/server/server/lib/live/live-manager.ts@@ -1,35 +1,40 @@-import { readdir, readFile } from 'fs-extra'+import { readdir, readFile } from 'fs/promises'import { createServer, Server } from 'net'+import context from 'node-media-server/src/node_core_ctx.js'+import nodeMediaServerLogger from 'node-media-server/src/node_core_logger.js'+import NodeRtmpSession from 'node-media-server/src/node_rtmp_session.js'import { join } from 'path'import { createServer as createServerTLS, Server as ServerTLS } from 'tls'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config'-import { VIDEO_LIVE, WEBSERVER } from '@server/initializers/constants'-import { sequelizeTypescript } from '@server/initializers/database'-import { RunnerJobModel } from '@server/models/runner/runner-job'-import { UserModel } from '@server/models/user/user'-import { VideoModel } from '@server/models/video/video'-import { VideoLiveModel } from '@server/models/video/video-live'-import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting'-import { VideoLiveSessionModel } from '@server/models/video/video-live-session'-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'-import { MVideo, MVideoLiveSession, MVideoLiveVideo, MVideoLiveVideoWithSetting } from '@server/types/models'-import { pick, wait } from '@shared/core-utils'-import { ffprobePromise, getVideoStreamBitrate, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAudioStream } from '@shared/ffmpeg'-import { LiveVideoError, VideoState } from '@shared/models'-import { federateVideoIfNeeded } from '../activitypub/videos'-import { JobQueue } from '../job-queue'-import { getLiveReplayBaseDirectory } from '../paths'-import { PeerTubeSocket } from '../peertube-socket'-import { Hooks } from '../plugins/hooks'-import { computeResolutionsToTranscode } from '../transcoding/transcoding-resolutions'-import { LiveQuotaStore } from './live-quota-store'-import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils'-import { MuxingSession } from './shared'--const NodeRtmpSession = require('node-media-server/src/node_rtmp_session')-const context = require('node-media-server/src/node_core_ctx')-const nodeMediaServerLogger = require('node-media-server/src/node_core_logger')+import { pick, wait } from '@peertube/peertube-core-utils'+import { LiveVideoError, LiveVideoErrorType, VideoState } from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config.js'+import { VIDEO_LIVE, WEBSERVER } from '@server/initializers/constants.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { RunnerJobModel } from '@server/models/runner/runner-job.js'+import { UserModel } from '@server/models/user/user.js'+import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting.js'+import { VideoLiveSessionModel } from '@server/models/video/video-live-session.js'+import { VideoLiveModel } from '@server/models/video/video-live.js'+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideo, MVideoLiveSession, MVideoLiveVideo, MVideoLiveVideoWithSetting } from '@server/types/models/index.js'+import {+ ffprobePromise,+ getVideoStreamBitrate,+ getVideoStreamDimensionsInfo,+ getVideoStreamFPS,+ hasAudioStream+} from '@peertube/peertube-ffmpeg'+import { federateVideoIfNeeded } from '../activitypub/videos/index.js'+import { JobQueue } from '../job-queue/index.js'+import { getLiveReplayBaseDirectory } from '../paths.js'+import { PeerTubeSocket } from '../peertube-socket.js'+import { Hooks } from '../plugins/hooks.js'+import { computeResolutionsToTranscode } from '../transcoding/transcoding-resolutions.js'+import { LiveQuotaStore } from './live-quota-store.js'+import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils.js'+import { MuxingSession } from './shared/index.js'// Disable node media server logsnodeMediaServerLogger.setLogType(0)@@ -182,7 +187,7 @@ class LiveManager {return this.getContext().sessions.has(sessionId)}- stopSessionOf (videoUUID: string, error: LiveVideoError | null) {+ stopSessionOf (videoUUID: string, error: LiveVideoErrorType | null) {const sessionId = this.videoSessions.get(videoUUID)if (!sessionId) {logger.debug('No live session to stop for video %s', videoUUID, lTags(sessionId, videoUUID))@@ -530,7 +535,7 @@ class LiveManager {})}- private async saveEndingSession (videoUUID: string, error: LiveVideoError | null) {+ private async saveEndingSession (videoUUID: string, error: LiveVideoErrorType | null) {const liveSession = await VideoLiveSessionModel.findCurrentSessionOf(videoUUID)if (!liveSession) returndiff --git a/server/lib/live/live-quota-store.ts b/server/server/lib/live/live-quota-store.tssimilarity index 100%rename from server/lib/live/live-quota-store.tsrename to server/server/lib/live/live-quota-store.tsdiff --git a/server/lib/live/live-segment-sha-store.ts b/server/server/lib/live/live-segment-sha-store.tssimilarity index 88%rename from server/lib/live/live-segment-sha-store.tsrename to server/server/lib/live/live-segment-sha-store.tsindex 8253c0274f..fbe1b5e292 100644--- a/server/lib/live/live-segment-sha-store.ts+++ b/server/server/lib/live/live-segment-sha-store.ts@@ -1,11 +1,12 @@-import { rename, writeJson } from 'fs-extra'+import { writeJson } from 'fs-extra/esm'+import { rename } from 'fs/promises'import PQueue from 'p-queue'import { basename } from 'path'-import { mapToJSON } from '@server/helpers/core-utils'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { MStreamingPlaylistVideo } from '@server/types/models'-import { buildSha256Segment } from '../hls'-import { storeHLSFileFromPath } from '../object-storage'+import { mapToJSON } from '@server/helpers/core-utils.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { MStreamingPlaylistVideo } from '@server/types/models/index.js'+import { buildSha256Segment } from '../hls.js'+import { storeHLSFileFromPath } from '../object-storage/index.js'const lTags = loggerTagsFactory('live')diff --git a/server/lib/live/live-utils.ts b/server/server/lib/live/live-utils.tssimilarity index 84%rename from server/lib/live/live-utils.tsrename to server/server/lib/live/live-utils.tsindex 3fb3ce1cee..55b7984bf1 100644--- a/server/lib/live/live-utils.ts+++ b/server/server/lib/live/live-utils.ts@@ -1,11 +1,12 @@-import { pathExists, readdir, remove } from 'fs-extra'+import { pathExists, remove } from 'fs-extra/esm'+import { readdir } from 'fs/promises'import { basename, join } from 'path'-import { logger } from '@server/helpers/logger'-import { VIDEO_LIVE } from '@server/initializers/constants'-import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models'-import { LiveVideoLatencyMode, VideoStorage } from '@shared/models'-import { listHLSFileKeysOf, removeHLSFileObjectStorageByFullKey, removeHLSObjectStorage } from '../object-storage'-import { getLiveDirectory } from '../paths'+import { LiveVideoLatencyMode, LiveVideoLatencyModeType, VideoStorage } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { VIDEO_LIVE } from '@server/initializers/constants.js'+import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models/index.js'+import { listHLSFileKeysOf, removeHLSFileObjectStorageByFullKey, removeHLSObjectStorage } from '../object-storage/index.js'+import { getLiveDirectory } from '../paths.js'function buildConcatenatedName (segmentOrPlaylistPath: string) {const num = basename(segmentOrPlaylistPath).match(/^(\d+)(-|\.)/)@@ -38,7 +39,7 @@ async function cleanupTMPLiveFiles (video: MVideo, streamingPlaylist: MStreamingawait cleanupTMPLiveFilesFromFilesystem(video)}-function getLiveSegmentTime (latencyMode: LiveVideoLatencyMode) {+function getLiveSegmentTime (latencyMode: LiveVideoLatencyModeType) {if (latencyMode === LiveVideoLatencyMode.SMALL_LATENCY) {return VIDEO_LIVE.SEGMENT_TIME_SECONDS.SMALL_LATENCY}diff --git a/server/server/lib/live/shared/index.ts b/server/server/lib/live/shared/index.tsnew file mode 100644index 0000000000..218eab284a--- /dev/null+++ b/server/server/lib/live/shared/index.ts@@ -0,0 +1 @@+export * from './muxing-session.js'diff --git a/server/lib/live/shared/muxing-session.ts b/server/server/lib/live/shared/muxing-session.tssimilarity index 94%rename from server/lib/live/shared/muxing-session.tsrename to server/server/lib/live/shared/muxing-session.tsindex 02691b6514..1a71a04d79 100644--- a/server/lib/live/shared/muxing-session.ts+++ b/server/server/lib/live/shared/muxing-session.ts@@ -1,31 +1,32 @@-import { mapSeries } from 'bluebird'+import Bluebird from 'bluebird'import { FSWatcher, watch } from 'chokidar'import { EventEmitter } from 'events'-import { appendFile, ensureDir, readFile, stat } from 'fs-extra'+import { ensureDir } from 'fs-extra/esm'+import { appendFile, readFile, stat } from 'fs/promises'+import memoizee from 'memoizee'import PQueue from 'p-queue'import { basename, join } from 'path'-import { computeOutputFPS } from '@server/helpers/ffmpeg'-import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { MEMOIZE_TTL, P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE } from '@server/initializers/constants'-import { removeHLSFileObjectStorageByPath, storeHLSFileFromContent, storeHLSFileFromPath } from '@server/lib/object-storage'-import { VideoFileModel } from '@server/models/video/video-file'-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'-import { MStreamingPlaylistVideo, MUserId, MVideoLiveVideo } from '@server/types/models'-import { VideoStorage, VideoStreamingPlaylistType } from '@shared/models'+import { computeOutputFPS } from '@server/helpers/ffmpeg/index.js'+import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { MEMOIZE_TTL, P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE } from '@server/initializers/constants.js'+import { removeHLSFileObjectStorageByPath, storeHLSFileFromContent, storeHLSFileFromPath } from '@server/lib/object-storage/index.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'+import { MStreamingPlaylistVideo, MUserId, MVideoLiveVideo } from '@server/types/models/index.js'+import { VideoStorage, VideoStreamingPlaylistType } from '@peertube/peertube-models'import {generateHLSMasterPlaylistFilename,generateHlsSha256SegmentsFilename,getLiveDirectory,getLiveReplayBaseDirectory-} from '../../paths'-import { isAbleToUploadVideo } from '../../user'-import { LiveQuotaStore } from '../live-quota-store'-import { LiveSegmentShaStore } from '../live-segment-sha-store'-import { buildConcatenatedName, getLiveSegmentTime } from '../live-utils'-import { AbstractTranscodingWrapper, FFmpegTranscodingWrapper, RemoteTranscodingWrapper } from './transcoding-wrapper'--import memoizee = require('memoizee')+} from '../../paths.js'+import { isAbleToUploadVideo } from '../../user.js'+import { LiveQuotaStore } from '../live-quota-store.js'+import { LiveSegmentShaStore } from '../live-segment-sha-store.js'+import { buildConcatenatedName, getLiveSegmentTime } from '../live-utils.js'+import { AbstractTranscodingWrapper, FFmpegTranscodingWrapper, RemoteTranscodingWrapper } from './transcoding-wrapper/index.js'+interface MuxingSessionEvents {'live-ready': (options: { videoUUID: string }) => void@@ -318,7 +319,7 @@ class MuxingSession extends EventEmitter {}private processSegments (segmentPaths: string[]) {- mapSeries(segmentPaths, previousSegment => this.processSegment(previousSegment))+ Bluebird.mapSeries(segmentPaths, previousSegment => this.processSegment(previousSegment)).catch(err => {if (this.aborted) returndiff --git a/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts b/server/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.tssimilarity index 90%rename from server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.tsrename to server/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.tsindex 95168745da..8cae0c45b2 100644--- a/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts+++ b/server/server/lib/live/shared/transcoding-wrapper/abstract-transcoding-wrapper.ts@@ -1,7 +1,7 @@+import { LiveVideoErrorType } from '@peertube/peertube-models'+import { LoggerTagsFn } from '@server/helpers/logger.js'+import { MStreamingPlaylistVideo, MVideoLiveVideo } from '@server/types/models/index.js'import EventEmitter from 'events'-import { LoggerTagsFn } from '@server/helpers/logger'-import { MStreamingPlaylistVideo, MVideoLiveVideo } from '@server/types/models'-import { LiveVideoError } from '@shared/models'interface TranscodingWrapperEvents {'end': () => void@@ -101,10 +101,11 @@ abstract class AbstractTranscodingWrapper extends EventEmitter {abstract run (): Promise<void>- abstract abort (error?: LiveVideoError): void+ abstract abort (error?: LiveVideoErrorType): void}export {- AbstractTranscodingWrapper,- AbstractTranscodingWrapperOptions+ type AbstractTranscodingWrapperOptions,++ AbstractTranscodingWrapper}diff --git a/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts b/server/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.tssimilarity index 89%rename from server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.tsrename to server/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.tsindex c6ee8ebf1c..4646864704 100644--- a/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts+++ b/server/server/lib/live/shared/transcoding-wrapper/ffmpeg-transcoding-wrapper.ts@@ -1,12 +1,12 @@import { FfmpegCommand } from 'fluent-ffmpeg'-import { getFFmpegCommandWrapperOptions } from '@server/helpers/ffmpeg'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { VIDEO_LIVE } from '@server/initializers/constants'-import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles'-import { FFmpegLive } from '@shared/ffmpeg'-import { getLiveSegmentTime } from '../../live-utils'-import { AbstractTranscodingWrapper } from './abstract-transcoding-wrapper'+import { getFFmpegCommandWrapperOptions } from '@server/helpers/ffmpeg/index.js'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { VIDEO_LIVE } from '@server/initializers/constants.js'+import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles.js'+import { FFmpegLive } from '@peertube/peertube-ffmpeg'+import { getLiveSegmentTime } from '../../live-utils.js'+import { AbstractTranscodingWrapper } from './abstract-transcoding-wrapper.js'export class FFmpegTranscodingWrapper extends AbstractTranscodingWrapper {private ffmpegCommand: FfmpegCommanddiff --git a/server/server/lib/live/shared/transcoding-wrapper/index.ts b/server/server/lib/live/shared/transcoding-wrapper/index.tsnew file mode 100644index 0000000000..3ab9f94179--- /dev/null+++ b/server/server/lib/live/shared/transcoding-wrapper/index.ts@@ -0,0 +1,3 @@+export * from './abstract-transcoding-wrapper.js'+export * from './ffmpeg-transcoding-wrapper.js'+export * from './remote-transcoding-wrapper.js'diff --git a/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts b/server/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.tssimilarity index 95%rename from server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.tsrename to server/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.tsindex 2aeeb31fb1..4e375a749f 100644--- a/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts+++ b/server/server/lib/live/shared/transcoding-wrapper/remote-transcoding-wrapper.ts@@ -1,5 +1,5 @@-import { LiveRTMPHLSTranscodingJobHandler } from '@server/lib/runners'-import { AbstractTranscodingWrapper } from './abstract-transcoding-wrapper'+import { LiveRTMPHLSTranscodingJobHandler } from '@server/lib/runners/index.js'+import { AbstractTranscodingWrapper } from './abstract-transcoding-wrapper.js'export class RemoteTranscodingWrapper extends AbstractTranscodingWrapper {async run () {diff --git a/server/lib/local-actor.ts b/server/server/lib/local-actor.tssimilarity index 80%rename from server/lib/local-actor.tsrename to server/server/lib/local-actor.tsindex 611e6d0af1..5ee9df8755 100644--- a/server/lib/local-actor.ts+++ b/server/server/lib/local-actor.ts@@ -1,18 +1,17 @@-import { remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'import { join } from 'path'-import { Transaction } from 'sequelize/types'-import { ActorModel } from '@server/models/actor/actor'-import { getLowercaseExtension } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { ActivityPubActorType, ActorImageType } from '@shared/models'-import { retryTransactionWrapper } from '../helpers/database-utils'-import { CONFIG } from '../initializers/config'-import { ACTOR_IMAGES_SIZE, WEBSERVER } from '../initializers/constants'-import { sequelizeTypescript } from '../initializers/database'-import { MAccountDefault, MActor, MChannelDefault } from '../types/models'-import { deleteActorImages, updateActorImages } from './activitypub/actors'-import { sendUpdateActor } from './activitypub/send'-import { processImageFromWorker } from './worker/parent-process'+import { Transaction } from 'sequelize'+import { ActivityPubActorType, ActorImageType, ActorImageType_Type } from '@peertube/peertube-models'+import { ActorModel } from '@server/models/actor/actor.js'+import { buildUUID, getLowercaseExtension } from '@peertube/peertube-node-utils'+import { retryTransactionWrapper } from '../helpers/database-utils.js'+import { CONFIG } from '../initializers/config.js'+import { ACTOR_IMAGES_SIZE, WEBSERVER } from '../initializers/constants.js'+import { sequelizeTypescript } from '../initializers/database.js'+import { MAccountDefault, MActor, MChannelDefault } from '../types/models/index.js'+import { deleteActorImages, updateActorImages } from './activitypub/actors/index.js'+import { sendUpdateActor } from './activitypub/send/index.js'+import { processImageFromWorker } from './worker/parent-process.js'export function buildActorInstance (type: ActivityPubActorType, url: string, preferredUsername: string) {return new ActorModel({@@ -34,7 +33,7 @@ export function buildActorInstance (type: ActivityPubActorType, url: string, preexport async function updateLocalActorImageFiles (accountOrChannel: MAccountDefault | MChannelDefault,imagePhysicalFile: Express.Multer.File,- type: ActorImageType+ type: ActorImageType_Type) {const processImageSize = async (imageSize: { width: number, height: number }) => {const extension = getLowercaseExtension(imagePhysicalFile.filename)@@ -72,7 +71,7 @@ export async function updateLocalActorImageFiles (}))}-export async function deleteLocalActorImageFile (accountOrChannel: MAccountDefault | MChannelDefault, type: ActorImageType) {+export async function deleteLocalActorImageFile (accountOrChannel: MAccountDefault | MChannelDefault, type: ActorImageType_Type) {return retryTransactionWrapper(() => {return sequelizeTypescript.transaction(async t => {const updatedActor = await deleteActorImages(accountOrChannel.Actor, type, t)diff --git a/server/lib/model-loaders/actor.ts b/server/server/lib/model-loaders/actor.tssimilarity index 80%rename from server/lib/model-loaders/actor.tsrename to server/server/lib/model-loaders/actor.tsindex 1355d8ee2c..3c11793913 100644--- a/server/lib/model-loaders/actor.ts+++ b/server/server/lib/model-loaders/actor.ts@@ -1,6 +1,5 @@--import { ActorModel } from '../../models/actor/actor'-import { MActorAccountChannelId, MActorFull } from '../../types/models'+import { ActorModel } from '../../models/actor/actor.js'+import { MActorAccountChannelId, MActorFull } from '../../types/models/index.js'type ActorLoadByUrlType = 'all' | 'association-ids'@@ -11,7 +10,7 @@ function loadActorByUrl (url: string, fetchType: ActorLoadByUrlType): Promise<MA}export {- ActorLoadByUrlType,+ type ActorLoadByUrlType,loadActorByUrl}diff --git a/server/server/lib/model-loaders/index.ts b/server/server/lib/model-loaders/index.tsnew file mode 100644index 0000000000..7aa426a565--- /dev/null+++ b/server/server/lib/model-loaders/index.ts@@ -0,0 +1,2 @@+export * from './actor.js'+export * from './video.js'diff --git a/server/lib/model-loaders/video.ts b/server/server/lib/model-loaders/video.tssimilarity index 94%rename from server/lib/model-loaders/video.tsrename to server/server/lib/model-loaders/video.tsindex 91057d4059..5ea2b67aa4 100644--- a/server/lib/model-loaders/video.ts+++ b/server/server/lib/model-loaders/video.ts@@ -1,4 +1,4 @@-import { VideoModel } from '@server/models/video/video'+import { VideoModel } from '@server/models/video/video.js'import {MVideoAccountLightBlacklistAllFiles,MVideoFormattableDetails,@@ -6,7 +6,7 @@ import {MVideoId,MVideoImmutable,MVideoThumbnail-} from '@server/types/models'+} from '@server/types/models/index.js'type VideoLoadType = 'for-api' | 'all' | 'only-video' | 'id' | 'none' | 'only-immutable-attributes'@@ -58,8 +58,8 @@ function loadVideoByUrl (}export {- VideoLoadType,- VideoLoadByUrlType,+ type VideoLoadType,+ type VideoLoadByUrlType,loadVideo,loadVideoByUrldiff --git a/server/lib/moderation.ts b/server/server/lib/moderation.tssimilarity index 90%rename from server/lib/moderation.tsrename to server/server/lib/moderation.tsindex db82848722..d02a12a30a 100644--- a/server/lib/moderation.ts+++ b/server/server/lib/moderation.ts@@ -1,14 +1,14 @@import express, { VideoUploadFile } from 'express'-import { PathLike } from 'fs-extra'-import { Transaction } from 'sequelize/types'-import { AbuseAuditView, auditLoggerFactory } from '@server/helpers/audit-logger'-import { afterCommitIfTransaction } from '@server/helpers/database-utils'-import { logger } from '@server/helpers/logger'-import { AbuseModel } from '@server/models/abuse/abuse'-import { VideoAbuseModel } from '@server/models/abuse/video-abuse'-import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'-import { VideoFileModel } from '@server/models/video/video-file'-import { FilteredModelAttributes } from '@server/types'+import { PathLike } from 'fs-extra/esm'+import { Transaction } from 'sequelize'+import { AbuseAuditView, auditLoggerFactory } from '@server/helpers/audit-logger.js'+import { afterCommitIfTransaction } from '@server/helpers/database-utils.js'+import { logger } from '@server/helpers/logger.js'+import { AbuseModel } from '@server/models/abuse/abuse.js'+import { VideoAbuseModel } from '@server/models/abuse/video-abuse.js'+import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { FilteredModelAttributes } from '@server/types/index.js'import {MAbuseFull,MAccountDefault,@@ -19,14 +19,13 @@ import {MUser,MVideoAbuseVideoFull,MVideoAccountLightBlacklistAllFiles-} from '@server/types/models'-import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos'-import { VideoCommentCreate } from '../../shared/models/videos/comment'-import { UserModel } from '../models/user/user'-import { VideoModel } from '../models/video/video'-import { VideoCommentModel } from '../models/video/video-comment'-import { sendAbuse } from './activitypub/send/send-flag'-import { Notifier } from './notifier'+} from '@server/types/models/index.js'+import { LiveVideoCreate, VideoCommentCreate, VideoCreate, VideoImportCreate } from '@peertube/peertube-models'+import { UserModel } from '../models/user/user.js'+import { VideoCommentModel } from '../models/video/video-comment.js'+import { VideoModel } from '../models/video/video.js'+import { sendAbuse } from './activitypub/send/send-flag.js'+import { Notifier } from './notifier/index.js'export type AcceptResult = {accepted: booleandiff --git a/server/server/lib/notifier/index.ts b/server/server/lib/notifier/index.tsnew file mode 100644index 0000000000..8476ba7ccd--- /dev/null+++ b/server/server/lib/notifier/index.ts@@ -0,0 +1 @@+export * from './notifier.js'diff --git a/server/lib/notifier/notifier.ts b/server/server/lib/notifier/notifier.tssimilarity index 93%rename from server/lib/notifier/notifier.tsrename to server/server/lib/notifier/notifier.tsindex 920c55df05..5cb227bba5 100644--- a/server/lib/notifier/notifier.ts+++ b/server/server/lib/notifier/notifier.ts@@ -1,13 +1,21 @@-import { MRegistration, MUser, MUserDefault } from '@server/types/models/user'-import { MVideoBlacklistLightVideo, MVideoBlacklistVideo } from '@server/types/models/video/video-blacklist'-import { UserNotificationSettingValue } from '../../../shared/models/users'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { MAbuseFull, MAbuseMessage, MActorFollowFull, MApplication, MPlugin } from '../../types/models'-import { MCommentOwnerVideo, MVideoAccountLight, MVideoFullLight } from '../../types/models/video'-import { JobQueue } from '../job-queue'-import { PeerTubeSocket } from '../peertube-socket'-import { Hooks } from '../plugins/hooks'+import { UserNotificationSettingValue, UserNotificationSettingValueType } from '@peertube/peertube-models'+import { MRegistration, MUser, MUserDefault } from '@server/types/models/user/index.js'+import { MVideoBlacklistLightVideo, MVideoBlacklistVideo } from '@server/types/models/video/video-blacklist.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import {+ MAbuseFull,+ MAbuseMessage,+ MActorFollowFull,+ MApplication,+ MCommentOwnerVideo,+ MPlugin,+ MVideoAccountLight,+ MVideoFullLight+} from '../../types/models/index.js'+import { JobQueue } from '../job-queue/index.js'+import { PeerTubeSocket } from '../peertube-socket.js'+import { Hooks } from '../plugins/hooks.js'import {AbstractNotification,AbuseStateChangeForReporter,@@ -34,7 +42,7 @@ import {RegistrationRequestForModerators,StudioEditionFinishedForOwner,UnblacklistForOwner-} from './shared'+} from './shared/index.js'class Notifier {@@ -255,13 +263,13 @@ class Notifier {}}- private isEmailEnabled (user: MUser, value: UserNotificationSettingValue) {+ private isEmailEnabled (user: MUser, value: UserNotificationSettingValueType) {if (CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION === true && user.emailVerified === false) return falsereturn value & UserNotificationSettingValue.EMAIL}- private isWebNotificationEnabled (value: UserNotificationSettingValue) {+ private isWebNotificationEnabled (value: UserNotificationSettingValueType) {return value & UserNotificationSettingValue.WEB}diff --git a/server/lib/notifier/shared/abuse/abstract-new-abuse-message.ts b/server/server/lib/notifier/shared/abuse/abstract-new-abuse-message.tssimilarity index 82%rename from server/lib/notifier/shared/abuse/abstract-new-abuse-message.tsrename to server/server/lib/notifier/shared/abuse/abstract-new-abuse-message.tsindex 1dc1ccfc23..f9a940299b 100644--- a/server/lib/notifier/shared/abuse/abstract-new-abuse-message.ts+++ b/server/server/lib/notifier/shared/abuse/abstract-new-abuse-message.ts@@ -1,9 +1,15 @@-import { WEBSERVER } from '@server/initializers/constants'-import { AccountModel } from '@server/models/account/account'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MAbuseFull, MAbuseMessage, MAccountDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { UserNotificationType } from '@peertube/peertube-models'+import { WEBSERVER } from '@server/initializers/constants.js'+import { AccountModel } from '@server/models/account/account.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import {+ MAbuseFull,+ MAbuseMessage,+ MAccountDefault,+ MUserWithNotificationSetting,+ UserNotificationModelForApi+} from '@server/types/models/index.js'+import { AbstractNotification } from '../common/abstract-notification.js'type NewAbuseMessagePayload = {abuse: MAbuseFulldiff --git a/server/lib/notifier/shared/abuse/abuse-state-change-for-reporter.ts b/server/server/lib/notifier/shared/abuse/abuse-state-change-for-reporter.tssimilarity index 81%rename from server/lib/notifier/shared/abuse/abuse-state-change-for-reporter.tsrename to server/server/lib/notifier/shared/abuse/abuse-state-change-for-reporter.tsindex 97e896c6a6..5e18e9fc99 100644--- a/server/lib/notifier/shared/abuse/abuse-state-change-for-reporter.ts+++ b/server/server/lib/notifier/shared/abuse/abuse-state-change-for-reporter.ts@@ -1,11 +1,11 @@-import { logger } from '@server/helpers/logger'-import { WEBSERVER } from '@server/initializers/constants'-import { getAbuseTargetUrl } from '@server/lib/activitypub/url'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MAbuseFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { AbuseState, UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { getAbuseTargetUrl } from '@server/lib/activitypub/url.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MAbuseFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { AbuseState, UserNotificationType } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class AbuseStateChangeForReporter extends AbstractNotification <MAbuseFull> {diff --git a/server/server/lib/notifier/shared/abuse/index.ts b/server/server/lib/notifier/shared/abuse/index.tsnew file mode 100644index 0000000000..4f4b30503e--- /dev/null+++ b/server/server/lib/notifier/shared/abuse/index.ts@@ -0,0 +1,4 @@+export * from './abuse-state-change-for-reporter.js'+export * from './new-abuse-for-moderators.js'+export * from './new-abuse-message-for-reporter.js'+export * from './new-abuse-message-for-moderators.js'diff --git a/server/lib/notifier/shared/abuse/new-abuse-for-moderators.ts b/server/server/lib/notifier/shared/abuse/new-abuse-for-moderators.tssimilarity index 90%rename from server/lib/notifier/shared/abuse/new-abuse-for-moderators.tsrename to server/server/lib/notifier/shared/abuse/new-abuse-for-moderators.tsindex 7d86fb55f5..2bd93133d9 100644--- a/server/lib/notifier/shared/abuse/new-abuse-for-moderators.ts+++ b/server/server/lib/notifier/shared/abuse/new-abuse-for-moderators.ts@@ -1,11 +1,11 @@-import { logger } from '@server/helpers/logger'-import { WEBSERVER } from '@server/initializers/constants'-import { getAbuseTargetUrl } from '@server/lib/activitypub/url'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MAbuseFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserAbuse, UserNotificationType, UserRight } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { getAbuseTargetUrl } from '@server/lib/activitypub/url.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MAbuseFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserAbuse, UserNotificationType, UserRight } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export type NewAbusePayload = { abuse: UserAbuse, abuseInstance: MAbuseFull, reporter: string }diff --git a/server/lib/notifier/shared/abuse/new-abuse-message-for-moderators.ts b/server/server/lib/notifier/shared/abuse/new-abuse-message-for-moderators.tssimilarity index 71%rename from server/lib/notifier/shared/abuse/new-abuse-message-for-moderators.tsrename to server/server/lib/notifier/shared/abuse/new-abuse-message-for-moderators.tsindex 9d0629690e..d3f590e463 100644--- a/server/lib/notifier/shared/abuse/new-abuse-message-for-moderators.ts+++ b/server/server/lib/notifier/shared/abuse/new-abuse-message-for-moderators.ts@@ -1,9 +1,9 @@-import { logger } from '@server/helpers/logger'-import { getAbuseTargetUrl } from '@server/lib/activitypub/url'-import { UserModel } from '@server/models/user/user'-import { MUserDefault } from '@server/types/models'-import { UserRight } from '@shared/models'-import { AbstractNewAbuseMessage } from './abstract-new-abuse-message'+import { logger } from '@server/helpers/logger.js'+import { getAbuseTargetUrl } from '@server/lib/activitypub/url.js'+import { UserModel } from '@server/models/user/user.js'+import { MUserDefault } from '@server/types/models/index.js'+import { UserRight } from '@peertube/peertube-models'+import { AbstractNewAbuseMessage } from './abstract-new-abuse-message.js'export class NewAbuseMessageForModerators extends AbstractNewAbuseMessage {private moderators: MUserDefault[]diff --git a/server/lib/notifier/shared/abuse/new-abuse-message-for-reporter.ts b/server/server/lib/notifier/shared/abuse/new-abuse-message-for-reporter.tssimilarity index 77%rename from server/lib/notifier/shared/abuse/new-abuse-message-for-reporter.tsrename to server/server/lib/notifier/shared/abuse/new-abuse-message-for-reporter.tsindex c5bbb54478..d0ec709fe2 100644--- a/server/lib/notifier/shared/abuse/new-abuse-message-for-reporter.ts+++ b/server/server/lib/notifier/shared/abuse/new-abuse-message-for-reporter.ts@@ -1,8 +1,8 @@-import { logger } from '@server/helpers/logger'-import { getAbuseTargetUrl } from '@server/lib/activitypub/url'-import { UserModel } from '@server/models/user/user'-import { MUserDefault } from '@server/types/models'-import { AbstractNewAbuseMessage } from './abstract-new-abuse-message'+import { logger } from '@server/helpers/logger.js'+import { getAbuseTargetUrl } from '@server/lib/activitypub/url.js'+import { UserModel } from '@server/models/user/user.js'+import { MUserDefault } from '@server/types/models/index.js'+import { AbstractNewAbuseMessage } from './abstract-new-abuse-message.js'export class NewAbuseMessageForReporter extends AbstractNewAbuseMessage {private reporter: MUserDefaultdiff --git a/server/server/lib/notifier/shared/blacklist/index.ts b/server/server/lib/notifier/shared/blacklist/index.tsnew file mode 100644index 0000000000..9af153b5a8--- /dev/null+++ b/server/server/lib/notifier/shared/blacklist/index.ts@@ -0,0 +1,3 @@+export * from './new-auto-blacklist-for-moderators.js'+export * from './new-blacklist-for-owner.js'+export * from './unblacklist-for-owner.js'diff --git a/server/lib/notifier/shared/blacklist/new-auto-blacklist-for-moderators.ts b/server/server/lib/notifier/shared/blacklist/new-auto-blacklist-for-moderators.tssimilarity index 80%rename from server/lib/notifier/shared/blacklist/new-auto-blacklist-for-moderators.tsrename to server/server/lib/notifier/shared/blacklist/new-auto-blacklist-for-moderators.tsindex ad2cc00ea9..3389bcd67e 100644--- a/server/lib/notifier/shared/blacklist/new-auto-blacklist-for-moderators.ts+++ b/server/server/lib/notifier/shared/blacklist/new-auto-blacklist-for-moderators.ts@@ -1,11 +1,16 @@-import { logger } from '@server/helpers/logger'-import { WEBSERVER } from '@server/initializers/constants'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { MUserDefault, MUserWithNotificationSetting, MVideoBlacklistLightVideo, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType, UserRight } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { UserNotificationType, UserRight } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { UserModel } from '@server/models/user/user.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import {+ MUserDefault,+ MUserWithNotificationSetting,+ MVideoBlacklistLightVideo,+ UserNotificationModelForApi+} from '@server/types/models/index.js'+import { AbstractNotification } from '../common/abstract-notification.js'export class NewAutoBlacklistForModerators extends AbstractNotification <MVideoBlacklistLightVideo> {private moderators: MUserDefault[]diff --git a/server/lib/notifier/shared/blacklist/new-blacklist-for-owner.ts b/server/server/lib/notifier/shared/blacklist/new-blacklist-for-owner.tssimilarity index 77%rename from server/lib/notifier/shared/blacklist/new-blacklist-for-owner.tsrename to server/server/lib/notifier/shared/blacklist/new-blacklist-for-owner.tsindex 342b69ec78..2ce8b13272 100644--- a/server/lib/notifier/shared/blacklist/new-blacklist-for-owner.ts+++ b/server/server/lib/notifier/shared/blacklist/new-blacklist-for-owner.ts@@ -1,11 +1,16 @@-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MUserDefault, MUserWithNotificationSetting, MVideoBlacklistVideo, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { UserNotificationType } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { UserModel } from '@server/models/user/user.js'+import {+ MUserDefault,+ MUserWithNotificationSetting,+ MVideoBlacklistVideo,+ UserNotificationModelForApi+} from '@server/types/models/index.js'+import { AbstractNotification } from '../common/abstract-notification.js'export class NewBlacklistForOwner extends AbstractNotification <MVideoBlacklistVideo> {private user: MUserDefaultdiff --git a/server/lib/notifier/shared/blacklist/unblacklist-for-owner.ts b/server/server/lib/notifier/shared/blacklist/unblacklist-for-owner.tssimilarity index 78%rename from server/lib/notifier/shared/blacklist/unblacklist-for-owner.tsrename to server/server/lib/notifier/shared/blacklist/unblacklist-for-owner.tsindex e6f90e23cd..66a6d1263b 100644--- a/server/lib/notifier/shared/blacklist/unblacklist-for-owner.ts+++ b/server/server/lib/notifier/shared/blacklist/unblacklist-for-owner.ts@@ -1,11 +1,11 @@-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class UnblacklistForOwner extends AbstractNotification <MVideoFullLight> {private user: MUserDefaultdiff --git a/server/lib/notifier/shared/comment/comment-mention.ts b/server/server/lib/notifier/shared/comment/comment-mention.tssimilarity index 89%rename from server/lib/notifier/shared/comment/comment-mention.tsrename to server/server/lib/notifier/shared/comment/comment-mention.tsindex 3074e97db6..e6bba1eee4 100644--- a/server/lib/notifier/shared/comment/comment-mention.ts+++ b/server/server/lib/notifier/shared/comment/comment-mention.ts@@ -1,20 +1,20 @@-import { logger } from '@server/helpers/logger'-import { toSafeHtml } from '@server/helpers/markdown'-import { WEBSERVER } from '@server/initializers/constants'-import { AccountBlocklistModel } from '@server/models/account/account-blocklist'-import { getServerActor } from '@server/models/application/application'-import { ServerBlocklistModel } from '@server/models/server/server-blocklist'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'+import { logger } from '@server/helpers/logger.js'+import { toSafeHtml } from '@server/helpers/markdown.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { AccountBlocklistModel } from '@server/models/account/account-blocklist.js'+import { getServerActor } from '@server/models/application/application.js'+import { ServerBlocklistModel } from '@server/models/server/server-blocklist.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { UserModel } from '@server/models/user/user.js'import {MCommentOwnerVideo,MUserDefault,MUserNotifSettingAccount,MUserWithNotificationSetting,UserNotificationModelForApi-} from '@server/types/models'-import { UserNotificationSettingValue, UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common'+} from '@server/types/models/index.js'+import { UserNotificationSettingValue, UserNotificationType } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/index.js'export class CommentMention extends AbstractNotification <MCommentOwnerVideo, MUserNotifSettingAccount> {private users: MUserDefault[]diff --git a/server/server/lib/notifier/shared/comment/index.ts b/server/server/lib/notifier/shared/comment/index.tsnew file mode 100644index 0000000000..cbb93ebd39--- /dev/null+++ b/server/server/lib/notifier/shared/comment/index.ts@@ -0,0 +1,2 @@+export * from './comment-mention.js'+export * from './new-comment-for-video-owner.js'diff --git a/server/lib/notifier/shared/comment/new-comment-for-video-owner.ts b/server/server/lib/notifier/shared/comment/new-comment-for-video-owner.tssimilarity index 86%rename from server/lib/notifier/shared/comment/new-comment-for-video-owner.tsrename to server/server/lib/notifier/shared/comment/new-comment-for-video-owner.tsindex 4f96439a30..eddb162f32 100644--- a/server/lib/notifier/shared/comment/new-comment-for-video-owner.ts+++ b/server/server/lib/notifier/shared/comment/new-comment-for-video-owner.ts@@ -1,12 +1,12 @@-import { logger } from '@server/helpers/logger'-import { toSafeHtml } from '@server/helpers/markdown'-import { WEBSERVER } from '@server/initializers/constants'-import { isBlockedByServerOrAccount } from '@server/lib/blocklist'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MCommentOwnerVideo, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { toSafeHtml } from '@server/helpers/markdown.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { isBlockedByServerOrAccount } from '@server/lib/blocklist.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MCommentOwnerVideo, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class NewCommentForVideoOwner extends AbstractNotification <MCommentOwnerVideo> {private user: MUserDefaultdiff --git a/server/lib/notifier/shared/common/abstract-notification.ts b/server/server/lib/notifier/shared/common/abstract-notification.tssimilarity index 72%rename from server/lib/notifier/shared/common/abstract-notification.tsrename to server/server/lib/notifier/shared/common/abstract-notification.tsindex 79403611e7..c8b385c6d0 100644--- a/server/lib/notifier/shared/common/abstract-notification.ts+++ b/server/server/lib/notifier/shared/common/abstract-notification.ts@@ -1,5 +1,5 @@-import { MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { EmailPayload, UserNotificationSettingValue } from '@shared/models'+import { EmailPayload, UserNotificationSettingValueType } from '@peertube/peertube-models'+import { MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'export abstract class AbstractNotification <T, U = MUserWithNotificationSetting> {@@ -10,7 +10,7 @@ export abstract class AbstractNotification <T, U = MUserWithNotificationSetting>abstract prepare (): Promise<void>abstract log (): void- abstract getSetting (user: U): UserNotificationSettingValue+ abstract getSetting (user: U): UserNotificationSettingValueTypeabstract getTargetUsers (): U[]abstract createNotification (user: U): UserNotificationModelForApidiff --git a/server/server/lib/notifier/shared/common/index.ts b/server/server/lib/notifier/shared/common/index.tsnew file mode 100644index 0000000000..322a351205--- /dev/null+++ b/server/server/lib/notifier/shared/common/index.ts@@ -0,0 +1 @@+export * from './abstract-notification.js'diff --git a/server/lib/notifier/shared/follow/auto-follow-for-instance.ts b/server/server/lib/notifier/shared/follow/auto-follow-for-instance.tssimilarity index 83%rename from server/lib/notifier/shared/follow/auto-follow-for-instance.tsrename to server/server/lib/notifier/shared/follow/auto-follow-for-instance.tsindex ab9747ba88..027bf8eefb 100644--- a/server/lib/notifier/shared/follow/auto-follow-for-instance.ts+++ b/server/server/lib/notifier/shared/follow/auto-follow-for-instance.ts@@ -1,9 +1,9 @@-import { logger } from '@server/helpers/logger'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MActorFollowFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType, UserRight } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MActorFollowFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType, UserRight } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class AutoFollowForInstance extends AbstractNotification <MActorFollowFull> {private admins: MUserDefault[]diff --git a/server/lib/notifier/shared/follow/follow-for-instance.ts b/server/server/lib/notifier/shared/follow/follow-for-instance.tssimilarity index 84%rename from server/lib/notifier/shared/follow/follow-for-instance.tsrename to server/server/lib/notifier/shared/follow/follow-for-instance.tsindex 777a12ef49..76fa0332ab 100644--- a/server/lib/notifier/shared/follow/follow-for-instance.ts+++ b/server/server/lib/notifier/shared/follow/follow-for-instance.ts@@ -1,11 +1,11 @@-import { logger } from '@server/helpers/logger'-import { WEBSERVER } from '@server/initializers/constants'-import { isBlockedByServerOrAccount } from '@server/lib/blocklist'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MActorFollowFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType, UserRight } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { isBlockedByServerOrAccount } from '@server/lib/blocklist.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MActorFollowFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType, UserRight } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class FollowForInstance extends AbstractNotification <MActorFollowFull> {private admins: MUserDefault[]diff --git a/server/lib/notifier/shared/follow/follow-for-user.ts b/server/server/lib/notifier/shared/follow/follow-for-user.tssimilarity index 89%rename from server/lib/notifier/shared/follow/follow-for-user.tsrename to server/server/lib/notifier/shared/follow/follow-for-user.tsindex 697c82cddd..bf915dfeb4 100644--- a/server/lib/notifier/shared/follow/follow-for-user.ts+++ b/server/server/lib/notifier/shared/follow/follow-for-user.ts@@ -1,10 +1,10 @@-import { logger } from '@server/helpers/logger'-import { isBlockedByServerOrAccount } from '@server/lib/blocklist'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MActorFollowFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { isBlockedByServerOrAccount } from '@server/lib/blocklist.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MActorFollowFull, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class FollowForUser extends AbstractNotification <MActorFollowFull> {private followType: 'account' | 'channel'diff --git a/server/server/lib/notifier/shared/follow/index.ts b/server/server/lib/notifier/shared/follow/index.tsnew file mode 100644index 0000000000..5fe27e4c95--- /dev/null+++ b/server/server/lib/notifier/shared/follow/index.ts@@ -0,0 +1,3 @@+export * from './auto-follow-for-instance.js'+export * from './follow-for-instance.js'+export * from './follow-for-user.js'diff --git a/server/server/lib/notifier/shared/index.ts b/server/server/lib/notifier/shared/index.tsnew file mode 100644index 0000000000..f4f165c401--- /dev/null+++ b/server/server/lib/notifier/shared/index.ts@@ -0,0 +1,7 @@+export * from './abuse/index.js'+export * from './blacklist/index.js'+export * from './comment/index.js'+export * from './common/index.js'+export * from './follow/index.js'+export * from './instance/index.js'+export * from './video-publication/index.js'diff --git a/server/lib/notifier/shared/instance/direct-registration-for-moderators.ts b/server/server/lib/notifier/shared/instance/direct-registration-for-moderators.tssimilarity index 80%rename from server/lib/notifier/shared/instance/direct-registration-for-moderators.tsrename to server/server/lib/notifier/shared/instance/direct-registration-for-moderators.tsindex 5044f20684..42078ba24c 100644--- a/server/lib/notifier/shared/instance/direct-registration-for-moderators.ts+++ b/server/server/lib/notifier/shared/instance/direct-registration-for-moderators.ts@@ -1,10 +1,10 @@-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType, UserRight } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType, UserRight } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class DirectRegistrationForModerators extends AbstractNotification <MUserDefault> {private moderators: MUserDefault[]diff --git a/server/server/lib/notifier/shared/instance/index.ts b/server/server/lib/notifier/shared/instance/index.tsnew file mode 100644index 0000000000..c922fcbe97--- /dev/null+++ b/server/server/lib/notifier/shared/instance/index.ts@@ -0,0 +1,4 @@+export * from './new-peertube-version-for-admins.js'+export * from './new-plugin-version-for-admins.js'+export * from './direct-registration-for-moderators.js'+export * from './registration-request-for-moderators.js'diff --git a/server/lib/notifier/shared/instance/new-peertube-version-for-admins.ts b/server/server/lib/notifier/shared/instance/new-peertube-version-for-admins.tssimilarity index 84%rename from server/lib/notifier/shared/instance/new-peertube-version-for-admins.tsrename to server/server/lib/notifier/shared/instance/new-peertube-version-for-admins.tsindex f5646c6669..ff9b248e58 100644--- a/server/lib/notifier/shared/instance/new-peertube-version-for-admins.ts+++ b/server/server/lib/notifier/shared/instance/new-peertube-version-for-admins.ts@@ -1,9 +1,9 @@-import { logger } from '@server/helpers/logger'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MApplication, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType, UserRight } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MApplication, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType, UserRight } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export type NewPeerTubeVersionForAdminsPayload = {application: MApplicationdiff --git a/server/lib/notifier/shared/instance/new-plugin-version-for-admins.ts b/server/server/lib/notifier/shared/instance/new-plugin-version-for-admins.tssimilarity index 82%rename from server/lib/notifier/shared/instance/new-plugin-version-for-admins.tsrename to server/server/lib/notifier/shared/instance/new-plugin-version-for-admins.tsindex 547c6726c0..4a9de9a0b4 100644--- a/server/lib/notifier/shared/instance/new-plugin-version-for-admins.ts+++ b/server/server/lib/notifier/shared/instance/new-plugin-version-for-admins.ts@@ -1,10 +1,10 @@-import { logger } from '@server/helpers/logger'-import { WEBSERVER } from '@server/initializers/constants'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MPlugin, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType, UserRight } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MPlugin, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType, UserRight } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class NewPluginVersionForAdmins extends AbstractNotification <MPlugin> {private admins: MUserDefault[]diff --git a/server/lib/notifier/shared/instance/registration-request-for-moderators.ts b/server/server/lib/notifier/shared/instance/registration-request-for-moderators.tssimilarity index 82%rename from server/lib/notifier/shared/instance/registration-request-for-moderators.tsrename to server/server/lib/notifier/shared/instance/registration-request-for-moderators.tsindex 79920245a2..29dda28be2 100644--- a/server/lib/notifier/shared/instance/registration-request-for-moderators.ts+++ b/server/server/lib/notifier/shared/instance/registration-request-for-moderators.ts@@ -1,9 +1,9 @@-import { logger } from '@server/helpers/logger'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MRegistration, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType, UserRight } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MRegistration, MUserDefault, MUserWithNotificationSetting, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType, UserRight } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class RegistrationRequestForModerators extends AbstractNotification <MRegistration> {private moderators: MUserDefault[]diff --git a/server/lib/notifier/shared/video-publication/abstract-owned-video-publication.ts b/server/server/lib/notifier/shared/video-publication/abstract-owned-video-publication.tssimilarity index 81%rename from server/lib/notifier/shared/video-publication/abstract-owned-video-publication.tsrename to server/server/lib/notifier/shared/video-publication/abstract-owned-video-publication.tsindex a940cde69d..c0bb336207 100644--- a/server/lib/notifier/shared/video-publication/abstract-owned-video-publication.ts+++ b/server/server/lib/notifier/shared/video-publication/abstract-owned-video-publication.ts@@ -1,10 +1,10 @@-import { logger } from '@server/helpers/logger'-import { WEBSERVER } from '@server/initializers/constants'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export abstract class AbstractOwnedVideoPublication extends AbstractNotification <MVideoFullLight> {protected user: MUserDefaultdiff --git a/server/lib/notifier/shared/video-publication/import-finished-for-owner.ts b/server/server/lib/notifier/shared/video-publication/import-finished-for-owner.tssimilarity index 90%rename from server/lib/notifier/shared/video-publication/import-finished-for-owner.tsrename to server/server/lib/notifier/shared/video-publication/import-finished-for-owner.tsindex 3bd64692fd..38f12d8cf7 100644--- a/server/lib/notifier/shared/video-publication/import-finished-for-owner.ts+++ b/server/server/lib/notifier/shared/video-publication/import-finished-for-owner.ts@@ -1,10 +1,10 @@-import { logger } from '@server/helpers/logger'-import { WEBSERVER } from '@server/initializers/constants'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MUserDefault, MUserWithNotificationSetting, MVideoImportVideo, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MUserDefault, MUserWithNotificationSetting, MVideoImportVideo, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export type ImportFinishedForOwnerPayload = {videoImport: MVideoImportVideodiff --git a/server/server/lib/notifier/shared/video-publication/index.ts b/server/server/lib/notifier/shared/video-publication/index.tsnew file mode 100644index 0000000000..fc36a98993--- /dev/null+++ b/server/server/lib/notifier/shared/video-publication/index.ts@@ -0,0 +1,6 @@+export * from './new-video-for-subscribers.js'+export * from './import-finished-for-owner.js'+export * from './owned-publication-after-auto-unblacklist.js'+export * from './owned-publication-after-schedule-update.js'+export * from './owned-publication-after-transcoding.js'+export * from './studio-edition-finished-for-owner.js'diff --git a/server/lib/notifier/shared/video-publication/new-video-for-subscribers.ts b/server/server/lib/notifier/shared/video-publication/new-video-for-subscribers.tssimilarity index 86%rename from server/lib/notifier/shared/video-publication/new-video-for-subscribers.tsrename to server/server/lib/notifier/shared/video-publication/new-video-for-subscribers.tsindex df7a5561d7..df2d89fc90 100644--- a/server/lib/notifier/shared/video-publication/new-video-for-subscribers.ts+++ b/server/server/lib/notifier/shared/video-publication/new-video-for-subscribers.ts@@ -1,10 +1,10 @@-import { logger } from '@server/helpers/logger'-import { WEBSERVER } from '@server/initializers/constants'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MUserWithNotificationSetting, MVideoAccountLight, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType, VideoPrivacy, VideoState } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MUserWithNotificationSetting, MVideoAccountLight, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType, VideoPrivacy, VideoState } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class NewVideoForSubscribers extends AbstractNotification <MVideoAccountLight> {private users: MUserWithNotificationSetting[]diff --git a/server/lib/notifier/shared/video-publication/owned-publication-after-auto-unblacklist.ts b/server/server/lib/notifier/shared/video-publication/owned-publication-after-auto-unblacklist.tssimilarity index 83%rename from server/lib/notifier/shared/video-publication/owned-publication-after-auto-unblacklist.tsrename to server/server/lib/notifier/shared/video-publication/owned-publication-after-auto-unblacklist.tsindex 27d89a5c76..3dbb6e05fd 100644--- a/server/lib/notifier/shared/video-publication/owned-publication-after-auto-unblacklist.ts+++ b/server/server/lib/notifier/shared/video-publication/owned-publication-after-auto-unblacklist.ts@@ -1,6 +1,6 @@-import { VideoState } from '@shared/models'-import { AbstractOwnedVideoPublication } from './abstract-owned-video-publication'+import { VideoState } from '@peertube/peertube-models'+import { AbstractOwnedVideoPublication } from './abstract-owned-video-publication.js'export class OwnedPublicationAfterAutoUnblacklist extends AbstractOwnedVideoPublication {diff --git a/server/lib/notifier/shared/video-publication/owned-publication-after-schedule-update.ts b/server/server/lib/notifier/shared/video-publication/owned-publication-after-schedule-update.tssimilarity index 83%rename from server/lib/notifier/shared/video-publication/owned-publication-after-schedule-update.tsrename to server/server/lib/notifier/shared/video-publication/owned-publication-after-schedule-update.tsindex 2e253b358d..d8f6e848a8 100644--- a/server/lib/notifier/shared/video-publication/owned-publication-after-schedule-update.ts+++ b/server/server/lib/notifier/shared/video-publication/owned-publication-after-schedule-update.ts@@ -1,5 +1,5 @@-import { VideoState } from '@shared/models'-import { AbstractOwnedVideoPublication } from './abstract-owned-video-publication'+import { VideoState } from '@peertube/peertube-models'+import { AbstractOwnedVideoPublication } from './abstract-owned-video-publication.js'export class OwnedPublicationAfterScheduleUpdate extends AbstractOwnedVideoPublication {diff --git a/server/lib/notifier/shared/video-publication/owned-publication-after-transcoding.ts b/server/server/lib/notifier/shared/video-publication/owned-publication-after-transcoding.tssimilarity index 94%rename from server/lib/notifier/shared/video-publication/owned-publication-after-transcoding.tsrename to server/server/lib/notifier/shared/video-publication/owned-publication-after-transcoding.tsindex 4fab1090f1..56b4aaaa96 100644--- a/server/lib/notifier/shared/video-publication/owned-publication-after-transcoding.ts+++ b/server/server/lib/notifier/shared/video-publication/owned-publication-after-transcoding.ts@@ -1,4 +1,4 @@-import { AbstractOwnedVideoPublication } from './abstract-owned-video-publication'+import { AbstractOwnedVideoPublication } from './abstract-owned-video-publication.js'export class OwnedPublicationAfterTranscoding extends AbstractOwnedVideoPublication {diff --git a/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts b/server/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.tssimilarity index 81%rename from server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.tsrename to server/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.tsindex f36399f05a..a4d72567ca 100644--- a/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts+++ b/server/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts@@ -1,10 +1,10 @@-import { logger } from '@server/helpers/logger'-import { WEBSERVER } from '@server/initializers/constants'-import { UserModel } from '@server/models/user/user'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotificationModelForApi } from '@server/types/models'-import { UserNotificationType } from '@shared/models'-import { AbstractNotification } from '../common/abstract-notification'+import { logger } from '@server/helpers/logger.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { UserModel } from '@server/models/user/user.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotificationModelForApi } from '@server/types/models/index.js'+import { UserNotificationType } from '@peertube/peertube-models'+import { AbstractNotification } from '../common/abstract-notification.js'export class StudioEditionFinishedForOwner extends AbstractNotification <MVideoFullLight> {private user: MUserDefaultdiff --git a/server/server/lib/object-storage/index.ts b/server/server/lib/object-storage/index.tsnew file mode 100644index 0000000000..238a652a6b--- /dev/null+++ b/server/server/lib/object-storage/index.ts@@ -0,0 +1,5 @@+export * from './keys.js'+export * from './proxy.js'+export * from './pre-signed-urls.js'+export * from './urls.js'+export * from './videos.js'diff --git a/server/lib/object-storage/keys.ts b/server/server/lib/object-storage/keys.tssimilarity index 88%rename from server/lib/object-storage/keys.tsrename to server/server/lib/object-storage/keys.tsindex 6d2098298d..9e52a7f19f 100644--- a/server/lib/object-storage/keys.ts+++ b/server/server/lib/object-storage/keys.ts@@ -1,5 +1,5 @@import { join } from 'path'-import { MStreamingPlaylistVideo } from '@server/types/models'+import { MStreamingPlaylistVideo } from '@server/types/models/index.js'function generateHLSObjectStorageKey (playlist: MStreamingPlaylistVideo, filename: string) {return join(generateHLSObjectBaseStorageKey(playlist), filename)diff --git a/server/lib/object-storage/pre-signed-urls.ts b/server/server/lib/object-storage/pre-signed-urls.tssimilarity index 67%rename from server/lib/object-storage/pre-signed-urls.tsrename to server/server/lib/object-storage/pre-signed-urls.tsindex caf149bb89..bbb19a57cc 100644--- a/server/lib/object-storage/pre-signed-urls.ts+++ b/server/server/lib/object-storage/pre-signed-urls.ts@@ -1,10 +1,8 @@-import { GetObjectCommand } from '@aws-sdk/client-s3'-import { getSignedUrl } from '@aws-sdk/s3-request-presigner'-import { CONFIG } from '@server/initializers/config'-import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models'-import { generateHLSObjectStorageKey, generateWebVideoObjectStorageKey } from './keys'-import { buildKey, getClient } from './shared'-import { getHLSPublicFileUrl, getWebVideoPublicFileUrl } from './urls'+import { CONFIG } from '@server/initializers/config.js'+import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models/index.js'+import { generateHLSObjectStorageKey, generateWebVideoObjectStorageKey } from './keys.js'+import { buildKey, getClient } from './shared/index.js'+import { getHLSPublicFileUrl, getWebVideoPublicFileUrl } from './urls.js'export async function generateWebVideoPresignedUrl (options: {file: MVideoFile@@ -14,13 +12,16 @@ export async function generateWebVideoPresignedUrl (options: {const key = generateWebVideoObjectStorageKey(file.filename)+ const { GetObjectCommand } = await import('@aws-sdk/client-s3')+ const { getSignedUrl } = await import('@aws-sdk/s3-request-presigner')+const command = new GetObjectCommand({Bucket: CONFIG.OBJECT_STORAGE.WEB_VIDEOS.BUCKET_NAME,Key: buildKey(key, CONFIG.OBJECT_STORAGE.WEB_VIDEOS),ResponseContentDisposition: `attachment; filename=${downloadFilename}`})- const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 })+ const url = await getSignedUrl(await getClient(), command, { expiresIn: 3600 * 24 })return getWebVideoPublicFileUrl(url)}@@ -34,13 +35,16 @@ export async function generateHLSFilePresignedUrl (options: {const key = generateHLSObjectStorageKey(streamingPlaylist, file.filename)+ const { GetObjectCommand } = await import('@aws-sdk/client-s3')+ const { getSignedUrl } = await import('@aws-sdk/s3-request-presigner')+const command = new GetObjectCommand({Bucket: CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS.BUCKET_NAME,Key: buildKey(key, CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS),ResponseContentDisposition: `attachment; filename=${downloadFilename}`})- const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 })+ const url = await getSignedUrl(await getClient(), command, { expiresIn: 3600 * 24 })return getHLSPublicFileUrl(url)}diff --git a/server/lib/object-storage/proxy.ts b/server/server/lib/object-storage/proxy.tssimilarity index 88%rename from server/lib/object-storage/proxy.tsrename to server/server/lib/object-storage/proxy.tsindex c09a0d1b07..bef899fed3 100644--- a/server/lib/object-storage/proxy.ts+++ b/server/server/lib/object-storage/proxy.ts@@ -1,13 +1,14 @@import express from 'express'import { PassThrough, pipeline } from 'stream'-import { GetObjectCommandOutput } from '@aws-sdk/client-s3'-import { buildReinjectVideoFileTokenQuery } from '@server/controllers/shared/m3u8-playlist'-import { logger } from '@server/helpers/logger'-import { StreamReplacer } from '@server/helpers/stream-replacer'-import { MStreamingPlaylist, MVideo } from '@server/types/models'-import { HttpStatusCode } from '@shared/models'-import { injectQueryToPlaylistUrls } from '../hls'-import { getHLSFileReadStream, getWebVideoFileReadStream } from './videos'+import { HttpStatusCode } from '@peertube/peertube-models'+import { buildReinjectVideoFileTokenQuery } from '@server/controllers/shared/m3u8-playlist.js'+import { logger } from '@server/helpers/logger.js'+import { StreamReplacer } from '@server/helpers/stream-replacer.js'+import { MStreamingPlaylist, MVideo } from '@server/types/models/index.js'+import { injectQueryToPlaylistUrls } from '../hls.js'+import { getHLSFileReadStream, getWebVideoFileReadStream } from './videos.js'++import type { GetObjectCommandOutput } from '@aws-sdk/client-s3'export async function proxifyWebVideoFile (options: {req: express.Requestdiff --git a/server/server/lib/object-storage/shared/client.ts b/server/server/lib/object-storage/shared/client.tsnew file mode 100644index 0000000000..085bdbc4c4--- /dev/null+++ b/server/server/lib/object-storage/shared/client.ts@@ -0,0 +1,78 @@+import type { S3Client } from '@aws-sdk/client-s3'+import { logger } from '@server/helpers/logger.js'+import { isProxyEnabled } from '@server/helpers/proxy.js'+import { getAgent } from '@server/helpers/requests.js'+import { CONFIG } from '@server/initializers/config.js'+import { lTags } from './logger.js'++async function getProxyRequestHandler () {+ if (!isProxyEnabled()) return null++ const { agent } = getAgent()++ const { NodeHttpHandler } = await import('@aws-sdk/node-http-handler')++ return new NodeHttpHandler({+ httpAgent: agent.http,+ httpsAgent: agent.https+ })+}++let endpointParsed: URL+function getEndpointParsed () {+ if (endpointParsed) return endpointParsed++ endpointParsed = new URL(getEndpoint())++ return endpointParsed+}++let s3ClientPromise: Promise<S3Client>+function getClient () {+ if (s3ClientPromise) return s3ClientPromise++ s3ClientPromise = (async () => {+ const OBJECT_STORAGE = CONFIG.OBJECT_STORAGE++ const { S3Client } = await import('@aws-sdk/client-s3')++ const s3Client = new S3Client({+ endpoint: getEndpoint(),+ region: OBJECT_STORAGE.REGION,+ credentials: OBJECT_STORAGE.CREDENTIALS.ACCESS_KEY_ID+ ? {+ accessKeyId: OBJECT_STORAGE.CREDENTIALS.ACCESS_KEY_ID,+ secretAccessKey: OBJECT_STORAGE.CREDENTIALS.SECRET_ACCESS_KEY+ }+ : undefined,+ requestHandler: await getProxyRequestHandler()+ })++ logger.info('Initialized S3 client %s with region %s.', getEndpoint(), OBJECT_STORAGE.REGION, lTags())++ return s3Client+ })()++ return s3ClientPromise+}++// ---------------------------------------------------------------------------++export {+ getEndpointParsed,+ getClient+}++// ---------------------------------------------------------------------------++let endpoint: string+function getEndpoint () {+ if (endpoint) return endpoint++ const endpointConfig = CONFIG.OBJECT_STORAGE.ENDPOINT+ endpoint = endpointConfig.startsWith('http://') || endpointConfig.startsWith('https://')+ ? CONFIG.OBJECT_STORAGE.ENDPOINT+ : 'https://' + CONFIG.OBJECT_STORAGE.ENDPOINT++ return endpoint+}diff --git a/server/server/lib/object-storage/shared/index.ts b/server/server/lib/object-storage/shared/index.tsnew file mode 100644index 0000000000..d6b76a3d53--- /dev/null+++ b/server/server/lib/object-storage/shared/index.ts@@ -0,0 +1,3 @@+export * from './client.js'+export * from './logger.js'+export * from './object-storage-helpers.js'diff --git a/server/lib/object-storage/shared/logger.ts b/server/server/lib/object-storage/shared/logger.tssimilarity index 53%rename from server/lib/object-storage/shared/logger.tsrename to server/server/lib/object-storage/shared/logger.tsindex 8ab7cbd71f..8b8e19f683 100644--- a/server/lib/object-storage/shared/logger.ts+++ b/server/server/lib/object-storage/shared/logger.ts@@ -1,4 +1,4 @@-import { loggerTagsFactory } from '@server/helpers/logger'+import { loggerTagsFactory } from '@server/helpers/logger.js'const lTags = loggerTagsFactory('object-storage')diff --git a/server/lib/object-storage/shared/object-storage-helpers.ts b/server/server/lib/object-storage/shared/object-storage-helpers.tssimilarity index 81%rename from server/lib/object-storage/shared/object-storage-helpers.tsrename to server/server/lib/object-storage/shared/object-storage-helpers.tsindex 0d8878bd2b..ce96696e5d 100644--- a/server/lib/object-storage/shared/object-storage-helpers.ts+++ b/server/server/lib/object-storage/shared/object-storage-helpers.ts@@ -1,25 +1,17 @@-import { map } from 'bluebird'-import { createReadStream, createWriteStream, ensureDir, ReadStream } from 'fs-extra'+import { pipelinePromise } from '@server/helpers/core-utils.js'+import { isArray } from '@server/helpers/custom-validators/misc.js'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import Bluebird from 'bluebird'+import { createReadStream, createWriteStream, ReadStream } from 'fs'+import { ensureDir } from 'fs-extra/esm'import { dirname } from 'path'import { Readable } from 'stream'-import {- _Object,- CompleteMultipartUploadCommandOutput,- DeleteObjectCommand,- GetObjectCommand,- ListObjectsV2Command,- PutObjectAclCommand,- PutObjectCommandInput,- S3Client-} from '@aws-sdk/client-s3'-import { Upload } from '@aws-sdk/lib-storage'-import { pipelinePromise } from '@server/helpers/core-utils'-import { isArray } from '@server/helpers/custom-validators/misc'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { getInternalUrl } from '../urls'-import { getClient } from './client'-import { lTags } from './logger'+import { getInternalUrl } from '../urls.js'+import { getClient } from './client.js'+import { lTags } from './logger.js'++import type { _Object, CompleteMultipartUploadCommandOutput, PutObjectCommandInput, S3Client } from '@aws-sdk/client-s3'type BucketInfo = {BUCKET_NAME: string@@ -27,7 +19,9 @@ type BucketInfo = {}async function listKeysOfPrefix (prefix: string, bucketInfo: BucketInfo) {- const s3Client = getClient()+ const s3Client = await getClient()++ const { ListObjectsV2Command } = await import('@aws-sdk/client-s3')const commandPrefix = bucketInfo.PREFIX + prefixconst listCommand = new ListObjectsV2Command({@@ -89,16 +83,19 @@ async function updateObjectACL (options: {logger.debug('Updating ACL file %s in bucket %s', key, bucketInfo.BUCKET_NAME, lTags())+ const { PutObjectAclCommand } = await import('@aws-sdk/client-s3')+const command = new PutObjectAclCommand({Bucket: bucketInfo.BUCKET_NAME,Key: key,ACL: acl})- await getClient().send(command)+ const client = await getClient()+ await client.send(command)}-function updatePrefixACL (options: {+async function updatePrefixACL (options: {prefix: stringbucketInfo: BucketInfoisPrivate: boolean@@ -108,6 +105,8 @@ function updatePrefixACL (options: {const acl = getACL(isPrivate)if (!acl) return+ const { PutObjectAclCommand } = await import('@aws-sdk/client-s3')+logger.debug('Updating ACL of files in prefix %s in bucket %s', prefix, bucketInfo.BUCKET_NAME, lTags())return applyOnPrefix({@@ -133,20 +132,26 @@ function removeObject (objectStorageKey: string, bucketInfo: BucketInfo) {return removeObjectByFullKey(key, bucketInfo)}-function removeObjectByFullKey (fullKey: string, bucketInfo: BucketInfo) {+async function removeObjectByFullKey (fullKey: string, bucketInfo: BucketInfo) {logger.debug('Removing file %s in bucket %s', fullKey, bucketInfo.BUCKET_NAME, lTags())+ const { DeleteObjectCommand } = await import('@aws-sdk/client-s3')+const command = new DeleteObjectCommand({Bucket: bucketInfo.BUCKET_NAME,Key: fullKey})- return getClient().send(command)+ const client = await getClient()++ return client.send(command)}async function removePrefix (prefix: string, bucketInfo: BucketInfo) {logger.debug('Removing prefix %s in bucket %s', prefix, bucketInfo.BUCKET_NAME, lTags())+ const { DeleteObjectCommand } = await import('@aws-sdk/client-s3')+return applyOnPrefix({prefix,bucketInfo,@@ -172,11 +177,15 @@ async function makeAvailable (options: {await ensureDir(dirname(options.destination))+ const { GetObjectCommand } = await import('@aws-sdk/client-s3')+const command = new GetObjectCommand({Bucket: bucketInfo.BUCKET_NAME,Key: buildKey(key, bucketInfo)})- const response = await getClient().send(command)++ const client = await getClient()+ const response = await client.send(command)const file = createWriteStream(destination)await pipelinePromise(response.Body as Readable, file)@@ -197,13 +206,16 @@ async function createObjectReadStream (options: {}) {const { key, bucketInfo, rangeHeader } = options+ const { GetObjectCommand } = await import('@aws-sdk/client-s3')+const command = new GetObjectCommand({Bucket: bucketInfo.BUCKET_NAME,Key: buildKey(key, bucketInfo),Range: rangeHeader})- const response = await getClient().send(command)+ const client = await getClient()+ const response = await client.send(command)return {response,@@ -214,7 +226,8 @@ async function createObjectReadStream (options: {// ---------------------------------------------------------------------------export {- BucketInfo,+ type BucketInfo,+buildKey,storeObject,@@ -252,8 +265,10 @@ async function uploadToStorage (options: {const acl = getACL(isPrivate)if (acl) input.ACL = acl+ const { Upload } = await import('@aws-sdk/lib-storage')+const parallelUploads3 = new Upload({- client: getClient(),+ client: await getClient(),queueSize: 4,partSize: CONFIG.OBJECT_STORAGE.MAX_UPLOAD_PART,@@ -291,7 +306,9 @@ async function applyOnPrefix (options: {}) {const { prefix, bucketInfo, commandBuilder, continuationToken } = options- const s3Client = getClient()+ const s3Client = await getClient()++ const { ListObjectsV2Command } = await import('@aws-sdk/client-s3')const commandPrefix = buildKey(prefix, bucketInfo)const listCommand = new ListObjectsV2Command({@@ -309,7 +326,7 @@ async function applyOnPrefix (options: {throw new Error(message)}- await map(listedObjects.Contents, object => {+ await Bluebird.map(listedObjects.Contents, object => {const command = commandBuilder(object)return s3Client.send(command)diff --git a/server/lib/object-storage/urls.ts b/server/server/lib/object-storage/urls.tssimilarity index 92%rename from server/lib/object-storage/urls.tsrename to server/server/lib/object-storage/urls.tsindex 40619cd5a1..0bd469ea86 100644--- a/server/lib/object-storage/urls.ts+++ b/server/server/lib/object-storage/urls.ts@@ -1,7 +1,7 @@-import { CONFIG } from '@server/initializers/config'-import { OBJECT_STORAGE_PROXY_PATHS, WEBSERVER } from '@server/initializers/constants'-import { MVideoUUID } from '@server/types/models'-import { BucketInfo, buildKey, getEndpointParsed } from './shared'+import { CONFIG } from '@server/initializers/config.js'+import { OBJECT_STORAGE_PROXY_PATHS, WEBSERVER } from '@server/initializers/constants.js'+import { MVideoUUID } from '@server/types/models/index.js'+import { BucketInfo, buildKey, getEndpointParsed } from './shared/index.js'function getInternalUrl (config: BucketInfo, keyWithoutPrefix: string) {return getBaseUrl(config) + buildKey(keyWithoutPrefix, config)diff --git a/server/lib/object-storage/videos.ts b/server/server/lib/object-storage/videos.tssimilarity index 94%rename from server/lib/object-storage/videos.tsrename to server/server/lib/object-storage/videos.tsindex 891e9ff763..46d32b5661 100644--- a/server/lib/object-storage/videos.ts+++ b/server/server/lib/object-storage/videos.ts@@ -1,10 +1,10 @@import { basename, join } from 'path'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { MStreamingPlaylistVideo, MVideo, MVideoFile } from '@server/types/models'-import { getHLSDirectory } from '../paths'-import { VideoPathManager } from '../video-path-manager'-import { generateHLSObjectBaseStorageKey, generateHLSObjectStorageKey, generateWebVideoObjectStorageKey } from './keys'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { MStreamingPlaylistVideo, MVideo, MVideoFile } from '@server/types/models/index.js'+import { getHLSDirectory } from '../paths.js'+import { VideoPathManager } from '../video-path-manager.js'+import { generateHLSObjectBaseStorageKey, generateHLSObjectStorageKey, generateWebVideoObjectStorageKey } from './keys.js'import {createObjectReadStream,listKeysOfPrefix,@@ -17,7 +17,7 @@ import {storeObject,updateObjectACL,updatePrefixACL-} from './shared'+} from './shared/index.js'function listHLSFileKeysOf (playlist: MStreamingPlaylistVideo) {return listKeysOfPrefix(generateHLSObjectBaseStorageKey(playlist), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS)diff --git a/server/lib/opentelemetry/metric-helpers/bittorrent-tracker-observers-builder.ts b/server/server/lib/opentelemetry/metric-helpers/bittorrent-tracker-observers-builder.tssimilarity index 100%rename from server/lib/opentelemetry/metric-helpers/bittorrent-tracker-observers-builder.tsrename to server/server/lib/opentelemetry/metric-helpers/bittorrent-tracker-observers-builder.tsdiff --git a/server/server/lib/opentelemetry/metric-helpers/index.ts b/server/server/lib/opentelemetry/metric-helpers/index.tsnew file mode 100644index 0000000000..ec9c354080--- /dev/null+++ b/server/server/lib/opentelemetry/metric-helpers/index.ts@@ -0,0 +1,7 @@+export * from './bittorrent-tracker-observers-builder.js'+export * from './lives-observers-builder.js'+export * from './job-queue-observers-builder.js'+export * from './nodejs-observers-builder.js'+export * from './playback-metrics.js'+export * from './stats-observers-builder.js'+export * from './viewers-observers-builder.js'diff --git a/server/lib/opentelemetry/metric-helpers/job-queue-observers-builder.ts b/server/server/lib/opentelemetry/metric-helpers/job-queue-observers-builder.tssimilarity index 91%rename from server/lib/opentelemetry/metric-helpers/job-queue-observers-builder.tsrename to server/server/lib/opentelemetry/metric-helpers/job-queue-observers-builder.tsindex 56713ede81..c0bcb517e8 100644--- a/server/lib/opentelemetry/metric-helpers/job-queue-observers-builder.ts+++ b/server/server/lib/opentelemetry/metric-helpers/job-queue-observers-builder.ts@@ -1,5 +1,5 @@import { Meter } from '@opentelemetry/api'-import { JobQueue } from '@server/lib/job-queue'+import { JobQueue } from '@server/lib/job-queue/index.js'export class JobQueueObserversBuilder {diff --git a/server/lib/opentelemetry/metric-helpers/lives-observers-builder.ts b/server/server/lib/opentelemetry/metric-helpers/lives-observers-builder.tssimilarity index 91%rename from server/lib/opentelemetry/metric-helpers/lives-observers-builder.tsrename to server/server/lib/opentelemetry/metric-helpers/lives-observers-builder.tsindex 5effc18e16..45676ed2b8 100644--- a/server/lib/opentelemetry/metric-helpers/lives-observers-builder.ts+++ b/server/server/lib/opentelemetry/metric-helpers/lives-observers-builder.ts@@ -1,5 +1,5 @@import { Meter } from '@opentelemetry/api'-import { VideoModel } from '@server/models/video/video'+import { VideoModel } from '@server/models/video/video.js'export class LivesObserversBuilder {diff --git a/server/lib/opentelemetry/metric-helpers/nodejs-observers-builder.ts b/server/server/lib/opentelemetry/metric-helpers/nodejs-observers-builder.tssimilarity index 98%rename from server/lib/opentelemetry/metric-helpers/nodejs-observers-builder.tsrename to server/server/lib/opentelemetry/metric-helpers/nodejs-observers-builder.tsindex 8ed219e9e4..40df12b8d5 100644--- a/server/lib/opentelemetry/metric-helpers/nodejs-observers-builder.ts+++ b/server/server/lib/opentelemetry/metric-helpers/nodejs-observers-builder.ts@@ -1,10 +1,10 @@-import { readdir } from 'fs-extra'+import { readdir } from 'fs/promises'import { constants, NodeGCPerformanceDetail, PerformanceObserver } from 'perf_hooks'import * as process from 'process'import { Meter, ObservableResult } from '@opentelemetry/api'import { ExplicitBucketHistogramAggregation } from '@opentelemetry/sdk-metrics'-import { View } from '@opentelemetry/sdk-metrics/build/src/view/View'-import { logger } from '@server/helpers/logger'+import { View } from '@opentelemetry/sdk-metrics/build/src/view/View.js'+import { logger } from '@server/helpers/logger.js'// Thanks to https://github.com/siimon/prom-client// We took their logic and adapter it for opentelemetrydiff --git a/server/lib/opentelemetry/metric-helpers/playback-metrics.ts b/server/server/lib/opentelemetry/metric-helpers/playback-metrics.tssimilarity index 95%rename from server/lib/opentelemetry/metric-helpers/playback-metrics.tsrename to server/server/lib/opentelemetry/metric-helpers/playback-metrics.tsindex 1eb08b5a66..ec139f3310 100644--- a/server/lib/opentelemetry/metric-helpers/playback-metrics.ts+++ b/server/server/lib/opentelemetry/metric-helpers/playback-metrics.ts@@ -1,6 +1,6 @@import { Counter, Meter } from '@opentelemetry/api'-import { MVideoImmutable } from '@server/types/models'-import { PlaybackMetricCreate } from '@shared/models'+import { MVideoImmutable } from '@server/types/models/index.js'+import { PlaybackMetricCreate } from '@peertube/peertube-models'export class PlaybackMetrics {private errorsCounter: Counterdiff --git a/server/lib/opentelemetry/metric-helpers/stats-observers-builder.ts b/server/server/lib/opentelemetry/metric-helpers/stats-observers-builder.tssimilarity index 98%rename from server/lib/opentelemetry/metric-helpers/stats-observers-builder.tsrename to server/server/lib/opentelemetry/metric-helpers/stats-observers-builder.tsindex 9f5f22e1bd..05e6431a45 100644--- a/server/lib/opentelemetry/metric-helpers/stats-observers-builder.ts+++ b/server/server/lib/opentelemetry/metric-helpers/stats-observers-builder.ts@@ -1,8 +1,8 @@import memoizee from 'memoizee'import { Meter } from '@opentelemetry/api'-import { MEMOIZE_TTL } from '@server/initializers/constants'-import { buildAvailableActivities } from '@server/lib/activitypub/activity'-import { StatsManager } from '@server/lib/stat-manager'+import { MEMOIZE_TTL } from '@server/initializers/constants.js'+import { buildAvailableActivities } from '@server/lib/activitypub/activity.js'+import { StatsManager } from '@server/lib/stat-manager.js'export class StatsObserversBuilder {diff --git a/server/lib/opentelemetry/metric-helpers/viewers-observers-builder.ts b/server/server/lib/opentelemetry/metric-helpers/viewers-observers-builder.tssimilarity index 97%rename from server/lib/opentelemetry/metric-helpers/viewers-observers-builder.tsrename to server/server/lib/opentelemetry/metric-helpers/viewers-observers-builder.tsindex c65f8ddaed..a1e1c74963 100644--- a/server/lib/opentelemetry/metric-helpers/viewers-observers-builder.ts+++ b/server/server/lib/opentelemetry/metric-helpers/viewers-observers-builder.ts@@ -1,6 +1,6 @@import { Meter } from '@opentelemetry/api'-import { VideoScope, ViewerScope } from '@server/lib/views/shared'-import { VideoViewsManager } from '@server/lib/views/video-views-manager'+import { VideoScope, ViewerScope } from '@server/lib/views/shared/index.js'+import { VideoViewsManager } from '@server/lib/views/video-views-manager.js'export class ViewersObserversBuilder {diff --git a/server/lib/opentelemetry/metrics.ts b/server/server/lib/opentelemetry/metrics.tssimilarity index 92%rename from server/lib/opentelemetry/metrics.tsrename to server/server/lib/opentelemetry/metrics.tsindex bffe008408..7276182efe 100644--- a/server/lib/opentelemetry/metrics.ts+++ b/server/server/lib/opentelemetry/metrics.ts@@ -2,10 +2,10 @@ import { Application, Request, Response } from 'express'import { Meter, metrics } from '@opentelemetry/api'import { PrometheusExporter } from '@opentelemetry/exporter-prometheus'import { MeterProvider } from '@opentelemetry/sdk-metrics'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { MVideoImmutable } from '@server/types/models'-import { PlaybackMetricCreate } from '@shared/models'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { MVideoImmutable } from '@server/types/models/index.js'+import { PlaybackMetricCreate } from '@peertube/peertube-models'import {BittorrentTrackerObserversBuilder,JobQueueObserversBuilder,@@ -14,7 +14,7 @@ import {PlaybackMetrics,StatsObserversBuilder,ViewersObserversBuilder-} from './metric-helpers'+} from './metric-helpers/index.js'class OpenTelemetryMetrics {diff --git a/server/server/lib/opentelemetry/tracing.ts b/server/server/lib/opentelemetry/tracing.tsnew file mode 100644index 0000000000..b306fa40c4--- /dev/null+++ b/server/server/lib/opentelemetry/tracing.ts@@ -0,0 +1,140 @@+import type { Span, Tracer } from '@opentelemetry/api'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'++let tracer: Tracer | TrackerMock++async function registerOpentelemetryTracing () {+ if (CONFIG.OPEN_TELEMETRY.TRACING.ENABLED !== true) {+ tracer = new TrackerMock()++ return+ }++ const { diag, DiagLogLevel, trace } = await import('@opentelemetry/api')+ tracer = trace.getTracer('peertube')++ const [+ { JaegerExporter },+ { registerInstrumentations },+ DnsInstrumentation,+ ExpressInstrumentation,+ { FsInstrumentation },+ { HttpInstrumentation },+ IORedisInstrumentation,+ PgInstrumentation,+ { SequelizeInstrumentation },+ Resource,+ BatchSpanProcessor,+ NodeTracerProvider,+ SemanticResourceAttributes+ ] = await Promise.all([+ import('@opentelemetry/exporter-jaeger'),+ import('@opentelemetry/instrumentation'),+ import('@opentelemetry/instrumentation-dns'),+ import('@opentelemetry/instrumentation-express'),+ import('@opentelemetry/instrumentation-fs'),+ import('@opentelemetry/instrumentation-http'),+ import('@opentelemetry/instrumentation-ioredis'),+ import('@opentelemetry/instrumentation-pg'),+ import('opentelemetry-instrumentation-sequelize'),+ import('@opentelemetry/resources'),+ import('@opentelemetry/sdk-trace-base'),+ import('@opentelemetry/sdk-trace-node'),+ import('@opentelemetry/semantic-conventions')+ ])++ logger.info('Registering Open Telemetry tracing')++ const customLogger = (level: string) => {+ return (message: string, ...args: unknown[]) => {+ let fullMessage = message++ for (const arg of args) {+ if (typeof arg === 'string') fullMessage += arg+ else break+ }++ logger[level](fullMessage)+ }+ }++ diag.setLogger({+ error: customLogger('error'),+ warn: customLogger('warn'),+ info: customLogger('info'),+ debug: customLogger('debug'),+ verbose: customLogger('verbose')+ }, DiagLogLevel.INFO)++ const tracerProvider = new NodeTracerProvider.default.NodeTracerProvider({+ resource: new Resource.default.Resource({+ [SemanticResourceAttributes.default.SemanticResourceAttributes.SERVICE_NAME]: 'peertube'+ })+ })++ registerInstrumentations({+ tracerProvider,+ instrumentations: [+ new PgInstrumentation.default.PgInstrumentation({+ enhancedDatabaseReporting: true+ }),+ new DnsInstrumentation.default.DnsInstrumentation(),+ new HttpInstrumentation(),+ new ExpressInstrumentation.default.ExpressInstrumentation(),+ new IORedisInstrumentation.default.IORedisInstrumentation({+ dbStatementSerializer: function (cmdName, cmdArgs) {+ return [ cmdName, ...cmdArgs ].join(' ')+ }+ }),+ new FsInstrumentation(),+ new SequelizeInstrumentation()+ ]+ })++ tracerProvider.addSpanProcessor(+ new BatchSpanProcessor.default.BatchSpanProcessor(+ new JaegerExporter({ endpoint: CONFIG.OPEN_TELEMETRY.TRACING.JAEGER_EXPORTER.ENDPOINT })+ )+ )++ tracerProvider.register()+}++async function wrapWithSpanAndContext <T> (spanName: string, cb: () => Promise<T>) {+ const { context, trace } = await import('@opentelemetry/api')++ if (CONFIG.OPEN_TELEMETRY.TRACING.ENABLED !== true) {+ return cb()+ }++ const span = tracer.startSpan(spanName)+ const activeContext = trace.setSpan(context.active(), span as Span)++ const result = await context.with(activeContext, () => cb())+ span.end()++ return result+}++export {+ registerOpentelemetryTracing,+ tracer,+ wrapWithSpanAndContext+}++// ---------------------------------------------------------------------------+// Private+// ---------------------------------------------------------------------------++class TrackerMock {+ startSpan () {+ return new SpanMock()+ }+}++class SpanMock {+ end () {++ }+}diff --git a/server/lib/paths.ts b/server/server/lib/paths.tssimilarity index 88%rename from server/lib/paths.tsrename to server/server/lib/paths.tsindex db1cdede2d..208e78efa3 100644--- a/server/lib/paths.ts+++ b/server/server/lib/paths.ts@@ -1,10 +1,10 @@import { join } from 'path'-import { CONFIG } from '@server/initializers/config'-import { DIRECTORIES, VIDEO_LIVE } from '@server/initializers/constants'-import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models'-import { removeFragmentedMP4Ext } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { isVideoInPrivateDirectory } from './video-privacy'+import { CONFIG } from '@server/initializers/config.js'+import { DIRECTORIES, VIDEO_LIVE } from '@server/initializers/constants.js'+import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models/index.js'+import { removeFragmentedMP4Ext } from '@peertube/peertube-core-utils'+import { buildUUID } from '@peertube/peertube-node-utils'+import { isVideoInPrivateDirectory } from './video-privacy.js'// ################## Video file name ##################diff --git a/server/lib/peertube-socket.ts b/server/server/lib/peertube-socket.tssimilarity index 91%rename from server/lib/peertube-socket.tsrename to server/server/lib/peertube-socket.tsindex 3e41a2def9..4bb82189e8 100644--- a/server/lib/peertube-socket.ts+++ b/server/server/lib/peertube-socket.ts@@ -1,13 +1,13 @@import { Server as HTTPServer } from 'http'import { Namespace, Server as SocketServer, Socket } from 'socket.io'-import { isIdValid } from '@server/helpers/custom-validators/misc'-import { Debounce } from '@server/helpers/debounce'-import { MVideo, MVideoImmutable } from '@server/types/models'-import { MRunner } from '@server/types/models/runners'-import { UserNotificationModelForApi } from '@server/types/models/user'-import { LiveVideoEventPayload, LiveVideoEventType } from '@shared/models'-import { logger } from '../helpers/logger'-import { authenticateRunnerSocket, authenticateSocket } from '../middlewares'+import { isIdValid } from '@server/helpers/custom-validators/misc.js'+import { Debounce } from '@server/helpers/debounce.js'+import { MVideo, MVideoImmutable } from '@server/types/models/index.js'+import { MRunner } from '@server/types/models/runners/index.js'+import { UserNotificationModelForApi } from '@server/types/models/user/index.js'+import { LiveVideoEventPayload, LiveVideoEventType } from '@peertube/peertube-models'+import { logger } from '../helpers/logger.js'+import { authenticateRunnerSocket, authenticateSocket } from '../middlewares/index.js'class PeerTubeSocket {diff --git a/server/lib/plugins/hooks.ts b/server/server/lib/plugins/hooks.tssimilarity index 84%rename from server/lib/plugins/hooks.tsrename to server/server/lib/plugins/hooks.tsindex 694527c122..70aaf47865 100644--- a/server/lib/plugins/hooks.ts+++ b/server/server/lib/plugins/hooks.ts@@ -1,7 +1,7 @@import Bluebird from 'bluebird'-import { ServerActionHookName, ServerFilterHookName } from '../../../shared/models'-import { logger } from '../../helpers/logger'-import { PluginManager } from './plugin-manager'+import { ServerActionHookName, ServerFilterHookName } from '@peertube/peertube-models'+import { logger } from '../../helpers/logger.js'+import { PluginManager } from './plugin-manager.js'type PromiseFunction <U, T> = (params: U) => Promise<T> | Bluebird<T>type RawFunction <U, T> = (params: U) => Tdiff --git a/server/lib/plugins/plugin-helpers-builder.ts b/server/server/lib/plugins/plugin-helpers-builder.tssimilarity index 88%rename from server/lib/plugins/plugin-helpers-builder.tsrename to server/server/lib/plugins/plugin-helpers-builder.tsindex b4e3eece48..4c1bd2bf71 100644--- a/server/lib/plugins/plugin-helpers-builder.ts+++ b/server/server/lib/plugins/plugin-helpers-builder.ts@@ -1,27 +1,27 @@import express from 'express'import { Server } from 'http'import { join } from 'path'-import { buildLogger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { sequelizeTypescript } from '@server/initializers/database'-import { AccountModel } from '@server/models/account/account'-import { AccountBlocklistModel } from '@server/models/account/account-blocklist'-import { getServerActor } from '@server/models/application/application'-import { ServerModel } from '@server/models/server/server'-import { ServerBlocklistModel } from '@server/models/server/server-blocklist'-import { UserModel } from '@server/models/user/user'-import { VideoModel } from '@server/models/video/video'-import { VideoBlacklistModel } from '@server/models/video/video-blacklist'-import { MPlugin, MVideo, UserNotificationModelForApi } from '@server/types/models'-import { PeerTubeHelpers } from '@server/types/plugins'-import { ffprobePromise } from '@shared/ffmpeg'-import { VideoBlacklistCreate, VideoStorage } from '@shared/models'-import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist'-import { PeerTubeSocket } from '../peertube-socket'-import { ServerConfigManager } from '../server-config-manager'-import { blacklistVideo, unblacklistVideo } from '../video-blacklist'-import { VideoPathManager } from '../video-path-manager'+import { buildLogger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { AccountModel } from '@server/models/account/account.js'+import { AccountBlocklistModel } from '@server/models/account/account-blocklist.js'+import { getServerActor } from '@server/models/application/application.js'+import { ServerModel } from '@server/models/server/server.js'+import { ServerBlocklistModel } from '@server/models/server/server-blocklist.js'+import { UserModel } from '@server/models/user/user.js'+import { VideoModel } from '@server/models/video/video.js'+import { VideoBlacklistModel } from '@server/models/video/video-blacklist.js'+import { MPlugin, MVideo, UserNotificationModelForApi } from '@server/types/models/index.js'+import { PeerTubeHelpers } from '@server/types/plugins/index.js'+import { ffprobePromise } from '@peertube/peertube-ffmpeg'+import { VideoBlacklistCreate, VideoStorage } from '@peertube/peertube-models'+import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist.js'+import { PeerTubeSocket } from '../peertube-socket.js'+import { ServerConfigManager } from '../server-config-manager.js'+import { blacklistVideo, unblacklistVideo } from '../video-blacklist.js'+import { VideoPathManager } from '../video-path-manager.js'function buildPluginHelpers (httpServer: Server, pluginModel: MPlugin, npmName: string): PeerTubeHelpers {const logger = buildPluginLogger(npmName)diff --git a/server/lib/plugins/plugin-index.ts b/server/server/lib/plugins/plugin-index.tssimilarity index 85%rename from server/lib/plugins/plugin-index.tsrename to server/server/lib/plugins/plugin-index.tsindex 119cee8e06..0f436f6b8a 100644--- a/server/lib/plugins/plugin-index.ts+++ b/server/server/lib/plugins/plugin-index.ts@@ -1,17 +1,17 @@-import { sanitizeUrl } from '@server/helpers/core-utils'-import { logger } from '@server/helpers/logger'-import { doJSONRequest } from '@server/helpers/requests'-import { CONFIG } from '@server/initializers/config'-import { PEERTUBE_VERSION } from '@server/initializers/constants'-import { PluginModel } from '@server/models/server/plugin'+import { sanitizeUrl } from '@server/helpers/core-utils.js'+import { logger } from '@server/helpers/logger.js'+import { doJSONRequest } from '@server/helpers/requests.js'+import { CONFIG } from '@server/initializers/config.js'+import { PEERTUBE_VERSION } from '@server/initializers/constants.js'+import { PluginModel } from '@server/models/server/plugin.js'import {PeerTubePluginIndex,PeertubePluginIndexList,PeertubePluginLatestVersionRequest,PeertubePluginLatestVersionResponse,ResultList-} from '@shared/models'-import { PluginManager } from './plugin-manager'+} from '@peertube/peertube-models'+import { PluginManager } from './plugin-manager.js'async function listAvailablePluginsFromIndex (options: PeertubePluginIndexList) {const { start = 0, count = 20, search, sort = 'npmName', pluginType } = optionsdiff --git a/server/lib/plugins/plugin-manager.ts b/server/server/lib/plugins/plugin-manager.tssimilarity index 94%rename from server/lib/plugins/plugin-manager.tsrename to server/server/lib/plugins/plugin-manager.tsindex 88c5b60d77..c4b4fae434 100644--- a/server/lib/plugins/plugin-manager.ts+++ b/server/server/lib/plugins/plugin-manager.ts@@ -1,31 +1,40 @@import express from 'express'import { createReadStream, createWriteStream } from 'fs'-import { ensureDir, outputFile, readJSON } from 'fs-extra'+import { ensureDir, outputFile, readJSON } from 'fs-extra/esm'import { Server } from 'http'+import { createRequire } from 'module'import { basename, join } from 'path'-import { decachePlugin } from '@server/helpers/decache'-import { ApplicationModel } from '@server/models/application/application'-import { MOAuthTokenUser, MUser } from '@server/types/models'-import { getCompleteLocale } from '@shared/core-utils'+import { getCompleteLocale, getHookType, internalRunHook } from '@peertube/peertube-core-utils'import {ClientScriptJSON,PluginPackageJSON,PluginTranslation,PluginTranslationPathsJSON,- RegisterServerHookOptions-} from '@shared/models'-import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks'-import { PluginType } from '../../../shared/models/plugins/plugin.type'-import { ServerHook, ServerHookName } from '../../../shared/models/plugins/server/server-hook.model'-import { isLibraryCodeValid, isPackageJSONValid } from '../../helpers/custom-validators/plugins'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { PLUGIN_GLOBAL_CSS_PATH } from '../../initializers/constants'-import { PluginModel } from '../../models/server/plugin'-import { PluginLibrary, RegisterServerAuthExternalOptions, RegisterServerAuthPassOptions, RegisterServerOptions } from '../../types/plugins'-import { ClientHtml } from '../client-html'-import { RegisterHelpers } from './register-helpers'-import { installNpmPlugin, installNpmPluginFromDisk, rebuildNativePlugins, removeNpmPlugin } from './yarn'+ PluginType,+ PluginType_Type,+ RegisterServerHookOptions,+ ServerHook,+ ServerHookName+} from '@peertube/peertube-models'+import { decachePlugin } from '@server/helpers/decache.js'+import { ApplicationModel } from '@server/models/application/application.js'+import { MOAuthTokenUser, MUser } from '@server/types/models/index.js'+import { isLibraryCodeValid, isPackageJSONValid } from '../../helpers/custom-validators/plugins.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { PLUGIN_GLOBAL_CSS_PATH } from '../../initializers/constants.js'+import { PluginModel } from '../../models/server/plugin.js'+import {+ PluginLibrary,+ RegisterServerAuthExternalOptions,+ RegisterServerAuthPassOptions,+ RegisterServerOptions+} from '../../types/plugins/index.js'+import { ClientHtml } from '../client-html.js'+import { RegisterHelpers } from './register-helpers.js'+import { installNpmPlugin, installNpmPluginFromDisk, rebuildNativePlugins, removeNpmPlugin } from './yarn.js'++const require = createRequire(import.meta.url)export interface RegisteredPlugin {npmName: string@@ -34,7 +43,7 @@ export interface RegisteredPlugin {description: stringpeertubeEngine: string- type: PluginType+ type: PluginType_Typepath: string@@ -496,7 +505,7 @@ export class PluginManager implements ServerHook {// Delete cache if neededconst modulePath = join(pluginPath, packageJSON.library)- decachePlugin(modulePath)+ decachePlugin(require, modulePath)const library: PluginLibrary = require(modulePath)if (!isLibraryCodeValid(library)) {@@ -582,13 +591,13 @@ export class PluginManager implements ServerHook {}}- private getPackageJSON (pluginName: string, pluginType: PluginType) {+ private getPackageJSON (pluginName: string, pluginType: PluginType_Type) {const pluginPath = join(this.getPluginPath(pluginName, pluginType), 'package.json')return readJSON(pluginPath) as Promise<PluginPackageJSON>}- private getPluginPath (pluginName: string, pluginType: PluginType) {+ private getPluginPath (pluginName: string, pluginType: PluginType_Type) {const npmName = PluginModel.buildNpmName(pluginName, pluginType)return join(CONFIG.STORAGE.PLUGINS_DIR, 'node_modules', npmName)@@ -606,7 +615,7 @@ export class PluginManager implements ServerHook {// ###################### Private getters ######################- private getRegisteredPluginsOrThemes (type: PluginType) {+ private getRegisteredPluginsOrThemes (type: PluginType_Type) {const plugins: RegisteredPlugin[] = []for (const npmName of Object.keys(this.registeredPlugins)) {@@ -644,7 +653,7 @@ export class PluginManager implements ServerHook {}}- private sanitizeAndCheckPackageJSONOrThrow (packageJSON: PluginPackageJSON, pluginType: PluginType) {+ private sanitizeAndCheckPackageJSONOrThrow (packageJSON: PluginPackageJSON, pluginType: PluginType_Type) {if (!packageJSON.staticDirs) packageJSON.staticDirs = {}if (!packageJSON.css) packageJSON.css = []if (!packageJSON.clientScripts) packageJSON.clientScripts = []diff --git a/server/lib/plugins/register-helpers.ts b/server/server/lib/plugins/register-helpers.tssimilarity index 95%rename from server/lib/plugins/register-helpers.tsrename to server/server/lib/plugins/register-helpers.tsindex 1aaef36068..7c44bff887 100644--- a/server/lib/plugins/register-helpers.ts+++ b/server/server/lib/plugins/register-helpers.ts@@ -1,17 +1,5 @@import express from 'express'import { Server } from 'http'-import { logger } from '@server/helpers/logger'-import { onExternalUserAuthenticated } from '@server/lib/auth/external-auth'-import { VideoConstantManagerFactory } from '@server/lib/plugins/video-constant-manager-factory'-import { PluginModel } from '@server/models/server/plugin'-import {- RegisterServerAuthExternalOptions,- RegisterServerAuthExternalResult,- RegisterServerAuthPassOptions,- RegisterServerExternalAuthenticatedResult,- RegisterServerOptions,- RegisterServerWebSocketRouteOptions-} from '@server/types/plugins'import {EncoderOptionsBuilder,PluginSettingsManager,@@ -20,11 +8,23 @@ import {RegisterServerSettingOptions,serverHookObject,SettingsChangeCallback,- VideoPlaylistPrivacy,- VideoPrivacy-} from '@shared/models'-import { VideoTranscodingProfilesManager } from '../transcoding/default-transcoding-profiles'-import { buildPluginHelpers } from './plugin-helpers-builder'+ VideoPlaylistPrivacyType,+ VideoPrivacyType+} from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { onExternalUserAuthenticated } from '@server/lib/auth/external-auth.js'+import { VideoConstantManagerFactory } from '@server/lib/plugins/video-constant-manager-factory.js'+import { PluginModel } from '@server/models/server/plugin.js'+import {+ RegisterServerAuthExternalOptions,+ RegisterServerAuthExternalResult,+ RegisterServerAuthPassOptions,+ RegisterServerExternalAuthenticatedResult,+ RegisterServerOptions,+ RegisterServerWebSocketRouteOptions+} from '@server/types/plugins/index.js'+import { VideoTranscodingProfilesManager } from '../transcoding/default-transcoding-profiles.js'+import { buildPluginHelpers } from './plugin-helpers-builder.js'export class RegisterHelpers {private readonly transcodingProfiles: {@@ -81,8 +81,8 @@ export class RegisterHelpers {const videoLicenceManager = this.videoConstantManagerFactory.createVideoConstantManager<number>('licence')const videoCategoryManager = this.videoConstantManagerFactory.createVideoConstantManager<number>('category')- const videoPrivacyManager = this.videoConstantManagerFactory.createVideoConstantManager<VideoPrivacy>('privacy')- const playlistPrivacyManager = this.videoConstantManagerFactory.createVideoConstantManager<VideoPlaylistPrivacy>('playlistPrivacy')+ const videoPrivacyManager = this.videoConstantManagerFactory.createVideoConstantManager<VideoPrivacyType>('privacy')+ const playlistPrivacyManager = this.videoConstantManagerFactory.createVideoConstantManager<VideoPlaylistPrivacyType>('playlistPrivacy')const transcodingManager = this.buildTranscodingManager()diff --git a/server/lib/plugins/theme-utils.ts b/server/server/lib/plugins/theme-utils.tssimilarity index 82%rename from server/lib/plugins/theme-utils.tsrename to server/server/lib/plugins/theme-utils.tsindex 76c671f1ce..4a64a579aa 100644--- a/server/lib/plugins/theme-utils.ts+++ b/server/server/lib/plugins/theme-utils.ts@@ -1,6 +1,6 @@-import { DEFAULT_THEME_NAME, DEFAULT_USER_THEME_NAME } from '../../initializers/constants'-import { PluginManager } from './plugin-manager'-import { CONFIG } from '../../initializers/config'+import { DEFAULT_THEME_NAME, DEFAULT_USER_THEME_NAME } from '../../initializers/constants.js'+import { PluginManager } from './plugin-manager.js'+import { CONFIG } from '../../initializers/config.js'function getThemeOrDefault (name: string, defaultTheme: string) {if (isThemeRegistered(name)) return namediff --git a/server/lib/plugins/video-constant-manager-factory.ts b/server/server/lib/plugins/video-constant-manager-factory.tssimilarity index 95%rename from server/lib/plugins/video-constant-manager-factory.tsrename to server/server/lib/plugins/video-constant-manager-factory.tsindex 5f7edfbe2f..04c30cf695 100644--- a/server/lib/plugins/video-constant-manager-factory.ts+++ b/server/server/lib/plugins/video-constant-manager-factory.ts@@ -1,12 +1,12 @@-import { logger } from '@server/helpers/logger'+import { ConstantManager } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'import {VIDEO_CATEGORIES,VIDEO_LANGUAGES,VIDEO_LICENCES,VIDEO_PLAYLIST_PRIVACIES,VIDEO_PRIVACIES-} from '@server/initializers/constants'-import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model'+} from '@server/initializers/constants.js'type AlterableVideoConstant = 'language' | 'licence' | 'category' | 'privacy' | 'playlistPrivacy'type VideoConstant = Record<number | string, string>diff --git a/server/lib/plugins/yarn.ts b/server/server/lib/plugins/yarn.tssimilarity index 85%rename from server/lib/plugins/yarn.tsrename to server/server/lib/plugins/yarn.tsindex 9cf6ec9e90..470880f443 100644--- a/server/lib/plugins/yarn.ts+++ b/server/server/lib/plugins/yarn.ts@@ -1,10 +1,10 @@-import { outputJSON, pathExists } from 'fs-extra'+import { outputJSON, pathExists } from 'fs-extra/esm'import { join } from 'path'-import { execShell } from '../../helpers/core-utils'-import { isNpmPluginNameValid, isPluginStableOrUnstableVersionValid } from '../../helpers/custom-validators/plugins'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { getLatestPluginVersion } from './plugin-index'+import { execShell } from '../../helpers/core-utils.js'+import { isNpmPluginNameValid, isPluginStableOrUnstableVersionValid } from '../../helpers/custom-validators/plugins.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { getLatestPluginVersion } from './plugin-index.js'async function installNpmPlugin (npmName: string, versionArg?: string) {// Security checkdiff --git a/server/lib/redis.ts b/server/server/lib/redis.tssimilarity index 97%rename from server/lib/redis.tsrename to server/server/lib/redis.tsindex 48d9986b52..7c87bf2e35 100644--- a/server/lib/redis.ts+++ b/server/server/lib/redis.ts@@ -1,20 +1,20 @@-import IoRedis, { RedisOptions } from 'ioredis'-import { exists } from '@server/helpers/custom-validators/misc'-import { sha256 } from '@shared/extra-utils'-import { logger } from '../helpers/logger'-import { generateRandomString } from '../helpers/utils'-import { CONFIG } from '../initializers/config'+import { Redis as IoRedis, RedisOptions } from 'ioredis'+import { exists } from '@server/helpers/custom-validators/misc.js'+import { sha256 } from '@peertube/peertube-node-utils'+import { logger } from '../helpers/logger.js'+import { generateRandomString } from '../helpers/utils.js'+import { CONFIG } from '../initializers/config.js'import {AP_CLEANER,CONTACT_FORM_LIFETIME,+ EMAIL_VERIFY_LIFETIME,RESUMABLE_UPLOAD_SESSION_LIFETIME,TWO_FACTOR_AUTH_REQUEST_TOKEN_LIFETIME,- EMAIL_VERIFY_LIFETIME,USER_PASSWORD_CREATE_LIFETIME,USER_PASSWORD_RESET_LIFETIME,VIEW_LIFETIME,WEBSERVER-} from '../initializers/constants'+} from '../initializers/constants.js'class Redis {diff --git a/server/lib/redundancy.ts b/server/server/lib/redundancy.tssimilarity index 88%rename from server/lib/redundancy.tsrename to server/server/lib/redundancy.tsindex 2613d01be1..b470373cea 100644--- a/server/lib/redundancy.ts+++ b/server/server/lib/redundancy.ts@@ -1,12 +1,12 @@import { Transaction } from 'sequelize'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { ActorFollowModel } from '@server/models/actor/actor-follow'-import { getServerActor } from '@server/models/application/application'-import { MActorSignature, MVideoRedundancyVideo } from '@server/types/models'-import { Activity } from '@shared/models'-import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'-import { sendUndoCacheFile } from './activitypub/send'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { ActorFollowModel } from '@server/models/actor/actor-follow.js'+import { getServerActor } from '@server/models/application/application.js'+import { MActorSignature, MVideoRedundancyVideo } from '@server/types/models/index.js'+import { Activity } from '@peertube/peertube-models'+import { VideoRedundancyModel } from '../models/redundancy/video-redundancy.js'+import { sendUndoCacheFile } from './activitypub/send/index.js'const lTags = loggerTagsFactory('redundancy')diff --git a/server/server/lib/runners/index.ts b/server/server/lib/runners/index.tsnew file mode 100644index 0000000000..43eb7351ee--- /dev/null+++ b/server/server/lib/runners/index.ts@@ -0,0 +1,3 @@+export * from './job-handlers/index.js'+export * from './runner.js'+export * from './runner-urls.js'diff --git a/server/lib/runners/job-handlers/abstract-job-handler.ts b/server/server/lib/runners/job-handlers/abstract-job-handler.tssimilarity index 93%rename from server/lib/runners/job-handlers/abstract-job-handler.tsrename to server/server/lib/runners/job-handlers/abstract-job-handler.tsindex 329977de19..b7e9a0a9db 100644--- a/server/lib/runners/job-handlers/abstract-job-handler.ts+++ b/server/server/lib/runners/job-handlers/abstract-job-handler.ts@@ -1,29 +1,30 @@-import { throttle } from 'lodash'-import { saveInTransactionWithRetries } from '@server/helpers/database-utils'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { RUNNER_JOBS } from '@server/initializers/constants'-import { sequelizeTypescript } from '@server/initializers/database'-import { PeerTubeSocket } from '@server/lib/peertube-socket'-import { RunnerJobModel } from '@server/models/runner/runner-job'-import { setAsUpdated } from '@server/models/shared'-import { MRunnerJob } from '@server/types/models/runners'-import { pick } from '@shared/core-utils'+import { pick } from '@peertube/peertube-core-utils'import {RunnerJobLiveRTMPHLSTranscodingPayload,RunnerJobLiveRTMPHLSTranscodingPrivatePayload,RunnerJobState,+ RunnerJobStateType,RunnerJobStudioTranscodingPayload,RunnerJobSuccessPayload,RunnerJobType,RunnerJobUpdatePayload,- RunnerJobVideoStudioTranscodingPrivatePayload,RunnerJobVODAudioMergeTranscodingPayload,RunnerJobVODAudioMergeTranscodingPrivatePayload,RunnerJobVODHLSTranscodingPayload,RunnerJobVODHLSTranscodingPrivatePayload,RunnerJobVODWebVideoTranscodingPayload,- RunnerJobVODWebVideoTranscodingPrivatePayload-} from '@shared/models'+ RunnerJobVODWebVideoTranscodingPrivatePayload,+ RunnerJobVideoStudioTranscodingPrivatePayload+} from '@peertube/peertube-models'+import { saveInTransactionWithRetries } from '@server/helpers/database-utils.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { RUNNER_JOBS } from '@server/initializers/constants.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { PeerTubeSocket } from '@server/lib/peertube-socket.js'+import { RunnerJobModel } from '@server/models/runner/runner-job.js'+import { setAsUpdated } from '@server/models/shared/index.js'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import throttle from 'lodash-es/throttle.js'type CreateRunnerJobArg ={@@ -264,6 +265,6 @@ export abstract class AbstractJobHandler <C, U extends RunnerJobUpdatePayload, Sprotected abstract specificError (options: {runnerJob: MRunnerJobmessage: string- nextState: RunnerJobState+ nextState: RunnerJobStateType}): Promise<void> | void}diff --git a/server/lib/runners/job-handlers/abstract-vod-transcoding-job-handler.ts b/server/server/lib/runners/job-handlers/abstract-vod-transcoding-job-handler.tssimilarity index 78%rename from server/lib/runners/job-handlers/abstract-vod-transcoding-job-handler.tsrename to server/server/lib/runners/job-handlers/abstract-vod-transcoding-job-handler.tsindex f425828d9f..392ff9aec7 100644--- a/server/lib/runners/job-handlers/abstract-vod-transcoding-job-handler.ts+++ b/server/server/lib/runners/job-handlers/abstract-vod-transcoding-job-handler.ts@@ -1,12 +1,18 @@-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { logger } from '@server/helpers/logger'-import { moveToFailedTranscodingState, moveToNextState } from '@server/lib/video-state'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { MRunnerJob } from '@server/types/models/runners'-import { RunnerJobState, RunnerJobSuccessPayload, RunnerJobUpdatePayload, RunnerJobVODPrivatePayload } from '@shared/models'-import { AbstractJobHandler } from './abstract-job-handler'-import { loadTranscodingRunnerVideo } from './shared'+import {+ RunnerJobState,+ RunnerJobStateType,+ RunnerJobSuccessPayload,+ RunnerJobUpdatePayload,+ RunnerJobVODPrivatePayload+} from '@peertube/peertube-models'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { logger } from '@server/helpers/logger.js'+import { moveToFailedTranscodingState, moveToNextState } from '@server/lib/video-state.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import { AbstractJobHandler } from './abstract-job-handler.js'+import { loadTranscodingRunnerVideo } from './shared/index.js'// eslint-disable-next-line max-lenexport abstract class AbstractVODTranscodingJobHandler <C, U extends RunnerJobUpdatePayload, S extends RunnerJobSuccessPayload> extends AbstractJobHandler<C, U, S> {@@ -29,7 +35,7 @@ export abstract class AbstractVODTranscodingJobHandler <C, U extends RunnerJobUpprotected async specificError (options: {runnerJob: MRunnerJob- nextState: RunnerJobState+ nextState: RunnerJobStateType}) {if (options.nextState !== RunnerJobState.ERRORED) returndiff --git a/server/server/lib/runners/job-handlers/index.ts b/server/server/lib/runners/job-handlers/index.tsnew file mode 100644index 0000000000..c3205fae39--- /dev/null+++ b/server/server/lib/runners/job-handlers/index.ts@@ -0,0 +1,7 @@+export * from './abstract-job-handler.js'+export * from './live-rtmp-hls-transcoding-job-handler.js'+export * from './runner-job-handlers.js'+export * from './video-studio-transcoding-job-handler.js'+export * from './vod-audio-merge-transcoding-job-handler.js'+export * from './vod-hls-transcoding-job-handler.js'+export * from './vod-web-video-transcoding-job-handler.js'diff --git a/server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.ts b/server/server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.tssimilarity index 90%rename from server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.tsrename to server/server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.tsindex 6b2894f8c8..695c64c8e2 100644--- a/server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.ts+++ b/server/server/lib/runners/job-handlers/live-rtmp-hls-transcoding-job-handler.ts@@ -1,20 +1,20 @@-import { move, remove } from 'fs-extra'-import { join } from 'path'-import { logger } from '@server/helpers/logger'-import { JOB_PRIORITY } from '@server/initializers/constants'-import { LiveManager } from '@server/lib/live'-import { MStreamingPlaylist, MVideo } from '@server/types/models'-import { MRunnerJob } from '@server/types/models/runners'-import { buildUUID } from '@shared/extra-utils'import {LiveRTMPHLSTranscodingSuccess,LiveRTMPHLSTranscodingUpdatePayload,LiveVideoError,RunnerJobLiveRTMPHLSTranscodingPayload,RunnerJobLiveRTMPHLSTranscodingPrivatePayload,- RunnerJobState-} from '@shared/models'-import { AbstractJobHandler } from './abstract-job-handler'+ RunnerJobStateType+} from '@peertube/peertube-models'+import { buildUUID } from '@peertube/peertube-node-utils'+import { logger } from '@server/helpers/logger.js'+import { JOB_PRIORITY } from '@server/initializers/constants.js'+import { LiveManager } from '@server/lib/live/index.js'+import { MStreamingPlaylist, MVideo } from '@server/types/models/index.js'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import { move, remove } from 'fs-extra/esm'+import { join } from 'path'+import { AbstractJobHandler } from './abstract-job-handler.js'type CreateOptions = {video: MVideo@@ -134,7 +134,7 @@ export class LiveRTMPHLSTranscodingJobHandler extends AbstractJobHandler<CreateOprotected specificError (options: {runnerJob: MRunnerJob- nextState: RunnerJobState+ nextState: RunnerJobStateType}) {return this.stopLive({runnerJob: options.runnerJob,diff --git a/server/lib/runners/job-handlers/runner-job-handlers.ts b/server/server/lib/runners/job-handlers/runner-job-handlers.tssimilarity index 74%rename from server/lib/runners/job-handlers/runner-job-handlers.tsrename to server/server/lib/runners/job-handlers/runner-job-handlers.tsindex 85551c365b..f8a672e649 100644--- a/server/lib/runners/job-handlers/runner-job-handlers.ts+++ b/server/server/lib/runners/job-handlers/runner-job-handlers.ts@@ -1,11 +1,11 @@-import { MRunnerJob } from '@server/types/models/runners'-import { RunnerJobSuccessPayload, RunnerJobType, RunnerJobUpdatePayload } from '@shared/models'-import { AbstractJobHandler } from './abstract-job-handler'-import { LiveRTMPHLSTranscodingJobHandler } from './live-rtmp-hls-transcoding-job-handler'-import { VideoStudioTranscodingJobHandler } from './video-studio-transcoding-job-handler'-import { VODAudioMergeTranscodingJobHandler } from './vod-audio-merge-transcoding-job-handler'-import { VODHLSTranscodingJobHandler } from './vod-hls-transcoding-job-handler'-import { VODWebVideoTranscodingJobHandler } from './vod-web-video-transcoding-job-handler'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import { RunnerJobSuccessPayload, RunnerJobType, RunnerJobUpdatePayload } from '@peertube/peertube-models'+import { AbstractJobHandler } from './abstract-job-handler.js'+import { LiveRTMPHLSTranscodingJobHandler } from './live-rtmp-hls-transcoding-job-handler.js'+import { VideoStudioTranscodingJobHandler } from './video-studio-transcoding-job-handler.js'+import { VODAudioMergeTranscodingJobHandler } from './vod-audio-merge-transcoding-job-handler.js'+import { VODHLSTranscodingJobHandler } from './vod-hls-transcoding-job-handler.js'+import { VODWebVideoTranscodingJobHandler } from './vod-web-video-transcoding-job-handler.js'const processors: Record<RunnerJobType, new() => AbstractJobHandler<unknown, RunnerJobUpdatePayload, RunnerJobSuccessPayload>> = {'vod-web-video-transcoding': VODWebVideoTranscodingJobHandler,diff --git a/server/server/lib/runners/job-handlers/shared/index.ts b/server/server/lib/runners/job-handlers/shared/index.tsnew file mode 100644index 0000000000..bec61e3a08--- /dev/null+++ b/server/server/lib/runners/job-handlers/shared/index.ts@@ -0,0 +1 @@+export * from './vod-helpers.js'diff --git a/server/lib/runners/job-handlers/shared/vod-helpers.ts b/server/server/lib/runners/job-handlers/shared/vod-helpers.tssimilarity index 74%rename from server/lib/runners/job-handlers/shared/vod-helpers.tsrename to server/server/lib/runners/job-handlers/shared/vod-helpers.tsindex 1a2ad02ca0..f7c1b73c90 100644--- a/server/lib/runners/job-handlers/shared/vod-helpers.ts+++ b/server/server/lib/runners/job-handlers/shared/vod-helpers.ts@@ -1,13 +1,13 @@-import { move } from 'fs-extra'+import { move } from 'fs-extra/esm'import { dirname, join } from 'path'-import { logger, LoggerTagsFn } from '@server/helpers/logger'-import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding'-import { onWebVideoFileTranscoding } from '@server/lib/transcoding/web-transcoding'-import { buildNewFile } from '@server/lib/video-file'-import { VideoModel } from '@server/models/video/video'-import { MVideoFullLight } from '@server/types/models'-import { MRunnerJob } from '@server/types/models/runners'-import { RunnerJobVODAudioMergeTranscodingPrivatePayload, RunnerJobVODWebVideoTranscodingPrivatePayload } from '@shared/models'+import { logger, LoggerTagsFn } from '@server/helpers/logger.js'+import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding.js'+import { onWebVideoFileTranscoding } from '@server/lib/transcoding/web-transcoding.js'+import { buildNewFile } from '@server/lib/video-file.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideoFullLight } from '@server/types/models/index.js'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import { RunnerJobVODAudioMergeTranscodingPrivatePayload, RunnerJobVODWebVideoTranscodingPrivatePayload } from '@peertube/peertube-models'export async function onVODWebVideoOrAudioMergeTranscodingJob (options: {video: MVideoFullLightdiff --git a/server/lib/runners/job-handlers/video-studio-transcoding-job-handler.ts b/server/server/lib/runners/job-handlers/video-studio-transcoding-job-handler.tssimilarity index 86%rename from server/lib/runners/job-handlers/video-studio-transcoding-job-handler.tsrename to server/server/lib/runners/job-handlers/video-studio-transcoding-job-handler.tsindex f604382b72..952e3a3c64 100644--- a/server/lib/runners/job-handlers/video-studio-transcoding-job-handler.ts+++ b/server/server/lib/runners/job-handlers/video-studio-transcoding-job-handler.ts@@ -1,25 +1,26 @@-import { basename } from 'path'-import { logger } from '@server/helpers/logger'-import { onVideoStudioEnded, safeCleanupStudioTMPFiles } from '@server/lib/video-studio'-import { MVideo } from '@server/types/models'-import { MRunnerJob } from '@server/types/models/runners'-import { buildUUID } from '@shared/extra-utils'import {- isVideoStudioTaskIntro,- isVideoStudioTaskOutro,- isVideoStudioTaskWatermark,RunnerJobState,- RunnerJobUpdatePayload,+ RunnerJobStateType,RunnerJobStudioTranscodingPayload,+ RunnerJobUpdatePayload,RunnerJobVideoStudioTranscodingPrivatePayload,- VideoStudioTranscodingSuccess,VideoState,- VideoStudioTaskPayload-} from '@shared/models'-import { generateRunnerEditionTranscodingVideoInputFileUrl, generateRunnerTranscodingVideoInputFileUrl } from '../runner-urls'-import { AbstractJobHandler } from './abstract-job-handler'-import { loadTranscodingRunnerVideo } from './shared'+ VideoStudioTaskPayload,+ VideoStudioTranscodingSuccess,+ isVideoStudioTaskIntro,+ isVideoStudioTaskOutro,+ isVideoStudioTaskWatermark+} from '@peertube/peertube-models'+import { buildUUID } from '@peertube/peertube-node-utils'+import { logger } from '@server/helpers/logger.js'+import { onVideoStudioEnded, safeCleanupStudioTMPFiles } from '@server/lib/video-studio.js'+import { MVideo } from '@server/types/models/index.js'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import { basename } from 'path'+import { generateRunnerEditionTranscodingVideoInputFileUrl, generateRunnerTranscodingVideoInputFileUrl } from '../runner-urls.js'+import { AbstractJobHandler } from './abstract-job-handler.js'+import { loadTranscodingRunnerVideo } from './shared/index.js'type CreateOptions = {video: MVideo@@ -126,7 +127,7 @@ export class VideoStudioTranscodingJobHandler extends AbstractJobHandler<CreateOprotected specificError (options: {runnerJob: MRunnerJob- nextState: RunnerJobState+ nextState: RunnerJobStateType}) {if (options.nextState === RunnerJobState.ERRORED) {return this.specificErrorOrCancel(options)diff --git a/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts b/server/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.tssimilarity index 84%rename from server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.tsrename to server/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.tsindex 137a94535a..e3339f569f 100644--- a/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts+++ b/server/server/lib/runners/job-handlers/vod-audio-merge-transcoding-job-handler.ts@@ -1,19 +1,19 @@-import { logger } from '@server/helpers/logger'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { MVideo } from '@server/types/models'-import { MRunnerJob } from '@server/types/models/runners'-import { pick } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'-import { getVideoStreamDuration } from '@shared/ffmpeg'+import { logger } from '@server/helpers/logger.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { MVideo } from '@server/types/models/index.js'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import { pick } from '@peertube/peertube-core-utils'+import { buildUUID } from '@peertube/peertube-node-utils'+import { getVideoStreamDuration } from '@peertube/peertube-ffmpeg'import {RunnerJobUpdatePayload,RunnerJobVODAudioMergeTranscodingPayload,RunnerJobVODWebVideoTranscodingPrivatePayload,VODAudioMergeTranscodingSuccess-} from '@shared/models'-import { generateRunnerTranscodingVideoInputFileUrl, generateRunnerTranscodingVideoPreviewFileUrl } from '../runner-urls'-import { AbstractVODTranscodingJobHandler } from './abstract-vod-transcoding-job-handler'-import { loadTranscodingRunnerVideo, onVODWebVideoOrAudioMergeTranscodingJob } from './shared'+} from '@peertube/peertube-models'+import { generateRunnerTranscodingVideoInputFileUrl, generateRunnerTranscodingVideoPreviewFileUrl } from '../runner-urls.js'+import { AbstractVODTranscodingJobHandler } from './abstract-vod-transcoding-job-handler.js'+import { loadTranscodingRunnerVideo, onVODWebVideoOrAudioMergeTranscodingJob } from './shared/index.js'type CreateOptions = {video: MVideodiff --git a/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts b/server/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.tssimilarity index 85%rename from server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.tsrename to server/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.tsindex 02845952cb..e0b90313f6 100644--- a/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts+++ b/server/server/lib/runners/job-handlers/vod-hls-transcoding-job-handler.ts@@ -1,25 +1,25 @@-import { move } from 'fs-extra'+import { move } from 'fs-extra/esm'import { dirname, join } from 'path'-import { logger } from '@server/helpers/logger'-import { renameVideoFileInPlaylist } from '@server/lib/hls'-import { getHlsResolutionPlaylistFilename } from '@server/lib/paths'-import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding'-import { onHLSVideoFileTranscoding } from '@server/lib/transcoding/hls-transcoding'-import { buildNewFile, removeAllWebVideoFiles } from '@server/lib/video-file'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { MVideo } from '@server/types/models'-import { MRunnerJob } from '@server/types/models/runners'-import { pick } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'+import { logger } from '@server/helpers/logger.js'+import { renameVideoFileInPlaylist } from '@server/lib/hls.js'+import { getHlsResolutionPlaylistFilename } from '@server/lib/paths.js'+import { onTranscodingEnded } from '@server/lib/transcoding/ended-transcoding.js'+import { onHLSVideoFileTranscoding } from '@server/lib/transcoding/hls-transcoding.js'+import { buildNewFile, removeAllWebVideoFiles } from '@server/lib/video-file.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { MVideo } from '@server/types/models/index.js'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import { pick } from '@peertube/peertube-core-utils'+import { buildUUID } from '@peertube/peertube-node-utils'import {RunnerJobUpdatePayload,RunnerJobVODHLSTranscodingPayload,RunnerJobVODHLSTranscodingPrivatePayload,VODHLSTranscodingSuccess-} from '@shared/models'-import { generateRunnerTranscodingVideoInputFileUrl } from '../runner-urls'-import { AbstractVODTranscodingJobHandler } from './abstract-vod-transcoding-job-handler'-import { loadTranscodingRunnerVideo } from './shared'+} from '@peertube/peertube-models'+import { generateRunnerTranscodingVideoInputFileUrl } from '../runner-urls.js'+import { AbstractVODTranscodingJobHandler } from './abstract-vod-transcoding-job-handler.js'+import { loadTranscodingRunnerVideo } from './shared/index.js'type CreateOptions = {video: MVideodiff --git a/server/lib/runners/job-handlers/vod-web-video-transcoding-job-handler.ts b/server/server/lib/runners/job-handlers/vod-web-video-transcoding-job-handler.tssimilarity index 85%rename from server/lib/runners/job-handlers/vod-web-video-transcoding-job-handler.tsrename to server/server/lib/runners/job-handlers/vod-web-video-transcoding-job-handler.tsindex 9ee8ab88e0..a137a5d480 100644--- a/server/lib/runners/job-handlers/vod-web-video-transcoding-job-handler.ts+++ b/server/server/lib/runners/job-handlers/vod-web-video-transcoding-job-handler.ts@@ -1,18 +1,18 @@-import { logger } from '@server/helpers/logger'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { MVideo } from '@server/types/models'-import { MRunnerJob } from '@server/types/models/runners'-import { pick } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'+import { logger } from '@server/helpers/logger.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { MVideo } from '@server/types/models/index.js'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import { pick } from '@peertube/peertube-core-utils'+import { buildUUID } from '@peertube/peertube-node-utils'import {RunnerJobUpdatePayload,RunnerJobVODWebVideoTranscodingPayload,RunnerJobVODWebVideoTranscodingPrivatePayload,VODWebVideoTranscodingSuccess-} from '@shared/models'-import { generateRunnerTranscodingVideoInputFileUrl } from '../runner-urls'-import { AbstractVODTranscodingJobHandler } from './abstract-vod-transcoding-job-handler'-import { loadTranscodingRunnerVideo, onVODWebVideoOrAudioMergeTranscodingJob } from './shared'+} from '@peertube/peertube-models'+import { generateRunnerTranscodingVideoInputFileUrl } from '../runner-urls.js'+import { AbstractVODTranscodingJobHandler } from './abstract-vod-transcoding-job-handler.js'+import { loadTranscodingRunnerVideo, onVODWebVideoOrAudioMergeTranscodingJob } from './shared/index.js'type CreateOptions = {video: MVideodiff --git a/server/lib/runners/runner-urls.ts b/server/server/lib/runners/runner-urls.tssimilarity index 91%rename from server/lib/runners/runner-urls.tsrename to server/server/lib/runners/runner-urls.tsindex a27060b33f..0c0a9966f8 100644--- a/server/lib/runners/runner-urls.ts+++ b/server/server/lib/runners/runner-urls.ts@@ -1,4 +1,4 @@-import { WEBSERVER } from '@server/initializers/constants'+import { WEBSERVER } from '@server/initializers/constants.js'export function generateRunnerTranscodingVideoInputFileUrl (jobUUID: string, videoUUID: string) {return WEBSERVER.URL + '/api/v1/runners/jobs/' + jobUUID + '/files/videos/' + videoUUID + '/max-quality'diff --git a/server/lib/runners/runner.ts b/server/server/lib/runners/runner.tssimilarity index 86%rename from server/lib/runners/runner.tsrename to server/server/lib/runners/runner.tsindex 947fdb3f03..8152e6f5fa 100644--- a/server/lib/runners/runner.ts+++ b/server/server/lib/runners/runner.ts@@ -1,10 +1,10 @@+import { RunnerJobState, RunnerJobStateType } from '@peertube/peertube-models'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { RUNNER_JOBS } from '@server/initializers/constants.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { MRunner, MRunnerJob } from '@server/types/models/runners/index.js'import express from 'express'-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { sequelizeTypescript } from '@server/initializers/database'-import { MRunner, MRunnerJob } from '@server/types/models/runners'-import { RUNNER_JOBS } from '@server/initializers/constants'-import { RunnerJobState } from '@shared/models'const lTags = loggerTagsFactory('runner')@@ -34,7 +34,7 @@ function updateLastRunnerContact (req: express.Request, runner: MRunner) {}function runnerJobCanBeCancelled (runnerJob: MRunnerJob) {- const allowedStates = new Set<RunnerJobState>([+ const allowedStates = new Set<RunnerJobStateType>([RunnerJobState.PENDING,RunnerJobState.PROCESSING,RunnerJobState.WAITING_FOR_PARENT_JOBdiff --git a/server/lib/schedulers/abstract-scheduler.ts b/server/server/lib/schedulers/abstract-scheduler.tssimilarity index 94%rename from server/lib/schedulers/abstract-scheduler.tsrename to server/server/lib/schedulers/abstract-scheduler.tsindex f3d51a22e0..8b6eef3f4f 100644--- a/server/lib/schedulers/abstract-scheduler.ts+++ b/server/server/lib/schedulers/abstract-scheduler.ts@@ -1,5 +1,5 @@import Bluebird from 'bluebird'-import { logger } from '../../helpers/logger'+import { logger } from '../../helpers/logger.js'export abstract class AbstractScheduler {diff --git a/server/lib/schedulers/actor-follow-scheduler.ts b/server/server/lib/schedulers/actor-follow-scheduler.tssimilarity index 88%rename from server/lib/schedulers/actor-follow-scheduler.tsrename to server/server/lib/schedulers/actor-follow-scheduler.tsindex e1c56c135d..86b83f60b0 100644--- a/server/lib/schedulers/actor-follow-scheduler.ts+++ b/server/server/lib/schedulers/actor-follow-scheduler.ts@@ -1,9 +1,9 @@-import { isTestOrDevInstance } from '../../helpers/core-utils'-import { logger } from '../../helpers/logger'-import { ACTOR_FOLLOW_SCORE, SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { ActorFollowModel } from '../../models/actor/actor-follow'-import { ActorFollowHealthCache } from '../actor-follow-health-cache'-import { AbstractScheduler } from './abstract-scheduler'+import { isTestOrDevInstance } from '@peertube/peertube-node-utils'+import { logger } from '../../helpers/logger.js'+import { ACTOR_FOLLOW_SCORE, SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { ActorFollowModel } from '../../models/actor/actor-follow.js'+import { ActorFollowHealthCache } from '../actor-follow-health-cache.js'+import { AbstractScheduler } from './abstract-scheduler.js'export class ActorFollowScheduler extends AbstractScheduler {diff --git a/server/lib/schedulers/auto-follow-index-instances.ts b/server/server/lib/schedulers/auto-follow-index-instances.tssimilarity index 84%rename from server/lib/schedulers/auto-follow-index-instances.tsrename to server/server/lib/schedulers/auto-follow-index-instances.tsindex 956ece749b..47a01ec0cb 100644--- a/server/lib/schedulers/auto-follow-index-instances.ts+++ b/server/server/lib/schedulers/auto-follow-index-instances.ts@@ -1,12 +1,12 @@-import { chunk } from 'lodash'-import { doJSONRequest } from '@server/helpers/requests'-import { JobQueue } from '@server/lib/job-queue'-import { ActorFollowModel } from '@server/models/actor/actor-follow'-import { getServerActor } from '@server/models/application/application'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { SCHEDULER_INTERVALS_MS, SERVER_ACTOR_NAME } from '../../initializers/constants'-import { AbstractScheduler } from './abstract-scheduler'+import { doJSONRequest } from '@server/helpers/requests.js'+import { JobQueue } from '@server/lib/job-queue/index.js'+import { ActorFollowModel } from '@server/models/actor/actor-follow.js'+import { getServerActor } from '@server/models/application/application.js'+import chunk from 'lodash-es/chunk.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { SCHEDULER_INTERVALS_MS, SERVER_ACTOR_NAME } from '../../initializers/constants.js'+import { AbstractScheduler } from './abstract-scheduler.js'export class AutoFollowIndexInstances extends AbstractScheduler {diff --git a/server/lib/schedulers/geo-ip-update-scheduler.ts b/server/server/lib/schedulers/geo-ip-update-scheduler.tssimilarity index 79%rename from server/lib/schedulers/geo-ip-update-scheduler.tsrename to server/server/lib/schedulers/geo-ip-update-scheduler.tsindex b06f5a9b55..b59aa71e54 100644--- a/server/lib/schedulers/geo-ip-update-scheduler.ts+++ b/server/server/lib/schedulers/geo-ip-update-scheduler.ts@@ -1,6 +1,6 @@-import { GeoIP } from '@server/helpers/geo-ip'-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { AbstractScheduler } from './abstract-scheduler'+import { GeoIP } from '@server/helpers/geo-ip.js'+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { AbstractScheduler } from './abstract-scheduler.js'export class GeoIPUpdateScheduler extends AbstractScheduler {diff --git a/server/lib/schedulers/peertube-version-check-scheduler.ts b/server/server/lib/schedulers/peertube-version-check-scheduler.tssimilarity index 76%rename from server/lib/schedulers/peertube-version-check-scheduler.tsrename to server/server/lib/schedulers/peertube-version-check-scheduler.tsindex bc38ed49f0..c706aba63b 100644--- a/server/lib/schedulers/peertube-version-check-scheduler.ts+++ b/server/server/lib/schedulers/peertube-version-check-scheduler.ts@@ -1,13 +1,13 @@-import { doJSONRequest } from '@server/helpers/requests'-import { ApplicationModel } from '@server/models/application/application'-import { compareSemVer } from '@shared/core-utils'-import { JoinPeerTubeVersions } from '@shared/models'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { PEERTUBE_VERSION, SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { Notifier } from '../notifier'-import { AbstractScheduler } from './abstract-scheduler'+import { doJSONRequest } from '@server/helpers/requests.js'+import { ApplicationModel } from '@server/models/application/application.js'+import { compareSemVer } from '@peertube/peertube-core-utils'+import { JoinPeerTubeVersions } from '@peertube/peertube-models'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { PEERTUBE_VERSION, SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { Notifier } from '../notifier/index.js'+import { AbstractScheduler } from './abstract-scheduler.js'export class PeerTubeVersionCheckScheduler extends AbstractScheduler {diff --git a/server/lib/schedulers/plugins-check-scheduler.ts b/server/server/lib/schedulers/plugins-check-scheduler.tssimilarity index 84%rename from server/lib/schedulers/plugins-check-scheduler.tsrename to server/server/lib/schedulers/plugins-check-scheduler.tsindex 820c01693d..627289663d 100644--- a/server/lib/schedulers/plugins-check-scheduler.ts+++ b/server/server/lib/schedulers/plugins-check-scheduler.ts@@ -1,12 +1,12 @@-import { chunk } from 'lodash'-import { compareSemVer } from '@shared/core-utils'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { PluginModel } from '../../models/server/plugin'-import { Notifier } from '../notifier'-import { getLatestPluginsVersion } from '../plugins/plugin-index'-import { AbstractScheduler } from './abstract-scheduler'+import { compareSemVer } from '@peertube/peertube-core-utils'+import chunk from 'lodash-es/chunk.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { PluginModel } from '../../models/server/plugin.js'+import { Notifier } from '../notifier/index.js'+import { getLatestPluginsVersion } from '../plugins/plugin-index.js'+import { AbstractScheduler } from './abstract-scheduler.js'export class PluginsCheckScheduler extends AbstractScheduler {diff --git a/server/lib/schedulers/remove-dangling-resumable-uploads-scheduler.ts b/server/server/lib/schedulers/remove-dangling-resumable-uploads-scheduler.tssimilarity index 90%rename from server/lib/schedulers/remove-dangling-resumable-uploads-scheduler.tsrename to server/server/lib/schedulers/remove-dangling-resumable-uploads-scheduler.tsindex 61e93eafa8..6d5e70b084 100644--- a/server/lib/schedulers/remove-dangling-resumable-uploads-scheduler.ts+++ b/server/server/lib/schedulers/remove-dangling-resumable-uploads-scheduler.ts@@ -1,8 +1,8 @@-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { SCHEDULER_INTERVALS_MS } from '@server/initializers/constants'-import { uploadx } from '../uploadx'-import { AbstractScheduler } from './abstract-scheduler'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { SCHEDULER_INTERVALS_MS } from '@server/initializers/constants.js'+import { uploadx } from '../uploadx.js'+import { AbstractScheduler } from './abstract-scheduler.js'const lTags = loggerTagsFactory('scheduler', 'resumable-upload', 'cleaner')diff --git a/server/lib/schedulers/remove-old-history-scheduler.ts b/server/server/lib/schedulers/remove-old-history-scheduler.tssimilarity index 80%rename from server/lib/schedulers/remove-old-history-scheduler.tsrename to server/server/lib/schedulers/remove-old-history-scheduler.tsindex 34b1607999..3a557ae97a 100644--- a/server/lib/schedulers/remove-old-history-scheduler.ts+++ b/server/server/lib/schedulers/remove-old-history-scheduler.ts@@ -1,8 +1,8 @@-import { logger } from '../../helpers/logger'-import { AbstractScheduler } from './abstract-scheduler'-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { UserVideoHistoryModel } from '../../models/user/user-video-history'-import { CONFIG } from '../../initializers/config'+import { logger } from '../../helpers/logger.js'+import { AbstractScheduler } from './abstract-scheduler.js'+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { UserVideoHistoryModel } from '../../models/user/user-video-history.js'+import { CONFIG } from '../../initializers/config.js'export class RemoveOldHistoryScheduler extends AbstractScheduler {diff --git a/server/lib/schedulers/remove-old-views-scheduler.ts b/server/server/lib/schedulers/remove-old-views-scheduler.tssimilarity index 75%rename from server/lib/schedulers/remove-old-views-scheduler.tsrename to server/server/lib/schedulers/remove-old-views-scheduler.tsindex 8bc53a0455..7bd28b17bc 100644--- a/server/lib/schedulers/remove-old-views-scheduler.ts+++ b/server/server/lib/schedulers/remove-old-views-scheduler.ts@@ -1,8 +1,8 @@-import { VideoViewModel } from '@server/models/view/video-view'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { AbstractScheduler } from './abstract-scheduler'+import { VideoViewModel } from '@server/models/view/video-view.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { AbstractScheduler } from './abstract-scheduler.js'export class RemoveOldViewsScheduler extends AbstractScheduler {diff --git a/server/lib/schedulers/runner-job-watch-dog-scheduler.ts b/server/server/lib/schedulers/runner-job-watch-dog-scheduler.tssimilarity index 82%rename from server/lib/schedulers/runner-job-watch-dog-scheduler.tsrename to server/server/lib/schedulers/runner-job-watch-dog-scheduler.tsindex f7a26d2bc7..941e79c3eb 100644--- a/server/lib/schedulers/runner-job-watch-dog-scheduler.ts+++ b/server/server/lib/schedulers/runner-job-watch-dog-scheduler.ts@@ -1,9 +1,9 @@-import { CONFIG } from '@server/initializers/config'-import { RunnerJobModel } from '@server/models/runner/runner-job'-import { logger, loggerTagsFactory } from '../../helpers/logger'-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { getRunnerJobHandlerClass } from '../runners'-import { AbstractScheduler } from './abstract-scheduler'+import { CONFIG } from '@server/initializers/config.js'+import { RunnerJobModel } from '@server/models/runner/runner-job.js'+import { logger, loggerTagsFactory } from '../../helpers/logger.js'+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { getRunnerJobHandlerClass } from '../runners/index.js'+import { AbstractScheduler } from './abstract-scheduler.js'const lTags = loggerTagsFactory('runner')diff --git a/server/lib/schedulers/update-videos-scheduler.ts b/server/server/lib/schedulers/update-videos-scheduler.tssimilarity index 78%rename from server/lib/schedulers/update-videos-scheduler.tsrename to server/server/lib/schedulers/update-videos-scheduler.tsindex e38685c04a..2d4892013e 100644--- a/server/lib/schedulers/update-videos-scheduler.ts+++ b/server/server/lib/schedulers/update-videos-scheduler.ts@@ -1,15 +1,15 @@-import { VideoModel } from '@server/models/video/video'-import { MScheduleVideoUpdate } from '@server/types/models'-import { VideoPrivacy, VideoState } from '@shared/models'-import { logger } from '../../helpers/logger'-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { sequelizeTypescript } from '../../initializers/database'-import { ScheduleVideoUpdateModel } from '../../models/video/schedule-video-update'-import { Notifier } from '../notifier'-import { addVideoJobsAfterUpdate } from '../video'-import { VideoPathManager } from '../video-path-manager'-import { setVideoPrivacy } from '../video-privacy'-import { AbstractScheduler } from './abstract-scheduler'+import { VideoPrivacy, VideoPrivacyType, VideoState } from '@peertube/peertube-models'+import { VideoModel } from '@server/models/video/video.js'+import { MScheduleVideoUpdate } from '@server/types/models/index.js'+import { logger } from '../../helpers/logger.js'+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { sequelizeTypescript } from '../../initializers/database.js'+import { ScheduleVideoUpdateModel } from '../../models/video/schedule-video-update.js'+import { Notifier } from '../notifier/index.js'+import { VideoPathManager } from '../video-path-manager.js'+import { setVideoPrivacy } from '../video-privacy.js'+import { addVideoJobsAfterUpdate } from '../video.js'+import { AbstractScheduler } from './abstract-scheduler.js'export class UpdateVideosScheduler extends AbstractScheduler {@@ -47,7 +47,7 @@ export class UpdateVideosScheduler extends AbstractScheduler {}private async updateAVideo (schedule: MScheduleVideoUpdate) {- let oldPrivacy: VideoPrivacy+ let oldPrivacy: VideoPrivacyTypelet isNewVideo: booleanlet published = falsediff --git a/server/lib/schedulers/video-channel-sync-latest-scheduler.ts b/server/server/lib/schedulers/video-channel-sync-latest-scheduler.tssimilarity index 85%rename from server/lib/schedulers/video-channel-sync-latest-scheduler.tsrename to server/server/lib/schedulers/video-channel-sync-latest-scheduler.tsindex efb957fac0..2a3ad18b19 100644--- a/server/lib/schedulers/video-channel-sync-latest-scheduler.ts+++ b/server/server/lib/schedulers/video-channel-sync-latest-scheduler.ts@@ -1,10 +1,10 @@-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { synchronizeChannel } from '../sync-channel'-import { AbstractScheduler } from './abstract-scheduler'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync.js'+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { synchronizeChannel } from '../sync-channel.js'+import { AbstractScheduler } from './abstract-scheduler.js'export class VideoChannelSyncLatestScheduler extends AbstractScheduler {private static instance: AbstractSchedulerdiff --git a/server/lib/schedulers/video-views-buffer-scheduler.ts b/server/server/lib/schedulers/video-views-buffer-scheduler.tssimilarity index 86%rename from server/lib/schedulers/video-views-buffer-scheduler.tsrename to server/server/lib/schedulers/video-views-buffer-scheduler.tsindex 244a88b14c..fd8a61324c 100644--- a/server/lib/schedulers/video-views-buffer-scheduler.ts+++ b/server/server/lib/schedulers/video-views-buffer-scheduler.ts@@ -1,9 +1,9 @@-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { VideoModel } from '@server/models/video/video'-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { federateVideoIfNeeded } from '../activitypub/videos'-import { Redis } from '../redis'-import { AbstractScheduler } from './abstract-scheduler'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { VideoModel } from '@server/models/video/video.js'+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { federateVideoIfNeeded } from '../activitypub/videos/index.js'+import { Redis } from '../redis.js'+import { AbstractScheduler } from './abstract-scheduler.js'const lTags = loggerTagsFactory('views')diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/server/lib/schedulers/videos-redundancy-scheduler.tssimilarity index 94%rename from server/lib/schedulers/videos-redundancy-scheduler.tsrename to server/server/lib/schedulers/videos-redundancy-scheduler.tsindex 91625ccb55..60d8686b28 100644--- a/server/lib/schedulers/videos-redundancy-scheduler.ts+++ b/server/server/lib/schedulers/videos-redundancy-scheduler.ts@@ -1,7 +1,7 @@-import { move } from 'fs-extra'+import { move } from 'fs-extra/esm'import { join } from 'path'-import { getServerActor } from '@server/models/application/application'-import { VideoModel } from '@server/models/video/video'+import { getServerActor } from '@server/models/application/application.js'+import { VideoModel } from '@server/models/video/video.js'import {MStreamingPlaylistFiles,MVideoAccountLight,@@ -11,20 +11,20 @@ import {MVideoRedundancyStreamingPlaylistVideo,MVideoRedundancyVideo,MVideoWithAllFiles-} from '@server/types/models'-import { VideosRedundancyStrategy } from '../../../shared/models/redundancy'-import { logger, loggerTagsFactory } from '../../helpers/logger'-import { downloadWebTorrentVideo } from '../../helpers/webtorrent'-import { CONFIG } from '../../initializers/config'-import { DIRECTORIES, REDUNDANCY, VIDEO_IMPORT_TIMEOUT } from '../../initializers/constants'-import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'-import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send'-import { getLocalVideoCacheFileActivityPubUrl, getLocalVideoCacheStreamingPlaylistActivityPubUrl } from '../activitypub/url'-import { getOrCreateAPVideo } from '../activitypub/videos'-import { downloadPlaylistSegments } from '../hls'-import { removeVideoRedundancy } from '../redundancy'-import { generateHLSRedundancyUrl, generateWebVideoRedundancyUrl } from '../video-urls'-import { AbstractScheduler } from './abstract-scheduler'+} from '@server/types/models/index.js'+import { VideosRedundancyStrategy } from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '../../helpers/logger.js'+import { downloadWebTorrentVideo } from '../../helpers/webtorrent.js'+import { CONFIG } from '../../initializers/config.js'+import { DIRECTORIES, REDUNDANCY, VIDEO_IMPORT_TIMEOUT } from '../../initializers/constants.js'+import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy.js'+import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send/index.js'+import { getLocalVideoCacheFileActivityPubUrl, getLocalVideoCacheStreamingPlaylistActivityPubUrl } from '../activitypub/url.js'+import { getOrCreateAPVideo } from '../activitypub/videos/index.js'+import { downloadPlaylistSegments } from '../hls.js'+import { removeVideoRedundancy } from '../redundancy.js'+import { generateHLSRedundancyUrl, generateWebVideoRedundancyUrl } from '../video-urls.js'+import { AbstractScheduler } from './abstract-scheduler.js'const lTags = loggerTagsFactory('redundancy')diff --git a/server/lib/schedulers/youtube-dl-update-scheduler.ts b/server/server/lib/schedulers/youtube-dl-update-scheduler.tssimilarity index 77%rename from server/lib/schedulers/youtube-dl-update-scheduler.tsrename to server/server/lib/schedulers/youtube-dl-update-scheduler.tsindex 1ee4ae1b28..9e3cbf7b2c 100644--- a/server/lib/schedulers/youtube-dl-update-scheduler.ts+++ b/server/server/lib/schedulers/youtube-dl-update-scheduler.ts@@ -1,6 +1,6 @@-import { YoutubeDLCLI } from '@server/helpers/youtube-dl'-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { AbstractScheduler } from './abstract-scheduler'+import { YoutubeDLCLI } from '@server/helpers/youtube-dl/index.js'+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants.js'+import { AbstractScheduler } from './abstract-scheduler.js'export class YoutubeDlUpdateScheduler extends AbstractScheduler {diff --git a/server/lib/search.ts b/server/server/lib/search.tssimilarity index 88%rename from server/lib/search.tsrename to server/server/lib/search.tsindex b3363fbec4..567eced7cc 100644--- a/server/lib/search.ts+++ b/server/server/lib/search.ts@@ -1,9 +1,9 @@import express from 'express'-import { CONFIG } from '@server/initializers/config'-import { AccountBlocklistModel } from '@server/models/account/account-blocklist'-import { getServerActor } from '@server/models/application/application'-import { ServerBlocklistModel } from '@server/models/server/server-blocklist'-import { SearchTargetQuery } from '@shared/models'+import { CONFIG } from '@server/initializers/config.js'+import { AccountBlocklistModel } from '@server/models/account/account-blocklist.js'+import { getServerActor } from '@server/models/application/application.js'+import { ServerBlocklistModel } from '@server/models/server/server-blocklist.js'+import { SearchTargetQuery } from '@peertube/peertube-models'function isSearchIndexSearch (query: SearchTargetQuery) {if (query.searchTarget === 'search-index') return truediff --git a/server/lib/server-config-manager.ts b/server/server/lib/server-config-manager.tssimilarity index 94%rename from server/lib/server-config-manager.tsrename to server/server/lib/server-config-manager.tsindex beb5d4d824..8b3b957fe3 100644--- a/server/lib/server-config-manager.ts+++ b/server/server/lib/server-config-manager.ts@@ -1,14 +1,20 @@-import { getServerCommit } from '@server/helpers/version'-import { CONFIG, isEmailEnabled } from '@server/initializers/config'-import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION } from '@server/initializers/constants'-import { isSignupAllowed, isSignupAllowedForCurrentIP } from '@server/lib/signup'-import { ActorCustomPageModel } from '@server/models/account/actor-custom-page'-import { PluginModel } from '@server/models/server/plugin'-import { HTMLServerConfig, RegisteredExternalAuthConfig, RegisteredIdAndPassAuthConfig, ServerConfig } from '@shared/models'-import { Hooks } from './plugins/hooks'-import { PluginManager } from './plugins/plugin-manager'-import { getThemeOrDefault } from './plugins/theme-utils'-import { VideoTranscodingProfilesManager } from './transcoding/default-transcoding-profiles'+import {+ HTMLServerConfig,+ RegisteredExternalAuthConfig,+ RegisteredIdAndPassAuthConfig,+ ServerConfig,+ VideoResolutionType+} from '@peertube/peertube-models'+import { getServerCommit } from '@server/helpers/version.js'+import { CONFIG, isEmailEnabled } from '@server/initializers/config.js'+import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION } from '@server/initializers/constants.js'+import { isSignupAllowed, isSignupAllowedForCurrentIP } from '@server/lib/signup.js'+import { ActorCustomPageModel } from '@server/models/account/actor-custom-page.js'+import { PluginModel } from '@server/models/server/plugin.js'+import { Hooks } from './plugins/hooks.js'+import { PluginManager } from './plugins/plugin-manager.js'+import { getThemeOrDefault } from './plugins/theme-utils.js'+import { VideoTranscodingProfilesManager } from './transcoding/default-transcoding-profiles.js'/***@@ -333,7 +339,7 @@ class ServerConfigManager {return Object.keys(transcoding.RESOLUTIONS).filter(key => transcoding.ENABLED && transcoding.RESOLUTIONS[key] === true)- .map(r => parseInt(r, 10))+ .map(r => parseInt(r, 10) as VideoResolutionType)}private getIdAndPassAuthPlugins () {diff --git a/server/lib/signup.ts b/server/server/lib/signup.tssimilarity index 73%rename from server/lib/signup.tsrename to server/server/lib/signup.tsindex 6702c22cbc..5ad5be9c32 100644--- a/server/lib/signup.ts+++ b/server/server/lib/signup.ts@@ -1,8 +1,7 @@-import { IPv4, IPv6, parse, subnetMatch } from 'ipaddr.js'-import { CONFIG } from '../initializers/config'-import { UserModel } from '../models/user/user'--const isCidr = require('is-cidr')+import ipaddr from 'ipaddr.js'+import isCidr from 'is-cidr'+import { CONFIG } from '../initializers/config.js'+import { UserModel } from '../models/user/user.js'export type SignupMode = 'direct-registration' | 'request-registration'@@ -35,7 +34,7 @@ async function isSignupAllowed (options: {function isSignupAllowedForCurrentIP (ip: string) {if (!ip) return false- const addr = parse(ip)+ const addr = ipaddr.parse(ip)const excludeList = [ 'blacklist' ]let matched = ''@@ -45,23 +44,23 @@ function isSignupAllowedForCurrentIP (ip: string) {}if (addr.kind() === 'ipv4') {- const addrV4 = IPv4.parse(ip)+ const addrV4 = ipaddr.IPv4.parse(ip)const rangeList = {whitelist: CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.filter(cidr => isCidr.v4(cidr))- .map(cidr => IPv4.parseCIDR(cidr)),+ .map(cidr => ipaddr.IPv4.parseCIDR(cidr)),blacklist: CONFIG.SIGNUP.FILTERS.CIDR.BLACKLIST.filter(cidr => isCidr.v4(cidr))- .map(cidr => IPv4.parseCIDR(cidr))+ .map(cidr => ipaddr.IPv4.parseCIDR(cidr))}- matched = subnetMatch(addrV4, rangeList, 'unknown')+ matched = ipaddr.subnetMatch(addrV4, rangeList, 'unknown')} else if (addr.kind() === 'ipv6') {- const addrV6 = IPv6.parse(ip)+ const addrV6 = ipaddr.IPv6.parse(ip)const rangeList = {whitelist: CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.filter(cidr => isCidr.v6(cidr))- .map(cidr => IPv6.parseCIDR(cidr)),+ .map(cidr => ipaddr.IPv6.parseCIDR(cidr)),blacklist: CONFIG.SIGNUP.FILTERS.CIDR.BLACKLIST.filter(cidr => isCidr.v6(cidr))- .map(cidr => IPv6.parseCIDR(cidr))+ .map(cidr => ipaddr.IPv6.parseCIDR(cidr))}- matched = subnetMatch(addrV6, rangeList, 'unknown')+ matched = ipaddr.subnetMatch(addrV6, rangeList, 'unknown')}return !excludeList.includes(matched)diff --git a/server/lib/stat-manager.ts b/server/server/lib/stat-manager.tssimilarity index 93%rename from server/lib/stat-manager.tsrename to server/server/lib/stat-manager.tsindex 0516e7f1a3..f27266571d 100644--- a/server/lib/stat-manager.ts+++ b/server/server/lib/stat-manager.ts@@ -1,14 +1,14 @@-import { mapSeries } from 'bluebird'-import { CONFIG } from '@server/initializers/config'-import { ActorFollowModel } from '@server/models/actor/actor-follow'-import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy'-import { UserModel } from '@server/models/user/user'-import { VideoModel } from '@server/models/video/video'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { VideoCommentModel } from '@server/models/video/video-comment'-import { VideoFileModel } from '@server/models/video/video-file'-import { VideoPlaylistModel } from '@server/models/video/video-playlist'-import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@shared/models'+import Bluebird from 'bluebird'+import { CONFIG } from '@server/initializers/config.js'+import { ActorFollowModel } from '@server/models/actor/actor-follow.js'+import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy.js'+import { UserModel } from '@server/models/user/user.js'+import { VideoModel } from '@server/models/video/video.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import { VideoCommentModel } from '@server/models/video/video-comment.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoPlaylistModel } from '@server/models/video/video-playlist.js'+import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@peertube/peertube-models'class StatsManager {@@ -107,7 +107,7 @@ class StatsManager {strategies.push({ strategy: 'manual', size: null })- return mapSeries(strategies, r => {+ return Bluebird.mapSeries(strategies, r => {return VideoRedundancyModel.getStats(r.strategy).then(stats => Object.assign(stats, { strategy: r.strategy, totalSize: r.size }))})diff --git a/server/lib/sync-channel.ts b/server/server/lib/sync-channel.tssimilarity index 86%rename from server/lib/sync-channel.tsrename to server/server/lib/sync-channel.tsindex 3a805a943d..b0cbf43ba4 100644--- a/server/lib/sync-channel.ts+++ b/server/server/lib/sync-channel.ts@@ -1,13 +1,13 @@-import { logger } from '@server/helpers/logger'-import { YoutubeDLWrapper } from '@server/helpers/youtube-dl'-import { CONFIG } from '@server/initializers/config'-import { buildYoutubeDLImport } from '@server/lib/video-pre-import'-import { UserModel } from '@server/models/user/user'-import { VideoImportModel } from '@server/models/video/video-import'-import { MChannel, MChannelAccountDefault, MChannelSync } from '@server/types/models'-import { VideoChannelSyncState, VideoPrivacy } from '@shared/models'-import { CreateJobArgument, JobQueue } from './job-queue'-import { ServerConfigManager } from './server-config-manager'+import { logger } from '@server/helpers/logger.js'+import { YoutubeDLWrapper } from '@server/helpers/youtube-dl/index.js'+import { CONFIG } from '@server/initializers/config.js'+import { buildYoutubeDLImport } from '@server/lib/video-pre-import.js'+import { UserModel } from '@server/models/user/user.js'+import { VideoImportModel } from '@server/models/video/video-import.js'+import { MChannel, MChannelAccountDefault, MChannelSync } from '@server/types/models/index.js'+import { VideoChannelSyncState, VideoPrivacy } from '@peertube/peertube-models'+import { CreateJobArgument, JobQueue } from './job-queue/index.js'+import { ServerConfigManager } from './server-config-manager.js'export async function synchronizeChannel (options: {channel: MChannelAccountDefaultdiff --git a/server/lib/thumbnail.ts b/server/server/lib/thumbnail.tssimilarity index 93%rename from server/lib/thumbnail.tsrename to server/server/lib/thumbnail.tsindex 0b98da14f9..e5424973bc 100644--- a/server/lib/thumbnail.ts+++ b/server/server/lib/thumbnail.ts@@ -1,14 +1,14 @@import { join } from 'path'-import { ThumbnailType } from '@shared/models'-import { generateImageFilename, generateImageFromVideoFile } from '../helpers/image-utils'-import { CONFIG } from '../initializers/config'-import { ASSETS_PATH, PREVIEWS_SIZE, THUMBNAILS_SIZE } from '../initializers/constants'-import { ThumbnailModel } from '../models/video/thumbnail'-import { MVideoFile, MVideoThumbnail, MVideoUUID, MVideoWithAllFiles } from '../types/models'-import { MThumbnail } from '../types/models/video/thumbnail'-import { MVideoPlaylistThumbnail } from '../types/models/video/video-playlist'-import { VideoPathManager } from './video-path-manager'-import { downloadImageFromWorker, processImageFromWorker } from './worker/parent-process'+import { ThumbnailType, ThumbnailType_Type } from '@peertube/peertube-models'+import { generateImageFilename, generateImageFromVideoFile } from '../helpers/image-utils.js'+import { CONFIG } from '../initializers/config.js'+import { ASSETS_PATH, PREVIEWS_SIZE, THUMBNAILS_SIZE } from '../initializers/constants.js'+import { ThumbnailModel } from '../models/video/thumbnail.js'+import { MVideoFile, MVideoThumbnail, MVideoUUID, MVideoWithAllFiles } from '../types/models/index.js'+import { MThumbnail } from '../types/models/video/thumbnail.js'+import { MVideoPlaylistThumbnail } from '../types/models/video/video-playlist.js'+import { VideoPathManager } from './video-path-manager.js'+import { downloadImageFromWorker, processImageFromWorker } from './worker/parent-process.js'type ImageSize = { height?: number, width?: number }@@ -63,7 +63,7 @@ function updateRemotePlaylistMiniatureFromUrl (options: {function updateLocalVideoMiniatureFromExisting (options: {inputPath: stringvideo: MVideoThumbnail- type: ThumbnailType+ type: ThumbnailType_TypeautomaticallyGenerated: booleansize?: ImageSizekeepOriginal?: boolean // default to false@@ -91,7 +91,7 @@ function updateLocalVideoMiniatureFromExisting (options: {function generateLocalVideoMiniature (options: {video: MVideoThumbnailvideoFile: MVideoFile- type: ThumbnailType+ type: ThumbnailType_Type}) {const { video, videoFile, type } = options@@ -130,7 +130,7 @@ function generateLocalVideoMiniature (options: {function updateLocalVideoMiniatureFromUrl (options: {downloadUrl: stringvideo: MVideoThumbnail- type: ThumbnailType+ type: ThumbnailType_Typesize?: ImageSize}) {const { downloadUrl, video, type, size } = options@@ -162,7 +162,7 @@ function updateLocalVideoMiniatureFromUrl (options: {function updateRemoteVideoThumbnail (options: {fileUrl: stringvideo: MVideoThumbnail- type: ThumbnailType+ type: ThumbnailType_Typesize: ImageSizeonDisk: boolean}) {@@ -246,7 +246,7 @@ function buildMetadataFromPlaylist (playlist: MVideoPlaylistThumbnail, size: Ima}}-function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, size?: ImageSize) {+function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType_Type, size?: ImageSize) {const existingThumbnail = Array.isArray(video.Thumbnails)? video.Thumbnails.find(t => t.type === type): undefined@@ -287,7 +287,7 @@ async function updateThumbnailFromFunction (parameters: {filename: stringheight: numberwidth: number- type: ThumbnailType+ type: ThumbnailType_TypeonDisk: booleanautomaticallyGenerated?: booleanfileUrl?: stringdiff --git a/server/lib/timeserie.ts b/server/server/lib/timeserie.tssimilarity index 97%rename from server/lib/timeserie.tsrename to server/server/lib/timeserie.tsindex 08b12129af..9723266ffe 100644--- a/server/lib/timeserie.ts+++ b/server/server/lib/timeserie.ts@@ -1,4 +1,4 @@-import { logger } from '@server/helpers/logger'+import { logger } from '@server/helpers/logger.js'function buildGroupByAndBoundaries (startDateString: string, endDateString: string) {const startDate = new Date(startDateString)diff --git a/server/lib/transcoding/create-transcoding-job.ts b/server/server/lib/transcoding/create-transcoding-job.tssimilarity index 91%rename from server/lib/transcoding/create-transcoding-job.tsrename to server/server/lib/transcoding/create-transcoding-job.tsindex d78e68b873..aea18b6326 100644--- a/server/lib/transcoding/create-transcoding-job.ts+++ b/server/server/lib/transcoding/create-transcoding-job.ts@@ -1,6 +1,6 @@-import { CONFIG } from '@server/initializers/config'-import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models'-import { TranscodingJobQueueBuilder, TranscodingRunnerJobBuilder } from './shared'+import { CONFIG } from '@server/initializers/config.js'+import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models/index.js'+import { TranscodingJobQueueBuilder, TranscodingRunnerJobBuilder } from './shared/index.js'export function createOptimizeOrMergeAudioJobs (options: {video: MVideoFullLightdiff --git a/server/lib/transcoding/default-transcoding-profiles.ts b/server/server/lib/transcoding/default-transcoding-profiles.tssimilarity index 95%rename from server/lib/transcoding/default-transcoding-profiles.tsrename to server/server/lib/transcoding/default-transcoding-profiles.tsindex 8f8fdd026e..90407d103b 100644--- a/server/lib/transcoding/default-transcoding-profiles.ts+++ b/server/server/lib/transcoding/default-transcoding-profiles.ts@@ -1,7 +1,7 @@-import { logger } from '@server/helpers/logger'-import { FFmpegCommandWrapper, getDefaultAvailableEncoders } from '@shared/ffmpeg'-import { AvailableEncoders, EncoderOptionsBuilder } from '@shared/models'+import { logger } from '@server/helpers/logger.js'+import { FFmpegCommandWrapper, getDefaultAvailableEncoders } from '@peertube/peertube-ffmpeg'+import { AvailableEncoders, EncoderOptionsBuilder } from '@peertube/peertube-models'// ---------------------------------------------------------------------------// Profile manager to get and change default profilesdiff --git a/server/lib/transcoding/ended-transcoding.ts b/server/server/lib/transcoding/ended-transcoding.tssimilarity index 79%rename from server/lib/transcoding/ended-transcoding.tsrename to server/server/lib/transcoding/ended-transcoding.tsindex d31674ede8..468a3aa830 100644--- a/server/lib/transcoding/ended-transcoding.ts+++ b/server/server/lib/transcoding/ended-transcoding.ts@@ -1,7 +1,7 @@-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { MVideo } from '@server/types/models'-import { moveToNextState } from '../video-state'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { MVideo } from '@server/types/models/index.js'+import { moveToNextState } from '../video-state.js'export async function onTranscodingEnded (options: {video: MVideodiff --git a/server/lib/transcoding/hls-transcoding.ts b/server/server/lib/transcoding/hls-transcoding.tssimilarity index 86%rename from server/lib/transcoding/hls-transcoding.tsrename to server/server/lib/transcoding/hls-transcoding.tsindex 2c325d9ee0..5f07f112a9 100644--- a/server/lib/transcoding/hls-transcoding.ts+++ b/server/server/lib/transcoding/hls-transcoding.ts@@ -1,28 +1,28 @@import { MutexInterface } from 'async-mutex'import { Job } from 'bullmq'-import { ensureDir, move, stat } from 'fs-extra'+import { ensureDir, move } from 'fs-extra/esm'+import { stat } from 'fs/promises'import { basename, extname as extnameUtil, join } from 'path'-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'-import { sequelizeTypescript } from '@server/initializers/database'-import { MVideo, MVideoFile } from '@server/types/models'-import { pick } from '@shared/core-utils'-import { getVideoStreamDuration, getVideoStreamFPS } from '@shared/ffmpeg'-import { VideoResolution } from '@shared/models'-import { CONFIG } from '../../initializers/config'-import { VideoFileModel } from '../../models/video/video-file'-import { VideoStreamingPlaylistModel } from '../../models/video/video-streaming-playlist'-import { updatePlaylistAfterFileChange } from '../hls'-import { generateHLSVideoFilename, getHlsResolutionPlaylistFilename } from '../paths'-import { buildFileMetadata } from '../video-file'-import { VideoPathManager } from '../video-path-manager'-import { buildFFmpegVOD } from './shared'+import { pick } from '@peertube/peertube-core-utils'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { MVideo, MVideoFile } from '@server/types/models/index.js'+import { getVideoStreamDuration, getVideoStreamFPS } from '@peertube/peertube-ffmpeg'+import { CONFIG } from '../../initializers/config.js'+import { VideoFileModel } from '../../models/video/video-file.js'+import { VideoStreamingPlaylistModel } from '../../models/video/video-streaming-playlist.js'+import { updatePlaylistAfterFileChange } from '../hls.js'+import { generateHLSVideoFilename, getHlsResolutionPlaylistFilename } from '../paths.js'+import { buildFileMetadata } from '../video-file.js'+import { VideoPathManager } from '../video-path-manager.js'+import { buildFFmpegVOD } from './shared/index.js'// Concat TS segments from a live video to a fragmented mp4 HLS playlistexport async function generateHlsPlaylistResolutionFromTS (options: {video: MVideoconcatenatedTsFilePath: string- resolution: VideoResolution+ resolution: numberfps: numberisAAC: booleaninputFileMutexReleaser: MutexInterface.Releaser@@ -39,7 +39,7 @@ export async function generateHlsPlaylistResolutionFromTS (options: {export function generateHlsPlaylistResolution (options: {video: MVideovideoInputPath: string- resolution: VideoResolution+ resolution: numberfps: numbercopyCodecs: booleaninputFileMutexReleaser: MutexInterface.Releaser@@ -125,7 +125,7 @@ async function generateHlsPlaylistCommon (options: {video: MVideoinputPath: string- resolution: VideoResolution+ resolution: numberfps: numberinputFileMutexReleaser: MutexInterface.Releaserdiff --git a/server/lib/transcoding/shared/ffmpeg-builder.ts b/server/server/lib/transcoding/shared/ffmpeg-builder.tssimilarity index 78%rename from server/lib/transcoding/shared/ffmpeg-builder.tsrename to server/server/lib/transcoding/shared/ffmpeg-builder.tsindex 441445ec4d..b28ffdb1f4 100644--- a/server/lib/transcoding/shared/ffmpeg-builder.ts+++ b/server/server/lib/transcoding/shared/ffmpeg-builder.ts@@ -1,8 +1,8 @@import { Job } from 'bullmq'-import { getFFmpegCommandWrapperOptions } from '@server/helpers/ffmpeg'-import { logger } from '@server/helpers/logger'-import { FFmpegVOD } from '@shared/ffmpeg'-import { VideoTranscodingProfilesManager } from '../default-transcoding-profiles'+import { getFFmpegCommandWrapperOptions } from '@server/helpers/ffmpeg/index.js'+import { logger } from '@server/helpers/logger.js'+import { FFmpegVOD } from '@peertube/peertube-ffmpeg'+import { VideoTranscodingProfilesManager } from '../default-transcoding-profiles.js'export function buildFFmpegVOD (job?: Job) {return new FFmpegVOD({diff --git a/server/server/lib/transcoding/shared/index.ts b/server/server/lib/transcoding/shared/index.tsnew file mode 100644index 0000000000..835ee6632b--- /dev/null+++ b/server/server/lib/transcoding/shared/index.ts@@ -0,0 +1,2 @@+export * from './job-builders/index.js'+export * from './ffmpeg-builder.js'diff --git a/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts b/server/server/lib/transcoding/shared/job-builders/abstract-job-builder.tssimilarity index 96%rename from server/lib/transcoding/shared/job-builders/abstract-job-builder.tsrename to server/server/lib/transcoding/shared/job-builders/abstract-job-builder.tsindex 15fc814ae3..96c8f990b9 100644--- a/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts+++ b/server/server/lib/transcoding/shared/job-builders/abstract-job-builder.ts@@ -1,5 +1,5 @@-import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models'+import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models/index.js'export abstract class AbstractJobBuilder {diff --git a/server/server/lib/transcoding/shared/job-builders/index.ts b/server/server/lib/transcoding/shared/job-builders/index.tsnew file mode 100644index 0000000000..099c6646e3--- /dev/null+++ b/server/server/lib/transcoding/shared/job-builders/index.ts@@ -0,0 +1,2 @@+export * from './transcoding-job-queue-builder.js'+export * from './transcoding-runner-job-builder.js'diff --git a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts b/server/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.tssimilarity index 95%rename from server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.tsrename to server/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.tsindex 0505c2b2f8..0f221472ff 100644--- a/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts+++ b/server/server/lib/transcoding/shared/job-builders/transcoding-job-queue-builder.ts@@ -1,25 +1,25 @@import Bluebird from 'bluebird'-import { computeOutputFPS } from '@server/helpers/ffmpeg'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { DEFAULT_AUDIO_RESOLUTION, VIDEO_TRANSCODING_FPS } from '@server/initializers/constants'-import { CreateJobArgument, JobQueue } from '@server/lib/job-queue'-import { Hooks } from '@server/lib/plugins/hooks'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { MUserId, MVideoFile, MVideoFullLight, MVideoWithFileThumbnail } from '@server/types/models'-import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAudioStream, isAudioFile } from '@shared/ffmpeg'+import { computeOutputFPS } from '@server/helpers/ffmpeg/index.js'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { DEFAULT_AUDIO_RESOLUTION, VIDEO_TRANSCODING_FPS } from '@server/initializers/constants.js'+import { CreateJobArgument, JobQueue } from '@server/lib/job-queue/index.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { MUserId, MVideoFile, MVideoFullLight, MVideoWithFileThumbnail } from '@server/types/models/index.js'+import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAudioStream, isAudioFile } from '@peertube/peertube-ffmpeg'import {HLSTranscodingPayload,MergeAudioTranscodingPayload,NewWebVideoResolutionTranscodingPayload,OptimizeTranscodingPayload,VideoTranscodingPayload-} from '@shared/models'-import { getTranscodingJobPriority } from '../../transcoding-priority'-import { canDoQuickTranscode } from '../../transcoding-quick-transcode'-import { buildOriginalFileResolution, computeResolutionsToTranscode } from '../../transcoding-resolutions'-import { AbstractJobBuilder } from './abstract-job-builder'+} from '@peertube/peertube-models'+import { getTranscodingJobPriority } from '../../transcoding-priority.js'+import { canDoQuickTranscode } from '../../transcoding-quick-transcode.js'+import { buildOriginalFileResolution, computeResolutionsToTranscode } from '../../transcoding-resolutions.js'+import { AbstractJobBuilder } from './abstract-job-builder.js'export class TranscodingJobQueueBuilder extends AbstractJobBuilder {diff --git a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts b/server/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.tssimilarity index 91%rename from server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.tsrename to server/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.tsindex f0671bd7a6..68d84a286b 100644--- a/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts+++ b/server/server/lib/transcoding/shared/job-builders/transcoding-runner-job-builder.ts@@ -1,16 +1,20 @@-import { computeOutputFPS } from '@server/helpers/ffmpeg'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { DEFAULT_AUDIO_RESOLUTION, VIDEO_TRANSCODING_FPS } from '@server/initializers/constants'-import { Hooks } from '@server/lib/plugins/hooks'-import { VODAudioMergeTranscodingJobHandler, VODHLSTranscodingJobHandler, VODWebVideoTranscodingJobHandler } from '@server/lib/runners'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { MUserId, MVideoFile, MVideoFullLight, MVideoWithFileThumbnail } from '@server/types/models'-import { MRunnerJob } from '@server/types/models/runners'-import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAudioStream, isAudioFile } from '@shared/ffmpeg'-import { getTranscodingJobPriority } from '../../transcoding-priority'-import { computeResolutionsToTranscode } from '../../transcoding-resolutions'-import { AbstractJobBuilder } from './abstract-job-builder'+import { computeOutputFPS } from '@server/helpers/ffmpeg/index.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { DEFAULT_AUDIO_RESOLUTION, VIDEO_TRANSCODING_FPS } from '@server/initializers/constants.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import {+ VODAudioMergeTranscodingJobHandler,+ VODHLSTranscodingJobHandler,+ VODWebVideoTranscodingJobHandler+} from '@server/lib/runners/index.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { MUserId, MVideoFile, MVideoFullLight, MVideoWithFileThumbnail } from '@server/types/models/index.js'+import { MRunnerJob } from '@server/types/models/runners/index.js'+import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAudioStream, isAudioFile } from '@peertube/peertube-ffmpeg'+import { getTranscodingJobPriority } from '../../transcoding-priority.js'+import { computeResolutionsToTranscode } from '../../transcoding-resolutions.js'+import { AbstractJobBuilder } from './abstract-job-builder.js'/***diff --git a/server/lib/transcoding/transcoding-priority.ts b/server/server/lib/transcoding/transcoding-priority.tssimilarity index 74%rename from server/lib/transcoding/transcoding-priority.tsrename to server/server/lib/transcoding/transcoding-priority.tsindex 82ab6f2f12..42061d0f96 100644--- a/server/lib/transcoding/transcoding-priority.ts+++ b/server/server/lib/transcoding/transcoding-priority.ts@@ -1,6 +1,6 @@-import { JOB_PRIORITY } from '@server/initializers/constants'-import { VideoModel } from '@server/models/video/video'-import { MUserId } from '@server/types/models'+import { JOB_PRIORITY } from '@server/initializers/constants.js'+import { VideoModel } from '@server/models/video/video.js'+import { MUserId } from '@server/types/models/index.js'export async function getTranscodingJobPriority (options: {user: MUserIddiff --git a/server/lib/transcoding/transcoding-quick-transcode.ts b/server/server/lib/transcoding/transcoding-quick-transcode.tssimilarity index 81%rename from server/lib/transcoding/transcoding-quick-transcode.tsrename to server/server/lib/transcoding/transcoding-quick-transcode.tsindex 53f12cd06f..1d054ece38 100644--- a/server/lib/transcoding/transcoding-quick-transcode.ts+++ b/server/server/lib/transcoding/transcoding-quick-transcode.ts@@ -1,6 +1,6 @@import { FfprobeData } from 'fluent-ffmpeg'-import { CONFIG } from '@server/initializers/config'-import { canDoQuickAudioTranscode, canDoQuickVideoTranscode, ffprobePromise } from '@shared/ffmpeg'+import { CONFIG } from '@server/initializers/config.js'+import { canDoQuickAudioTranscode, canDoQuickVideoTranscode, ffprobePromise } from '@peertube/peertube-ffmpeg'export async function canDoQuickTranscode (path: string, existingProbe?: FfprobeData): Promise<boolean> {if (CONFIG.TRANSCODING.PROFILE !== 'default') return falsediff --git a/server/lib/transcoding/transcoding-resolutions.ts b/server/server/lib/transcoding/transcoding-resolutions.tssimilarity index 88%rename from server/lib/transcoding/transcoding-resolutions.tsrename to server/server/lib/transcoding/transcoding-resolutions.tsindex 9a6bf57229..b1c55edf93 100644--- a/server/lib/transcoding/transcoding-resolutions.ts+++ b/server/server/lib/transcoding/transcoding-resolutions.ts@@ -1,6 +1,6 @@-import { CONFIG } from '@server/initializers/config'-import { toEven } from '@shared/core-utils'-import { VideoResolution } from '@shared/models'+import { toEven } from '@peertube/peertube-core-utils'+import { VideoResolution, VideoResolutionType } from '@peertube/peertube-models'+import { CONFIG } from '@server/initializers/config.js'export function buildOriginalFileResolution (inputResolution: number) {if (CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION === true) {@@ -39,7 +39,7 @@ export function computeResolutionsToTranscode (options: {const resolutionsEnabled = new Set<number>()// Put in the order we want to proceed jobs- const availableResolutions: VideoResolution[] = [+ const availableResolutions: VideoResolutionType[] = [VideoResolution.H_NOVIDEO,VideoResolution.H_480P,VideoResolution.H_360P,diff --git a/server/lib/transcoding/web-transcoding.ts b/server/server/lib/transcoding/web-transcoding.tssimilarity index 90%rename from server/lib/transcoding/web-transcoding.tsrename to server/server/lib/transcoding/web-transcoding.tsindex f92d457a09..e8247e9587 100644--- a/server/lib/transcoding/web-transcoding.ts+++ b/server/server/lib/transcoding/web-transcoding.ts@@ -1,20 +1,21 @@import { Job } from 'bullmq'-import { copyFile, move, remove, stat } from 'fs-extra'+import { move, remove } from 'fs-extra/esm'+import { copyFile, stat } from 'fs/promises'import { basename, join } from 'path'-import { computeOutputFPS } from '@server/helpers/ffmpeg'-import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'-import { VideoModel } from '@server/models/video/video'-import { MVideoFile, MVideoFullLight } from '@server/types/models'-import { ffprobePromise, getVideoStreamDuration, getVideoStreamFPS, TranscodeVODOptionsType } from '@shared/ffmpeg'-import { VideoResolution, VideoStorage } from '@shared/models'-import { CONFIG } from '../../initializers/config'-import { VideoFileModel } from '../../models/video/video-file'-import { JobQueue } from '../job-queue'-import { generateWebVideoFilename } from '../paths'-import { buildFileMetadata } from '../video-file'-import { VideoPathManager } from '../video-path-manager'-import { buildFFmpegVOD } from './shared'-import { buildOriginalFileResolution } from './transcoding-resolutions'+import { VideoStorage } from '@peertube/peertube-models'+import { computeOutputFPS } from '@server/helpers/ffmpeg/index.js'+import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideoFile, MVideoFullLight } from '@server/types/models/index.js'+import { ffprobePromise, getVideoStreamDuration, getVideoStreamFPS, TranscodeVODOptionsType } from '@peertube/peertube-ffmpeg'+import { CONFIG } from '../../initializers/config.js'+import { VideoFileModel } from '../../models/video/video-file.js'+import { JobQueue } from '../job-queue/index.js'+import { generateWebVideoFilename } from '../paths.js'+import { buildFileMetadata } from '../video-file.js'+import { VideoPathManager } from '../video-path-manager.js'+import { buildFFmpegVOD } from './shared/index.js'+import { buildOriginalFileResolution } from './transcoding-resolutions.js'// Optimize the original video file and replace it. The resolution is not changed.export async function optimizeOriginalVideofile (options: {@@ -86,7 +87,7 @@ export async function optimizeOriginalVideofile (options: {// Transcode the original video file to a lower resolution compatible with web browsersexport async function transcodeNewWebVideoResolution (options: {video: MVideoFullLight- resolution: VideoResolution+ resolution: numberfps: numberjob: Job}) {@@ -138,7 +139,7 @@ export async function transcodeNewWebVideoResolution (options: {// Merge an image with an audio file to create a videoexport async function mergeAudioVideofile (options: {video: MVideoFullLight- resolution: VideoResolution+ resolution: numberfps: numberjob: Job}) {diff --git a/server/lib/uploadx.ts b/server/server/lib/uploadx.tssimilarity index 81%rename from server/lib/uploadx.tsrename to server/server/lib/uploadx.tsindex c7e0eb414e..81c93f77c5 100644--- a/server/lib/uploadx.ts+++ b/server/server/lib/uploadx.ts@@ -1,7 +1,7 @@import express from 'express'-import { buildLogger } from '@server/helpers/logger'-import { getResumableUploadPath } from '@server/helpers/upload'-import { CONFIG } from '@server/initializers/config'+import { buildLogger } from '@server/helpers/logger.js'+import { getResumableUploadPath } from '@server/helpers/upload.js'+import { CONFIG } from '@server/initializers/config.js'import { LogLevel, Uploadx } from '@uploadx/core'import { extname } from 'path'diff --git a/server/lib/user.ts b/server/server/lib/user.tssimilarity index 88%rename from server/lib/user.tsrename to server/server/lib/user.tsindex 56995cca33..d391f384bc 100644--- a/server/lib/user.ts+++ b/server/server/lib/user.ts@@ -1,24 +1,31 @@-import { Transaction } from 'sequelize/types'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { UserModel } from '@server/models/user/user'-import { MActorDefault } from '@server/types/models/actor'-import { ActivityPubActorType } from '../../shared/models/activitypub'-import { UserAdminFlag, UserNotificationSetting, UserNotificationSettingValue, UserRole } from '../../shared/models/users'-import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants'-import { sequelizeTypescript } from '../initializers/database'-import { AccountModel } from '../models/account/account'-import { UserNotificationSettingModel } from '../models/user/user-notification-setting'-import { MAccountDefault, MChannelActor } from '../types/models'-import { MRegistration, MUser, MUserDefault, MUserId } from '../types/models/user'-import { generateAndSaveActorKeys } from './activitypub/actors'-import { getLocalAccountActivityPubUrl } from './activitypub/url'-import { Emailer } from './emailer'-import { LiveQuotaStore } from './live/live-quota-store'-import { buildActorInstance, findAvailableLocalActorName } from './local-actor'-import { Redis } from './redis'-import { createLocalVideoChannel } from './video-channel'-import { createWatchLaterPlaylist } from './video-playlist'+import { Transaction } from 'sequelize'+import {+ ActivityPubActorType,+ UserAdminFlag,+ UserAdminFlagType,+ UserNotificationSetting,+ UserNotificationSettingValue,+ UserRole,+ UserRoleType+} from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { UserModel } from '@server/models/user/user.js'+import { MActorDefault } from '@server/types/models/actor/index.js'+import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants.js'+import { sequelizeTypescript } from '../initializers/database.js'+import { AccountModel } from '../models/account/account.js'+import { UserNotificationSettingModel } from '../models/user/user-notification-setting.js'+import { MAccountDefault, MChannelActor } from '../types/models/index.js'+import { MRegistration, MUser, MUserDefault, MUserId } from '../types/models/user/index.js'+import { generateAndSaveActorKeys } from './activitypub/actors/index.js'+import { getLocalAccountActivityPubUrl } from './activitypub/url.js'+import { Emailer } from './emailer.js'+import { LiveQuotaStore } from './live/live-quota-store.js'+import { buildActorInstance, findAvailableLocalActorName } from './local-actor.js'+import { Redis } from './redis.js'+import { createLocalVideoChannel } from './video-channel.js'+import { createWatchLaterPlaylist } from './video-playlist.js'type ChannelNames = { name: string, displayName: string }@@ -27,8 +34,8 @@ function buildUser (options: {password: stringemail: string- role?: UserRole // Default to UserRole.User- adminFlags?: UserAdminFlag // Default to UserAdminFlag.NONE+ role?: UserRoleType // Default to UserRole.User+ adminFlags?: UserAdminFlagType // Default to UserAdminFlag.NONEemailVerified: boolean | nulldiff --git a/server/lib/video-blacklist.ts b/server/server/lib/video-blacklist.tssimilarity index 87%rename from server/lib/video-blacklist.tsrename to server/server/lib/video-blacklist.tsindex d5664a1b94..3fd0a59edb 100644--- a/server/lib/video-blacklist.ts+++ b/server/server/lib/video-blacklist.ts@@ -1,6 +1,7 @@import { Transaction } from 'sequelize'-import { afterCommitIfTransaction } from '@server/helpers/database-utils'-import { sequelizeTypescript } from '@server/initializers/database'+import { LiveVideoError, UserAdminFlag, UserRight, VideoBlacklistCreate, VideoBlacklistType } from '@peertube/peertube-models'+import { afterCommitIfTransaction } from '@server/helpers/database-utils.js'+import { sequelizeTypescript } from '@server/initializers/database.js'import {MUser,MVideoAccountLight,@@ -8,17 +9,15 @@ import {MVideoBlacklistVideo,MVideoFullLight,MVideoWithBlacklistLight-} from '@server/types/models'-import { LiveVideoError, UserRight, VideoBlacklistCreate, VideoBlacklistType } from '../../shared/models'-import { UserAdminFlag } from '../../shared/models/users/user-flag.model'-import { logger, loggerTagsFactory } from '../helpers/logger'-import { CONFIG } from '../initializers/config'-import { VideoBlacklistModel } from '../models/video/video-blacklist'-import { sendDeleteVideo } from './activitypub/send'-import { federateVideoIfNeeded } from './activitypub/videos'-import { LiveManager } from './live/live-manager'-import { Notifier } from './notifier'-import { Hooks } from './plugins/hooks'+} from '@server/types/models/index.js'+import { logger, loggerTagsFactory } from '../helpers/logger.js'+import { CONFIG } from '../initializers/config.js'+import { VideoBlacklistModel } from '../models/video/video-blacklist.js'+import { sendDeleteVideo } from './activitypub/send/index.js'+import { federateVideoIfNeeded } from './activitypub/videos/index.js'+import { LiveManager } from './live/live-manager.js'+import { Notifier } from './notifier/index.js'+import { Hooks } from './plugins/hooks.js'const lTags = loggerTagsFactory('blacklist')diff --git a/server/lib/video-channel.ts b/server/server/lib/video-channel.tssimilarity index 82%rename from server/lib/video-channel.tsrename to server/server/lib/video-channel.tsindex 8322c9ad2a..ea24b5f1da 100644--- a/server/lib/video-channel.ts+++ b/server/server/lib/video-channel.ts@@ -1,11 +1,11 @@import * as Sequelize from 'sequelize'-import { VideoChannelCreate } from '../../shared/models'-import { VideoModel } from '../models/video/video'-import { VideoChannelModel } from '../models/video/video-channel'-import { MAccountId, MChannelId } from '../types/models'-import { getLocalVideoChannelActivityPubUrl } from './activitypub/url'-import { federateVideoIfNeeded } from './activitypub/videos'-import { buildActorInstance } from './local-actor'+import { VideoChannelCreate } from '@peertube/peertube-models'+import { VideoChannelModel } from '../models/video/video-channel.js'+import { VideoModel } from '../models/video/video.js'+import { MAccountId, MChannelId } from '../types/models/index.js'+import { getLocalVideoChannelActivityPubUrl } from './activitypub/url.js'+import { federateVideoIfNeeded } from './activitypub/videos/index.js'+import { buildActorInstance } from './local-actor.js'async function createLocalVideoChannel (videoChannelInfo: VideoChannelCreate, account: MAccountId, t: Sequelize.Transaction) {const url = getLocalVideoChannelActivityPubUrl(videoChannelInfo.name)diff --git a/server/lib/video-comment.ts b/server/server/lib/video-comment.tssimilarity index 90%rename from server/lib/video-comment.tsrename to server/server/lib/video-comment.tsindex 6eb865f7f9..f892156716 100644--- a/server/lib/video-comment.ts+++ b/server/server/lib/video-comment.ts@@ -1,11 +1,10 @@+import { ResultList, VideoCommentThreadTree } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { sequelizeTypescript } from '@server/initializers/database.js'import express from 'express'-import { cloneDeep } from 'lodash'+import cloneDeep from 'lodash-es/cloneDeep.js'import * as Sequelize from 'sequelize'-import { logger } from '@server/helpers/logger'-import { sequelizeTypescript } from '@server/initializers/database'-import { ResultList } from '../../shared/models'-import { VideoCommentThreadTree } from '../../shared/models/videos/comment/video-comment.model'-import { VideoCommentModel } from '../models/video/video-comment'+import { VideoCommentModel } from '../models/video/video-comment.js'import {MAccountDefault,MComment,@@ -13,10 +12,10 @@ import {MCommentOwnerVideo,MCommentOwnerVideoReply,MVideoFullLight-} from '../types/models'-import { sendCreateVideoComment, sendDeleteVideoComment } from './activitypub/send'-import { getLocalVideoCommentActivityPubUrl } from './activitypub/url'-import { Hooks } from './plugins/hooks'+} from '../types/models/index.js'+import { sendCreateVideoComment, sendDeleteVideoComment } from './activitypub/send/index.js'+import { getLocalVideoCommentActivityPubUrl } from './activitypub/url.js'+import { Hooks } from './plugins/hooks.js'async function removeComment (commentArg: MComment, req: express.Request, res: express.Response) {let videoCommentInstanceBefore: MCommentOwnerVideodiff --git a/server/lib/video-file.ts b/server/server/lib/video-file.tssimilarity index 87%rename from server/lib/video-file.tsrename to server/server/lib/video-file.tsindex 46af67ccd3..9d8a6e8fc4 100644--- a/server/lib/video-file.ts+++ b/server/server/lib/video-file.ts@@ -1,14 +1,13 @@import { FfprobeData } from 'fluent-ffmpeg'-import { logger } from '@server/helpers/logger'-import { VideoFileModel } from '@server/models/video/video-file'-import { MVideoWithAllFiles } from '@server/types/models'-import { getLowercaseExtension } from '@shared/core-utils'-import { getFileSize } from '@shared/extra-utils'-import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, isAudioFile } from '@shared/ffmpeg'-import { VideoFileMetadata, VideoResolution } from '@shared/models'-import { lTags } from './object-storage/shared'-import { generateHLSVideoFilename, generateWebVideoFilename } from './paths'-import { VideoPathManager } from './video-path-manager'+import { VideoFileMetadata, VideoResolution } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { MVideoWithAllFiles } from '@server/types/models/index.js'+import { getFileSize, getLowercaseExtension } from '@peertube/peertube-node-utils'+import { ffprobePromise, getVideoStreamDimensionsInfo, getVideoStreamFPS, isAudioFile } from '@peertube/peertube-ffmpeg'+import { lTags } from './object-storage/shared/index.js'+import { generateHLSVideoFilename, generateWebVideoFilename } from './paths.js'+import { VideoPathManager } from './video-path-manager.js'async function buildNewFile (options: {path: stringdiff --git a/server/lib/video-path-manager.ts b/server/server/lib/video-path-manager.tssimilarity index 88%rename from server/lib/video-path-manager.tsrename to server/server/lib/video-path-manager.tsindex 133544bb22..0a8604a58a 100644--- a/server/lib/video-path-manager.ts+++ b/server/server/lib/video-path-manager.ts@@ -1,16 +1,22 @@import { Mutex } from 'async-mutex'-import { remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'import { extname, join } from 'path'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { extractVideo } from '@server/helpers/video'-import { CONFIG } from '@server/initializers/config'-import { DIRECTORIES } from '@server/initializers/constants'-import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '@server/types/models'-import { buildUUID } from '@shared/extra-utils'-import { VideoStorage } from '@shared/models'-import { makeHLSFileAvailable, makeWebVideoFileAvailable } from './object-storage'-import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths'-import { isVideoInPrivateDirectory } from './video-privacy'+import { VideoStorage } from '@peertube/peertube-models'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { extractVideo } from '@server/helpers/video.js'+import { CONFIG } from '@server/initializers/config.js'+import { DIRECTORIES } from '@server/initializers/constants.js'+import {+ MStreamingPlaylistVideo,+ MVideo,+ MVideoFile,+ MVideoFileStreamingPlaylistVideo,+ MVideoFileVideo+} from '@server/types/models/index.js'+import { buildUUID } from '@peertube/peertube-node-utils'+import { makeHLSFileAvailable, makeWebVideoFileAvailable } from './object-storage/index.js'+import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths.js'+import { isVideoInPrivateDirectory } from './video-privacy.js'type MakeAvailableCB <T> = (path: string) => Promise<T> | Tdiff --git a/server/lib/video-playlist.ts b/server/server/lib/video-playlist.tssimilarity index 77%rename from server/lib/video-playlist.tsrename to server/server/lib/video-playlist.tsindex a1af2e1af6..5c97f9c9a6 100644--- a/server/lib/video-playlist.ts+++ b/server/server/lib/video-playlist.ts@@ -1,10 +1,9 @@import * as Sequelize from 'sequelize'-import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'-import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'-import { VideoPlaylistModel } from '../models/video/video-playlist'-import { MAccount } from '../types/models'-import { MVideoPlaylistOwner } from '../types/models/video/video-playlist'-import { getLocalVideoPlaylistActivityPubUrl } from './activitypub/url'+import { VideoPlaylistPrivacy, VideoPlaylistType } from '@peertube/peertube-models'+import { VideoPlaylistModel } from '../models/video/video-playlist.js'+import { MAccount } from '../types/models/index.js'+import { MVideoPlaylistOwner } from '../types/models/video/video-playlist.js'+import { getLocalVideoPlaylistActivityPubUrl } from './activitypub/url.js'async function createWatchLaterPlaylist (account: MAccount, t: Sequelize.Transaction) {const videoPlaylist: MVideoPlaylistOwner = new VideoPlaylistModel({diff --git a/server/lib/video-pre-import.ts b/server/server/lib/video-pre-import.tssimilarity index 91%rename from server/lib/video-pre-import.tsrename to server/server/lib/video-pre-import.tsindex fcb9f77d77..0298e121ea 100644--- a/server/lib/video-pre-import.ts+++ b/server/server/lib/video-pre-import.ts@@ -1,20 +1,30 @@-import { remove } from 'fs-extra'-import { moveAndProcessCaptionFile } from '@server/helpers/captions-utils'-import { isVTTFileValid } from '@server/helpers/custom-validators/video-captions'-import { isVideoFileExtnameValid } from '@server/helpers/custom-validators/videos'-import { isResolvingToUnicastOnly } from '@server/helpers/dns'-import { logger } from '@server/helpers/logger'-import { YoutubeDLInfo, YoutubeDLWrapper } from '@server/helpers/youtube-dl'-import { CONFIG } from '@server/initializers/config'-import { sequelizeTypescript } from '@server/initializers/database'-import { Hooks } from '@server/lib/plugins/hooks'-import { ServerConfigManager } from '@server/lib/server-config-manager'-import { setVideoTags } from '@server/lib/video'-import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist'-import { VideoModel } from '@server/models/video/video'-import { VideoCaptionModel } from '@server/models/video/video-caption'-import { VideoImportModel } from '@server/models/video/video-import'-import { FilteredModelAttributes } from '@server/types'+import { remove } from 'fs-extra/esm'+import {+ ThumbnailType,+ ThumbnailType_Type,+ VideoImportCreate,+ VideoImportPayload,+ VideoImportState,+ VideoPrivacy,+ VideoState+} from '@peertube/peertube-models'+import { moveAndProcessCaptionFile } from '@server/helpers/captions-utils.js'+import { isVTTFileValid } from '@server/helpers/custom-validators/video-captions.js'+import { isVideoFileExtnameValid } from '@server/helpers/custom-validators/videos.js'+import { isResolvingToUnicastOnly } from '@server/helpers/dns.js'+import { logger } from '@server/helpers/logger.js'+import { YoutubeDLInfo, YoutubeDLWrapper } from '@server/helpers/youtube-dl/index.js'+import { CONFIG } from '@server/initializers/config.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { ServerConfigManager } from '@server/lib/server-config-manager.js'+import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist.js'+import { setVideoTags } from '@server/lib/video.js'+import { VideoCaptionModel } from '@server/models/video/video-caption.js'+import { VideoImportModel } from '@server/models/video/video-import.js'+import { VideoPasswordModel } from '@server/models/video/video-password.js'+import { VideoModel } from '@server/models/video/video.js'+import { FilteredModelAttributes } from '@server/types/index.js'import {MChannelAccountDefault,MChannelSync,@@ -26,11 +36,9 @@ import {MVideoTag,MVideoThumbnail,MVideoWithBlacklistLight-} from '@server/types/models'-import { ThumbnailType, VideoImportCreate, VideoImportPayload, VideoImportState, VideoPrivacy, VideoState } from '@shared/models'-import { getLocalVideoActivityPubUrl } from './activitypub/url'-import { updateLocalVideoMiniatureFromExisting, updateLocalVideoMiniatureFromUrl } from './thumbnail'-import { VideoPasswordModel } from '@server/models/video/video-password'+} from '@server/types/models/index.js'+import { getLocalVideoActivityPubUrl } from './activitypub/url.js'+import { updateLocalVideoMiniatureFromExisting, updateLocalVideoMiniatureFromUrl } from './thumbnail.js'class YoutubeDlImportError extends Error {code: YoutubeDlImportError.CODE@@ -254,7 +262,7 @@ async function forgeThumbnail ({ inputPath, video, downloadUrl, type }: {inputPath?: stringdownloadUrl?: stringvideo: MVideoThumbnail- type: ThumbnailType+ type: ThumbnailType_Type}): Promise<MThumbnail> {if (inputPath) {return updateLocalVideoMiniatureFromExisting({diff --git a/server/lib/video-privacy.ts b/server/server/lib/video-privacy.tssimilarity index 90%rename from server/lib/video-privacy.tsrename to server/server/lib/video-privacy.tsindex 5dd4d9781e..df8ac974ba 100644--- a/server/lib/video-privacy.ts+++ b/server/server/lib/video-privacy.ts@@ -1,10 +1,10 @@-import { move } from 'fs-extra'+import { move } from 'fs-extra/esm'import { join } from 'path'-import { logger } from '@server/helpers/logger'-import { DIRECTORIES } from '@server/initializers/constants'-import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'-import { VideoPrivacy, VideoStorage } from '@shared/models'-import { updateHLSFilesACL, updateWebVideoFileACL } from './object-storage'+import { VideoPrivacy, VideoPrivacyType, VideoStorage } from '@peertube/peertube-models'+import { logger } from '@server/helpers/logger.js'+import { DIRECTORIES } from '@server/initializers/constants.js'+import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models/index.js'+import { updateHLSFilesACL, updateWebVideoFileACL } from './object-storage/index.js'const validPrivacySet = new Set([VideoPrivacy.PRIVATE,@@ -12,7 +12,7 @@ const validPrivacySet = new Set([VideoPrivacy.PASSWORD_PROTECTED])-function setVideoPrivacy (video: MVideo, newPrivacy: VideoPrivacy) {+function setVideoPrivacy (video: MVideo, newPrivacy: VideoPrivacyType) {if (video.privacy === VideoPrivacy.PRIVATE && newPrivacy !== VideoPrivacy.PRIVATE) {video.publishedAt = new Date()}@@ -24,11 +24,11 @@ function isVideoInPrivateDirectory (privacy) {return validPrivacySet.has(privacy)}-function isVideoInPublicDirectory (privacy: VideoPrivacy) {+function isVideoInPublicDirectory (privacy: VideoPrivacyType) {return !isVideoInPrivateDirectory(privacy)}-async function moveFilesIfPrivacyChanged (video: MVideoFullLight, oldPrivacy: VideoPrivacy) {+async function moveFilesIfPrivacyChanged (video: MVideoFullLight, oldPrivacy: VideoPrivacyType) {// Now public, previously privateif (isVideoInPublicDirectory(video.privacy) && isVideoInPrivateDirectory(oldPrivacy)) {await moveFiles({ type: 'private-to-public', video })diff --git a/server/lib/video-state.ts b/server/server/lib/video-state.tssimilarity index 87%rename from server/lib/video-state.tsrename to server/server/lib/video-state.tsindex 893725d850..3b17877afc 100644--- a/server/lib/video-state.ts+++ b/server/server/lib/video-state.ts@@ -1,18 +1,18 @@import { Transaction } from 'sequelize'-import { retryTransactionWrapper } from '@server/helpers/database-utils'-import { logger } from '@server/helpers/logger'-import { CONFIG } from '@server/initializers/config'-import { sequelizeTypescript } from '@server/initializers/database'-import { VideoModel } from '@server/models/video/video'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { MVideo, MVideoFullLight, MVideoUUID } from '@server/types/models'-import { VideoState } from '@shared/models'-import { federateVideoIfNeeded } from './activitypub/videos'-import { JobQueue } from './job-queue'-import { Notifier } from './notifier'-import { buildMoveToObjectStorageJob } from './video'--function buildNextVideoState (currentState?: VideoState) {+import { VideoState, VideoStateType } from '@peertube/peertube-models'+import { retryTransactionWrapper } from '@server/helpers/database-utils.js'+import { logger } from '@server/helpers/logger.js'+import { CONFIG } from '@server/initializers/config.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideo, MVideoFullLight, MVideoUUID } from '@server/types/models/index.js'+import { federateVideoIfNeeded } from './activitypub/videos/index.js'+import { JobQueue } from './job-queue/index.js'+import { Notifier } from './notifier/index.js'+import { buildMoveToObjectStorageJob } from './video.js'++function buildNextVideoState (currentState?: VideoStateType) {if (currentState === VideoState.PUBLISHED) {throw new Error('Video is already in its final state')}@@ -38,7 +38,7 @@ function buildNextVideoState (currentState?: VideoState) {function moveToNextState (options: {video: MVideoUUID- previousVideoState?: VideoState+ previousVideoState?: VideoStateTypeisNewVideo?: boolean // Default true}) {const { video, previousVideoState, isNewVideo = true } = options@@ -128,7 +128,7 @@ async function moveToPublishedState (options: {video: MVideoFullLightisNewVideo: booleantransaction: Transaction- previousVideoState?: VideoState+ previousVideoState?: VideoStateType}) {const { video, isNewVideo, transaction, previousVideoState } = optionsconst previousState = previousVideoState ?? video.statediff --git a/server/lib/video-studio.ts b/server/server/lib/video-studio.tssimilarity index 86%rename from server/lib/video-studio.tsrename to server/server/lib/video-studio.tsindex f549a70843..79b07cf4ad 100644--- a/server/lib/video-studio.ts+++ b/server/server/lib/video-studio.ts@@ -1,19 +1,19 @@-import { move, remove } from 'fs-extra'+import { move, remove } from 'fs-extra/esm'import { join } from 'path'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { createTorrentAndSetInfoHashFromPath } from '@server/helpers/webtorrent'-import { CONFIG } from '@server/initializers/config'-import { UserModel } from '@server/models/user/user'-import { MUser, MVideo, MVideoFile, MVideoFullLight, MVideoWithAllFiles } from '@server/types/models'-import { getVideoStreamDuration } from '@shared/ffmpeg'-import { VideoStudioEditionPayload, VideoStudioTask, VideoStudioTaskPayload } from '@shared/models'-import { federateVideoIfNeeded } from './activitypub/videos'-import { JobQueue } from './job-queue'-import { VideoStudioTranscodingJobHandler } from './runners'-import { createOptimizeOrMergeAudioJobs } from './transcoding/create-transcoding-job'-import { getTranscodingJobPriority } from './transcoding/transcoding-priority'-import { buildNewFile, removeHLSPlaylist, removeWebVideoFile } from './video-file'-import { VideoPathManager } from './video-path-manager'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { createTorrentAndSetInfoHashFromPath } from '@server/helpers/webtorrent.js'+import { CONFIG } from '@server/initializers/config.js'+import { UserModel } from '@server/models/user/user.js'+import { MUser, MVideo, MVideoFile, MVideoFullLight, MVideoWithAllFiles } from '@server/types/models/index.js'+import { getVideoStreamDuration } from '@peertube/peertube-ffmpeg'+import { VideoStudioEditionPayload, VideoStudioTask, VideoStudioTaskPayload } from '@peertube/peertube-models'+import { federateVideoIfNeeded } from './activitypub/videos/index.js'+import { JobQueue } from './job-queue/index.js'+import { VideoStudioTranscodingJobHandler } from './runners/index.js'+import { createOptimizeOrMergeAudioJobs } from './transcoding/create-transcoding-job.js'+import { getTranscodingJobPriority } from './transcoding/transcoding-priority.js'+import { buildNewFile, removeHLSPlaylist, removeWebVideoFile } from './video-file.js'+import { VideoPathManager } from './video-path-manager.js'const lTags = loggerTagsFactory('video-studio')diff --git a/server/lib/video-tokens-manager.ts b/server/server/lib/video-tokens-manager.tssimilarity index 88%rename from server/lib/video-tokens-manager.tsrename to server/server/lib/video-tokens-manager.tsindex e28e55cf77..57128721a8 100644--- a/server/lib/video-tokens-manager.ts+++ b/server/server/lib/video-tokens-manager.ts@@ -1,8 +1,8 @@import { LRUCache } from 'lru-cache'-import { LRU_CACHE } from '@server/initializers/constants'-import { MUserAccountUrl } from '@server/types/models'-import { pick } from '@shared/core-utils'-import { buildUUID } from '@shared/extra-utils'+import { LRU_CACHE } from '@server/initializers/constants.js'+import { MUserAccountUrl } from '@server/types/models/index.js'+import { pick } from '@peertube/peertube-core-utils'+import { buildUUID } from '@peertube/peertube-node-utils'// ---------------------------------------------------------------------------// Create temporary tokens that can be used as URL query parameters to access video static filesdiff --git a/server/lib/video-urls.ts b/server/server/lib/video-urls.tssimilarity index 95%rename from server/lib/video-urls.tsrename to server/server/lib/video-urls.tsindex 0597488ad4..bf399847ed 100644--- a/server/lib/video-urls.ts+++ b/server/server/lib/video-urls.ts@@ -1,6 +1,6 @@-import { STATIC_PATHS, WEBSERVER } from '@server/initializers/constants'-import { MStreamingPlaylist, MVideo, MVideoFile, MVideoUUID } from '@server/types/models'+import { STATIC_PATHS, WEBSERVER } from '@server/initializers/constants.js'+import { MStreamingPlaylist, MVideo, MVideoFile, MVideoUUID } from '@server/types/models/index.js'// ################## Redundancy ##################diff --git a/server/lib/video.ts b/server/server/lib/video.tssimilarity index 84%rename from server/lib/video.tsrename to server/server/lib/video.tsindex 362c861a5c..46346c3edb 100644--- a/server/lib/video.ts+++ b/server/server/lib/video.ts@@ -1,17 +1,25 @@import { UploadFiles } from 'express'import memoizee from 'memoizee'-import { Transaction } from 'sequelize/types'-import { CONFIG } from '@server/initializers/config'-import { MEMOIZE_LENGTH, MEMOIZE_TTL } from '@server/initializers/constants'-import { TagModel } from '@server/models/video/tag'-import { VideoModel } from '@server/models/video/video'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { FilteredModelAttributes } from '@server/types'-import { MThumbnail, MVideoFullLight, MVideoTag, MVideoThumbnail, MVideoUUID } from '@server/types/models'-import { ManageVideoTorrentPayload, ThumbnailType, VideoCreate, VideoPrivacy, VideoState } from '@shared/models'-import { CreateJobArgument, JobQueue } from './job-queue/job-queue'-import { updateLocalVideoMiniatureFromExisting } from './thumbnail'-import { moveFilesIfPrivacyChanged } from './video-privacy'+import { Transaction } from 'sequelize'+import {+ ManageVideoTorrentPayload,+ ThumbnailType,+ ThumbnailType_Type,+ VideoCreate,+ VideoPrivacy,+ VideoPrivacyType,+ VideoStateType+} from '@peertube/peertube-models'+import { CONFIG } from '@server/initializers/config.js'+import { MEMOIZE_LENGTH, MEMOIZE_TTL } from '@server/initializers/constants.js'+import { TagModel } from '@server/models/video/tag.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { VideoModel } from '@server/models/video/video.js'+import { FilteredModelAttributes } from '@server/types/index.js'+import { MThumbnail, MVideoFullLight, MVideoTag, MVideoThumbnail, MVideoUUID } from '@server/types/models/index.js'+import { CreateJobArgument, JobQueue } from './job-queue/job-queue.js'+import { updateLocalVideoMiniatureFromExisting } from './thumbnail.js'+import { moveFilesIfPrivacyChanged } from './video-privacy.js'function buildLocalVideoFromReq (videoInfo: VideoCreate, channelId: number): FilteredModelAttributes<VideoModel> {return {@@ -37,7 +45,7 @@ function buildLocalVideoFromReq (videoInfo: VideoCreate, channelId: number): Filasync function buildVideoThumbnailsFromReq (options: {video: MVideoThumbnailfiles: UploadFiles- fallback: (type: ThumbnailType) => Promise<MThumbnail>+ fallback: (type: ThumbnailType_Type) => Promise<MThumbnail>automaticallyGenerated?: boolean}) {const { video, files, fallback, automaticallyGenerated } = options@@ -89,7 +97,7 @@ async function setVideoTags (options: {async function buildMoveToObjectStorageJob (options: {video: MVideoUUID- previousVideoState: VideoState+ previousVideoState: VideoStateTypeisNewVideo?: boolean // Default true}) {const { video, previousVideoState, isNewVideo = true } = options@@ -131,7 +139,7 @@ async function addVideoJobsAfterUpdate (options: {isNewVideo: booleannameChanged: boolean- oldPrivacy: VideoPrivacy+ oldPrivacy: VideoPrivacyType}) {const { video, nameChanged, oldPrivacy, isNewVideo } = optionsconst jobs: CreateJobArgument[] = []@@ -162,7 +170,11 @@ async function addVideoJobsAfterUpdate (options: {}})- const wasConfidentialVideo = new Set([ VideoPrivacy.PRIVATE, VideoPrivacy.UNLISTED, VideoPrivacy.INTERNAL ]).has(oldPrivacy)+ const wasConfidentialVideo = new Set<VideoPrivacyType>([+ VideoPrivacy.PRIVATE,+ VideoPrivacy.UNLISTED,+ VideoPrivacy.INTERNAL+ ]).has(oldPrivacy)if (wasConfidentialVideo) {jobs.push({diff --git a/server/server/lib/views/shared/index.ts b/server/server/lib/views/shared/index.tsnew file mode 100644index 0000000000..e311fb22fc--- /dev/null+++ b/server/server/lib/views/shared/index.ts@@ -0,0 +1,3 @@+export * from './video-viewer-counters.js'+export * from './video-viewer-stats.js'+export * from './video-views.js'diff --git a/server/lib/views/shared/video-viewer-counters.ts b/server/server/lib/views/shared/video-viewer-counters.tssimilarity index 93%rename from server/lib/views/shared/video-viewer-counters.tsrename to server/server/lib/views/shared/video-viewer-counters.tsindex f5b83130e6..605e456451 100644--- a/server/lib/views/shared/video-viewer-counters.ts+++ b/server/server/lib/views/shared/video-viewer-counters.ts@@ -1,12 +1,11 @@-import { isTestOrDevInstance } from '@server/helpers/core-utils'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { VIEW_LIFETIME } from '@server/initializers/constants'-import { sendView } from '@server/lib/activitypub/send/send-view'-import { PeerTubeSocket } from '@server/lib/peertube-socket'-import { getServerActor } from '@server/models/application/application'-import { VideoModel } from '@server/models/video/video'-import { MVideo, MVideoImmutable } from '@server/types/models'-import { buildUUID, sha256 } from '@shared/extra-utils'+import { buildUUID, isTestOrDevInstance, sha256 } from '@peertube/peertube-node-utils'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { VIEW_LIFETIME } from '@server/initializers/constants.js'+import { sendView } from '@server/lib/activitypub/send/send-view.js'+import { PeerTubeSocket } from '@server/lib/peertube-socket.js'+import { getServerActor } from '@server/models/application/application.js'+import { VideoModel } from '@server/models/video/video.js'+import { MVideo, MVideoImmutable } from '@server/types/models/index.js'const lTags = loggerTagsFactory('views')diff --git a/server/lib/views/shared/video-viewer-stats.ts b/server/server/lib/views/shared/video-viewer-stats.tssimilarity index 91%rename from server/lib/views/shared/video-viewer-stats.tsrename to server/server/lib/views/shared/video-viewer-stats.tsindex ebd963e598..35ef5a7ea9 100644--- a/server/lib/views/shared/video-viewer-stats.ts+++ b/server/server/lib/views/shared/video-viewer-stats.ts@@ -1,17 +1,17 @@-import { Transaction } from 'sequelize/types'-import { isTestOrDevInstance } from '@server/helpers/core-utils'-import { GeoIP } from '@server/helpers/geo-ip'-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { MAX_LOCAL_VIEWER_WATCH_SECTIONS, VIEW_LIFETIME } from '@server/initializers/constants'-import { sequelizeTypescript } from '@server/initializers/database'-import { sendCreateWatchAction } from '@server/lib/activitypub/send'-import { getLocalVideoViewerActivityPubUrl } from '@server/lib/activitypub/url'-import { Redis } from '@server/lib/redis'-import { VideoModel } from '@server/models/video/video'-import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'-import { LocalVideoViewerWatchSectionModel } from '@server/models/view/local-video-viewer-watch-section'-import { MVideo, MVideoImmutable } from '@server/types/models'-import { VideoViewEvent } from '@shared/models'+import { Transaction } from 'sequelize'+import { VideoViewEvent } from '@peertube/peertube-models'+import { isTestOrDevInstance } from '@peertube/peertube-node-utils'+import { GeoIP } from '@server/helpers/geo-ip.js'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { MAX_LOCAL_VIEWER_WATCH_SECTIONS, VIEW_LIFETIME } from '@server/initializers/constants.js'+import { sequelizeTypescript } from '@server/initializers/database.js'+import { sendCreateWatchAction } from '@server/lib/activitypub/send/index.js'+import { getLocalVideoViewerActivityPubUrl } from '@server/lib/activitypub/url.js'+import { Redis } from '@server/lib/redis.js'+import { VideoModel } from '@server/models/video/video.js'+import { LocalVideoViewerWatchSectionModel } from '@server/models/view/local-video-viewer-watch-section.js'+import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer.js'+import { MVideo, MVideoImmutable } from '@server/types/models/index.js'const lTags = loggerTagsFactory('views')diff --git a/server/lib/views/shared/video-views.ts b/server/server/lib/views/shared/video-views.tssimilarity index 87%rename from server/lib/views/shared/video-views.tsrename to server/server/lib/views/shared/video-views.tsindex e563287e18..ee56e30bc1 100644--- a/server/lib/views/shared/video-views.ts+++ b/server/server/lib/views/shared/video-views.ts@@ -1,10 +1,10 @@-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { sendView } from '@server/lib/activitypub/send/send-view'-import { getCachedVideoDuration } from '@server/lib/video'-import { getServerActor } from '@server/models/application/application'-import { MVideo, MVideoImmutable } from '@server/types/models'-import { buildUUID } from '@shared/extra-utils'-import { Redis } from '../../redis'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { sendView } from '@server/lib/activitypub/send/send-view.js'+import { getCachedVideoDuration } from '@server/lib/video.js'+import { getServerActor } from '@server/models/application/application.js'+import { MVideo, MVideoImmutable } from '@server/types/models/index.js'+import { buildUUID } from '@peertube/peertube-node-utils'+import { Redis } from '../../redis.js'const lTags = loggerTagsFactory('views')diff --git a/server/lib/views/video-views-manager.ts b/server/server/lib/views/video-views-manager.tssimilarity index 94%rename from server/lib/views/video-views-manager.tsrename to server/server/lib/views/video-views-manager.tsindex c088dad5e9..9fc76d55e9 100644--- a/server/lib/views/video-views-manager.ts+++ b/server/server/lib/views/video-views-manager.ts@@ -1,7 +1,7 @@-import { logger, loggerTagsFactory } from '@server/helpers/logger'-import { MVideo, MVideoImmutable } from '@server/types/models'-import { VideoViewEvent } from '@shared/models'-import { VideoScope, VideoViewerCounters, VideoViewerStats, VideoViews, ViewerScope } from './shared'+import { logger, loggerTagsFactory } from '@server/helpers/logger.js'+import { MVideo, MVideoImmutable } from '@server/types/models/index.js'+import { VideoViewEvent } from '@peertube/peertube-models'+import { VideoScope, VideoViewerCounters, VideoViewerStats, VideoViews, ViewerScope } from './shared/index.js'/*** If processing a local view:diff --git a/server/lib/worker/parent-process.ts b/server/server/lib/worker/parent-process.tssimilarity index 82%rename from server/lib/worker/parent-process.tsrename to server/server/lib/worker/parent-process.tsindex 48b6c682be..2b56b4526a 100644--- a/server/lib/worker/parent-process.ts+++ b/server/server/lib/worker/parent-process.ts@@ -1,16 +1,16 @@import { join } from 'path'import Piscina from 'piscina'-import { processImage } from '@server/helpers/image-utils'-import { JOB_CONCURRENCY, WORKER_THREADS } from '@server/initializers/constants'-import { httpBroadcast } from './workers/http-broadcast'-import { downloadImage } from './workers/image-downloader'+import { JOB_CONCURRENCY, WORKER_THREADS } from '@server/initializers/constants.js'+import httpBroadcast from './workers/http-broadcast.js'+import downloadImage from './workers/image-downloader.js'+import processImage from './workers/image-processor.js'let downloadImageWorker: Piscinafunction downloadImageFromWorker (options: Parameters<typeof downloadImage>[0]): Promise<ReturnType<typeof downloadImage>> {if (!downloadImageWorker) {downloadImageWorker = new Piscina({- filename: join(__dirname, 'workers', 'image-downloader.js'),+ filename: new URL(join('workers', 'image-downloader.js'), import.meta.url).href,concurrentTasksPerWorker: WORKER_THREADS.DOWNLOAD_IMAGE.CONCURRENCY,maxThreads: WORKER_THREADS.DOWNLOAD_IMAGE.MAX_THREADS})@@ -26,7 +26,7 @@ let processImageWorker: Piscinafunction processImageFromWorker (options: Parameters<typeof processImage>[0]): Promise<ReturnType<typeof processImage>> {if (!processImageWorker) {processImageWorker = new Piscina({- filename: join(__dirname, 'workers', 'image-processor.js'),+ filename: new URL(join('workers', 'image-processor.js'), import.meta.url).href,concurrentTasksPerWorker: WORKER_THREADS.PROCESS_IMAGE.CONCURRENCY,maxThreads: WORKER_THREADS.PROCESS_IMAGE.MAX_THREADS})@@ -42,7 +42,7 @@ let parallelHTTPBroadcastWorker: Piscinafunction parallelHTTPBroadcastFromWorker (options: Parameters<typeof httpBroadcast>[0]): Promise<ReturnType<typeof httpBroadcast>> {if (!parallelHTTPBroadcastWorker) {parallelHTTPBroadcastWorker = new Piscina({- filename: join(__dirname, 'workers', 'http-broadcast.js'),+ filename: new URL(join('workers', 'http-broadcast.js'), import.meta.url).href,// Keep it sync with job concurrency so the worker will accept all the requests sent by the parallelized jobsconcurrentTasksPerWorker: JOB_CONCURRENCY['activitypub-http-broadcast-parallel'],maxThreads: 1@@ -59,7 +59,7 @@ let sequentialHTTPBroadcastWorker: Piscinafunction sequentialHTTPBroadcastFromWorker (options: Parameters<typeof httpBroadcast>[0]): Promise<ReturnType<typeof httpBroadcast>> {if (!sequentialHTTPBroadcastWorker) {sequentialHTTPBroadcastWorker = new Piscina({- filename: join(__dirname, 'workers', 'http-broadcast.js'),+ filename: new URL(join('workers', 'http-broadcast.js'), import.meta.url).href,// Keep it sync with job concurrency so the worker will accept all the requests sent by the parallelized jobsconcurrentTasksPerWorker: JOB_CONCURRENCY['activitypub-http-broadcast'],maxThreads: 1diff --git a/server/lib/worker/workers/http-broadcast.ts b/server/server/lib/worker/workers/http-broadcast.tssimilarity index 76%rename from server/lib/worker/workers/http-broadcast.tsrename to server/server/lib/worker/workers/http-broadcast.tsindex 8c9c6b8cab..29895a00ae 100644--- a/server/lib/worker/workers/http-broadcast.ts+++ b/server/server/lib/worker/workers/http-broadcast.ts@@ -1,7 +1,7 @@-import { map } from 'bluebird'-import { logger } from '@server/helpers/logger'-import { doRequest, PeerTubeRequestOptions } from '@server/helpers/requests'-import { BROADCAST_CONCURRENCY } from '@server/initializers/constants'+import Bluebird from 'bluebird'+import { logger } from '@server/helpers/logger.js'+import { doRequest, PeerTubeRequestOptions } from '@server/helpers/requests.js'+import { BROADCAST_CONCURRENCY } from '@server/initializers/constants.js'async function httpBroadcast (payload: {uris: string[]@@ -12,7 +12,7 @@ async function httpBroadcast (payload: {const badUrls: string[] = []const goodUrls: string[] = []- await map(uris, async uri => {+ await Bluebird.map(uris, async uri => {try {await doRequest(uri, requestOptions)goodUrls.push(uri)@@ -25,8 +25,4 @@ async function httpBroadcast (payload: {return { goodUrls, badUrls }}-module.exports = httpBroadcast--export {- httpBroadcast-}+export default httpBroadcastdiff --git a/server/lib/worker/workers/image-downloader.ts b/server/server/lib/worker/workers/image-downloader.tssimilarity index 74%rename from server/lib/worker/workers/image-downloader.tsrename to server/server/lib/worker/workers/image-downloader.tsindex 2095945891..c75acf0cda 100644--- a/server/lib/worker/workers/image-downloader.ts+++ b/server/server/lib/worker/workers/image-downloader.ts@@ -1,8 +1,8 @@-import { remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'import { join } from 'path'-import { processImage } from '@server/helpers/image-utils'-import { doRequestAndSaveToFile } from '@server/helpers/requests'-import { CONFIG } from '@server/initializers/config'+import { processImage } from '@server/helpers/image-utils.js'+import { doRequestAndSaveToFile } from '@server/helpers/requests.js'+import { CONFIG } from '@server/initializers/config.js'async function downloadImage (options: {url: string@@ -28,8 +28,4 @@ async function downloadImage (options: {return destPath}-module.exports = downloadImage--export {- downloadImage-}+export default downloadImagediff --git a/server/server/lib/worker/workers/image-processor.ts b/server/server/lib/worker/workers/image-processor.tsnew file mode 100644index 0000000000..6aa8dcc295--- /dev/null+++ b/server/server/lib/worker/workers/image-processor.ts@@ -0,0 +1,3 @@+import { processImage } from '@server/helpers/image-utils.js'++export default processImagediff --git a/server/middlewares/activitypub.ts b/server/server/middlewares/activitypub.tssimilarity index 93%rename from server/middlewares/activitypub.tsrename to server/server/middlewares/activitypub.tsindex 261b9f6909..0d333061e3 100644--- a/server/middlewares/activitypub.ts+++ b/server/server/middlewares/activitypub.ts@@ -1,12 +1,12 @@import { NextFunction, Request, Response } from 'express'-import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor'-import { getAPId } from '@server/lib/activitypub/activity'-import { wrapWithSpanAndContext } from '@server/lib/opentelemetry/tracing'-import { ActivityDelete, ActivityPubSignature, HttpStatusCode } from '@shared/models'-import { logger } from '../helpers/logger'-import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto'-import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants'-import { getOrCreateAPActor, loadActorUrlOrGetFromWebfinger } from '../lib/activitypub/actors'+import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor.js'+import { getAPId } from '@server/lib/activitypub/activity.js'+import { wrapWithSpanAndContext } from '@server/lib/opentelemetry/tracing.js'+import { ActivityDelete, ActivityPubSignature, HttpStatusCode } from '@peertube/peertube-models'+import { logger } from '../helpers/logger.js'+import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto.js'+import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants.js'+import { getOrCreateAPActor, loadActorUrlOrGetFromWebfinger } from '../lib/activitypub/actors/index.js'async function checkSignature (req: Request, res: Response, next: NextFunction) {try {diff --git a/server/middlewares/async.ts b/server/server/middlewares/async.tssimilarity index 98%rename from server/middlewares/async.tsrename to server/server/middlewares/async.tsindex 7e131257d5..b6997e31be 100644--- a/server/middlewares/async.ts+++ b/server/server/middlewares/async.ts@@ -1,8 +1,8 @@import Bluebird from 'bluebird'import { NextFunction, Request, RequestHandler, Response } from 'express'import { ValidationChain } from 'express-validator'-import { ExpressPromiseHandler } from '@server/types/express-handler'-import { retryTransactionWrapper } from '../helpers/database-utils'+import { ExpressPromiseHandler } from '@server/types/express-handler.js'+import { retryTransactionWrapper } from '../helpers/database-utils.js'// Syntactic sugar to avoid try/catch in express controllers/middlewaresdiff --git a/server/middlewares/auth.ts b/server/server/middlewares/auth.tssimilarity index 88%rename from server/middlewares/auth.tsrename to server/server/middlewares/auth.tsindex 39a7b29982..6eddd80bde 100644--- a/server/middlewares/auth.ts+++ b/server/server/middlewares/auth.ts@@ -1,11 +1,10 @@import express from 'express'import { Socket } from 'socket.io'-import { getAccessToken } from '@server/lib/auth/oauth-model'-import { RunnerModel } from '@server/models/runner/runner'-import { HttpStatusCode } from '../../shared/models/http/http-error-codes'-import { logger } from '../helpers/logger'-import { handleOAuthAuthenticate } from '../lib/auth/oauth'-import { ServerErrorCode } from '@shared/models'+import { HttpStatusCode, HttpStatusCodeType, ServerErrorCodeType } from '@peertube/peertube-models'+import { getAccessToken } from '@server/lib/auth/oauth-model.js'+import { RunnerModel } from '@server/models/runner/runner.js'+import { logger } from '../helpers/logger.js'+import { handleOAuthAuthenticate } from '../lib/auth/oauth.js'function authenticate (req: express.Request, res: express.Response, next: express.NextFunction) {handleOAuthAuthenticate(req, res)@@ -53,8 +52,8 @@ function authenticatePromise (options: {req: express.Requestres: express.ResponseerrorMessage?: string- errorStatus?: HttpStatusCode- errorType?: ServerErrorCode+ errorStatus?: HttpStatusCodeType+ errorType?: ServerErrorCodeType}) {const { req, res, errorMessage = 'Not authenticated', errorStatus = HttpStatusCode.UNAUTHORIZED_401, errorType } = optionsreturn new Promise<void>(resolve => {diff --git a/server/middlewares/cache/cache.ts b/server/server/middlewares/cache/cache.tssimilarity index 86%rename from server/middlewares/cache/cache.tsrename to server/server/middlewares/cache/cache.tsindex 6041c76c3c..6cf37e3224 100644--- a/server/middlewares/cache/cache.ts+++ b/server/server/middlewares/cache/cache.ts@@ -1,5 +1,5 @@-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { ApiCache, APICacheOptions } from './shared'+import { HttpStatusCode } from '@peertube/peertube-models'+import { ApiCache, APICacheOptions } from './shared/index.js'const defaultOptions: APICacheOptions = {excludeStatus: [diff --git a/server/server/middlewares/cache/index.ts b/server/server/middlewares/cache/index.tsnew file mode 100644index 0000000000..96c489a165--- /dev/null+++ b/server/server/middlewares/cache/index.ts@@ -0,0 +1 @@+export * from './cache.js'diff --git a/server/middlewares/cache/shared/api-cache.ts b/server/server/middlewares/cache/shared/api-cache.tssimilarity index 94%rename from server/middlewares/cache/shared/api-cache.tsrename to server/server/middlewares/cache/shared/api-cache.tsindex b50b7dce41..514fc2f992 100644--- a/server/middlewares/cache/shared/api-cache.ts+++ b/server/server/middlewares/cache/shared/api-cache.ts@@ -3,15 +3,16 @@import express from 'express'import { OutgoingHttpHeaders } from 'http'-import { isTestInstance, parseDurationToMs } from '@server/helpers/core-utils'-import { logger } from '@server/helpers/logger'-import { Redis } from '@server/lib/redis'-import { asyncMiddleware } from '@server/middlewares'-import { HttpStatusCode } from '@shared/models'+import { HttpStatusCodeType } from '@peertube/peertube-models'+import { isTestInstance } from '@peertube/peertube-node-utils'+import { parseDurationToMs } from '@server/helpers/core-utils.js'+import { logger } from '@server/helpers/logger.js'+import { Redis } from '@server/lib/redis.js'+import { asyncMiddleware } from '@server/middlewares/index.js'export interface APICacheOptions {headerBlacklist?: string[]- excludeStatus?: HttpStatusCode[]+ excludeStatus?: HttpStatusCodeType[]}interface CacheObject {@@ -97,7 +98,7 @@ export class ApiCache {private shouldCacheResponse (response: express.Response) {if (!response) return false- if (this.options.excludeStatus.includes(response.statusCode)) return false+ if (this.options.excludeStatus.includes(response.statusCode as HttpStatusCodeType)) return falsereturn true}diff --git a/server/server/middlewares/cache/shared/index.ts b/server/server/middlewares/cache/shared/index.tsnew file mode 100644index 0000000000..0e0c44f937--- /dev/null+++ b/server/server/middlewares/cache/shared/index.ts@@ -0,0 +1 @@+export * from './api-cache.js'diff --git a/server/middlewares/csp.ts b/server/server/middlewares/csp.tssimilarity index 96%rename from server/middlewares/csp.tsrename to server/server/middlewares/csp.tsindex e2a75a17eb..cc218c6705 100644--- a/server/middlewares/csp.ts+++ b/server/server/middlewares/csp.ts@@ -1,5 +1,5 @@import { contentSecurityPolicy } from 'helmet'-import { CONFIG } from '../initializers/config'+import { CONFIG } from '../initializers/config.js'const baseDirectives = Object.assign({},{diff --git a/server/middlewares/dnt.ts b/server/server/middlewares/dnt.tssimilarity index 100%rename from server/middlewares/dnt.tsrename to server/server/middlewares/dnt.tsdiff --git a/server/middlewares/doc.ts b/server/server/middlewares/doc.tssimilarity index 100%rename from server/middlewares/doc.tsrename to server/server/middlewares/doc.tsdiff --git a/server/middlewares/error.ts b/server/server/middlewares/error.tssimilarity index 92%rename from server/middlewares/error.tsrename to server/server/middlewares/error.tsindex 94762e3554..7060097955 100644--- a/server/middlewares/error.ts+++ b/server/server/middlewares/error.ts@@ -1,7 +1,7 @@import express from 'express'import { ProblemDocument, ProblemDocumentExtension } from 'http-problem-details'-import { logger } from '@server/helpers/logger'-import { HttpStatusCode } from '@shared/models'+import { logger } from '@server/helpers/logger.js'+import { HttpStatusCode } from '@peertube/peertube-models'function apiFailMiddleware (req: express.Request, res: express.Response, next: express.NextFunction) {res.fail = options => {diff --git a/server/server/middlewares/index.ts b/server/server/middlewares/index.tsnew file mode 100644index 0000000000..96ea240d1d--- /dev/null+++ b/server/server/middlewares/index.ts@@ -0,0 +1,15 @@+export * from './validators/index.js'+export * from './cache/index.js'+export * from './activitypub.js'+export * from './async.js'+export * from './auth.js'+export * from './pagination.js'+export * from './rate-limiter.js'+export * from './robots.js'+export * from './servers.js'+export * from './sort.js'+export * from './user-right.js'+export * from './dnt.js'+export * from './error.js'+export * from './doc.js'+export * from './csp.js'diff --git a/server/middlewares/pagination.ts b/server/server/middlewares/pagination.tssimilarity index 80%rename from server/middlewares/pagination.tsrename to server/server/middlewares/pagination.tsindex 17e43f743c..acee2f54d1 100644--- a/server/middlewares/pagination.ts+++ b/server/server/middlewares/pagination.ts@@ -1,6 +1,6 @@import express from 'express'-import { forceNumber } from '@shared/core-utils'-import { PAGINATION } from '../initializers/constants'+import { forceNumber } from '@peertube/peertube-core-utils'+import { PAGINATION } from '../initializers/constants.js'function setDefaultPagination (req: express.Request, res: express.Response, next: express.NextFunction) {if (!req.query.start) req.query.start = 0diff --git a/server/middlewares/rate-limiter.ts b/server/server/middlewares/rate-limiter.tssimilarity index 83%rename from server/middlewares/rate-limiter.tsrename to server/server/middlewares/rate-limiter.tsindex 143d436325..3a707709e5 100644--- a/server/middlewares/rate-limiter.ts+++ b/server/server/middlewares/rate-limiter.ts@@ -1,11 +1,11 @@import express from 'express'import RateLimit, { Options as RateLimitHandlerOptions } from 'express-rate-limit'-import { CONFIG } from '@server/initializers/config'-import { RunnerModel } from '@server/models/runner/runner'-import { UserRole } from '@shared/models'-import { optionalAuthenticate } from './auth'+import { UserRole, UserRoleType } from '@peertube/peertube-models'+import { CONFIG } from '@server/initializers/config.js'+import { RunnerModel } from '@server/models/runner/runner.js'+import { optionalAuthenticate } from './auth.js'-const whitelistRoles = new Set([ UserRole.ADMINISTRATOR, UserRole.MODERATOR ])+const whitelistRoles = new Set<UserRoleType>([ UserRole.ADMINISTRATOR, UserRole.MODERATOR ])export function buildRateLimiter (options: {windowMs: numberdiff --git a/server/middlewares/robots.ts b/server/server/middlewares/robots.tssimilarity index 100%rename from server/middlewares/robots.tsrename to server/server/middlewares/robots.tsdiff --git a/server/middlewares/servers.ts b/server/server/middlewares/servers.tssimilarity index 83%rename from server/middlewares/servers.tsrename to server/server/middlewares/servers.tsindex ebfa03e6ca..7971f4d243 100644--- a/server/middlewares/servers.ts+++ b/server/server/middlewares/servers.ts@@ -1,6 +1,6 @@import express from 'express'-import { HttpStatusCode } from '../../shared/models/http/http-error-codes'-import { getHostWithPort } from '../helpers/express-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { getHostWithPort } from '../helpers/express-utils.js'function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) {if (!req.body.hosts) return next()diff --git a/server/middlewares/sort.ts b/server/server/middlewares/sort.tssimilarity index 100%rename from server/middlewares/sort.tsrename to server/server/middlewares/sort.tsdiff --git a/server/middlewares/user-right.ts b/server/server/middlewares/user-right.tssimilarity index 76%rename from server/middlewares/user-right.tsrename to server/server/middlewares/user-right.tsindex 7d53e83412..4240fab2a1 100644--- a/server/middlewares/user-right.ts+++ b/server/server/middlewares/user-right.ts@@ -1,8 +1,8 @@import express from 'express'-import { HttpStatusCode, UserRight } from '@shared/models'-import { logger } from '../helpers/logger'+import { HttpStatusCode, UserRightType } from '@peertube/peertube-models'+import { logger } from '../helpers/logger.js'-function ensureUserHasRight (userRight: UserRight) {+function ensureUserHasRight (userRight: UserRightType) {return function (req: express.Request, res: express.Response, next: express.NextFunction) {const user = res.locals.oauth.token.userif (user.hasRight(userRight) === false) {diff --git a/server/middlewares/validators/abuse.ts b/server/server/middlewares/validators/abuse.tssimilarity index 94%rename from server/middlewares/validators/abuse.tsrename to server/server/middlewares/validators/abuse.tsindex 70bae17758..48fe06f4cf 100644--- a/server/middlewares/validators/abuse.ts+++ b/server/server/middlewares/validators/abuse.ts@@ -1,5 +1,7 @@import express from 'express'import { body, param, query } from 'express-validator'+import { forceNumber } from '@peertube/peertube-core-utils'+import { AbuseCreate, HttpStatusCode, UserRight } from '@peertube/peertube-models'import {areAbusePredefinedReasonsValid,isAbuseFilterValid,@@ -11,14 +13,11 @@ import {isAbuseTimestampCoherent,isAbuseTimestampValid,isAbuseVideoIsValid-} from '@server/helpers/custom-validators/abuses'-import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID, toIntOrNull } from '@server/helpers/custom-validators/misc'-import { logger } from '@server/helpers/logger'-import { AbuseMessageModel } from '@server/models/abuse/abuse-message'-import { AbuseCreate, UserRight } from '@shared/models'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { areValidationErrors, doesAbuseExist, doesAccountIdExist, doesCommentIdExist, doesVideoExist } from './shared'-import { forceNumber } from '@shared/core-utils'+} from '@server/helpers/custom-validators/abuses.js'+import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID, toIntOrNull } from '@server/helpers/custom-validators/misc.js'+import { logger } from '@server/helpers/logger.js'+import { AbuseMessageModel } from '@server/models/abuse/abuse-message.js'+import { areValidationErrors, doesAbuseExist, doesAccountIdExist, doesCommentIdExist, doesVideoExist } from './shared/index.js'const abuseReportValidator = [body('account.id')diff --git a/server/middlewares/validators/account.ts b/server/server/middlewares/validators/account.tssimilarity index 93%rename from server/middlewares/validators/account.tsrename to server/server/middlewares/validators/account.tsindex 551f67d61f..a8793752e9 100644--- a/server/middlewares/validators/account.ts+++ b/server/server/middlewares/validators/account.ts@@ -1,7 +1,7 @@import express from 'express'import { param } from 'express-validator'-import { isAccountNameValid } from '../../helpers/custom-validators/accounts'-import { areValidationErrors, doesAccountNameWithHostExist, doesLocalAccountNameExist } from './shared'+import { isAccountNameValid } from '../../helpers/custom-validators/accounts.js'+import { areValidationErrors, doesAccountNameWithHostExist, doesLocalAccountNameExist } from './shared/index.js'const localAccountValidator = [param('name')diff --git a/server/middlewares/validators/activitypub/activity.ts b/server/server/middlewares/validators/activitypub/activity.tssimilarity index 84%rename from server/middlewares/validators/activitypub/activity.tsrename to server/server/middlewares/validators/activitypub/activity.tsindex e296b8be74..9d6bf396b1 100644--- a/server/middlewares/validators/activitypub/activity.ts+++ b/server/server/middlewares/validators/activitypub/activity.ts@@ -1,8 +1,8 @@import express from 'express'-import { getServerActor } from '@server/models/application/application'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'-import { logger } from '../../../helpers/logger'+import { HttpStatusCode } from '@peertube/peertube-models'+import { getServerActor } from '@server/models/application/application.js'+import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity.js'+import { logger } from '../../../helpers/logger.js'async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) {logger.debug('Checking activity pub parameters')diff --git a/server/server/middlewares/validators/activitypub/index.ts b/server/server/middlewares/validators/activitypub/index.tsnew file mode 100644index 0000000000..ef02625bae--- /dev/null+++ b/server/server/middlewares/validators/activitypub/index.ts@@ -0,0 +1,3 @@+export * from './activity.js'+export * from './signature.js'+export * from './pagination.js'diff --git a/server/middlewares/validators/activitypub/pagination.ts b/server/server/middlewares/validators/activitypub/pagination.tssimilarity index 83%rename from server/middlewares/validators/activitypub/pagination.tsrename to server/server/middlewares/validators/activitypub/pagination.tsindex 1259e4fef0..66cbfb8701 100644--- a/server/middlewares/validators/activitypub/pagination.ts+++ b/server/server/middlewares/validators/activitypub/pagination.ts@@ -1,7 +1,7 @@import express from 'express'import { query } from 'express-validator'-import { PAGINATION } from '@server/initializers/constants'-import { areValidationErrors } from '../shared'+import { PAGINATION } from '@server/initializers/constants.js'+import { areValidationErrors } from '../shared/index.js'const apPaginationValidator = [query('page')diff --git a/server/middlewares/validators/activitypub/signature.ts b/server/server/middlewares/validators/activitypub/signature.tssimilarity index 89%rename from server/middlewares/validators/activitypub/signature.tsrename to server/server/middlewares/validators/activitypub/signature.tsindex 998d0c0c49..a318c9463b 100644--- a/server/middlewares/validators/activitypub/signature.ts+++ b/server/server/middlewares/validators/activitypub/signature.ts@@ -4,10 +4,10 @@ import {isSignatureCreatorValid,isSignatureTypeValid,isSignatureValueValid-} from '../../../helpers/custom-validators/activitypub/signature'-import { isDateValid } from '../../../helpers/custom-validators/misc'-import { logger } from '../../../helpers/logger'-import { areValidationErrors } from '../shared'+} from '../../../helpers/custom-validators/activitypub/signature.js'+import { isDateValid } from '../../../helpers/custom-validators/misc.js'+import { logger } from '../../../helpers/logger.js'+import { areValidationErrors } from '../shared/index.js'const signatureValidator = [body('signature.type')diff --git a/server/middlewares/validators/actor-image.ts b/server/server/middlewares/validators/actor-image.tssimilarity index 86%rename from server/middlewares/validators/actor-image.tsrename to server/server/middlewares/validators/actor-image.tsindex 9dcf5e8717..807d73c526 100644--- a/server/middlewares/validators/actor-image.ts+++ b/server/server/middlewares/validators/actor-image.ts@@ -1,9 +1,9 @@import express from 'express'import { body } from 'express-validator'-import { isActorImageFile } from '@server/helpers/custom-validators/actor-images'-import { cleanUpReqFiles } from '../../helpers/express-utils'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { areValidationErrors } from './shared'+import { isActorImageFile } from '@server/helpers/custom-validators/actor-images.js'+import { cleanUpReqFiles } from '../../helpers/express-utils.js'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { areValidationErrors } from './shared/index.js'const updateActorImageValidatorFactory = (fieldname: string) => ([body(fieldname).custom((value, { req }) => isActorImageFile(req.files, fieldname)).withMessage(diff --git a/server/middlewares/validators/blocklist.ts b/server/server/middlewares/validators/blocklist.tssimilarity index 93%rename from server/middlewares/validators/blocklist.tsrename to server/server/middlewares/validators/blocklist.tsindex 8ec6cb01d5..19f1bff1da 100644--- a/server/middlewares/validators/blocklist.ts+++ b/server/server/middlewares/validators/blocklist.ts@@ -1,15 +1,15 @@import express from 'express'import { body, param, query } from 'express-validator'-import { areValidActorHandles } from '@server/helpers/custom-validators/activitypub/actor'-import { getServerActor } from '@server/models/application/application'-import { arrayify } from '@shared/core-utils'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers'-import { WEBSERVER } from '../../initializers/constants'-import { AccountBlocklistModel } from '../../models/account/account-blocklist'-import { ServerModel } from '../../models/server/server'-import { ServerBlocklistModel } from '../../models/server/server-blocklist'-import { areValidationErrors, doesAccountNameWithHostExist } from './shared'+import { areValidActorHandles } from '@server/helpers/custom-validators/activitypub/actor.js'+import { getServerActor } from '@server/models/application/application.js'+import { arrayify } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers.js'+import { WEBSERVER } from '../../initializers/constants.js'+import { AccountBlocklistModel } from '../../models/account/account-blocklist.js'+import { ServerBlocklistModel } from '../../models/server/server-blocklist.js'+import { ServerModel } from '../../models/server/server.js'+import { areValidationErrors, doesAccountNameWithHostExist } from './shared/index.js'const blockAccountValidator = [body('accountName')diff --git a/server/middlewares/validators/bulk.ts b/server/server/middlewares/validators/bulk.tssimilarity index 85%rename from server/middlewares/validators/bulk.tsrename to server/server/middlewares/validators/bulk.tsindex a1cea8032e..3c25757c41 100644--- a/server/middlewares/validators/bulk.ts+++ b/server/server/middlewares/validators/bulk.ts@@ -1,9 +1,8 @@import express from 'express'import { body } from 'express-validator'-import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk'-import { HttpStatusCode, UserRight } from '@shared/models'-import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'-import { areValidationErrors, doesAccountNameWithHostExist } from './shared'+import { BulkRemoveCommentsOfBody, HttpStatusCode, UserRight } from '@peertube/peertube-models'+import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk.js'+import { areValidationErrors, doesAccountNameWithHostExist } from './shared/index.js'const bulkRemoveCommentsOfValidator = [body('accountName')diff --git a/server/middlewares/validators/config.ts b/server/server/middlewares/validators/config.tssimilarity index 96%rename from server/middlewares/validators/config.tsrename to server/server/middlewares/validators/config.tsindex 7790025e45..e495bb959d 100644--- a/server/middlewares/validators/config.ts+++ b/server/server/middlewares/validators/config.ts@@ -1,13 +1,12 @@import express from 'express'import { body } from 'express-validator'-import { isIntOrNull } from '@server/helpers/custom-validators/misc'-import { CONFIG, isEmailEnabled } from '@server/initializers/config'-import { HttpStatusCode } from '@shared/models/http/http-error-codes'-import { CustomConfig } from '../../../shared/models/server/custom-config.model'-import { isThemeNameValid } from '../../helpers/custom-validators/plugins'-import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users'-import { isThemeRegistered } from '../../lib/plugins/theme-utils'-import { areValidationErrors } from './shared'+import { CustomConfig, HttpStatusCode } from '@peertube/peertube-models'+import { isIntOrNull } from '@server/helpers/custom-validators/misc.js'+import { CONFIG, isEmailEnabled } from '@server/initializers/config.js'+import { isThemeNameValid } from '../../helpers/custom-validators/plugins.js'+import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users.js'+import { isThemeRegistered } from '../../lib/plugins/theme-utils.js'+import { areValidationErrors } from './shared/index.js'const customConfigUpdateValidator = [body('instance.name').exists(),diff --git a/server/middlewares/validators/express.ts b/server/server/middlewares/validators/express.tssimilarity index 100%rename from server/middlewares/validators/express.tsrename to server/server/middlewares/validators/express.tsdiff --git a/server/middlewares/validators/feeds.ts b/server/server/middlewares/validators/feeds.tssimilarity index 96%rename from server/middlewares/validators/feeds.tsrename to server/server/middlewares/validators/feeds.tsindex 72804a2590..ec99b6920b 100644--- a/server/middlewares/validators/feeds.ts+++ b/server/server/middlewares/validators/feeds.ts@@ -1,9 +1,9 @@import express from 'express'import { param, query } from 'express-validator'-import { HttpStatusCode } from '@shared/models'-import { isValidRSSFeed } from '../../helpers/custom-validators/feeds'-import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc'-import { buildPodcastGroupsCache } from '../cache'+import { HttpStatusCode } from '@peertube/peertube-models'+import { isValidRSSFeed } from '../../helpers/custom-validators/feeds.js'+import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc.js'+import { buildPodcastGroupsCache } from '../cache/index.js'import {areValidationErrors,checkCanSeeVideo,@@ -13,7 +13,7 @@ import {doesVideoChannelIdExist,doesVideoChannelNameWithHostExist,doesVideoExist-} from './shared'+} from './shared/index.js'const feedsFormatValidator = [param('format')diff --git a/server/middlewares/validators/follows.ts b/server/server/middlewares/validators/follows.tssimilarity index 87%rename from server/middlewares/validators/follows.tsrename to server/server/middlewares/validators/follows.tsindex be98a4c04b..a124dcf27c 100644--- a/server/middlewares/validators/follows.ts+++ b/server/server/middlewares/validators/follows.ts@@ -1,20 +1,19 @@import express from 'express'import { body, param, query } from 'express-validator'-import { isProdInstance } from '@server/helpers/core-utils'-import { isEachUniqueHandleValid, isFollowStateValid, isRemoteHandleValid } from '@server/helpers/custom-validators/follows'-import { loadActorUrlOrGetFromWebfinger } from '@server/lib/activitypub/actors'-import { getRemoteNameAndHost } from '@server/lib/activitypub/follow'-import { getServerActor } from '@server/models/application/application'-import { MActorFollowActorsDefault } from '@server/types/models'-import { ServerFollowCreate } from '@shared/models'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { isActorTypeValid, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'-import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers'-import { logger } from '../../helpers/logger'-import { WEBSERVER } from '../../initializers/constants'-import { ActorModel } from '../../models/actor/actor'-import { ActorFollowModel } from '../../models/actor/actor-follow'-import { areValidationErrors } from './shared'+import { HttpStatusCode, ServerFollowCreate } from '@peertube/peertube-models'+import { isProdInstance } from '@peertube/peertube-node-utils'+import { isEachUniqueHandleValid, isFollowStateValid, isRemoteHandleValid } from '@server/helpers/custom-validators/follows.js'+import { loadActorUrlOrGetFromWebfinger } from '@server/lib/activitypub/actors/index.js'+import { getRemoteNameAndHost } from '@server/lib/activitypub/follow.js'+import { getServerActor } from '@server/models/application/application.js'+import { MActorFollowActorsDefault } from '@server/types/models/index.js'+import { isActorTypeValid, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor.js'+import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers.js'+import { logger } from '../../helpers/logger.js'+import { WEBSERVER } from '../../initializers/constants.js'+import { ActorFollowModel } from '../../models/actor/actor-follow.js'+import { ActorModel } from '../../models/actor/actor.js'+import { areValidationErrors } from './shared/index.js'const listFollowsValidator = [query('state')diff --git a/server/server/middlewares/validators/index.ts b/server/server/middlewares/validators/index.tsnew file mode 100644index 0000000000..5c6beb40e6--- /dev/null+++ b/server/server/middlewares/validators/index.ts@@ -0,0 +1,32 @@+export * from './abuse.js'+export * from './account.js'+export * from './activitypub/index.js'+export * from './actor-image.js'+export * from './blocklist.js'+export * from './bulk.js'+export * from './config.js'+export * from './express.js'+export * from './feeds.js'+export * from './follows.js'+export * from './jobs.js'+export * from './logs.js'+export * from './metrics.js'+export * from './object-storage-proxy.js'+export * from './oembed.js'+export * from './pagination.js'+export * from './plugins.js'+export * from './redundancy.js'+export * from './search.js'+export * from './server.js'+export * from './sort.js'+export * from './static.js'+export * from './themes.js'+export * from './user-email-verification.js'+export * from './user-history.js'+export * from './user-notifications.js'+export * from './user-registrations.js'+export * from './user-subscriptions.js'+export * from './users.js'+export * from './videos/index.js'+export * from './webfinger.js'+export * from './runners/index.js'diff --git a/server/middlewares/validators/jobs.ts b/server/server/middlewares/validators/jobs.tssimilarity index 81%rename from server/middlewares/validators/jobs.tsrename to server/server/middlewares/validators/jobs.tsindex e5008adc36..070cef32e7 100644--- a/server/middlewares/validators/jobs.ts+++ b/server/server/middlewares/validators/jobs.ts@@ -1,8 +1,8 @@import express from 'express'import { param, query } from 'express-validator'-import { isValidJobState, isValidJobType } from '../../helpers/custom-validators/jobs'-import { loggerTagsFactory } from '../../helpers/logger'-import { areValidationErrors } from './shared'+import { isValidJobState, isValidJobType } from '../../helpers/custom-validators/jobs.js'+import { loggerTagsFactory } from '../../helpers/logger.js'+import { areValidationErrors } from './shared/index.js'const lTags = loggerTagsFactory('validators', 'jobs')diff --git a/server/middlewares/validators/logs.ts b/server/server/middlewares/validators/logs.tssimilarity index 88%rename from server/middlewares/validators/logs.tsrename to server/server/middlewares/validators/logs.tsindex 2d828bb429..e93d8a6184 100644--- a/server/middlewares/validators/logs.ts+++ b/server/server/middlewares/validators/logs.ts@@ -1,10 +1,10 @@import express from 'express'import { body, query } from 'express-validator'-import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc'-import { isStringArray } from '@server/helpers/custom-validators/search'-import { CONFIG } from '@server/initializers/config'-import { arrayify } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc.js'+import { isStringArray } from '@server/helpers/custom-validators/search.js'+import { CONFIG } from '@server/initializers/config.js'+import { arrayify } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'import {isValidClientLogLevel,isValidClientLogMessage,@@ -12,9 +12,9 @@ import {isValidClientLogStackTrace,isValidClientLogUserAgent,isValidLogLevel-} from '../../helpers/custom-validators/logs'-import { isDateValid } from '../../helpers/custom-validators/misc'-import { areValidationErrors } from './shared'+} from '../../helpers/custom-validators/logs.js'+import { isDateValid } from '../../helpers/custom-validators/misc.js'+import { areValidationErrors } from './shared/index.js'const createClientLogValidator = [body('message')diff --git a/server/middlewares/validators/metrics.ts b/server/server/middlewares/validators/metrics.tssimilarity index 84%rename from server/middlewares/validators/metrics.tsrename to server/server/middlewares/validators/metrics.tsindex 986b30a193..6e1e11952b 100644--- a/server/middlewares/validators/metrics.ts+++ b/server/server/middlewares/validators/metrics.ts@@ -1,10 +1,10 @@import express from 'express'import { body } from 'express-validator'-import { isValidPlayerMode } from '@server/helpers/custom-validators/metrics'-import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'-import { CONFIG } from '@server/initializers/config'-import { HttpStatusCode, PlaybackMetricCreate } from '@shared/models'-import { areValidationErrors, doesVideoExist } from './shared'+import { isValidPlayerMode } from '@server/helpers/custom-validators/metrics.js'+import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc.js'+import { CONFIG } from '@server/initializers/config.js'+import { HttpStatusCode, PlaybackMetricCreate } from '@peertube/peertube-models'+import { areValidationErrors, doesVideoExist } from './shared/index.js'const addPlaybackMetricValidator = [body('resolution')diff --git a/server/middlewares/validators/object-storage-proxy.ts b/server/server/middlewares/validators/object-storage-proxy.tssimilarity index 80%rename from server/middlewares/validators/object-storage-proxy.tsrename to server/server/middlewares/validators/object-storage-proxy.tsindex bbd77f2629..755e15a2fc 100644--- a/server/middlewares/validators/object-storage-proxy.ts+++ b/server/server/middlewares/validators/object-storage-proxy.ts@@ -1,6 +1,6 @@import express from 'express'-import { CONFIG } from '@server/initializers/config'-import { HttpStatusCode } from '@shared/models'+import { CONFIG } from '@server/initializers/config.js'+import { HttpStatusCode } from '@peertube/peertube-models'const ensurePrivateObjectStorageProxyIsEnabled = [(req: express.Request, res: express.Response, next: express.NextFunction) => {diff --git a/server/middlewares/validators/oembed.ts b/server/server/middlewares/validators/oembed.tssimilarity index 90%rename from server/middlewares/validators/oembed.tsrename to server/server/middlewares/validators/oembed.tsindex ef9a227a04..32217f6931 100644--- a/server/middlewares/validators/oembed.ts+++ b/server/server/middlewares/validators/oembed.ts@@ -1,14 +1,13 @@import express from 'express'import { query } from 'express-validator'import { join } from 'path'-import { loadVideo } from '@server/lib/model-loaders'-import { VideoPlaylistModel } from '@server/models/video/video-playlist'-import { VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { isTestOrDevInstance } from '../../helpers/core-utils'-import { isIdOrUUIDValid, isUUIDValid, toCompleteUUID } from '../../helpers/custom-validators/misc'-import { WEBSERVER } from '../../initializers/constants'-import { areValidationErrors } from './shared'+import { HttpStatusCode, VideoPlaylistPrivacy, VideoPrivacy } from '@peertube/peertube-models'+import { isTestOrDevInstance } from '@peertube/peertube-node-utils'+import { loadVideo } from '@server/lib/model-loaders/index.js'+import { VideoPlaylistModel } from '@server/models/video/video-playlist.js'+import { isIdOrUUIDValid, isUUIDValid, toCompleteUUID } from '../../helpers/custom-validators/misc.js'+import { WEBSERVER } from '../../initializers/constants.js'+import { areValidationErrors } from './shared/index.js'const playlistPaths = [join('videos', 'watch', 'playlist'),diff --git a/server/middlewares/validators/pagination.ts b/server/server/middlewares/validators/pagination.tssimilarity index 86%rename from server/middlewares/validators/pagination.tsrename to server/server/middlewares/validators/pagination.tsindex 79ddbbf184..de5729b2a5 100644--- a/server/middlewares/validators/pagination.ts+++ b/server/server/middlewares/validators/pagination.ts@@ -1,7 +1,7 @@import express from 'express'import { query } from 'express-validator'-import { PAGINATION } from '@server/initializers/constants'-import { areValidationErrors } from './shared'+import { PAGINATION } from '@server/initializers/constants.js'+import { areValidationErrors } from './shared/index.js'const paginationValidator = paginationValidatorBuilder()diff --git a/server/middlewares/validators/plugins.ts b/server/server/middlewares/validators/plugins.tssimilarity index 89%rename from server/middlewares/validators/plugins.tsrename to server/server/middlewares/validators/plugins.tsindex 64bef26480..0d2b7605a7 100644--- a/server/middlewares/validators/plugins.ts+++ b/server/server/middlewares/validators/plugins.ts@@ -1,21 +1,19 @@import express from 'express'import { body, param, query, ValidationChain } from 'express-validator'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { PluginType } from '../../../shared/models/plugins/plugin.type'-import { InstallOrUpdatePlugin } from '../../../shared/models/plugins/server/api/install-plugin.model'-import { exists, isBooleanValid, isSafePath, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc'+import { HttpStatusCode, InstallOrUpdatePlugin, PluginType_Type } from '@peertube/peertube-models'+import { exists, isBooleanValid, isSafePath, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc.js'import {isNpmPluginNameValid,isPluginNameValid,isPluginStableOrUnstableVersionValid,isPluginTypeValid-} from '../../helpers/custom-validators/plugins'-import { CONFIG } from '../../initializers/config'-import { PluginManager } from '../../lib/plugins/plugin-manager'-import { PluginModel } from '../../models/server/plugin'-import { areValidationErrors } from './shared'+} from '../../helpers/custom-validators/plugins.js'+import { CONFIG } from '../../initializers/config.js'+import { PluginManager } from '../../lib/plugins/plugin-manager.js'+import { PluginModel } from '../../models/server/plugin.js'+import { areValidationErrors } from './shared/index.js'-const getPluginValidator = (pluginType: PluginType, withVersion = true) => {+const getPluginValidator = (pluginType: PluginType_Type, withVersion = true) => {const validators: (ValidationChain | express.Handler)[] = [param('pluginName').custom(isPluginNameValid)diff --git a/server/middlewares/validators/redundancy.ts b/server/server/middlewares/validators/redundancy.tssimilarity index 94%rename from server/middlewares/validators/redundancy.tsrename to server/server/middlewares/validators/redundancy.tsindex c80f9b7282..d46a645f5a 100644--- a/server/middlewares/validators/redundancy.ts+++ b/server/server/middlewares/validators/redundancy.ts@@ -1,8 +1,8 @@import express from 'express'import { body, param, query } from 'express-validator'-import { isVideoRedundancyTarget } from '@server/helpers/custom-validators/video-redundancies'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { isVideoRedundancyTarget } from '@server/helpers/custom-validators/video-redundancies.js'import {exists,isBooleanValid,@@ -11,11 +11,11 @@ import {toBooleanOrNull,toCompleteUUID,toIntOrNull-} from '../../helpers/custom-validators/misc'-import { isHostValid } from '../../helpers/custom-validators/servers'-import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'-import { ServerModel } from '../../models/server/server'-import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from './shared'+} from '../../helpers/custom-validators/misc.js'+import { isHostValid } from '../../helpers/custom-validators/servers.js'+import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy.js'+import { ServerModel } from '../../models/server/server.js'+import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from './shared/index.js'const videoFileRedundancyGetValidator = [isValidVideoIdParam('videoId'),diff --git a/server/server/middlewares/validators/runners/index.ts b/server/server/middlewares/validators/runners/index.tsnew file mode 100644index 0000000000..f8cfedec3e--- /dev/null+++ b/server/server/middlewares/validators/runners/index.ts@@ -0,0 +1,3 @@+export * from './jobs.js'+export * from './registration-token.js'+export * from './runners.js'diff --git a/server/middlewares/validators/runners/job-files.ts b/server/server/middlewares/validators/runners/job-files.tssimilarity index 94%rename from server/middlewares/validators/runners/job-files.tsrename to server/server/middlewares/validators/runners/job-files.tsindex 57c27fcfec..8bfd2cce79 100644--- a/server/middlewares/validators/runners/job-files.ts+++ b/server/server/middlewares/validators/runners/job-files.ts@@ -1,9 +1,9 @@import express from 'express'import { param } from 'express-validator'import { basename } from 'path'-import { isSafeFilename } from '@server/helpers/custom-validators/misc'-import { hasVideoStudioTaskFile, HttpStatusCode, RunnerJobStudioTranscodingPayload } from '@shared/models'-import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'+import { isSafeFilename } from '@server/helpers/custom-validators/misc.js'+import { hasVideoStudioTaskFile, HttpStatusCode, RunnerJobStudioTranscodingPayload } from '@peertube/peertube-models'+import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared/index.js'const tags = [ 'runner' ]diff --git a/server/middlewares/validators/runners/jobs.ts b/server/server/middlewares/validators/runners/jobs.tssimilarity index 92%rename from server/middlewares/validators/runners/jobs.tsrename to server/server/middlewares/validators/runners/jobs.tsindex 62f9340a57..9110fce39c 100644--- a/server/middlewares/validators/runners/jobs.ts+++ b/server/server/middlewares/validators/runners/jobs.ts@@ -1,6 +1,14 @@-import express from 'express'-import { body, param, query } from 'express-validator'-import { exists, isUUIDValid } from '@server/helpers/custom-validators/misc'+import { arrayify } from '@peertube/peertube-core-utils'+import {+ HttpStatusCode,+ RunnerJobLiveRTMPHLSTranscodingPrivatePayload,+ RunnerJobState,+ RunnerJobStateType,+ RunnerJobSuccessBody,+ RunnerJobUpdateBody,+ ServerErrorCode+} from '@peertube/peertube-models'+import { exists, isUUIDValid } from '@server/helpers/custom-validators/misc.js'import {isRunnerJobAbortReasonValid,isRunnerJobArrayOfStateValid,@@ -9,22 +17,15 @@ import {isRunnerJobSuccessPayloadValid,isRunnerJobTokenValid,isRunnerJobUpdatePayloadValid-} from '@server/helpers/custom-validators/runners/jobs'-import { isRunnerTokenValid } from '@server/helpers/custom-validators/runners/runners'-import { cleanUpReqFiles } from '@server/helpers/express-utils'-import { LiveManager } from '@server/lib/live'-import { runnerJobCanBeCancelled } from '@server/lib/runners'-import { RunnerJobModel } from '@server/models/runner/runner-job'-import { arrayify } from '@shared/core-utils'-import {- HttpStatusCode,- RunnerJobLiveRTMPHLSTranscodingPrivatePayload,- RunnerJobState,- RunnerJobSuccessBody,- RunnerJobUpdateBody,- ServerErrorCode-} from '@shared/models'-import { areValidationErrors } from '../shared'+} from '@server/helpers/custom-validators/runners/jobs.js'+import { isRunnerTokenValid } from '@server/helpers/custom-validators/runners/runners.js'+import { cleanUpReqFiles } from '@server/helpers/express-utils.js'+import { LiveManager } from '@server/lib/live/index.js'+import { runnerJobCanBeCancelled } from '@server/lib/runners/index.js'+import { RunnerJobModel } from '@server/models/runner/runner-job.js'+import express from 'express'+import { body, param, query } from 'express-validator'+import { areValidationErrors } from '../shared/index.js'const tags = [ 'runner' ]@@ -171,7 +172,7 @@ export const runnerJobGetValidator = [}]-export function jobOfRunnerGetValidatorFactory (allowedStates: RunnerJobState[]) {+export function jobOfRunnerGetValidatorFactory (allowedStates: RunnerJobStateType[]) {return [param('jobUUID').custom(isUUIDValid),diff --git a/server/middlewares/validators/runners/registration-token.ts b/server/server/middlewares/validators/runners/registration-token.tssimilarity index 81%rename from server/middlewares/validators/runners/registration-token.tsrename to server/server/middlewares/validators/runners/registration-token.tsindex cc31d4a7e3..046b2c9885 100644--- a/server/middlewares/validators/runners/registration-token.ts+++ b/server/server/middlewares/validators/runners/registration-token.ts@@ -1,10 +1,10 @@import express from 'express'import { param } from 'express-validator'-import { isIdValid } from '@server/helpers/custom-validators/misc'-import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'-import { areValidationErrors } from '../shared/utils'+import { isIdValid } from '@server/helpers/custom-validators/misc.js'+import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token.js'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'+import { areValidationErrors } from '../shared/utils.js'const tags = [ 'runner' ]diff --git a/server/middlewares/validators/runners/runners.ts b/server/server/middlewares/validators/runners/runners.tssimilarity index 89%rename from server/middlewares/validators/runners/runners.tsrename to server/server/middlewares/validators/runners/runners.tsindex 4d4d79b4c2..80525c6098 100644--- a/server/middlewares/validators/runners/runners.ts+++ b/server/server/middlewares/validators/runners/runners.ts@@ -1,17 +1,17 @@import express from 'express'import { body, param } from 'express-validator'-import { isIdValid } from '@server/helpers/custom-validators/misc'+import { isIdValid } from '@server/helpers/custom-validators/misc.js'import {isRunnerDescriptionValid,isRunnerNameValid,isRunnerRegistrationTokenValid,isRunnerTokenValid-} from '@server/helpers/custom-validators/runners/runners'-import { RunnerModel } from '@server/models/runner/runner'-import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode, RegisterRunnerBody, ServerErrorCode } from '@shared/models'-import { areValidationErrors } from '../shared/utils'+} from '@server/helpers/custom-validators/runners/runners.js'+import { RunnerModel } from '@server/models/runner/runner.js'+import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token.js'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode, RegisterRunnerBody, ServerErrorCode } from '@peertube/peertube-models'+import { areValidationErrors } from '../shared/utils.js'const tags = [ 'runner' ]diff --git a/server/middlewares/validators/search.ts b/server/server/middlewares/validators/search.tssimilarity index 94%rename from server/middlewares/validators/search.tsrename to server/server/middlewares/validators/search.tsindex a63fd08932..9bfcfd79e7 100644--- a/server/middlewares/validators/search.ts+++ b/server/server/middlewares/validators/search.ts@@ -1,9 +1,9 @@import express from 'express'import { query } from 'express-validator'-import { isSearchTargetValid } from '@server/helpers/custom-validators/search'-import { isHostValid } from '@server/helpers/custom-validators/servers'-import { areUUIDsValid, isDateValid, isNotEmptyStringArray, toCompleteUUIDs } from '../../helpers/custom-validators/misc'-import { areValidationErrors } from './shared'+import { isSearchTargetValid } from '@server/helpers/custom-validators/search.js'+import { isHostValid } from '@server/helpers/custom-validators/servers.js'+import { areUUIDsValid, isDateValid, isNotEmptyStringArray, toCompleteUUIDs } from '../../helpers/custom-validators/misc.js'+import { areValidationErrors } from './shared/index.js'const videosSearchValidator = [query('search')diff --git a/server/middlewares/validators/server.ts b/server/server/middlewares/validators/server.tssimilarity index 85%rename from server/middlewares/validators/server.tsrename to server/server/middlewares/validators/server.tsindex 7d37ae2291..b8d7a8aa40 100644--- a/server/middlewares/validators/server.ts+++ b/server/server/middlewares/validators/server.ts@@ -1,13 +1,13 @@import express from 'express'import { body } from 'express-validator'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { isHostValid, isValidContactBody } from '../../helpers/custom-validators/servers'-import { isUserDisplayNameValid } from '../../helpers/custom-validators/users'-import { logger } from '../../helpers/logger'-import { CONFIG, isEmailEnabled } from '../../initializers/config'-import { Redis } from '../../lib/redis'-import { ServerModel } from '../../models/server/server'-import { areValidationErrors } from './shared'+import { HttpStatusCode } from '@peertube/peertube-models'+import { isHostValid, isValidContactBody } from '../../helpers/custom-validators/servers.js'+import { isUserDisplayNameValid } from '../../helpers/custom-validators/users.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG, isEmailEnabled } from '../../initializers/config.js'+import { Redis } from '../../lib/redis.js'+import { ServerModel } from '../../models/server/server.js'+import { areValidationErrors } from './shared/index.js'const serverGetValidator = [body('host').custom(isHostValid).withMessage('Should have a valid host'),diff --git a/server/middlewares/validators/shared/abuses.ts b/server/server/middlewares/validators/shared/abuses.tssimilarity index 72%rename from server/middlewares/validators/shared/abuses.tsrename to server/server/middlewares/validators/shared/abuses.tsindex 2c988f9ec5..dfe18fb4fe 100644--- a/server/middlewares/validators/shared/abuses.ts+++ b/server/server/middlewares/validators/shared/abuses.ts@@ -1,7 +1,7 @@import { Response } from 'express'-import { AbuseModel } from '@server/models/abuse/abuse'-import { HttpStatusCode } from '@shared/models'-import { forceNumber } from '@shared/core-utils'+import { AbuseModel } from '@server/models/abuse/abuse.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { forceNumber } from '@peertube/peertube-core-utils'async function doesAbuseExist (abuseId: number | string, res: Response) {const abuse = await AbuseModel.loadByIdWithReporter(forceNumber(abuseId))diff --git a/server/middlewares/validators/shared/accounts.ts b/server/server/middlewares/validators/shared/accounts.tssimilarity index 84%rename from server/middlewares/validators/shared/accounts.tsrename to server/server/middlewares/validators/shared/accounts.tsindex 72b0e235e6..27c56a09ea 100644--- a/server/middlewares/validators/shared/accounts.ts+++ b/server/server/middlewares/validators/shared/accounts.ts@@ -1,9 +1,9 @@import { Response } from 'express'-import { AccountModel } from '@server/models/account/account'-import { UserModel } from '@server/models/user/user'-import { MAccountDefault } from '@server/types/models'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { AccountModel } from '@server/models/account/account.js'+import { UserModel } from '@server/models/user/user.js'+import { MAccountDefault } from '@server/types/models/index.js'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'function doesAccountIdExist (id: number | string, res: Response, sendNotFound = true) {const promise = AccountModel.load(forceNumber(id))diff --git a/server/server/middlewares/validators/shared/index.ts b/server/server/middlewares/validators/shared/index.tsnew file mode 100644index 0000000000..d60ac49ca3--- /dev/null+++ b/server/server/middlewares/validators/shared/index.ts@@ -0,0 +1,14 @@+export * from './abuses.js'+export * from './accounts.js'+export * from './users.js'+export * from './utils.js'+export * from './video-blacklists.js'+export * from './video-captions.js'+export * from './video-channels.js'+export * from './video-channel-syncs.js'+export * from './video-comments.js'+export * from './video-imports.js'+export * from './video-ownerships.js'+export * from './video-playlists.js'+export * from './video-passwords.js'+export * from './videos.js'diff --git a/server/middlewares/validators/shared/user-registrations.ts b/server/server/middlewares/validators/shared/user-registrations.tssimilarity index 88%rename from server/middlewares/validators/shared/user-registrations.tsrename to server/server/middlewares/validators/shared/user-registrations.tsindex dbc7dda069..ede9d6b916 100644--- a/server/middlewares/validators/shared/user-registrations.ts+++ b/server/server/middlewares/validators/shared/user-registrations.ts@@ -1,8 +1,8 @@import express from 'express'-import { UserRegistrationModel } from '@server/models/user/user-registration'-import { MRegistration } from '@server/types/models'-import { forceNumber, pick } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { UserRegistrationModel } from '@server/models/user/user-registration.js'+import { MRegistration } from '@server/types/models/index.js'+import { forceNumber, pick } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'function checkRegistrationIdExist (idArg: number | string, res: express.Response) {const id = forceNumber(idArg)diff --git a/server/middlewares/validators/shared/users.ts b/server/server/middlewares/validators/shared/users.tssimilarity index 84%rename from server/middlewares/validators/shared/users.tsrename to server/server/middlewares/validators/shared/users.tsindex 030adc9f7a..025f2a3357 100644--- a/server/middlewares/validators/shared/users.ts+++ b/server/server/middlewares/validators/shared/users.ts@@ -1,9 +1,9 @@import express from 'express'-import { ActorModel } from '@server/models/actor/actor'-import { UserModel } from '@server/models/user/user'-import { MUserDefault } from '@server/types/models'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { ActorModel } from '@server/models/actor/actor.js'+import { UserModel } from '@server/models/user/user.js'+import { MUserDefault } from '@server/types/models/index.js'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'function checkUserIdExist (idArg: number | string, res: express.Response, withStats = false) {const id = forceNumber(idArg)diff --git a/server/middlewares/validators/shared/utils.ts b/server/server/middlewares/validators/shared/utils.tssimilarity index 95%rename from server/middlewares/validators/shared/utils.tsrename to server/server/middlewares/validators/shared/utils.tsindex f39128fddd..c36525a6d9 100644--- a/server/middlewares/validators/shared/utils.ts+++ b/server/server/middlewares/validators/shared/utils.ts@@ -1,7 +1,7 @@import express from 'express'import { param, validationResult } from 'express-validator'-import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'-import { logger } from '../../../helpers/logger'+import { isIdOrUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc.js'+import { logger } from '../../../helpers/logger.js'function areValidationErrors (req: express.Request,diff --git a/server/middlewares/validators/shared/video-blacklists.ts b/server/server/middlewares/validators/shared/video-blacklists.tssimilarity index 89%rename from server/middlewares/validators/shared/video-blacklists.tsrename to server/server/middlewares/validators/shared/video-blacklists.tsindex f85b39b232..fa81305def 100644--- a/server/middlewares/validators/shared/video-blacklists.ts+++ b/server/server/middlewares/validators/shared/video-blacklists.ts@@ -1,6 +1,6 @@import { Response } from 'express'-import { VideoBlacklistModel } from '@server/models/video/video-blacklist'-import { HttpStatusCode } from '@shared/models'+import { VideoBlacklistModel } from '@server/models/video/video-blacklist.js'+import { HttpStatusCode } from '@peertube/peertube-models'async function doesVideoBlacklistExist (videoId: number, res: Response) {const videoBlacklist = await VideoBlacklistModel.loadByVideoId(videoId)diff --git a/server/middlewares/validators/shared/video-captions.ts b/server/server/middlewares/validators/shared/video-captions.tssimilarity index 82%rename from server/middlewares/validators/shared/video-captions.tsrename to server/server/middlewares/validators/shared/video-captions.tsindex 831b366eae..bf2c27a7ff 100644--- a/server/middlewares/validators/shared/video-captions.ts+++ b/server/server/middlewares/validators/shared/video-captions.ts@@ -1,7 +1,7 @@import { Response } from 'express'-import { VideoCaptionModel } from '@server/models/video/video-caption'-import { MVideoId } from '@server/types/models'-import { HttpStatusCode } from '@shared/models'+import { VideoCaptionModel } from '@server/models/video/video-caption.js'+import { MVideoId } from '@server/types/models/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'async function doesVideoCaptionExist (video: MVideoId, language: string, res: Response) {const videoCaption = await VideoCaptionModel.loadByVideoIdAndLanguage(video.id, language)diff --git a/server/middlewares/validators/shared/video-channel-syncs.ts b/server/server/middlewares/validators/shared/video-channel-syncs.tssimilarity index 87%rename from server/middlewares/validators/shared/video-channel-syncs.tsrename to server/server/middlewares/validators/shared/video-channel-syncs.tsindex a6e51eb97f..5d68728333 100644--- a/server/middlewares/validators/shared/video-channel-syncs.ts+++ b/server/server/middlewares/validators/shared/video-channel-syncs.ts@@ -1,6 +1,6 @@import express from 'express'-import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'-import { HttpStatusCode } from '@shared/models'+import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync.js'+import { HttpStatusCode } from '@peertube/peertube-models'async function doesVideoChannelSyncIdExist (id: number, res: express.Response) {const sync = await VideoChannelSyncModel.loadWithChannel(+id)diff --git a/server/middlewares/validators/shared/video-channels.ts b/server/server/middlewares/validators/shared/video-channels.tssimilarity index 93%rename from server/middlewares/validators/shared/video-channels.tsrename to server/server/middlewares/validators/shared/video-channels.tsindex bed9f5dbe7..eee379c190 100644--- a/server/middlewares/validators/shared/video-channels.ts+++ b/server/server/middlewares/validators/shared/video-channels.ts@@ -1,7 +1,7 @@import express from 'express'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { MChannelBannerAccountDefault } from '@server/types/models'-import { HttpStatusCode } from '@shared/models'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import { MChannelBannerAccountDefault } from '@server/types/models/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'async function doesVideoChannelIdExist (id: number, res: express.Response) {const videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id)diff --git a/server/middlewares/validators/shared/video-comments.ts b/server/server/middlewares/validators/shared/video-comments.tssimilarity index 90%rename from server/middlewares/validators/shared/video-comments.tsrename to server/server/middlewares/validators/shared/video-comments.tsindex 0961b3ec9d..e11696dbf4 100644--- a/server/middlewares/validators/shared/video-comments.ts+++ b/server/server/middlewares/validators/shared/video-comments.ts@@ -1,8 +1,8 @@import express from 'express'-import { VideoCommentModel } from '@server/models/video/video-comment'-import { MVideoId } from '@server/types/models'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode, ServerErrorCode } from '@shared/models'+import { VideoCommentModel } from '@server/models/video/video-comment.js'+import { MVideoId } from '@server/types/models/index.js'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode, ServerErrorCode } from '@peertube/peertube-models'async function doesVideoCommentThreadExist (idArg: number | string, video: MVideoId, res: express.Response) {const id = forceNumber(idArg)diff --git a/server/middlewares/validators/shared/video-imports.ts b/server/server/middlewares/validators/shared/video-imports.tssimilarity index 87%rename from server/middlewares/validators/shared/video-imports.tsrename to server/server/middlewares/validators/shared/video-imports.tsindex 69fda4b324..9b7d8e7f0c 100644--- a/server/middlewares/validators/shared/video-imports.ts+++ b/server/server/middlewares/validators/shared/video-imports.ts@@ -1,6 +1,6 @@import express from 'express'-import { VideoImportModel } from '@server/models/video/video-import'-import { HttpStatusCode } from '@shared/models'+import { VideoImportModel } from '@server/models/video/video-import.js'+import { HttpStatusCode } from '@peertube/peertube-models'async function doesVideoImportExist (id: number, res: express.Response) {const videoImport = await VideoImportModel.loadAndPopulateVideo(id)diff --git a/server/middlewares/validators/shared/video-ownerships.ts b/server/server/middlewares/validators/shared/video-ownerships.tssimilarity index 79%rename from server/middlewares/validators/shared/video-ownerships.tsrename to server/server/middlewares/validators/shared/video-ownerships.tsindex 33ac9c8b69..9f3d7b2c23 100644--- a/server/middlewares/validators/shared/video-ownerships.ts+++ b/server/server/middlewares/validators/shared/video-ownerships.ts@@ -1,7 +1,7 @@import express from 'express'-import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode } from '@shared/models'+import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership.js'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode } from '@peertube/peertube-models'async function doesChangeVideoOwnershipExist (idArg: number | string, res: express.Response) {const id = forceNumber(idArg)diff --git a/server/middlewares/validators/shared/video-passwords.ts b/server/server/middlewares/validators/shared/video-passwords.tssimilarity index 90%rename from server/middlewares/validators/shared/video-passwords.tsrename to server/server/middlewares/validators/shared/video-passwords.tsindex efcc95dc43..dc82be572d 100644--- a/server/middlewares/validators/shared/video-passwords.ts+++ b/server/server/middlewares/validators/shared/video-passwords.ts@@ -1,9 +1,9 @@import express from 'express'-import { HttpStatusCode, UserRight, VideoPrivacy } from '@shared/models'-import { forceNumber } from '@shared/core-utils'-import { VideoPasswordModel } from '@server/models/video/video-password'+import { HttpStatusCode, UserRight, VideoPrivacy } from '@peertube/peertube-models'+import { forceNumber } from '@peertube/peertube-core-utils'+import { VideoPasswordModel } from '@server/models/video/video-password.js'import { header } from 'express-validator'-import { getVideoWithAttributes } from '@server/helpers/video'+import { getVideoWithAttributes } from '@server/helpers/video.js'function isValidVideoPasswordHeader () {return header('x-peertube-video-password')diff --git a/server/middlewares/validators/shared/video-playlists.ts b/server/server/middlewares/validators/shared/video-playlists.tssimilarity index 89%rename from server/middlewares/validators/shared/video-playlists.tsrename to server/server/middlewares/validators/shared/video-playlists.tsindex 4342fe5527..caa0bfaf45 100644--- a/server/middlewares/validators/shared/video-playlists.ts+++ b/server/server/middlewares/validators/shared/video-playlists.ts@@ -1,7 +1,7 @@import express from 'express'-import { VideoPlaylistModel } from '@server/models/video/video-playlist'-import { MVideoPlaylist } from '@server/types/models'-import { HttpStatusCode } from '@shared/models'+import { VideoPlaylistModel } from '@server/models/video/video-playlist.js'+import { MVideoPlaylist } from '@server/types/models/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'export type VideoPlaylistFetchType = 'summary' | 'all'async function doesVideoPlaylistExist (id: number | string, res: express.Response, fetchType: VideoPlaylistFetchType = 'summary') {diff --git a/server/middlewares/validators/shared/videos.ts b/server/server/middlewares/validators/shared/videos.tssimilarity index 92%rename from server/middlewares/validators/shared/videos.tsrename to server/server/middlewares/validators/shared/videos.tsindex 9a74970076..0e7dfebcbc 100644--- a/server/middlewares/validators/shared/videos.ts+++ b/server/server/middlewares/validators/shared/videos.ts@@ -1,11 +1,14 @@import { Request, Response } from 'express'-import { loadVideo, VideoLoadType } from '@server/lib/model-loaders'-import { isAbleToUploadVideo } from '@server/lib/user'-import { VideoTokensManager } from '@server/lib/video-tokens-manager'-import { authenticatePromise } from '@server/middlewares/auth'-import { VideoModel } from '@server/models/video/video'-import { VideoChannelModel } from '@server/models/video/video-channel'-import { VideoFileModel } from '@server/models/video/video-file'+import { HttpStatusCode, ServerErrorCode, UserRight, UserRightType, VideoPrivacy } from '@peertube/peertube-models'+import { exists } from '@server/helpers/custom-validators/misc.js'+import { loadVideo, VideoLoadType } from '@server/lib/model-loaders/index.js'+import { isAbleToUploadVideo } from '@server/lib/user.js'+import { VideoTokensManager } from '@server/lib/video-tokens-manager.js'+import { authenticatePromise } from '@server/middlewares/auth.js'+import { VideoChannelModel } from '@server/models/video/video-channel.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoPasswordModel } from '@server/models/video/video-password.js'+import { VideoModel } from '@server/models/video/video.js'import {MUser,MUserAccountId,@@ -18,10 +21,7 @@ import {MVideoImmutable,MVideoThumbnail,MVideoWithRights-} from '@server/types/models'-import { HttpStatusCode, ServerErrorCode, UserRight, VideoPrivacy } from '@shared/models'-import { VideoPasswordModel } from '@server/models/video/video-password'-import { exists } from '@server/helpers/custom-validators/misc'+} from '@server/types/models/index.js'async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') {const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined@@ -215,7 +215,7 @@ async function checkCanSeePasswordProtectedVideo (options: {return false}-function canUserAccessVideo (user: MUser, video: MVideoWithRights | MVideoAccountLight, right: UserRight) {+function canUserAccessVideo (user: MUser, video: MVideoWithRights | MVideoAccountLight, right: UserRightType) {const isOwnedByUser = video.VideoChannel.Account.userId === user.idreturn isOwnedByUser || user.hasRight(right)@@ -257,7 +257,7 @@ async function checkCanAccessVideoStaticFiles (options: {// ----------------------------------------------------------------------------function checkUserCanManageVideo (user: MUser, video: MVideoAccountLight, right: UserRight, res: Response, onlyOwned = true) {+function checkUserCanManageVideo (user: MUser, video: MVideoAccountLight, right: UserRightType, res: Response, onlyOwned = true) {// Retrieve the user who did the requestif (onlyOwned && video.isOwned() === false) {res.fail({diff --git a/server/middlewares/validators/sort.ts b/server/server/middlewares/validators/sort.tssimilarity index 96%rename from server/middlewares/validators/sort.tsrename to server/server/middlewares/validators/sort.tsindex 07d6cba827..3f3b2eb4ec 100644--- a/server/middlewares/validators/sort.ts+++ b/server/server/middlewares/validators/sort.ts@@ -1,7 +1,7 @@import express from 'express'import { query } from 'express-validator'-import { SORTABLE_COLUMNS } from '../../initializers/constants'-import { areValidationErrors } from './shared'+import { SORTABLE_COLUMNS } from '../../initializers/constants.js'+import { areValidationErrors } from './shared/index.js'export const adminUsersSortValidator = checkSortFactory(SORTABLE_COLUMNS.ADMIN_USERS)export const accountsSortValidator = checkSortFactory(SORTABLE_COLUMNS.ACCOUNTS)diff --git a/server/middlewares/validators/static.ts b/server/server/middlewares/validators/static.tssimilarity index 92%rename from server/middlewares/validators/static.tsrename to server/server/middlewares/validators/static.tsindex 86cc0a8d70..afd1441ab4 100644--- a/server/middlewares/validators/static.ts+++ b/server/server/middlewares/validators/static.ts@@ -2,14 +2,14 @@ import express from 'express'import { query } from 'express-validator'import { LRUCache } from 'lru-cache'import { basename, dirname } from 'path'-import { exists, isSafePeerTubeFilenameWithoutExtension, isUUIDValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc'-import { logger } from '@server/helpers/logger'-import { LRU_CACHE } from '@server/initializers/constants'-import { VideoModel } from '@server/models/video/video'-import { VideoFileModel } from '@server/models/video/video-file'-import { MStreamingPlaylist, MVideoFile, MVideoThumbnail } from '@server/types/models'-import { HttpStatusCode } from '@shared/models'-import { areValidationErrors, checkCanAccessVideoStaticFiles, isValidVideoPasswordHeader } from './shared'+import { exists, isSafePeerTubeFilenameWithoutExtension, isUUIDValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc.js'+import { logger } from '@server/helpers/logger.js'+import { LRU_CACHE } from '@server/initializers/constants.js'+import { VideoModel } from '@server/models/video/video.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { MStreamingPlaylist, MVideoFile, MVideoThumbnail } from '@server/types/models/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { areValidationErrors, checkCanAccessVideoStaticFiles, isValidVideoPasswordHeader } from './shared/index.js'type LRUValue = {allowed: booleandiff --git a/server/middlewares/validators/themes.ts b/server/server/middlewares/validators/themes.tssimilarity index 84%rename from server/middlewares/validators/themes.tsrename to server/server/middlewares/validators/themes.tsindex 080b3e0963..ec7ce3b4fd 100644--- a/server/middlewares/validators/themes.ts+++ b/server/server/middlewares/validators/themes.ts@@ -1,10 +1,10 @@import express from 'express'import { param } from 'express-validator'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { isSafePath } from '../../helpers/custom-validators/misc'-import { isPluginNameValid, isPluginStableOrUnstableVersionValid } from '../../helpers/custom-validators/plugins'-import { PluginManager } from '../../lib/plugins/plugin-manager'-import { areValidationErrors } from './shared'+import { HttpStatusCode } from '@peertube/peertube-models'+import { isSafePath } from '../../helpers/custom-validators/misc.js'+import { isPluginNameValid, isPluginStableOrUnstableVersionValid } from '../../helpers/custom-validators/plugins.js'+import { PluginManager } from '../../lib/plugins/plugin-manager.js'+import { areValidationErrors } from './shared/index.js'const serveThemeCSSValidator = [param('themeName')diff --git a/server/middlewares/validators/two-factor.ts b/server/server/middlewares/validators/two-factor.tssimilarity index 93%rename from server/middlewares/validators/two-factor.tsrename to server/server/middlewares/validators/two-factor.tsindex 106b579b5d..950f72528e 100644--- a/server/middlewares/validators/two-factor.ts+++ b/server/server/middlewares/validators/two-factor.ts@@ -1,8 +1,8 @@import express from 'express'import { body, param } from 'express-validator'-import { HttpStatusCode, UserRight } from '@shared/models'-import { exists, isIdValid } from '../../helpers/custom-validators/misc'-import { areValidationErrors, checkUserIdExist } from './shared'+import { HttpStatusCode, UserRight } from '@peertube/peertube-models'+import { exists, isIdValid } from '../../helpers/custom-validators/misc.js'+import { areValidationErrors, checkUserIdExist } from './shared/index.js'const requestOrConfirmTwoFactorValidator = [param('id').custom(isIdValid),diff --git a/server/middlewares/validators/user-email-verification.ts b/server/server/middlewares/validators/user-email-verification.tssimilarity index 93%rename from server/middlewares/validators/user-email-verification.tsrename to server/server/middlewares/validators/user-email-verification.tsindex 74702a8f5b..50151f6423 100644--- a/server/middlewares/validators/user-email-verification.ts+++ b/server/server/middlewares/validators/user-email-verification.ts@@ -1,11 +1,11 @@import express from 'express'import { body, param } from 'express-validator'-import { toBooleanOrNull } from '@server/helpers/custom-validators/misc'-import { HttpStatusCode } from '@shared/models'-import { logger } from '../../helpers/logger'-import { Redis } from '../../lib/redis'-import { areValidationErrors, checkUserEmailExist, checkUserIdExist } from './shared'-import { checkRegistrationEmailExist, checkRegistrationIdExist } from './shared/user-registrations'+import { toBooleanOrNull } from '@server/helpers/custom-validators/misc.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { logger } from '../../helpers/logger.js'+import { Redis } from '../../lib/redis.js'+import { areValidationErrors, checkUserEmailExist, checkUserIdExist } from './shared/index.js'+import { checkRegistrationEmailExist, checkRegistrationIdExist } from './shared/user-registrations.js'const usersAskSendVerifyEmailValidator = [body('email').isEmail().not().isEmpty().withMessage('Should have a valid email'),diff --git a/server/middlewares/validators/user-history.ts b/server/server/middlewares/validators/user-history.tssimilarity index 93%rename from server/middlewares/validators/user-history.tsrename to server/server/middlewares/validators/user-history.tsindex f2dae31343..8415dab2ad 100644--- a/server/middlewares/validators/user-history.ts+++ b/server/server/middlewares/validators/user-history.ts@@ -1,7 +1,7 @@import express from 'express'import { body, param, query } from 'express-validator'-import { exists, isDateValid, isIdValid } from '../../helpers/custom-validators/misc'-import { areValidationErrors } from './shared'+import { exists, isDateValid, isIdValid } from '../../helpers/custom-validators/misc.js'+import { areValidationErrors } from './shared/index.js'const userHistoryListValidator = [query('search')diff --git a/server/middlewares/validators/user-notifications.ts b/server/server/middlewares/validators/user-notifications.tssimilarity index 94%rename from server/middlewares/validators/user-notifications.tsrename to server/server/middlewares/validators/user-notifications.tsindex 8d70dcdd29..16bbc6693f 100644--- a/server/middlewares/validators/user-notifications.ts+++ b/server/server/middlewares/validators/user-notifications.ts@@ -1,8 +1,8 @@import express from 'express'import { body, query } from 'express-validator'-import { isNotEmptyIntArray, toBooleanOrNull } from '../../helpers/custom-validators/misc'-import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'-import { areValidationErrors } from './shared'+import { isNotEmptyIntArray, toBooleanOrNull } from '../../helpers/custom-validators/misc.js'+import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications.js'+import { areValidationErrors } from './shared/index.js'const listUserNotificationsValidator = [query('unread')diff --git a/server/middlewares/validators/user-registrations.ts b/server/server/middlewares/validators/user-registrations.tssimilarity index 92%rename from server/middlewares/validators/user-registrations.tsrename to server/server/middlewares/validators/user-registrations.tsindex 47397391bc..392fe52a60 100644--- a/server/middlewares/validators/user-registrations.ts+++ b/server/server/middlewares/validators/user-registrations.ts@@ -1,16 +1,16 @@import express from 'express'import { body, param, query, ValidationChain } from 'express-validator'-import { exists, isBooleanValid, isIdValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc'-import { isRegistrationModerationResponseValid, isRegistrationReasonValid } from '@server/helpers/custom-validators/user-registration'-import { CONFIG } from '@server/initializers/config'-import { Hooks } from '@server/lib/plugins/hooks'-import { HttpStatusCode, UserRegister, UserRegistrationRequest, UserRegistrationState } from '@shared/models'-import { isUserDisplayNameValid, isUserPasswordValid, isUserUsernameValid } from '../../helpers/custom-validators/users'-import { isVideoChannelDisplayNameValid, isVideoChannelUsernameValid } from '../../helpers/custom-validators/video-channels'-import { isSignupAllowed, isSignupAllowedForCurrentIP, SignupMode } from '../../lib/signup'-import { ActorModel } from '../../models/actor/actor'-import { areValidationErrors, checkUserNameOrEmailDoNotAlreadyExist } from './shared'-import { checkRegistrationHandlesDoNotAlreadyExist, checkRegistrationIdExist } from './shared/user-registrations'+import { exists, isBooleanValid, isIdValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc.js'+import { isRegistrationModerationResponseValid, isRegistrationReasonValid } from '@server/helpers/custom-validators/user-registration.js'+import { CONFIG } from '@server/initializers/config.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { HttpStatusCode, UserRegister, UserRegistrationRequest, UserRegistrationState } from '@peertube/peertube-models'+import { isUserDisplayNameValid, isUserPasswordValid, isUserUsernameValid } from '../../helpers/custom-validators/users.js'+import { isVideoChannelDisplayNameValid, isVideoChannelUsernameValid } from '../../helpers/custom-validators/video-channels.js'+import { isSignupAllowed, isSignupAllowedForCurrentIP, SignupMode } from '../../lib/signup.js'+import { ActorModel } from '../../models/actor/actor.js'+import { areValidationErrors, checkUserNameOrEmailDoNotAlreadyExist } from './shared/index.js'+import { checkRegistrationHandlesDoNotAlreadyExist, checkRegistrationIdExist } from './shared/user-registrations.js'const usersDirectRegistrationValidator = usersCommonRegistrationValidatorFactory()diff --git a/server/middlewares/validators/user-subscriptions.ts b/server/server/middlewares/validators/user-subscriptions.tssimilarity index 89%rename from server/middlewares/validators/user-subscriptions.tsrename to server/server/middlewares/validators/user-subscriptions.tsindex 68d83add52..78bea840f6 100644--- a/server/middlewares/validators/user-subscriptions.ts+++ b/server/server/middlewares/validators/user-subscriptions.ts@@ -1,12 +1,11 @@import express from 'express'import { body, param, query } from 'express-validator'-import { arrayify } from '@shared/core-utils'-import { FollowState } from '@shared/models'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'-import { WEBSERVER } from '../../initializers/constants'-import { ActorFollowModel } from '../../models/actor/actor-follow'-import { areValidationErrors } from './shared'+import { arrayify } from '@peertube/peertube-core-utils'+import { FollowState, HttpStatusCode } from '@peertube/peertube-models'+import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor.js'+import { WEBSERVER } from '../../initializers/constants.js'+import { ActorFollowModel } from '../../models/actor/actor-follow.js'+import { areValidationErrors } from './shared/index.js'const userSubscriptionListValidator = [query('search')diff --git a/server/middlewares/validators/users.ts b/server/server/middlewares/validators/users.tssimilarity index 96%rename from server/middlewares/validators/users.tsrename to server/server/middlewares/validators/users.tsindex 3d311b15be..010ae496d6 100644--- a/server/middlewares/validators/users.ts+++ b/server/server/middlewares/validators/users.ts@@ -1,9 +1,9 @@import express from 'express'import { body, param, query } from 'express-validator'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode, UserRight, UserRole } from '@shared/models'-import { exists, isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc'-import { isThemeNameValid } from '../../helpers/custom-validators/plugins'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode, UserRight, UserRole } from '@peertube/peertube-models'+import { exists, isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc.js'+import { isThemeNameValid } from '../../helpers/custom-validators/plugins.js'import {isUserAdminFlagsValid,isUserAutoPlayNextVideoValid,@@ -23,12 +23,12 @@ import {isUserVideoQuotaDailyValid,isUserVideoQuotaValid,isUserVideosHistoryEnabledValid-} from '../../helpers/custom-validators/users'-import { isVideoChannelUsernameValid } from '../../helpers/custom-validators/video-channels'-import { logger } from '../../helpers/logger'-import { isThemeRegistered } from '../../lib/plugins/theme-utils'-import { Redis } from '../../lib/redis'-import { ActorModel } from '../../models/actor/actor'+} from '../../helpers/custom-validators/users.js'+import { isVideoChannelUsernameValid } from '../../helpers/custom-validators/video-channels.js'+import { logger } from '../../helpers/logger.js'+import { isThemeRegistered } from '../../lib/plugins/theme-utils.js'+import { Redis } from '../../lib/redis.js'+import { ActorModel } from '../../models/actor/actor.js'import {areValidationErrors,checkUserEmailExist,@@ -37,7 +37,7 @@ import {doesVideoChannelIdExist,doesVideoExist,isValidVideoIdParam-} from './shared'+} from './shared/index.js'const usersListValidator = [query('blocked')diff --git a/server/server/middlewares/validators/videos/index.ts b/server/server/middlewares/validators/videos/index.tsnew file mode 100644index 0000000000..05c6659ae0--- /dev/null+++ b/server/server/middlewares/validators/videos/index.ts@@ -0,0 +1,19 @@+export * from './video-blacklist.js'+export * from './video-captions.js'+export * from './video-channel-sync.js'+export * from './video-channels.js'+export * from './video-comments.js'+export * from './video-files.js'+export * from './video-imports.js'+export * from './video-live.js'+export * from './video-ownership-changes.js'+export * from './video-passwords.js'+export * from './video-rates.js'+export * from './video-shares.js'+export * from './video-source.js'+export * from './video-stats.js'+export * from './video-studio.js'+export * from './video-token.js'+export * from './video-transcoding.js'+export * from './video-view.js'+export * from './videos.js'diff --git a/server/server/middlewares/validators/videos/shared/index.ts b/server/server/middlewares/validators/videos/shared/index.tsnew file mode 100644index 0000000000..cb1a25a742--- /dev/null+++ b/server/server/middlewares/validators/videos/shared/index.ts@@ -0,0 +1,2 @@+export * from './upload.js'+export * from './video-validators.js'diff --git a/server/middlewares/validators/videos/shared/upload.ts b/server/server/middlewares/validators/videos/shared/upload.tssimilarity index 86%rename from server/middlewares/validators/videos/shared/upload.tsrename to server/server/middlewares/validators/videos/shared/upload.tsindex ea0dddc3c2..6798acc434 100644--- a/server/middlewares/validators/videos/shared/upload.ts+++ b/server/server/middlewares/validators/videos/shared/upload.ts@@ -1,7 +1,7 @@import express from 'express'-import { logger } from '@server/helpers/logger'-import { getVideoStreamDuration } from '@shared/ffmpeg'-import { HttpStatusCode } from '@shared/models'+import { logger } from '@server/helpers/logger.js'+import { getVideoStreamDuration } from '@peertube/peertube-ffmpeg'+import { HttpStatusCode } from '@peertube/peertube-models'export async function addDurationToVideoFileIfNeeded (options: {res: express.Responsediff --git a/server/middlewares/validators/videos/shared/video-validators.ts b/server/server/middlewares/validators/videos/shared/video-validators.tssimilarity index 84%rename from server/middlewares/validators/videos/shared/video-validators.tsrename to server/server/middlewares/validators/videos/shared/video-validators.tsindex 95e4fef116..27d86a35e9 100644--- a/server/middlewares/validators/videos/shared/video-validators.ts+++ b/server/server/middlewares/validators/videos/shared/video-validators.ts@@ -1,12 +1,12 @@import express from 'express'-import { isVideoFileMimeTypeValid, isVideoFileSizeValid } from '@server/helpers/custom-validators/videos'-import { logger } from '@server/helpers/logger'-import { CONSTRAINTS_FIELDS } from '@server/initializers/constants'-import { isLocalVideoFileAccepted } from '@server/lib/moderation'-import { Hooks } from '@server/lib/plugins/hooks'-import { MUserAccountId, MVideo } from '@server/types/models'-import { HttpStatusCode, ServerErrorCode, ServerFilterHookName, VideoState } from '@shared/models'-import { checkUserQuota } from '../../shared'+import { HttpStatusCode, ServerErrorCode, ServerFilterHookName, VideoState, VideoStateType } from '@peertube/peertube-models'+import { isVideoFileMimeTypeValid, isVideoFileSizeValid } from '@server/helpers/custom-validators/videos.js'+import { logger } from '@server/helpers/logger.js'+import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'+import { isLocalVideoFileAccepted } from '@server/lib/moderation.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { MUserAccountId, MVideo } from '@server/types/models/index.js'+import { checkUserQuota } from '../../shared/index.js'export async function commonVideoFileChecks (options: {res: express.Response@@ -86,7 +86,12 @@ export function checkVideoFileCanBeEdited (video: MVideo, res: express.Response)return false}- const validStates = new Set([ VideoState.PUBLISHED, VideoState.TO_MOVE_TO_EXTERNAL_STORAGE_FAILED, VideoState.TRANSCODING_FAILED ])+ const validStates = new Set<VideoStateType>([+ VideoState.PUBLISHED,+ VideoState.TO_MOVE_TO_EXTERNAL_STORAGE_FAILED,+ VideoState.TRANSCODING_FAILED+ ])+if (!validStates.has(video.state)) {res.fail({status: HttpStatusCode.BAD_REQUEST_400,diff --git a/server/middlewares/validators/videos/video-blacklist.ts b/server/server/middlewares/validators/videos/video-blacklist.tssimilarity index 92%rename from server/middlewares/validators/videos/video-blacklist.tsrename to server/server/middlewares/validators/videos/video-blacklist.tsindex 6b9aea07c9..8790a02a66 100644--- a/server/middlewares/validators/videos/video-blacklist.ts+++ b/server/server/middlewares/validators/videos/video-blacklist.ts@@ -1,9 +1,9 @@import express from 'express'import { body, query } from 'express-validator'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { isBooleanValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'-import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist'-import { areValidationErrors, doesVideoBlacklistExist, doesVideoExist, isValidVideoIdParam } from '../shared'+import { HttpStatusCode } from '@peertube/peertube-models'+import { isBooleanValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc.js'+import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../../helpers/custom-validators/video-blacklist.js'+import { areValidationErrors, doesVideoBlacklistExist, doesVideoExist, isValidVideoIdParam } from '../shared/index.js'const videosBlacklistRemoveValidator = [isValidVideoIdParam('videoId'),diff --git a/server/middlewares/validators/videos/video-captions.ts b/server/server/middlewares/validators/videos/video-captions.tssimilarity index 92%rename from server/middlewares/validators/videos/video-captions.tsrename to server/server/middlewares/validators/videos/video-captions.tsindex 077a58d2ed..d89b48f5f6 100644--- a/server/middlewares/validators/videos/video-captions.ts+++ b/server/server/middlewares/validators/videos/video-captions.ts@@ -1,9 +1,9 @@import express from 'express'import { body, param } from 'express-validator'-import { UserRight } from '@shared/models'-import { isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions'-import { cleanUpReqFiles } from '../../../helpers/express-utils'-import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../../initializers/constants'+import { UserRight } from '@peertube/peertube-models'+import { isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions.js'+import { cleanUpReqFiles } from '../../../helpers/express-utils.js'+import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../../initializers/constants.js'import {areValidationErrors,checkCanSeeVideo,@@ -12,7 +12,7 @@ import {doesVideoExist,isValidVideoIdParam,isValidVideoPasswordHeader-} from '../shared'+} from '../shared/index.js'const addVideoCaptionValidator = [isValidVideoIdParam('videoId'),diff --git a/server/middlewares/validators/videos/video-channel-sync.ts b/server/server/middlewares/validators/videos/video-channel-sync.tssimilarity index 90%rename from server/middlewares/validators/videos/video-channel-sync.tsrename to server/server/middlewares/validators/videos/video-channel-sync.tsindex 7e5b124717..1daf406254 100644--- a/server/middlewares/validators/videos/video-channel-sync.ts+++ b/server/server/middlewares/validators/videos/video-channel-sync.ts@@ -1,11 +1,11 @@import * as express from 'express'import { body, param } from 'express-validator'-import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc'-import { CONFIG } from '@server/initializers/config'-import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'-import { HttpStatusCode, VideoChannelSyncCreate } from '@shared/models'-import { areValidationErrors, doesVideoChannelIdExist } from '../shared'-import { doesVideoChannelSyncIdExist } from '../shared/video-channel-syncs'+import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc.js'+import { CONFIG } from '@server/initializers/config.js'+import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync.js'+import { HttpStatusCode, VideoChannelSyncCreate } from '@peertube/peertube-models'+import { areValidationErrors, doesVideoChannelIdExist } from '../shared/index.js'+import { doesVideoChannelSyncIdExist } from '../shared/video-channel-syncs.js'export const ensureSyncIsEnabled = (req: express.Request, res: express.Response, next: express.NextFunction) => {if (!CONFIG.IMPORT.VIDEO_CHANNEL_SYNCHRONIZATION.ENABLED) {diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/server/middlewares/validators/videos/video-channels.tssimilarity index 92%rename from server/middlewares/validators/videos/video-channels.tsrename to server/server/middlewares/validators/videos/video-channels.tsindex ca6b570035..f67bc25740 100644--- a/server/middlewares/validators/videos/video-channels.ts+++ b/server/server/middlewares/validators/videos/video-channels.ts@@ -1,21 +1,20 @@import express from 'express'import { body, param, query } from 'express-validator'-import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc'-import { CONFIG } from '@server/initializers/config'-import { MChannelAccountDefault } from '@server/types/models'-import { VideosImportInChannelCreate } from '@shared/models'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { isBooleanValid, isIdValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc'+import { HttpStatusCode, VideosImportInChannelCreate } from '@peertube/peertube-models'+import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc.js'+import { CONFIG } from '@server/initializers/config.js'+import { MChannelAccountDefault } from '@server/types/models/index.js'+import { isBooleanValid, isIdValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc.js'import {isVideoChannelDescriptionValid,isVideoChannelDisplayNameValid,isVideoChannelSupportValid,isVideoChannelUsernameValid-} from '../../../helpers/custom-validators/video-channels'-import { ActorModel } from '../../../models/actor/actor'-import { VideoChannelModel } from '../../../models/video/video-channel'-import { areValidationErrors, checkUserQuota, doesVideoChannelNameWithHostExist } from '../shared'-import { doesVideoChannelSyncIdExist } from '../shared/video-channel-syncs'+} from '../../../helpers/custom-validators/video-channels.js'+import { ActorModel } from '../../../models/actor/actor.js'+import { VideoChannelModel } from '../../../models/video/video-channel.js'+import { areValidationErrors, checkUserQuota, doesVideoChannelNameWithHostExist } from '../shared/index.js'+import { doesVideoChannelSyncIdExist } from '../shared/video-channel-syncs.js'export const videoChannelsAddValidator = [body('name')diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/server/middlewares/validators/videos/video-comments.tssimilarity index 94%rename from server/middlewares/validators/videos/video-comments.tsrename to server/server/middlewares/validators/videos/video-comments.tsindex 70689b02e3..284d87e859 100644--- a/server/middlewares/validators/videos/video-comments.ts+++ b/server/server/middlewares/validators/videos/video-comments.ts@@ -1,13 +1,13 @@import express from 'express'import { body, param, query } from 'express-validator'-import { MUserAccountUrl } from '@server/types/models'-import { HttpStatusCode, UserRight } from '@shared/models'-import { exists, isBooleanValid, isIdValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc'-import { isValidVideoCommentText } from '../../../helpers/custom-validators/video-comments'-import { logger } from '../../../helpers/logger'-import { AcceptResult, isLocalVideoCommentReplyAccepted, isLocalVideoThreadAccepted } from '../../../lib/moderation'-import { Hooks } from '../../../lib/plugins/hooks'-import { MCommentOwnerVideoReply, MVideo, MVideoFullLight } from '../../../types/models/video'+import { MUserAccountUrl } from '@server/types/models/index.js'+import { HttpStatusCode, UserRight } from '@peertube/peertube-models'+import { exists, isBooleanValid, isIdValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc.js'+import { isValidVideoCommentText } from '../../../helpers/custom-validators/video-comments.js'+import { logger } from '../../../helpers/logger.js'+import { AcceptResult, isLocalVideoCommentReplyAccepted, isLocalVideoThreadAccepted } from '../../../lib/moderation.js'+import { Hooks } from '../../../lib/plugins/hooks.js'+import { MCommentOwnerVideoReply, MVideo, MVideoFullLight } from '../../../types/models/video/index.js'import {areValidationErrors,checkCanSeeVideo,@@ -16,7 +16,7 @@ import {doesVideoExist,isValidVideoIdParam,isValidVideoPasswordHeader-} from '../shared'+} from '../shared/index.js'const listVideoCommentsValidator = [query('isLocal')diff --git a/server/middlewares/validators/videos/video-files.ts b/server/server/middlewares/validators/videos/video-files.tssimilarity index 96%rename from server/middlewares/validators/videos/video-files.tsrename to server/server/middlewares/validators/videos/video-files.tsindex 6c0ecda428..0a14fa1340 100644--- a/server/middlewares/validators/videos/video-files.ts+++ b/server/server/middlewares/validators/videos/video-files.ts@@ -1,9 +1,9 @@import express from 'express'import { param } from 'express-validator'-import { isIdValid } from '@server/helpers/custom-validators/misc'-import { MVideo } from '@server/types/models'-import { HttpStatusCode } from '@shared/models'-import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'+import { isIdValid } from '@server/helpers/custom-validators/misc.js'+import { MVideo } from '@server/types/models/index.js'+import { HttpStatusCode } from '@peertube/peertube-models'+import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared/index.js'const videoFilesDeleteWebVideoValidator = [isValidVideoIdParam('id'),diff --git a/server/middlewares/validators/videos/video-imports.ts b/server/server/middlewares/validators/videos/video-imports.tssimilarity index 88%rename from server/middlewares/validators/videos/video-imports.tsrename to server/server/middlewares/validators/videos/video-imports.tsindex a1cb65b708..c9fceadaec 100644--- a/server/middlewares/validators/videos/video-imports.ts+++ b/server/server/middlewares/validators/videos/video-imports.ts@@ -1,25 +1,20 @@import express from 'express'import { body, param, query } from 'express-validator'-import { isResolvingToUnicastOnly } from '@server/helpers/dns'-import { isPreImportVideoAccepted } from '@server/lib/moderation'-import { Hooks } from '@server/lib/plugins/hooks'-import { MUserAccountId, MVideoImport } from '@server/types/models'-import { forceNumber } from '@shared/core-utils'-import { HttpStatusCode, UserRight, VideoImportState } from '@shared/models'-import { VideoImportCreate } from '@shared/models/videos/import/video-import-create.model'-import { isIdValid, toIntOrNull } from '../../../helpers/custom-validators/misc'-import { isVideoImportTargetUrlValid, isVideoImportTorrentFile } from '../../../helpers/custom-validators/video-imports'-import {- isValidPasswordProtectedPrivacy,- isVideoMagnetUriValid,- isVideoNameValid-} from '../../../helpers/custom-validators/videos'-import { cleanUpReqFiles } from '../../../helpers/express-utils'-import { logger } from '../../../helpers/logger'-import { CONFIG } from '../../../initializers/config'-import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'-import { areValidationErrors, doesVideoChannelOfAccountExist, doesVideoImportExist } from '../shared'-import { getCommonVideoEditAttributes } from './videos'+import { forceNumber } from '@peertube/peertube-core-utils'+import { HttpStatusCode, UserRight, VideoImportCreate, VideoImportState } from '@peertube/peertube-models'+import { isResolvingToUnicastOnly } from '@server/helpers/dns.js'+import { isPreImportVideoAccepted } from '@server/lib/moderation.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { MUserAccountId, MVideoImport } from '@server/types/models/index.js'+import { isIdValid, toIntOrNull } from '../../../helpers/custom-validators/misc.js'+import { isVideoImportTargetUrlValid, isVideoImportTorrentFile } from '../../../helpers/custom-validators/video-imports.js'+import { isValidPasswordProtectedPrivacy, isVideoMagnetUriValid, isVideoNameValid } from '../../../helpers/custom-validators/videos.js'+import { cleanUpReqFiles } from '../../../helpers/express-utils.js'+import { logger } from '../../../helpers/logger.js'+import { CONFIG } from '../../../initializers/config.js'+import { CONSTRAINTS_FIELDS } from '../../../initializers/constants.js'+import { areValidationErrors, doesVideoChannelOfAccountExist, doesVideoImportExist } from '../shared/index.js'+import { getCommonVideoEditAttributes } from './videos.js'const videoImportAddValidator = getCommonVideoEditAttributes().concat([body('channelId')diff --git a/server/middlewares/validators/videos/video-live.ts b/server/server/middlewares/validators/videos/video-live.tssimilarity index 94%rename from server/middlewares/validators/videos/video-live.tsrename to server/server/middlewares/validators/videos/video-live.tsindex ec69a3011c..097da079d1 100644--- a/server/middlewares/validators/videos/video-live.ts+++ b/server/server/middlewares/validators/videos/video-live.ts@@ -1,12 +1,12 @@import express from 'express'import { body } from 'express-validator'-import { isLiveLatencyModeValid } from '@server/helpers/custom-validators/video-lives'-import { CONSTRAINTS_FIELDS } from '@server/initializers/constants'-import { isLocalLiveVideoAccepted } from '@server/lib/moderation'-import { Hooks } from '@server/lib/plugins/hooks'-import { VideoModel } from '@server/models/video/video'-import { VideoLiveModel } from '@server/models/video/video-live'-import { VideoLiveSessionModel } from '@server/models/video/video-live-session'+import { isLiveLatencyModeValid } from '@server/helpers/custom-validators/video-lives.js'+import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'+import { isLocalLiveVideoAccepted } from '@server/lib/moderation.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { VideoModel } from '@server/models/video/video.js'+import { VideoLiveModel } from '@server/models/video/video-live.js'+import { VideoLiveSessionModel } from '@server/models/video/video-live-session.js'import {HttpStatusCode,LiveVideoCreate,@@ -15,20 +15,20 @@ import {ServerErrorCode,UserRight,VideoState-} from '@shared/models'-import { exists, isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'-import { isValidPasswordProtectedPrivacy, isVideoNameValid, isVideoReplayPrivacyValid } from '../../../helpers/custom-validators/videos'-import { cleanUpReqFiles } from '../../../helpers/express-utils'-import { logger } from '../../../helpers/logger'-import { CONFIG } from '../../../initializers/config'+} from '@peertube/peertube-models'+import { exists, isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc.js'+import { isValidPasswordProtectedPrivacy, isVideoNameValid, isVideoReplayPrivacyValid } from '../../../helpers/custom-validators/videos.js'+import { cleanUpReqFiles } from '../../../helpers/express-utils.js'+import { logger } from '../../../helpers/logger.js'+import { CONFIG } from '../../../initializers/config.js'import {areValidationErrors,checkUserCanManageVideo,doesVideoChannelOfAccountExist,doesVideoExist,isValidVideoIdParam-} from '../shared'-import { getCommonVideoEditAttributes } from './videos'+} from '../shared/index.js'+import { getCommonVideoEditAttributes } from './videos.js'const videoLiveGetValidator = [isValidVideoIdParam('videoId'),diff --git a/server/middlewares/validators/videos/video-ownership-changes.ts b/server/server/middlewares/validators/videos/video-ownership-changes.tssimilarity index 91%rename from server/middlewares/validators/videos/video-ownership-changes.tsrename to server/server/middlewares/validators/videos/video-ownership-changes.tsindex 3eca78c25a..0cdb077b3c 100644--- a/server/middlewares/validators/videos/video-ownership-changes.ts+++ b/server/server/middlewares/validators/videos/video-ownership-changes.ts@@ -1,10 +1,10 @@import express from 'express'import { param } from 'express-validator'-import { isIdValid } from '@server/helpers/custom-validators/misc'-import { checkUserCanTerminateOwnershipChange } from '@server/helpers/custom-validators/video-ownership'-import { AccountModel } from '@server/models/account/account'-import { MVideoWithAllFiles } from '@server/types/models'-import { HttpStatusCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models'+import { isIdValid } from '@server/helpers/custom-validators/misc.js'+import { checkUserCanTerminateOwnershipChange } from '@server/helpers/custom-validators/video-ownership.js'+import { AccountModel } from '@server/models/account/account.js'+import { MVideoWithAllFiles } from '@server/types/models/index.js'+import { HttpStatusCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@peertube/peertube-models'import {areValidationErrors,checkUserCanManageVideo,@@ -13,7 +13,7 @@ import {doesVideoChannelOfAccountExist,doesVideoExist,isValidVideoIdParam-} from '../shared'+} from '../shared/index.js'const videosChangeOwnershipValidator = [isValidVideoIdParam('videoId'),diff --git a/server/middlewares/validators/videos/video-passwords.ts b/server/server/middlewares/validators/videos/video-passwords.tssimilarity index 95%rename from server/middlewares/validators/videos/video-passwords.tsrename to server/server/middlewares/validators/videos/video-passwords.tsindex 200e496f6b..58ca224f45 100644--- a/server/middlewares/validators/videos/video-passwords.ts+++ b/server/server/middlewares/validators/videos/video-passwords.ts@@ -7,11 +7,11 @@ import {doesVideoPasswordExist,isVideoPasswordDeletable,checkUserCanManageVideo-} from '../shared'+} from '../shared/index.js'import { body, param } from 'express-validator'-import { isIdValid } from '@server/helpers/custom-validators/misc'-import { isValidPasswordProtectedPrivacy } from '@server/helpers/custom-validators/videos'-import { UserRight } from '@shared/models'+import { isIdValid } from '@server/helpers/custom-validators/misc.js'+import { isValidPasswordProtectedPrivacy } from '@server/helpers/custom-validators/videos.js'+import { UserRight } from '@peertube/peertube-models'const listVideoPasswordValidator = [isValidVideoIdParam('videoId'),diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/server/middlewares/validators/videos/video-playlists.tssimilarity index 94%rename from server/middlewares/validators/videos/video-playlists.tsrename to server/server/middlewares/validators/videos/video-playlists.tsindex 95a5ba63ad..1e49981016 100644--- a/server/middlewares/validators/videos/video-playlists.ts+++ b/server/server/middlewares/validators/videos/video-playlists.ts@@ -1,16 +1,17 @@import express from 'express'import { body, param, query, ValidationChain } from 'express-validator'-import { ExpressPromiseHandler } from '@server/types/express-handler'-import { MUserAccountId } from '@server/types/models'-import { forceNumber } from '@shared/core-utils'+import { forceNumber } from '@peertube/peertube-core-utils'import {HttpStatusCode,UserRight,+ UserRightType,VideoPlaylistCreate,VideoPlaylistPrivacy,VideoPlaylistType,VideoPlaylistUpdate-} from '@shared/models'+} from '@peertube/peertube-models'+import { ExpressPromiseHandler } from '@server/types/express-handler.js'+import { MUserAccountId } from '@server/types/models/index.js'import {isArrayOf,isIdOrUUIDValid,@@ -20,20 +21,20 @@ import {toIntArray,toIntOrNull,toValueOrNull-} from '../../../helpers/custom-validators/misc'+} from '../../../helpers/custom-validators/misc.js'import {isVideoPlaylistDescriptionValid,isVideoPlaylistNameValid,isVideoPlaylistPrivacyValid,isVideoPlaylistTimestampValid,isVideoPlaylistTypeValid-} from '../../../helpers/custom-validators/video-playlists'-import { isVideoImageValid } from '../../../helpers/custom-validators/videos'-import { cleanUpReqFiles } from '../../../helpers/express-utils'-import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'-import { VideoPlaylistElementModel } from '../../../models/video/video-playlist-element'-import { MVideoPlaylist } from '../../../types/models/video/video-playlist'-import { authenticatePromise } from '../../auth'+} from '../../../helpers/custom-validators/video-playlists.js'+import { isVideoImageValid } from '../../../helpers/custom-validators/videos.js'+import { cleanUpReqFiles } from '../../../helpers/express-utils.js'+import { CONSTRAINTS_FIELDS } from '../../../initializers/constants.js'+import { VideoPlaylistElementModel } from '../../../models/video/video-playlist-element.js'+import { MVideoPlaylist } from '../../../types/models/video/video-playlist.js'+import { authenticatePromise } from '../../auth.js'import {areValidationErrors,doesVideoChannelIdExist,@@ -41,7 +42,7 @@ import {doesVideoPlaylistExist,isValidPlaylistIdParam,VideoPlaylistFetchType-} from '../shared'+} from '../shared/index.js'const videoPlaylistsAddValidator = getCommonPlaylistEditAttributes().concat([body('displayName')@@ -391,7 +392,12 @@ function getCommonPlaylistEditAttributes () {] as (ValidationChain | ExpressPromiseHandler)[]}-function checkUserCanManageVideoPlaylist (user: MUserAccountId, videoPlaylist: MVideoPlaylist, right: UserRight, res: express.Response) {+function checkUserCanManageVideoPlaylist (+ user: MUserAccountId,+ videoPlaylist: MVideoPlaylist,+ right: UserRightType,+ res: express.Response+) {if (videoPlaylist.isOwned() === false) {res.fail({status: HttpStatusCode.FORBIDDEN_403,diff --git a/server/middlewares/validators/videos/video-rates.ts b/server/server/middlewares/validators/videos/video-rates.tssimilarity index 90%rename from server/middlewares/validators/videos/video-rates.tsrename to server/server/middlewares/validators/videos/video-rates.tsindex c837b047b9..f7b784fe3b 100644--- a/server/middlewares/validators/videos/video-rates.ts+++ b/server/server/middlewares/validators/videos/video-rates.ts@@ -1,13 +1,12 @@import express from 'express'import { body, param, query } from 'express-validator'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { VideoRateType } from '../../../../shared/models/videos'-import { isAccountNameValid } from '../../../helpers/custom-validators/accounts'-import { isIdValid } from '../../../helpers/custom-validators/misc'-import { isRatingValid } from '../../../helpers/custom-validators/video-rates'-import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos'-import { AccountVideoRateModel } from '../../../models/account/account-video-rate'-import { areValidationErrors, checkCanSeeVideo, doesVideoExist, isValidVideoIdParam, isValidVideoPasswordHeader } from '../shared'+import { HttpStatusCode, VideoRateType } from '@peertube/peertube-models'+import { isAccountNameValid } from '../../../helpers/custom-validators/accounts.js'+import { isIdValid } from '../../../helpers/custom-validators/misc.js'+import { isRatingValid } from '../../../helpers/custom-validators/video-rates.js'+import { isVideoRatingTypeValid } from '../../../helpers/custom-validators/videos.js'+import { AccountVideoRateModel } from '../../../models/account/account-video-rate.js'+import { areValidationErrors, checkCanSeeVideo, doesVideoExist, isValidVideoIdParam, isValidVideoPasswordHeader } from '../shared/index.js'const videoUpdateRateValidator = [isValidVideoIdParam('id'),diff --git a/server/middlewares/validators/videos/video-shares.ts b/server/server/middlewares/validators/videos/video-shares.tssimilarity index 89%rename from server/middlewares/validators/videos/video-shares.tsrename to server/server/middlewares/validators/videos/video-shares.tsindex c234de6ed5..1ecf0fd04b 100644--- a/server/middlewares/validators/videos/video-shares.ts+++ b/server/server/middlewares/validators/videos/video-shares.ts@@ -1,9 +1,9 @@import express from 'express'import { param } from 'express-validator'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { isIdValid } from '../../../helpers/custom-validators/misc'-import { VideoShareModel } from '../../../models/video/video-share'-import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'+import { HttpStatusCode } from '@peertube/peertube-models'+import { isIdValid } from '../../../helpers/custom-validators/misc.js'+import { VideoShareModel } from '../../../models/video/video-share.js'+import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared/index.js'const videosShareValidator = [isValidVideoIdParam('id'),diff --git a/server/middlewares/validators/videos/video-source.ts b/server/server/middlewares/validators/videos/video-source.tssimilarity index 87%rename from server/middlewares/validators/videos/video-source.tsrename to server/server/middlewares/validators/videos/video-source.tsindex bbccb58b08..3d4f77e218 100644--- a/server/middlewares/validators/videos/video-source.ts+++ b/server/server/middlewares/validators/videos/video-source.ts@@ -1,16 +1,16 @@import express from 'express'import { body, header } from 'express-validator'-import { getResumableUploadPath } from '@server/helpers/upload'-import { getVideoWithAttributes } from '@server/helpers/video'-import { CONFIG } from '@server/initializers/config'-import { uploadx } from '@server/lib/uploadx'-import { VideoSourceModel } from '@server/models/video/video-source'-import { MVideoFullLight } from '@server/types/models'-import { HttpStatusCode, UserRight } from '@shared/models'+import { getResumableUploadPath } from '@server/helpers/upload.js'+import { getVideoWithAttributes } from '@server/helpers/video.js'+import { CONFIG } from '@server/initializers/config.js'+import { uploadx } from '@server/lib/uploadx.js'+import { VideoSourceModel } from '@server/models/video/video-source.js'+import { MVideoFullLight } from '@server/types/models/index.js'+import { HttpStatusCode, UserRight } from '@peertube/peertube-models'import { Metadata as UploadXMetadata } from '@uploadx/core'-import { logger } from '../../../helpers/logger'-import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared'-import { addDurationToVideoFileIfNeeded, checkVideoFileCanBeEdited, commonVideoFileChecks, isVideoFileAccepted } from './shared'+import { logger } from '../../../helpers/logger.js'+import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared/index.js'+import { addDurationToVideoFileIfNeeded, checkVideoFileCanBeEdited, commonVideoFileChecks, isVideoFileAccepted } from './shared/index.js'export const videoSourceGetLatestValidator = [isValidVideoIdParam('id'),diff --git a/server/middlewares/validators/videos/video-stats.ts b/server/server/middlewares/validators/videos/video-stats.tssimilarity index 94%rename from server/middlewares/validators/videos/video-stats.tsrename to server/server/middlewares/validators/videos/video-stats.tsindex a79526d397..c490c8f828 100644--- a/server/middlewares/validators/videos/video-stats.ts+++ b/server/server/middlewares/validators/videos/video-stats.ts@@ -1,10 +1,10 @@import express from 'express'import { param, query } from 'express-validator'-import { isDateValid } from '@server/helpers/custom-validators/misc'-import { isValidStatTimeserieMetric } from '@server/helpers/custom-validators/video-stats'-import { STATS_TIMESERIE } from '@server/initializers/constants'-import { HttpStatusCode, UserRight, VideoStatsTimeserieQuery } from '@shared/models'-import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared'+import { isDateValid } from '@server/helpers/custom-validators/misc.js'+import { isValidStatTimeserieMetric } from '@server/helpers/custom-validators/video-stats.js'+import { STATS_TIMESERIE } from '@server/initializers/constants.js'+import { HttpStatusCode, UserRight, VideoStatsTimeserieQuery } from '@peertube/peertube-models'+import { areValidationErrors, checkUserCanManageVideo, doesVideoExist, isValidVideoIdParam } from '../shared/index.js'const videoOverallStatsValidator = [isValidVideoIdParam('videoId'),diff --git a/server/middlewares/validators/videos/video-studio.ts b/server/server/middlewares/validators/videos/video-studio.tssimilarity index 88%rename from server/middlewares/validators/videos/video-studio.tsrename to server/server/middlewares/validators/videos/video-studio.tsindex a375af60ae..6f6f2dc542 100644--- a/server/middlewares/validators/videos/video-studio.ts+++ b/server/server/middlewares/validators/videos/video-studio.ts@@ -1,19 +1,19 @@import express from 'express'import { body, param } from 'express-validator'-import { isIdOrUUIDValid } from '@server/helpers/custom-validators/misc'+import { isIdOrUUIDValid } from '@server/helpers/custom-validators/misc.js'import {isStudioCutTaskValid,isStudioTaskAddIntroOutroValid,isStudioTaskAddWatermarkValid,isValidStudioTasksArray-} from '@server/helpers/custom-validators/video-studio'-import { cleanUpReqFiles } from '@server/helpers/express-utils'-import { CONFIG } from '@server/initializers/config'-import { approximateIntroOutroAdditionalSize, getTaskFileFromReq } from '@server/lib/video-studio'-import { isAudioFile } from '@shared/ffmpeg'-import { HttpStatusCode, UserRight, VideoStudioCreateEdition, VideoStudioTask } from '@shared/models'-import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared'-import { checkVideoFileCanBeEdited } from './shared'+} from '@server/helpers/custom-validators/video-studio.js'+import { cleanUpReqFiles } from '@server/helpers/express-utils.js'+import { CONFIG } from '@server/initializers/config.js'+import { approximateIntroOutroAdditionalSize, getTaskFileFromReq } from '@server/lib/video-studio.js'+import { isAudioFile } from '@peertube/peertube-ffmpeg'+import { HttpStatusCode, UserRight, VideoStudioCreateEdition, VideoStudioTask } from '@peertube/peertube-models'+import { areValidationErrors, checkUserCanManageVideo, checkUserQuota, doesVideoExist } from '../shared/index.js'+import { checkVideoFileCanBeEdited } from './shared/index.js'const videoStudioAddEditionValidator = [param('videoId')diff --git a/server/middlewares/validators/videos/video-token.ts b/server/server/middlewares/validators/videos/video-token.tssimilarity index 75%rename from server/middlewares/validators/videos/video-token.tsrename to server/server/middlewares/validators/videos/video-token.tsindex d4253e21d6..7489137551 100644--- a/server/middlewares/validators/videos/video-token.ts+++ b/server/server/middlewares/validators/videos/video-token.ts@@ -1,7 +1,6 @@import express from 'express'-import { VideoPrivacy } from '../../../../shared/models/videos'-import { HttpStatusCode } from '@shared/models'-import { exists } from '@server/helpers/custom-validators/misc'+import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'+import { exists } from '@server/helpers/custom-validators/misc.js'const videoFileTokenValidator = [(req: express.Request, res: express.Response, next: express.NextFunction) => {diff --git a/server/middlewares/validators/videos/video-transcoding.ts b/server/server/middlewares/validators/videos/video-transcoding.tssimilarity index 90%rename from server/middlewares/validators/videos/video-transcoding.tsrename to server/server/middlewares/validators/videos/video-transcoding.tsindex 2f99ff42c2..28f0579795 100644--- a/server/middlewares/validators/videos/video-transcoding.ts+++ b/server/server/middlewares/validators/videos/video-transcoding.ts@@ -1,11 +1,11 @@import express from 'express'import { body } from 'express-validator'-import { isBooleanValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc'-import { isValidCreateTranscodingType } from '@server/helpers/custom-validators/video-transcoding'-import { CONFIG } from '@server/initializers/config'-import { VideoJobInfoModel } from '@server/models/video/video-job-info'-import { HttpStatusCode, ServerErrorCode, VideoTranscodingCreate } from '@shared/models'-import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'+import { isBooleanValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc.js'+import { isValidCreateTranscodingType } from '@server/helpers/custom-validators/video-transcoding.js'+import { CONFIG } from '@server/initializers/config.js'+import { VideoJobInfoModel } from '@server/models/video/video-job-info.js'+import { HttpStatusCode, ServerErrorCode, VideoTranscodingCreate } from '@peertube/peertube-models'+import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared/index.js'const createTranscodingValidator = [isValidVideoIdParam('videoId'),diff --git a/server/middlewares/validators/videos/video-view.ts b/server/server/middlewares/validators/videos/video-view.tssimilarity index 88%rename from server/middlewares/validators/videos/video-view.tsrename to server/server/middlewares/validators/videos/video-view.tsindex a2f61f4ba3..14ee1da46c 100644--- a/server/middlewares/validators/videos/video-view.ts+++ b/server/server/middlewares/validators/videos/video-view.ts@@ -1,11 +1,11 @@import express from 'express'import { body, param } from 'express-validator'-import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view'-import { getCachedVideoDuration } from '@server/lib/video'-import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'-import { isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'-import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'+import { HttpStatusCode } from '@peertube/peertube-models'+import { isVideoTimeValid } from '@server/helpers/custom-validators/video-view.js'+import { getCachedVideoDuration } from '@server/lib/video.js'+import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer.js'+import { isIdValid, isIntOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc.js'+import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared/index.js'const getVideoLocalViewerValidator = [param('localViewerId')diff --git a/server/middlewares/validators/videos/videos.ts b/server/server/middlewares/validators/videos/videos.tssimilarity index 95%rename from server/middlewares/validators/videos/videos.tsrename to server/server/middlewares/validators/videos/videos.tsindex 5a49779ed7..a1f6e72c8e 100644--- a/server/middlewares/validators/videos/videos.ts+++ b/server/server/middlewares/validators/videos/videos.ts@@ -1,14 +1,14 @@import express from 'express'import { body, header, param, query, ValidationChain } from 'express-validator'-import { isTestInstance } from '@server/helpers/core-utils'-import { getResumableUploadPath } from '@server/helpers/upload'-import { Redis } from '@server/lib/redis'-import { uploadx } from '@server/lib/uploadx'-import { getServerActor } from '@server/models/application/application'-import { ExpressPromiseHandler } from '@server/types/express-handler'-import { MUserAccountId, MVideoFullLight } from '@server/types/models'-import { arrayify } from '@shared/core-utils'-import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@shared/models'+import { arrayify } from '@peertube/peertube-core-utils'+import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@peertube/peertube-models'+import { isTestInstance } from '@peertube/peertube-node-utils'+import { getResumableUploadPath } from '@server/helpers/upload.js'+import { Redis } from '@server/lib/redis.js'+import { uploadx } from '@server/lib/uploadx.js'+import { getServerActor } from '@server/models/application/application.js'+import { ExpressPromiseHandler } from '@server/types/express-handler.js'+import { MUserAccountId, MVideoFullLight } from '@server/types/models/index.js'import {exists,isBooleanValid,@@ -18,8 +18,8 @@ import {toBooleanOrNull,toIntOrNull,toValueOrNull-} from '../../../helpers/custom-validators/misc'-import { isBooleanBothQueryValid, isNumberArray, isStringArray } from '../../../helpers/custom-validators/search'+} from '../../../helpers/custom-validators/misc.js'+import { isBooleanBothQueryValid, isNumberArray, isStringArray } from '../../../helpers/custom-validators/search.js'import {areVideoTagsValid,isScheduleVideoUpdatePrivacyValid,@@ -34,13 +34,13 @@ import {isVideoOriginallyPublishedAtValid,isVideoPrivacyValid,isVideoSupportValid-} from '../../../helpers/custom-validators/videos'-import { cleanUpReqFiles } from '../../../helpers/express-utils'-import { logger } from '../../../helpers/logger'-import { getVideoWithAttributes } from '../../../helpers/video'-import { CONFIG } from '../../../initializers/config'-import { CONSTRAINTS_FIELDS, OVERVIEWS } from '../../../initializers/constants'-import { VideoModel } from '../../../models/video/video'+} from '../../../helpers/custom-validators/videos.js'+import { cleanUpReqFiles } from '../../../helpers/express-utils.js'+import { logger } from '../../../helpers/logger.js'+import { getVideoWithAttributes } from '../../../helpers/video.js'+import { CONFIG } from '../../../initializers/config.js'+import { CONSTRAINTS_FIELDS, OVERVIEWS } from '../../../initializers/constants.js'+import { VideoModel } from '../../../models/video/video.js'import {areValidationErrors,checkCanAccessVideoStaticFiles,@@ -51,8 +51,8 @@ import {doesVideoFileOfVideoExist,isValidVideoIdParam,isValidVideoPasswordHeader-} from '../shared'-import { addDurationToVideoFileIfNeeded, commonVideoFileChecks, isVideoFileAccepted } from './shared'+} from '../shared/index.js'+import { addDurationToVideoFileIfNeeded, commonVideoFileChecks, isVideoFileAccepted } from './shared/index.js'const videosAddLegacyValidator = getCommonVideoEditAttributes().concat([body('videofile')diff --git a/server/middlewares/validators/webfinger.ts b/server/server/middlewares/validators/webfinger.tssimilarity index 77%rename from server/middlewares/validators/webfinger.tsrename to server/server/middlewares/validators/webfinger.tsindex dcfba99fa8..63855bbf38 100644--- a/server/middlewares/validators/webfinger.ts+++ b/server/server/middlewares/validators/webfinger.ts@@ -1,10 +1,10 @@import express from 'express'import { query } from 'express-validator'-import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'-import { isWebfingerLocalResourceValid } from '../../helpers/custom-validators/webfinger'-import { getHostWithPort } from '../../helpers/express-utils'-import { ActorModel } from '../../models/actor/actor'-import { areValidationErrors } from './shared'+import { HttpStatusCode } from '@peertube/peertube-models'+import { isWebfingerLocalResourceValid } from '../../helpers/custom-validators/webfinger.js'+import { getHostWithPort } from '../../helpers/express-utils.js'+import { ActorModel } from '../../models/actor/actor.js'+import { areValidationErrors } from './shared/index.js'const webfingerValidator = [query('resource')diff --git a/server/models/abuse/abuse-message.ts b/server/server/models/abuse/abuse-message.tssimilarity index 87%rename from server/models/abuse/abuse-message.tsrename to server/server/models/abuse/abuse-message.tsindex 14a5bffa28..9ba080e779 100644--- a/server/models/abuse/abuse-message.ts+++ b/server/server/models/abuse/abuse-message.ts@@ -1,12 +1,12 @@import { FindOptions } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { isAbuseMessageValid } from '@server/helpers/custom-validators/abuses'-import { MAbuseMessage, MAbuseMessageFormattable } from '@server/types/models'-import { AbuseMessage } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { AccountModel, ScopeNames as AccountScopeNames } from '../account/account'-import { getSort, throwIfNotValid } from '../shared'-import { AbuseModel } from './abuse'+import { isAbuseMessageValid } from '@server/helpers/custom-validators/abuses.js'+import { MAbuseMessage, MAbuseMessageFormattable } from '@server/types/models/index.js'+import { AbuseMessage } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { AccountModel, ScopeNames as AccountScopeNames } from '../account/account.js'+import { getSort, throwIfNotValid } from '../shared/index.js'+import { AbuseModel } from './abuse.js'@Table({tableName: 'abuseMessage',@@ -47,7 +47,7 @@ export class AbuseMessageModel extends Model<Partial<AttributesOnly<AbuseMessage},onDelete: 'set null'})- Account: AccountModel+ Account: Awaited<AccountModel>@ForeignKey(() => AbuseModel)@Column@@ -60,7 +60,7 @@ export class AbuseMessageModel extends Model<Partial<AttributesOnly<AbuseMessage},onDelete: 'cascade'})- Abuse: AbuseModel+ Abuse: Awaited<AbuseModel>static listForApi (abuseId: number) {const getQuery = (forCount: boolean) => {diff --git a/server/models/abuse/abuse.ts b/server/server/models/abuse/abuse.tssimilarity index 90%rename from server/models/abuse/abuse.tsrename to server/server/models/abuse/abuse.tsindex 4ce40bf2f3..8a8e292e49 100644--- a/server/models/abuse/abuse.ts+++ b/server/server/models/abuse/abuse.ts@@ -1,5 +1,21 @@-import { invert } from 'lodash'-import { literal, Op, QueryTypes } from 'sequelize'+import { abusePredefinedReasonsMap } from '@peertube/peertube-core-utils'+import {+ AbuseFilter,+ AbuseObject,+ AbusePredefinedReasonsString,+ AbusePredefinedReasonsType,+ AbuseVideoIs,+ AdminAbuse,+ AdminVideoAbuse,+ AdminVideoCommentAbuse,+ UserAbuse,+ UserVideoAbuse,+ type AbuseStateType+} from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isAbuseModerationCommentValid, isAbuseReasonValid, isAbuseStateValid } from '@server/helpers/custom-validators/abuses.js'+import invert from 'lodash-es/invert.js'+import { Op, QueryTypes, literal } from 'sequelize'import {AllowNull,BelongsTo,@@ -15,34 +31,25 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { isAbuseModerationCommentValid, isAbuseReasonValid, isAbuseStateValid } from '@server/helpers/custom-validators/abuses'-import { abusePredefinedReasonsMap } from '@shared/core-utils'+import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants.js'import {- AbuseFilter,- AbuseObject,- AbusePredefinedReasons,- AbusePredefinedReasonsString,- AbuseState,- AbuseVideoIs,- AdminAbuse,- AdminVideoAbuse,- AdminVideoCommentAbuse,- UserAbuse,- UserVideoAbuse-} from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { MAbuseAdminFormattable, MAbuseAP, MAbuseFull, MAbuseReporter, MAbuseUserFormattable, MUserAccountId } from '../../types/models'-import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account'-import { getSort, throwIfNotValid } from '../shared'-import { ThumbnailModel } from '../video/thumbnail'-import { ScopeNames as VideoScopeNames, VideoModel } from '../video/video'-import { VideoBlacklistModel } from '../video/video-blacklist'-import { ScopeNames as VideoChannelScopeNames, SummaryOptions as ChannelSummaryOptions, VideoChannelModel } from '../video/video-channel'-import { ScopeNames as CommentScopeNames, VideoCommentModel } from '../video/video-comment'-import { buildAbuseListQuery, BuildAbusesQueryOptions } from './sql/abuse-query-builder'-import { VideoAbuseModel } from './video-abuse'-import { VideoCommentAbuseModel } from './video-comment-abuse'+ MAbuseAP,+ MAbuseAdminFormattable,+ MAbuseFull,+ MAbuseReporter,+ MAbuseUserFormattable,+ MUserAccountId+} from '../../types/models/index.js'+import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account.js'+import { getSort, throwIfNotValid } from '../shared/index.js'+import { ThumbnailModel } from '../video/thumbnail.js'+import { VideoBlacklistModel } from '../video/video-blacklist.js'+import { SummaryOptions as ChannelSummaryOptions, VideoChannelModel, ScopeNames as VideoChannelScopeNames } from '../video/video-channel.js'+import { ScopeNames as CommentScopeNames, VideoCommentModel } from '../video/video-comment.js'+import { VideoModel, ScopeNames as VideoScopeNames } from '../video/video.js'+import { BuildAbusesQueryOptions, buildAbuseListQuery } from './sql/abuse-query-builder.js'+import { VideoAbuseModel } from './video-abuse.js'+import { VideoCommentAbuseModel } from './video-comment-abuse.js'export enum ScopeNames {FOR_API = 'FOR_API'@@ -200,7 +207,7 @@ export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {@Default(null)@Is('AbuseState', value => throwIfNotValid(value, isAbuseStateValid, 'state'))@Column- state: AbuseState+ state: AbuseStateType@AllowNull(true)@Default(null)@@ -211,7 +218,7 @@ export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {@AllowNull(true)@Default(null)@Column(DataType.ARRAY(DataType.INTEGER))- predefinedReasons: AbusePredefinedReasons[]+ predefinedReasons: AbusePredefinedReasonsType[]@CreatedAtcreatedAt: Date@@ -231,7 +238,7 @@ export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {as: 'ReporterAccount',onDelete: 'set null'})- ReporterAccount: AccountModel+ ReporterAccount: Awaited<AccountModel>@ForeignKey(() => AccountModel)@Column@@ -245,7 +252,7 @@ export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {as: 'FlaggedAccount',onDelete: 'set null'})- FlaggedAccount: AccountModel+ FlaggedAccount: Awaited<AccountModel>@HasOne(() => VideoCommentAbuseModel, {foreignKey: {@@ -254,7 +261,7 @@ export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {},onDelete: 'cascade'})- VideoCommentAbuse: VideoCommentAbuseModel+ VideoCommentAbuse: Awaited<VideoCommentAbuseModel>@HasOne(() => VideoAbuseModel, {foreignKey: {@@ -263,7 +270,7 @@ export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {},onDelete: 'cascade'})- VideoAbuse: VideoAbuseModel+ VideoAbuse: Awaited<VideoAbuseModel>static loadByIdWithReporter (id: number): Promise<MAbuseReporter> {const query = {@@ -339,7 +346,7 @@ export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {id?: numberpredefinedReason?: AbusePredefinedReasonsString- state?: AbuseState+ state?: AbuseStateTypevideoIs?: AbuseVideoIssearch?: string@@ -404,7 +411,7 @@ export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {id?: numbersearch?: string- state?: AbuseState+ state?: AbuseStateType}) {const {start,@@ -614,7 +621,7 @@ export class AbuseModel extends Model<Partial<AttributesOnly<AbuseModel>>> {return ABUSE_STATES[id] || 'Unknown'}- private static getPredefinedReasonsStrings (predefinedReasons: AbusePredefinedReasons[]): AbusePredefinedReasonsString[] {+ private static getPredefinedReasonsStrings (predefinedReasons: AbusePredefinedReasonsType[]): AbusePredefinedReasonsString[] {const invertedPredefinedReasons = invert(abusePredefinedReasonsMap)return (predefinedReasons || [])diff --git a/server/models/abuse/sql/abuse-query-builder.ts b/server/server/models/abuse/sql/abuse-query-builder.tssimilarity index 94%rename from server/models/abuse/sql/abuse-query-builder.tsrename to server/server/models/abuse/sql/abuse-query-builder.tsindex 282d4541a3..aeed91676b 100644--- a/server/models/abuse/sql/abuse-query-builder.ts+++ b/server/server/models/abuse/sql/abuse-query-builder.ts@@ -1,8 +1,8 @@-import { exists } from '@server/helpers/custom-validators/misc'-import { forceNumber } from '@shared/core-utils'-import { AbuseFilter, AbuseState, AbuseVideoIs } from '@shared/models'-import { buildBlockedAccountSQL, buildSortDirectionAndField } from '../../shared'+import { forceNumber } from '@peertube/peertube-core-utils'+import { AbuseFilter, AbuseStateType, AbuseVideoIs } from '@peertube/peertube-models'+import { exists } from '@server/helpers/custom-validators/misc.js'+import { buildBlockedAccountSQL, buildSortDirectionAndField } from '../../shared/index.js'export type BuildAbusesQueryOptions = {start: number@@ -24,7 +24,7 @@ export type BuildAbusesQueryOptions = {predefinedReasonId?: numberfilter?: AbuseFilter- state?: AbuseState+ state?: AbuseStateType// accountIdsserverAccountId?: numberdiff --git a/server/models/abuse/video-abuse.ts b/server/server/models/abuse/video-abuse.tssimilarity index 78%rename from server/models/abuse/video-abuse.tsrename to server/server/models/abuse/video-abuse.tsindex 773a9ebbab..1f2f85f1c2 100644--- a/server/models/abuse/video-abuse.ts+++ b/server/server/models/abuse/video-abuse.ts@@ -1,8 +1,8 @@+import { type VideoDetails } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoDetails } from '@shared/models'-import { VideoModel } from '../video/video'-import { AbuseModel } from './abuse'+import { VideoModel } from '../video/video.js'+import { AbuseModel } from './abuse.js'@Table({tableName: 'videoAbuse',@@ -48,7 +48,7 @@ export class VideoAbuseModel extends Model<Partial<AttributesOnly<VideoAbuseMode},onDelete: 'cascade'})- Abuse: AbuseModel+ Abuse: Awaited<AbuseModel>@ForeignKey(() => VideoModel)@Column@@ -60,5 +60,5 @@ export class VideoAbuseModel extends Model<Partial<AttributesOnly<VideoAbuseMode},onDelete: 'set null'})- Video: VideoModel+ Video: Awaited<VideoModel>}diff --git a/server/models/abuse/video-comment-abuse.ts b/server/server/models/abuse/video-comment-abuse.tssimilarity index 76%rename from server/models/abuse/video-comment-abuse.tsrename to server/server/models/abuse/video-comment-abuse.tsindex 337aaaa58e..6c5078aa8f 100644--- a/server/models/abuse/video-comment-abuse.ts+++ b/server/server/models/abuse/video-comment-abuse.ts@@ -1,7 +1,7 @@import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoCommentModel } from '../video/video-comment'-import { AbuseModel } from './abuse'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { VideoCommentModel } from '../video/video-comment.js'+import { AbuseModel } from './abuse.js'@Table({tableName: 'commentAbuse',@@ -32,7 +32,7 @@ export class VideoCommentAbuseModel extends Model<Partial<AttributesOnly<VideoCo},onDelete: 'cascade'})- Abuse: AbuseModel+ Abuse: Awaited<AbuseModel>@ForeignKey(() => VideoCommentModel)@Column@@ -44,5 +44,5 @@ export class VideoCommentAbuseModel extends Model<Partial<AttributesOnly<VideoCo},onDelete: 'set null'})- VideoComment: VideoCommentModel+ VideoComment: Awaited<VideoCommentModel>}diff --git a/server/models/account/account-blocklist.ts b/server/server/models/account/account-blocklist.tssimilarity index 93%rename from server/models/account/account-blocklist.tsrename to server/server/models/account/account-blocklist.tsindex f6212ff6e9..fa7fa80218 100644--- a/server/models/account/account-blocklist.ts+++ b/server/server/models/account/account-blocklist.ts@@ -1,13 +1,13 @@import { FindOptions, Op, QueryTypes } from 'sequelize'import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { handlesToNameAndHost } from '@server/helpers/actors'-import { MAccountBlocklist, MAccountBlocklistFormattable } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { AccountBlock } from '../../../shared/models'-import { ActorModel } from '../actor/actor'-import { ServerModel } from '../server/server'-import { createSafeIn, getSort, searchAttribute } from '../shared'-import { AccountModel } from './account'+import { AccountBlock } from '@peertube/peertube-models'+import { handlesToNameAndHost } from '@server/helpers/actors.js'+import { MAccountBlocklist, MAccountBlocklistFormattable } from '@server/types/models/index.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { ActorModel } from '../actor/actor.js'+import { ServerModel } from '../server/server.js'+import { createSafeIn, getSort, searchAttribute } from '../shared/index.js'+import { AccountModel } from './account.js'@Table({tableName: 'accountBlocklist',@@ -41,7 +41,7 @@ export class AccountBlocklistModel extends Model<Partial<AttributesOnly<AccountBas: 'ByAccount',onDelete: 'CASCADE'})- ByAccount: AccountModel+ ByAccount: Awaited<AccountModel>@ForeignKey(() => AccountModel)@Column@@ -55,7 +55,7 @@ export class AccountBlocklistModel extends Model<Partial<AttributesOnly<AccountBas: 'BlockedAccount',onDelete: 'CASCADE'})- BlockedAccount: AccountModel+ BlockedAccount: Awaited<AccountModel>static isAccountMutedByAccounts (accountIds: number[], targetAccountId: number) {const query = {diff --git a/server/models/account/account-video-rate.ts b/server/server/models/account/account-video-rate.tssimilarity index 90%rename from server/models/account/account-video-rate.tsrename to server/server/models/account/account-video-rate.tsindex 18ff07d539..0d099ff9f0 100644--- a/server/models/account/account-video-rate.ts+++ b/server/server/models/account/account-video-rate.ts@@ -1,20 +1,20 @@-import { FindOptions, Op, QueryTypes, Transaction } from 'sequelize'-import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'+import { AccountVideoRate, type VideoRateType } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'import {MAccountVideoRate,MAccountVideoRateAccountUrl,MAccountVideoRateAccountVideo,MAccountVideoRateFormattable-} from '@server/types/models'-import { AccountVideoRate, VideoRateType } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'-import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers/constants'-import { ActorModel } from '../actor/actor'-import { getSort, throwIfNotValid } from '../shared'-import { VideoModel } from '../video/video'-import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from '../video/video-channel'-import { AccountModel } from './account'+} from '@server/types/models/index.js'+import { FindOptions, Op, QueryTypes, Transaction } from 'sequelize'+import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'+import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'+import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers/constants.js'+import { ActorModel } from '../actor/actor.js'+import { getSort, throwIfNotValid } from '../shared/index.js'+import { SummaryOptions, VideoChannelModel, ScopeNames as VideoChannelScopeNames } from '../video/video-channel.js'+import { VideoModel } from '../video/video.js'+import { AccountModel } from './account.js'/*Account rates per video.@@ -68,7 +68,7 @@ export class AccountVideoRateModel extends Model<Partial<AttributesOnly<AccountV},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>@ForeignKey(() => AccountModel)@Column@@ -80,7 +80,7 @@ export class AccountVideoRateModel extends Model<Partial<AttributesOnly<AccountV},onDelete: 'CASCADE'})- Account: AccountModel+ Account: Awaited<AccountModel>static load (accountId: number, videoId: number, transaction?: Transaction): Promise<MAccountVideoRate> {const options: FindOptions = {diff --git a/server/models/account/account.ts b/server/server/models/account/account.tssimilarity index 88%rename from server/models/account/account.tsrename to server/server/models/account/account.tsindex 8593f2f28f..7c2660c40d 100644--- a/server/models/account/account.ts+++ b/server/server/models/account/account.ts@@ -16,12 +16,12 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { ModelCache } from '@server/models/shared/model-cache'-import { AttributesOnly } from '@shared/typescript-utils'-import { Account, AccountSummary } from '../../../shared/models/actors'-import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts'-import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants'-import { sendDeleteActor } from '../../lib/activitypub/send/send-delete'+import { Account, AccountSummary } from '@peertube/peertube-models'+import { ModelCache } from '@server/models/shared/model-cache.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts.js'+import { CONSTRAINTS_FIELDS, SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants.js'+import { sendDeleteActor } from '../../lib/activitypub/send/send-delete.js'import {MAccount,MAccountActor,@@ -31,20 +31,20 @@ import {MAccountHost,MAccountSummaryFormattable,MChannelHost-} from '../../types/models'-import { ActorModel } from '../actor/actor'-import { ActorFollowModel } from '../actor/actor-follow'-import { ActorImageModel } from '../actor/actor-image'-import { ApplicationModel } from '../application/application'-import { ServerModel } from '../server/server'-import { ServerBlocklistModel } from '../server/server-blocklist'-import { buildSQLAttributes, getSort, throwIfNotValid } from '../shared'-import { UserModel } from '../user/user'-import { VideoModel } from '../video/video'-import { VideoChannelModel } from '../video/video-channel'-import { VideoCommentModel } from '../video/video-comment'-import { VideoPlaylistModel } from '../video/video-playlist'-import { AccountBlocklistModel } from './account-blocklist'+} from '../../types/models/index.js'+import { ActorFollowModel } from '../actor/actor-follow.js'+import { ActorImageModel } from '../actor/actor-image.js'+import { ActorModel } from '../actor/actor.js'+import { ApplicationModel } from '../application/application.js'+import { ServerBlocklistModel } from '../server/server-blocklist.js'+import { ServerModel } from '../server/server.js'+import { buildSQLAttributes, getSort, throwIfNotValid } from '../shared/index.js'+import { UserModel } from '../user/user.js'+import { VideoChannelModel } from '../video/video-channel.js'+import { VideoCommentModel } from '../video/video-comment.js'+import { VideoPlaylistModel } from '../video/video-playlist.js'+import { VideoModel } from '../video/video.js'+import { AccountBlocklistModel } from './account-blocklist.js'export enum ScopeNames {SUMMARY = 'SUMMARY'@@ -174,7 +174,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {},onDelete: 'cascade'})- Actor: ActorModel+ Actor: Awaited<ActorModel>@ForeignKey(() => UserModel)@Column@@ -186,7 +186,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {},onDelete: 'cascade'})- User: UserModel+ User: Awaited<UserModel>@ForeignKey(() => ApplicationModel)@Column@@ -198,7 +198,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {},onDelete: 'cascade'})- Application: ApplicationModel+ Application: Awaited<ApplicationModel>@HasMany(() => VideoChannelModel, {foreignKey: {@@ -207,7 +207,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {onDelete: 'cascade',hooks: true})- VideoChannels: VideoChannelModel[]+ VideoChannels: Awaited<VideoChannelModel>[]@HasMany(() => VideoPlaylistModel, {foreignKey: {@@ -216,7 +216,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {onDelete: 'cascade',hooks: true})- VideoPlaylists: VideoPlaylistModel[]+ VideoPlaylists: Awaited<VideoPlaylistModel>[]@HasMany(() => VideoCommentModel, {foreignKey: {@@ -225,7 +225,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {onDelete: 'cascade',hooks: true})- VideoComments: VideoCommentModel[]+ VideoComments: Awaited<VideoCommentModel>[]@HasMany(() => AccountBlocklistModel, {foreignKey: {@@ -235,7 +235,7 @@ export class AccountModel extends Model<Partial<AttributesOnly<AccountModel>>> {as: 'BlockedBy',onDelete: 'CASCADE'})- BlockedBy: AccountBlocklistModel[]+ BlockedBy: Awaited<AccountBlocklistModel>[]@BeforeDestroystatic async sendDeleteIfOwned (instance: AccountModel, options) {diff --git a/server/models/account/actor-custom-page.ts b/server/server/models/account/actor-custom-page.tssimilarity index 86%rename from server/models/account/actor-custom-page.tsrename to server/server/models/account/actor-custom-page.tsindex 8930231811..8a9b09706e 100644--- a/server/models/account/actor-custom-page.ts+++ b/server/server/models/account/actor-custom-page.ts@@ -1,7 +1,7 @@import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { CustomPage } from '@shared/models'-import { ActorModel } from '../actor/actor'-import { getServerActor } from '../application/application'+import { CustomPage } from '@peertube/peertube-models'+import { ActorModel } from '../actor/actor.js'+import { getServerActor } from '../application/application.js'@Table({tableName: 'actorCustomPage',@@ -39,7 +39,7 @@ export class ActorCustomPageModel extends Model {},onDelete: 'cascade'})- Actor: ActorModel+ Actor: Awaited<ActorModel>static async updateInstanceHomepage (content: string) {const serverActor = await getServerActor()diff --git a/server/models/actor/actor-follow.ts b/server/server/models/actor/actor-follow.tssimilarity index 95%rename from server/models/actor/actor-follow.tsrename to server/server/models/actor/actor-follow.tsindex 71ce9fa6fb..268edb5b45 100644--- a/server/models/actor/actor-follow.ts+++ b/server/server/models/actor/actor-follow.ts@@ -1,5 +1,19 @@-import { difference } from 'lodash'-import { Attributes, FindOptions, Includeable, IncludeOptions, Op, QueryTypes, Transaction, WhereAttributeHash } from 'sequelize'+import { ActorFollow, type FollowState } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc.js'+import { afterCommitIfTransaction } from '@server/helpers/database-utils.js'+import { getServerActor } from '@server/models/application/application.js'+import {+ MActor,+ MActorFollowActors,+ MActorFollowActorsDefault,+ MActorFollowActorsDefaultSubscription,+ MActorFollowFollowingHost,+ MActorFollowFormattable,+ MActorFollowSubscriptions+} from '@server/types/models/index.js'+import difference from 'lodash-es/difference.js'+import { Attributes, FindOptions, IncludeOptions, Includeable, Op, QueryTypes, Transaction, WhereAttributeHash } from 'sequelize'import {AfterCreate,AfterDestroy,@@ -18,31 +32,16 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc'-import { afterCommitIfTransaction } from '@server/helpers/database-utils'-import { getServerActor } from '@server/models/application/application'-import {- MActor,- MActorFollowActors,- MActorFollowActorsDefault,- MActorFollowActorsDefaultSubscription,- MActorFollowFollowingHost,- MActorFollowFormattable,- MActorFollowSubscriptions-} from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { FollowState } from '../../../shared/models/actors'-import { ActorFollow } from '../../../shared/models/actors/follow.model'-import { logger } from '../../helpers/logger'-import { ACTOR_FOLLOW_SCORE, CONSTRAINTS_FIELDS, FOLLOW_STATES, SERVER_ACTOR_NAME, SORTABLE_COLUMNS } from '../../initializers/constants'-import { AccountModel } from '../account/account'-import { ServerModel } from '../server/server'-import { buildSQLAttributes, createSafeIn, getSort, searchAttribute, throwIfNotValid } from '../shared'-import { doesExist } from '../shared/query'-import { VideoChannelModel } from '../video/video-channel'-import { ActorModel, unusedActorAttributesForAPI } from './actor'-import { InstanceListFollowersQueryBuilder, ListFollowersOptions } from './sql/instance-list-followers-query-builder'-import { InstanceListFollowingQueryBuilder, ListFollowingOptions } from './sql/instance-list-following-query-builder'+import { logger } from '../../helpers/logger.js'+import { ACTOR_FOLLOW_SCORE, CONSTRAINTS_FIELDS, FOLLOW_STATES, SERVER_ACTOR_NAME, SORTABLE_COLUMNS } from '../../initializers/constants.js'+import { AccountModel } from '../account/account.js'+import { ServerModel } from '../server/server.js'+import { buildSQLAttributes, createSafeIn, getSort, searchAttribute, throwIfNotValid } from '../shared/index.js'+import { doesExist } from '../shared/query.js'+import { VideoChannelModel } from '../video/video-channel.js'+import { ActorModel, unusedActorAttributesForAPI } from './actor.js'+import { InstanceListFollowersQueryBuilder, ListFollowersOptions } from './sql/instance-list-followers-query-builder.js'+import { InstanceListFollowingQueryBuilder, ListFollowingOptions } from './sql/instance-list-following-query-builder.js'@Table({tableName: 'actorFollow',@@ -103,7 +102,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMoas: 'ActorFollower',onDelete: 'CASCADE'})- ActorFollower: ActorModel+ ActorFollower: Awaited<ActorModel>@ForeignKey(() => ActorModel)@Column@@ -117,7 +116,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMoas: 'ActorFollowing',onDelete: 'CASCADE'})- ActorFollowing: ActorModel+ ActorFollowing: Awaited<ActorModel>@AfterCreate@AfterUpdatediff --git a/server/models/actor/actor-image.ts b/server/server/models/actor/actor-image.tssimilarity index 82%rename from server/models/actor/actor-image.tsrename to server/server/models/actor/actor-image.tsindex 51085a16dc..727e89f046 100644--- a/server/models/actor/actor-image.ts+++ b/server/server/models/actor/actor-image.ts@@ -1,4 +1,8 @@-import { remove } from 'fs-extra'+import { ActivityIconObject, ActorImage, ActorImageType, type ActorImageType_Type } from '@peertube/peertube-models'+import { getLowercaseExtension } from '@peertube/peertube-node-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { MActorImage, MActorImageFormattable } from '@server/types/models/index.js'+import { remove } from 'fs-extra/esm'import { join } from 'path'import {AfterDestroy,@@ -13,17 +17,12 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { MActorImage, MActorImageFormattable } from '@server/types/models'-import { getLowercaseExtension } from '@shared/core-utils'-import { ActivityIconObject, ActorImageType } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { ActorImage } from '../../../shared/models/actors/actor-image.model'-import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { LAZY_STATIC_PATHS, MIMETYPES, WEBSERVER } from '../../initializers/constants'-import { buildSQLAttributes, throwIfNotValid } from '../shared'-import { ActorModel } from './actor'+import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { LAZY_STATIC_PATHS, MIMETYPES, WEBSERVER } from '../../initializers/constants.js'+import { buildSQLAttributes, throwIfNotValid } from '../shared/index.js'+import { ActorModel } from './actor.js'@Table({tableName: 'actorImage',@@ -65,7 +64,7 @@ export class ActorImageModel extends Model<Partial<AttributesOnly<ActorImageMode@AllowNull(false)@Column- type: ActorImageType+ type: ActorImageType_Type@CreatedAtcreatedAt: Date@@ -83,7 +82,7 @@ export class ActorImageModel extends Model<Partial<AttributesOnly<ActorImageMode},onDelete: 'CASCADE'})- Actor: ActorModel+ Actor: Awaited<ActorModel> // Remove awaited: https://github.com/sequelize/sequelize-typescript/issues/825@AfterDestroystatic removeFilesAndSendDelete (instance: ActorImageModel) {diff --git a/server/models/actor/actor.ts b/server/server/models/actor/actor.tssimilarity index 90%rename from server/models/actor/actor.tsrename to server/server/models/actor/actor.tsindex e2e85f3d6f..adb0099684 100644--- a/server/models/actor/actor.ts+++ b/server/server/models/actor/actor.ts@@ -1,3 +1,11 @@+import { forceNumber } from '@peertube/peertube-core-utils'+import { ActivityIconObject, ActorImageType, ActorImageType_Type, type ActivityPubActorType } from '@peertube/peertube-models'+import { getLowercaseExtension } from '@peertube/peertube-node-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { activityPubContextify } from '@server/helpers/activity-pub-utils.js'+import { getContextFilter } from '@server/lib/activitypub/context.js'+import { getBiggestActorImage } from '@server/lib/actor-image.js'+import { ModelCache } from '@server/models/shared/model-cache.js'import { col, fn, literal, Op, QueryTypes, Transaction, where } from 'sequelize'import {AllowNull,@@ -15,20 +23,15 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { activityPubContextify } from '@server/lib/activitypub/context'-import { getBiggestActorImage } from '@server/lib/actor-image'-import { ModelCache } from '@server/models/shared/model-cache'-import { forceNumber, getLowercaseExtension } from '@shared/core-utils'-import { ActivityIconObject, ActivityPubActorType, ActorImageType } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'+import { Where } from 'sequelize/types/utils'import {isActorFollowersCountValid,isActorFollowingCountValid,isActorPreferredUsernameValid,isActorPrivateKeyValid,isActorPublicKeyValid-} from '../../helpers/custom-validators/activitypub/actor'-import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'+} from '../../helpers/custom-validators/activitypub/actor.js'+import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'import {ACTIVITY_PUB,ACTIVITY_PUB_ACTOR_TYPES,@@ -36,7 +39,7 @@ import {MIMETYPES,SERVER_ACTOR_NAME,WEBSERVER-} from '../../initializers/constants'+} from '../../initializers/constants.js'import {MActor,MActorAccountChannelId,@@ -51,15 +54,15 @@ import {MActorSummaryFormattable,MActorUrl,MActorWithInboxes-} from '../../types/models'-import { AccountModel } from '../account/account'-import { getServerActor } from '../application/application'-import { ServerModel } from '../server/server'-import { buildSQLAttributes, isOutdated, throwIfNotValid } from '../shared'-import { VideoModel } from '../video/video'-import { VideoChannelModel } from '../video/video-channel'-import { ActorFollowModel } from './actor-follow'-import { ActorImageModel } from './actor-image'+} from '../../types/models/index.js'+import { AccountModel } from '../account/account.js'+import { getServerActor } from '../application/application.js'+import { ServerModel } from '../server/server.js'+import { buildSQLAttributes, isOutdated, throwIfNotValid } from '../shared/index.js'+import { VideoChannelModel } from '../video/video-channel.js'+import { VideoModel } from '../video/video.js'+import { ActorFollowModel } from './actor-follow.js'+import { ActorImageModel } from './actor-image.js'enum ScopeNames {FULL = 'FULL'@@ -243,7 +246,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {type: ActorImageType.AVATAR}})- Avatars: ActorImageModel[]+ Avatars: Awaited<ActorImageModel>[]@HasMany(() => ActorImageModel, {as: 'Banners',@@ -256,7 +259,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {type: ActorImageType.BANNER}})- Banners: ActorImageModel[]+ Banners: Awaited<ActorImageModel>[]@HasMany(() => ActorFollowModel, {foreignKey: {@@ -266,7 +269,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {as: 'ActorFollowings',onDelete: 'cascade'})- ActorFollowing: ActorFollowModel[]+ ActorFollowing: Awaited<ActorFollowModel>[]@HasMany(() => ActorFollowModel, {foreignKey: {@@ -276,7 +279,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {as: 'ActorFollowers',onDelete: 'cascade'})- ActorFollowers: ActorFollowModel[]+ ActorFollowers: Awaited<ActorFollowModel>[]@ForeignKey(() => ServerModel)@Column@@ -288,7 +291,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {},onDelete: 'cascade'})- Server: ServerModel+ Server: Awaited<ServerModel>@HasOne(() => AccountModel, {foreignKey: {@@ -297,7 +300,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {onDelete: 'cascade',hooks: true})- Account: AccountModel+ Account: Awaited<AccountModel>@HasOne(() => VideoChannelModel, {foreignKey: {@@ -306,7 +309,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {onDelete: 'cascade',hooks: true})- VideoChannel: VideoChannelModel+ VideoChannel: Awaited<VideoChannelModel>// ---------------------------------------------------------------------------@@ -329,7 +332,8 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {// ---------------------------------------------------------------------------- static wherePreferredUsername (preferredUsername: string, colName = 'preferredUsername') {+ // FIXME: have to specify the result type to not break peertube typings generation+ static wherePreferredUsername (preferredUsername: string, colName = 'preferredUsername'): Where {return where(fn('lower', col(colName)), preferredUsername.toLowerCase())}@@ -605,7 +609,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {image}- return activityPubContextify(json, 'Actor')+ return activityPubContextify(json, 'Actor', getContextFilter())}getFollowerSharedInboxUrls (t: Transaction) {@@ -666,7 +670,7 @@ export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> {return this.Server ? this.Server.redundancyAllowed : false}- hasImage (type: ActorImageType) {+ hasImage (type: ActorImageType_Type) {const images = type === ActorImageType.AVATAR? this.Avatars: this.Bannersdiff --git a/server/models/actor/sql/instance-list-followers-query-builder.ts b/server/server/models/actor/sql/instance-list-followers-query-builder.tssimilarity index 84%rename from server/models/actor/sql/instance-list-followers-query-builder.tsrename to server/server/models/actor/sql/instance-list-followers-query-builder.tsindex 34ce29b5dc..ce91bca0df 100644--- a/server/models/actor/sql/instance-list-followers-query-builder.ts+++ b/server/server/models/actor/sql/instance-list-followers-query-builder.ts@@ -1,9 +1,9 @@import { Sequelize } from 'sequelize'-import { ModelBuilder } from '@server/models/shared'-import { MActorFollowActorsDefault } from '@server/types/models'-import { ActivityPubActorType, FollowState } from '@shared/models'-import { parseRowCountResult } from '../../shared'-import { InstanceListFollowsQueryBuilder } from './shared/instance-list-follows-query-builder'+import { ModelBuilder } from '@server/models/shared/index.js'+import { MActorFollowActorsDefault } from '@server/types/models/index.js'+import { ActivityPubActorType, FollowState } from '@peertube/peertube-models'+import { parseRowCountResult } from '../../shared/index.js'+import { InstanceListFollowsQueryBuilder } from './shared/instance-list-follows-query-builder.js'export interface ListFollowersOptions {actorIds: number[]diff --git a/server/models/actor/sql/instance-list-following-query-builder.ts b/server/server/models/actor/sql/instance-list-following-query-builder.tssimilarity index 85%rename from server/models/actor/sql/instance-list-following-query-builder.tsrename to server/server/models/actor/sql/instance-list-following-query-builder.tsindex 77b4e3dce2..dab70db43c 100644--- a/server/models/actor/sql/instance-list-following-query-builder.ts+++ b/server/server/models/actor/sql/instance-list-following-query-builder.ts@@ -1,9 +1,9 @@import { Sequelize } from 'sequelize'-import { ModelBuilder } from '@server/models/shared'-import { MActorFollowActorsDefault } from '@server/types/models'-import { ActivityPubActorType, FollowState } from '@shared/models'-import { parseRowCountResult } from '../../shared'-import { InstanceListFollowsQueryBuilder } from './shared/instance-list-follows-query-builder'+import { ModelBuilder } from '@server/models/shared/index.js'+import { MActorFollowActorsDefault } from '@server/types/models/index.js'+import { ActivityPubActorType, FollowState } from '@peertube/peertube-models'+import { parseRowCountResult } from '../../shared/index.js'+import { InstanceListFollowsQueryBuilder } from './shared/instance-list-follows-query-builder.js'export interface ListFollowingOptions {followerId: numberdiff --git a/server/models/actor/sql/shared/actor-follow-table-attributes.ts b/server/server/models/actor/sql/shared/actor-follow-table-attributes.tssimilarity index 71%rename from server/models/actor/sql/shared/actor-follow-table-attributes.tsrename to server/server/models/actor/sql/shared/actor-follow-table-attributes.tsindex 4431aa6d1c..409c2f0e2a 100644--- a/server/models/actor/sql/shared/actor-follow-table-attributes.ts+++ b/server/server/models/actor/sql/shared/actor-follow-table-attributes.ts@@ -1,8 +1,8 @@-import { Memoize } from '@server/helpers/memoize'-import { ServerModel } from '@server/models/server/server'-import { ActorModel } from '../../actor'-import { ActorFollowModel } from '../../actor-follow'-import { ActorImageModel } from '../../actor-image'+import { Memoize } from '@server/helpers/memoize.js'+import { ServerModel } from '@server/models/server/server.js'+import { ActorModel } from '../../actor.js'+import { ActorFollowModel } from '../../actor-follow.js'+import { ActorImageModel } from '../../actor-image.js'export class ActorFollowTableAttributes {diff --git a/server/models/actor/sql/shared/instance-list-follows-query-builder.ts b/server/server/models/actor/sql/shared/instance-list-follows-query-builder.tssimilarity index 93%rename from server/models/actor/sql/shared/instance-list-follows-query-builder.tsrename to server/server/models/actor/sql/shared/instance-list-follows-query-builder.tsindex d9593e48b8..e0569e2f8e 100644--- a/server/models/actor/sql/shared/instance-list-follows-query-builder.ts+++ b/server/server/models/actor/sql/shared/instance-list-follows-query-builder.ts@@ -1,8 +1,8 @@import { Sequelize } from 'sequelize'-import { AbstractRunQuery } from '@server/models/shared'-import { ActorImageType } from '@shared/models'-import { getInstanceFollowsSort } from '../../../shared'-import { ActorFollowTableAttributes } from './actor-follow-table-attributes'+import { AbstractRunQuery } from '@server/models/shared/index.js'+import { ActorImageType } from '@peertube/peertube-models'+import { getInstanceFollowsSort } from '../../../shared/index.js'+import { ActorFollowTableAttributes } from './actor-follow-table-attributes.js'type BaseOptions = {sort: stringdiff --git a/server/models/application/application.ts b/server/server/models/application/application.tssimilarity index 87%rename from server/models/application/application.tsrename to server/server/models/application/application.tsindex c51ceb2454..1b1ff15b1a 100644--- a/server/models/application/application.ts+++ b/server/server/models/application/application.ts@@ -1,8 +1,8 @@import memoizee from 'memoizee'import { AllowNull, Column, Default, DefaultScope, HasOne, IsInt, Model, Table } from 'sequelize-typescript'-import { getNodeABIVersion } from '@server/helpers/version'-import { AttributesOnly } from '@shared/typescript-utils'-import { AccountModel } from '../account/account'+import { getNodeABIVersion } from '@server/helpers/version.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { AccountModel } from '../account/account.js'export const getServerActor = memoizee(async function () {const application = await ApplicationModel.load()@@ -52,7 +52,7 @@ export class ApplicationModel extends Model<Partial<AttributesOnly<ApplicationMo},onDelete: 'cascade'})- Account: AccountModel+ Account: Awaited<AccountModel>static countTotal () {return ApplicationModel.count()diff --git a/server/models/oauth/oauth-client.ts b/server/server/models/oauth/oauth-client.tssimilarity index 87%rename from server/models/oauth/oauth-client.tsrename to server/server/models/oauth/oauth-client.tsindex 457e846137..3d17f24315 100644--- a/server/models/oauth/oauth-client.ts+++ b/server/server/models/oauth/oauth-client.ts@@ -1,6 +1,6 @@import { AllowNull, Column, CreatedAt, DataType, HasMany, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { AttributesOnly } from '@shared/typescript-utils'-import { OAuthTokenModel } from './oauth-token'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { OAuthTokenModel } from './oauth-token.js'@Table({tableName: 'oAuthClient',@@ -40,7 +40,7 @@ export class OAuthClientModel extends Model<Partial<AttributesOnly<OAuthClientMo@HasMany(() => OAuthTokenModel, {onDelete: 'cascade'})- OAuthTokens: OAuthTokenModel[]+ OAuthTokens: Awaited<OAuthTokenModel>[]static countTotal () {return OAuthClientModel.count()diff --git a/server/models/oauth/oauth-token.ts b/server/server/models/oauth/oauth-token.tssimilarity index 87%rename from server/models/oauth/oauth-token.tsrename to server/server/models/oauth/oauth-token.tsindex f72423190e..7101e199a6 100644--- a/server/models/oauth/oauth-token.ts+++ b/server/server/models/oauth/oauth-token.ts@@ -12,21 +12,22 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { TokensCache } from '@server/lib/auth/tokens-cache'-import { MUserAccountId } from '@server/types/models'-import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'-import { AttributesOnly } from '@shared/typescript-utils'-import { logger } from '../../helpers/logger'-import { AccountModel } from '../account/account'-import { ActorModel } from '../actor/actor'-import { UserModel } from '../user/user'-import { OAuthClientModel } from './oauth-client'+import { TokensCache } from '@server/lib/auth/tokens-cache.js'+import { MUserAccountId } from '@server/types/models/index.js'+import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { logger } from '../../helpers/logger.js'+import { AccountModel } from '../account/account.js'+import { ActorModel } from '../actor/actor.js'+import { UserModel } from '../user/user.js'+import { OAuthClientModel } from './oauth-client.js'export type OAuthTokenInfo = {refreshToken: stringrefreshTokenExpiresAt: Dateclient: {id: number+ grants: string[]}user: MUserAccountIdtoken: MOAuthTokenUser@@ -116,7 +117,7 @@ export class OAuthTokenModel extends Model<Partial<AttributesOnly<OAuthTokenMode},onDelete: 'cascade'})- User: UserModel+ User: Awaited<UserModel>@ForeignKey(() => OAuthClientModel)@Column@@ -128,7 +129,7 @@ export class OAuthTokenModel extends Model<Partial<AttributesOnly<OAuthTokenMode},onDelete: 'cascade'})- OAuthClients: OAuthClientModel[]+ OAuthClients: Awaited<OAuthClientModel>[]@AfterUpdate@AfterDestroy@@ -161,7 +162,8 @@ export class OAuthTokenModel extends Model<Partial<AttributesOnly<OAuthTokenModerefreshToken: token.refreshToken,refreshTokenExpiresAt: token.refreshTokenExpiresAt,client: {- id: token.oAuthClientId+ id: token.oAuthClientId,+ grants: []},user: token.User,tokendiff --git a/server/models/redundancy/video-redundancy.ts b/server/server/models/redundancy/video-redundancy.tssimilarity index 96%rename from server/models/redundancy/video-redundancy.tsrename to server/server/models/redundancy/video-redundancy.tsindex cebf47dfd9..26089594d9 100644--- a/server/models/redundancy/video-redundancy.ts+++ b/server/server/models/redundancy/video-redundancy.ts@@ -1,4 +1,4 @@-import { sample } from 'lodash'+import sample from 'lodash-es/sample.js'import { literal, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize'import {AllowNull,@@ -14,8 +14,6 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { getServerActor } from '@server/models/application/application'-import { MActor, MVideoForRedundancyAPI, MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/types/models'import {CacheFileObject,FileRedundancyInformation,@@ -25,21 +23,23 @@ import {VideoRedundancy,VideoRedundancyStrategy,VideoRedundancyStrategyWithManual-} from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { isTestInstance } from '../../helpers/core-utils'-import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validators/activitypub/misc'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../initializers/constants'-import { ActorModel } from '../actor/actor'-import { ServerModel } from '../server/server'-import { getSort, getVideoSort, parseAggregateResult, throwIfNotValid } from '../shared'-import { ScheduleVideoUpdateModel } from '../video/schedule-video-update'-import { VideoModel } from '../video/video'-import { VideoChannelModel } from '../video/video-channel'-import { VideoFileModel } from '../video/video-file'-import { VideoStreamingPlaylistModel } from '../video/video-streaming-playlist'+} from '@peertube/peertube-models'+import { isTestInstance } from '@peertube/peertube-node-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { getServerActor } from '@server/models/application/application.js'+import { MActor, MVideoForRedundancyAPI, MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/types/models/index.js'+import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../initializers/constants.js'+import { ActorModel } from '../actor/actor.js'+import { ServerModel } from '../server/server.js'+import { getSort, getVideoSort, parseAggregateResult, throwIfNotValid } from '../shared/index.js'+import { ScheduleVideoUpdateModel } from '../video/schedule-video-update.js'+import { VideoChannelModel } from '../video/video-channel.js'+import { VideoFileModel } from '../video/video-file.js'+import { VideoStreamingPlaylistModel } from '../video/video-streaming-playlist.js'+import { VideoModel } from '../video/video.js'export enum ScopeNames {WITH_VIDEO = 'WITH_VIDEO'@@ -126,7 +126,7 @@ export class VideoRedundancyModel extends Model<Partial<AttributesOnly<VideoRedu},onDelete: 'cascade'})- VideoFile: VideoFileModel+ VideoFile: Awaited<VideoFileModel>@ForeignKey(() => VideoStreamingPlaylistModel)@Column@@ -138,7 +138,7 @@ export class VideoRedundancyModel extends Model<Partial<AttributesOnly<VideoRedu},onDelete: 'cascade'})- VideoStreamingPlaylist: VideoStreamingPlaylistModel+ VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>@ForeignKey(() => ActorModel)@Column@@ -150,7 +150,7 @@ export class VideoRedundancyModel extends Model<Partial<AttributesOnly<VideoRedu},onDelete: 'cascade'})- Actor: ActorModel+ Actor: Awaited<ActorModel>@BeforeDestroystatic async removeFile (instance: VideoRedundancyModel) {diff --git a/server/models/runner/runner-job.ts b/server/server/models/runner/runner-job.tssimilarity index 89%rename from server/models/runner/runner-job.tsrename to server/server/models/runner/runner-job.tsindex f2ffd6a844..1ebcdae1d5 100644--- a/server/models/runner/runner-job.ts+++ b/server/server/models/runner/runner-job.ts@@ -1,3 +1,16 @@+import {+ RunnerJob,+ RunnerJobAdmin,+ RunnerJobState,+ type RunnerJobPayload,+ type RunnerJobPrivatePayload,+ type RunnerJobStateType,+ type RunnerJobType+} from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isArray, isUUIDValid } from '@server/helpers/custom-validators/misc.js'+import { CONSTRAINTS_FIELDS, RUNNER_JOB_STATES } from '@server/initializers/constants.js'+import { MRunnerJob, MRunnerJobRunner, MRunnerJobRunnerParent } from '@server/types/models/runners/index.js'import { Op, Transaction } from 'sequelize'import {AllowNull,@@ -13,13 +26,8 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { isArray, isUUIDValid } from '@server/helpers/custom-validators/misc'-import { CONSTRAINTS_FIELDS, RUNNER_JOB_STATES } from '@server/initializers/constants'-import { MRunnerJob, MRunnerJobRunner, MRunnerJobRunnerParent } from '@server/types/models/runners'-import { RunnerJob, RunnerJobAdmin, RunnerJobPayload, RunnerJobPrivatePayload, RunnerJobState, RunnerJobType } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { getSort, searchAttribute } from '../shared'-import { RunnerModel } from './runner'+import { getSort, searchAttribute } from '../shared/index.js'+import { RunnerModel } from './runner.js'enum ScopeNames {WITH_RUNNER = 'WITH_RUNNER',@@ -81,7 +89,7 @@ export class RunnerJobModel extends Model<Partial<AttributesOnly<RunnerJobModel>@AllowNull(false)@Column- state: RunnerJobState+ state: RunnerJobStateType@AllowNull(false)@Default(0)@@ -131,7 +139,7 @@ export class RunnerJobModel extends Model<Partial<AttributesOnly<RunnerJobModel>},onDelete: 'cascade'})- DependsOnRunnerJob: RunnerJobModel+ DependsOnRunnerJob: Awaited<RunnerJobModel>@ForeignKey(() => RunnerModel)@Column@@ -144,7 +152,7 @@ export class RunnerJobModel extends Model<Partial<AttributesOnly<RunnerJobModel>},onDelete: 'SET NULL'})- Runner: RunnerModel+ Runner: Awaited<RunnerModel>// ---------------------------------------------------------------------------@@ -227,7 +235,7 @@ export class RunnerJobModel extends Model<Partial<AttributesOnly<RunnerJobModel>count: numbersort: stringsearch?: string- stateOneOf?: RunnerJobState[]+ stateOneOf?: RunnerJobStateType[]}) {const { start, count, sort, search, stateOneOf } = options@@ -292,7 +300,8 @@ export class RunnerJobModel extends Model<Partial<AttributesOnly<RunnerJobModel>}setToErrorOrCancel (- state: RunnerJobState.PARENT_ERRORED | RunnerJobState.ERRORED | RunnerJobState.CANCELLED | RunnerJobState.PARENT_CANCELLED+ // eslint-disable-next-line max-len+ state: typeof RunnerJobState.PARENT_ERRORED | typeof RunnerJobState.ERRORED | typeof RunnerJobState.CANCELLED | typeof RunnerJobState.PARENT_CANCELLED) {this.state = statethis.processingJobToken = nulldiff --git a/server/models/runner/runner-registration-token.ts b/server/server/models/runner/runner-registration-token.tssimilarity index 89%rename from server/models/runner/runner-registration-token.tsrename to server/server/models/runner/runner-registration-token.tsindex b2ae6c9eb6..1bde519ca6 100644--- a/server/models/runner/runner-registration-token.ts+++ b/server/server/models/runner/runner-registration-token.ts@@ -1,10 +1,10 @@import { FindOptions, literal } from 'sequelize'import { AllowNull, Column, CreatedAt, HasMany, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { MRunnerRegistrationToken } from '@server/types/models/runners'-import { RunnerRegistrationToken } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { getSort } from '../shared'-import { RunnerModel } from './runner'+import { MRunnerRegistrationToken } from '@server/types/models/runners/index.js'+import { RunnerRegistrationToken } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { getSort } from '../shared/index.js'+import { RunnerModel } from './runner.js'/***@@ -39,7 +39,7 @@ export class RunnerRegistrationTokenModel extends Model<Partial<AttributesOnly<R},onDelete: 'cascade'})- Runners: RunnerModel[]+ Runners: Awaited<RunnerModel>[]static load (id: number) {return RunnerRegistrationTokenModel.findByPk(id)diff --git a/server/models/runner/runner.ts b/server/server/models/runner/runner.tssimilarity index 88%rename from server/models/runner/runner.tsrename to server/server/models/runner/runner.tsindex 4d07707d8e..5c968b1c22 100644--- a/server/models/runner/runner.ts+++ b/server/server/models/runner/runner.ts@@ -1,11 +1,11 @@import { FindOptions } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { MRunner } from '@server/types/models/runners'-import { Runner } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { getSort } from '../shared'-import { RunnerRegistrationTokenModel } from './runner-registration-token'-import { CONSTRAINTS_FIELDS } from '@server/initializers/constants'+import { MRunner } from '@server/types/models/runners/index.js'+import { Runner } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { getSort } from '../shared/index.js'+import { RunnerRegistrationTokenModel } from './runner-registration-token.js'+import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'@Table({tableName: 'runner',@@ -62,7 +62,7 @@ export class RunnerModel extends Model<Partial<AttributesOnly<RunnerModel>>> {},onDelete: 'cascade'})- RunnerRegistrationToken: RunnerRegistrationTokenModel+ RunnerRegistrationToken: Awaited<RunnerRegistrationTokenModel>// ---------------------------------------------------------------------------diff --git a/server/models/server/plugin.ts b/server/server/models/server/plugin.tssimilarity index 87%rename from server/models/server/plugin.tsrename to server/server/models/server/plugin.tsindex 9948c9f7ac..ff8350b6a2 100644--- a/server/models/server/plugin.ts+++ b/server/server/models/server/plugin.ts@@ -1,8 +1,15 @@+import {+ PeerTubePlugin,+ PluginType,+ RegisterServerSettingOptions,+ SettingEntries,+ SettingValue,+ type PluginType_Type+} from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { MPlugin, MPluginFormattable } from '@server/types/models/index.js'import { FindAndCountOptions, json, QueryTypes } from 'sequelize'import { AllowNull, Column, CreatedAt, DataType, DefaultScope, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { MPlugin, MPluginFormattable } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { PeerTubePlugin, PluginType, RegisterServerSettingOptions, SettingEntries, SettingValue } from '../../../shared/models'import {isPluginDescriptionValid,isPluginHomepage,@@ -10,8 +17,8 @@ import {isPluginStableOrUnstableVersionValid,isPluginStableVersionValid,isPluginTypeValid-} from '../../helpers/custom-validators/plugins'-import { getSort, throwIfNotValid } from '../shared'+} from '../../helpers/custom-validators/plugins.js'+import { getSort, throwIfNotValid } from '../shared/index.js'@DefaultScope(() => ({attributes: {@@ -38,7 +45,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> {@AllowNull(false)@Is('PluginType', value => throwIfNotValid(value, isPluginTypeValid, 'type'))@Column- type: number+ type: PluginType_Type@AllowNull(false)@Is('PluginVersion', value => throwIfNotValid(value, isPluginStableOrUnstableVersionValid, 'version'))@@ -111,7 +118,12 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> {return PluginModel.findOne(query)}- static getSetting (pluginName: string, pluginType: PluginType, settingName: string, registeredSettings: RegisterServerSettingOptions[]) {+ static getSetting (+ pluginName: string,+ pluginType: PluginType_Type,+ settingName: string,+ registeredSettings: RegisterServerSettingOptions[]+ ) {const query = {attributes: [ 'settings' ],where: {@@ -135,7 +147,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> {static getSettings (pluginName: string,- pluginType: PluginType,+ pluginType: PluginType_Type,settingNames: string[],registeredSettings: RegisterServerSettingOptions[]) {@@ -167,7 +179,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> {})}- static setSetting (pluginName: string, pluginType: PluginType, settingName: string, settingValue: SettingValue) {+ static setSetting (pluginName: string, pluginType: PluginType_Type, settingName: string, settingValue: SettingValue) {const query = {where: {name: pluginName,@@ -183,7 +195,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> {.then(() => undefined)}- static getData (pluginName: string, pluginType: PluginType, key: string) {+ static getData (pluginName: string, pluginType: PluginType_Type, key: string) {const query = {raw: true,attributes: [ [ json('storage.' + key), 'value' ] as any ], // FIXME: typings@@ -206,7 +218,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> {})}- static storeData (pluginName: string, pluginType: PluginType, key: string, data: any) {+ static storeData (pluginName: string, pluginType: PluginType_Type, key: string, data: any) {const query = 'UPDATE "plugin" SET "storage" = jsonb_set(coalesce("storage", \'{}\'), :key, :data::jsonb) ' +'WHERE "name" = :pluginName AND "type" = :pluginType'@@ -222,7 +234,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> {}static listForApi (options: {- pluginType?: PluginType+ pluginType?: PluginType_Typeuninstalled?: booleanstart: numbercount: number@@ -266,7 +278,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> {: PluginType.THEME}- static buildNpmName (name: string, type: PluginType) {+ static buildNpmName (name: string, type: PluginType_Type) {if (type === PluginType.THEME) return 'peertube-theme-' + namereturn 'peertube-plugin-' + namediff --git a/server/models/server/server-blocklist.ts b/server/server/models/server/server-blocklist.tssimilarity index 92%rename from server/models/server/server-blocklist.tsrename to server/server/models/server/server-blocklist.tsindex 3d755fe4a1..7817d122e8 100644--- a/server/models/server/server-blocklist.ts+++ b/server/server/models/server/server-blocklist.ts@@ -1,11 +1,11 @@import { Op, QueryTypes } from 'sequelize'import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'-import { MServerBlocklist, MServerBlocklistAccountServer, MServerBlocklistFormattable } from '@server/types/models'-import { ServerBlock } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { AccountModel } from '../account/account'-import { createSafeIn, getSort, searchAttribute } from '../shared'-import { ServerModel } from './server'+import { MServerBlocklist, MServerBlocklistAccountServer, MServerBlocklistFormattable } from '@server/types/models/index.js'+import { ServerBlock } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { AccountModel } from '../account/account.js'+import { createSafeIn, getSort, searchAttribute } from '../shared/index.js'+import { ServerModel } from './server.js'enum ScopeNames {WITH_ACCOUNT = 'WITH_ACCOUNT',@@ -62,7 +62,7 @@ export class ServerBlocklistModel extends Model<Partial<AttributesOnly<ServerBlo},onDelete: 'CASCADE'})- ByAccount: AccountModel+ ByAccount: Awaited<AccountModel>@ForeignKey(() => ServerModel)@Column@@ -74,7 +74,7 @@ export class ServerBlocklistModel extends Model<Partial<AttributesOnly<ServerBlo},onDelete: 'CASCADE'})- BlockedServer: ServerModel+ BlockedServer: Awaited<ServerModel>static isServerMutedByAccounts (accountIds: number[], targetServerId: number) {const query = {diff --git a/server/models/server/server.ts b/server/server/models/server/server.tssimilarity index 85%rename from server/models/server/server.tsrename to server/server/models/server/server.tsindex a5e05f460f..a50cc25d83 100644--- a/server/models/server/server.ts+++ b/server/server/models/server/server.ts@@ -1,11 +1,11 @@import { Transaction } from 'sequelize'import { AllowNull, Column, CreatedAt, Default, HasMany, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { MServer, MServerFormattable } from '@server/types/models/server'-import { AttributesOnly } from '@shared/typescript-utils'-import { isHostValid } from '../../helpers/custom-validators/servers'-import { ActorModel } from '../actor/actor'-import { buildSQLAttributes, throwIfNotValid } from '../shared'-import { ServerBlocklistModel } from './server-blocklist'+import { MServer, MServerFormattable } from '@server/types/models/server/index.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isHostValid } from '../../helpers/custom-validators/servers.js'+import { ActorModel } from '../actor/actor.js'+import { buildSQLAttributes, throwIfNotValid } from '../shared/index.js'+import { ServerBlocklistModel } from './server-blocklist.js'@Table({tableName: 'server',@@ -42,7 +42,7 @@ export class ServerModel extends Model<Partial<AttributesOnly<ServerModel>>> {onDelete: 'CASCADE',hooks: true})- Actors: ActorModel[]+ Actors: Awaited<ActorModel>[]@HasMany(() => ServerBlocklistModel, {foreignKey: {@@ -50,7 +50,7 @@ export class ServerModel extends Model<Partial<AttributesOnly<ServerModel>>> {},onDelete: 'CASCADE'})- BlockedBy: ServerBlocklistModel[]+ BlockedBy: Awaited<ServerBlocklistModel>[]// ---------------------------------------------------------------------------diff --git a/server/models/server/tracker.ts b/server/server/models/server/tracker.tssimilarity index 82%rename from server/models/server/tracker.tsrename to server/server/models/server/tracker.tsindex ee087c4a30..46955768d2 100644--- a/server/models/server/tracker.ts+++ b/server/server/models/server/tracker.ts@@ -1,9 +1,9 @@import { AllowNull, BelongsToMany, Column, CreatedAt, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { Transaction } from 'sequelize/types'-import { MTracker } from '@server/types/models/server/tracker'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoModel } from '../video/video'-import { VideoTrackerModel } from './video-tracker'+import { Transaction } from 'sequelize'+import { MTracker } from '@server/types/models/server/tracker.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { VideoModel } from '../video/video.js'+import { VideoTrackerModel } from './video-tracker.js'@Table({tableName: 'tracker',@@ -31,7 +31,7 @@ export class TrackerModel extends Model<Partial<AttributesOnly<TrackerModel>>> {through: () => VideoTrackerModel,onDelete: 'CASCADE'})- Videos: VideoModel[]+ Videos: Awaited<VideoModel>[]static listUrlsByVideoId (videoId: number) {const query = {diff --git a/server/models/server/video-tracker.ts b/server/server/models/server/video-tracker.tssimilarity index 76%rename from server/models/server/video-tracker.tsrename to server/server/models/server/video-tracker.tsindex f14f3bd7d1..a925dc5c1d 100644--- a/server/models/server/video-tracker.ts+++ b/server/server/models/server/video-tracker.ts@@ -1,7 +1,7 @@import { Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoModel } from '../video/video'-import { TrackerModel } from './tracker'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { VideoModel } from '../video/video.js'+import { TrackerModel } from './tracker.js'@Table({tableName: 'videoTracker',diff --git a/server/models/shared/abstract-run-query.ts b/server/server/models/shared/abstract-run-query.tssimilarity index 100%rename from server/models/shared/abstract-run-query.tsrename to server/server/models/shared/abstract-run-query.tsdiff --git a/server/server/models/shared/index.ts b/server/server/models/shared/index.tsnew file mode 100644index 0000000000..53cf65d5f9--- /dev/null+++ b/server/server/models/shared/index.ts@@ -0,0 +1,8 @@+export * from './abstract-run-query.js'+export * from './model-builder.js'+export * from './model-cache.js'+export * from './query.js'+export * from './sequelize-helpers.js'+export * from './sort.js'+export * from './sql.js'+export * from './update.js'diff --git a/server/models/shared/model-builder.ts b/server/server/models/shared/model-builder.tssimilarity index 97%rename from server/models/shared/model-builder.tsrename to server/server/models/shared/model-builder.tsindex 07f7c40386..c19ce2d56f 100644--- a/server/models/shared/model-builder.ts+++ b/server/server/models/shared/model-builder.ts@@ -1,6 +1,6 @@-import { isPlainObject } from 'lodash'+import isPlainObject from 'lodash-es/isPlainObject.js'import { Model as SequelizeModel, ModelStatic, Sequelize } from 'sequelize'-import { logger } from '@server/helpers/logger'+import { logger } from '@server/helpers/logger.js'/***diff --git a/server/models/shared/model-cache.ts b/server/server/models/shared/model-cache.tssimilarity index 97%rename from server/models/shared/model-cache.tsrename to server/server/models/shared/model-cache.tsindex 3651267e7c..273d8e6080 100644--- a/server/models/shared/model-cache.ts+++ b/server/server/models/shared/model-cache.ts@@ -1,5 +1,5 @@import { Model } from 'sequelize-typescript'-import { logger } from '@server/helpers/logger'+import { logger } from '@server/helpers/logger.js'type ModelCacheType ='local-account-name'diff --git a/server/models/shared/query.ts b/server/server/models/shared/query.tssimilarity index 84%rename from server/models/shared/query.tsrename to server/server/models/shared/query.tsindex 934acc21f7..0158454e81 100644--- a/server/models/shared/query.ts+++ b/server/server/models/shared/query.ts@@ -1,6 +1,7 @@import { BindOrReplacements, Op, QueryTypes, Sequelize } from 'sequelize'+import { Fn } from 'sequelize/types/utils'import validator from 'validator'-import { forceNumber } from '@shared/core-utils'+import { forceNumber } from '@peertube/peertube-core-utils'function doesExist (sequelize: Sequelize, query: string, bind?: BindOrReplacements) {const options = {@@ -13,7 +14,8 @@ function doesExist (sequelize: Sequelize, query: string, bind?: BindOrReplacemen.then(results => results.length === 1)}-function createSimilarityAttribute (col: string, value: string) {+// FIXME: have to specify the result type to not break peertube typings generation+function createSimilarityAttribute (col: string, value: string): Fn {return Sequelize.fn('similarity',@@ -24,7 +26,7 @@ function createSimilarityAttribute (col: string, value: string) {}function buildWhereIdOrUUID (id: number | string) {- return validator.isInt('' + id) ? { id } : { uuid: id }+ return validator.default.isInt('' + id) ? { id } : { uuid: id }}function parseAggregateResult (result: any) {diff --git a/server/models/shared/sequelize-helpers.ts b/server/server/models/shared/sequelize-helpers.tssimilarity index 100%rename from server/models/shared/sequelize-helpers.tsrename to server/server/models/shared/sequelize-helpers.tsdiff --git a/server/models/shared/sort.ts b/server/server/models/shared/sort.tssimilarity index 100%rename from server/models/shared/sort.tsrename to server/server/models/shared/sort.tsdiff --git a/server/models/shared/sql.ts b/server/server/models/shared/sql.tssimilarity index 82%rename from server/models/shared/sql.tsrename to server/server/models/shared/sql.tsindex 5aaeb49f0e..3f22dd4e3e 100644--- a/server/models/shared/sql.ts+++ b/server/server/models/shared/sql.ts@@ -1,14 +1,17 @@import { literal, Model, ModelStatic } from 'sequelize'-import { forceNumber } from '@shared/core-utils'-import { AttributesOnly } from '@shared/typescript-utils'+import { Literal } from 'sequelize/types/utils'+import { forceNumber } from '@peertube/peertube-core-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'-function buildLocalAccountIdsIn () {+// FIXME: have to specify the result type to not break peertube typings generation+function buildLocalAccountIdsIn (): Literal {return literal('(SELECT "account"."id" FROM "account" INNER JOIN "actor" ON "actor"."id" = "account"."actorId" AND "actor"."serverId" IS NULL)')}-function buildLocalActorIdsIn () {+// FIXME: have to specify the result type to not break peertube typings generation+function buildLocalActorIdsIn (): Literal {return literal('(SELECT "actor"."id" FROM "actor" WHERE "actor"."serverId" IS NULL)')diff --git a/server/models/shared/update.ts b/server/server/models/shared/update.tssimilarity index 100%rename from server/models/shared/update.tsrename to server/server/models/shared/update.tsdiff --git a/server/models/user/sql/user-notitication-list-query-builder.ts b/server/server/models/user/sql/user-notitication-list-query-builder.tssimilarity index 99%rename from server/models/user/sql/user-notitication-list-query-builder.tsrename to server/server/models/user/sql/user-notitication-list-query-builder.tsindex 7b29807a36..ba3a2d70fe 100644--- a/server/models/user/sql/user-notitication-list-query-builder.ts+++ b/server/server/models/user/sql/user-notitication-list-query-builder.ts@@ -1,8 +1,8 @@import { Sequelize } from 'sequelize'-import { AbstractRunQuery, ModelBuilder } from '@server/models/shared'-import { UserNotificationModelForApi } from '@server/types/models'-import { ActorImageType } from '@shared/models'-import { getSort } from '../../shared'+import { AbstractRunQuery, ModelBuilder } from '@server/models/shared/index.js'+import { UserNotificationModelForApi } from '@server/types/models/index.js'+import { ActorImageType } from '@peertube/peertube-models'+import { getSort } from '../../shared/index.js'export interface ListNotificationsOptions {userId: numberdiff --git a/server/models/user/user-notification-setting.ts b/server/server/models/user/user-notification-setting.tssimilarity index 79%rename from server/models/user/user-notification-setting.tsrename to server/server/models/user/user-notification-setting.tsindex 394494c0ce..8b59fbe705 100644--- a/server/models/user/user-notification-setting.ts+++ b/server/server/models/user/user-notification-setting.ts@@ -1,3 +1,7 @@+import { type UserNotificationSetting, type UserNotificationSettingValueType } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { TokensCache } from '@server/lib/auth/tokens-cache.js'+import { MNotificationSettingFormattable } from '@server/types/models/index.js'import {AfterDestroy,AfterUpdate,@@ -12,13 +16,9 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { TokensCache } from '@server/lib/auth/tokens-cache'-import { MNotificationSettingFormattable } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model'-import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'-import { throwIfNotValid } from '../shared'-import { UserModel } from './user'+import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications.js'+import { throwIfNotValid } from '../shared/index.js'+import { UserModel } from './user.js'@Table({tableName: 'userNotificationSetting',@@ -38,7 +38,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newVideoFromSubscription'))@Column- newVideoFromSubscription: UserNotificationSettingValue+ newVideoFromSubscription: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -47,7 +47,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newCommentOnMyVideo'))@Column- newCommentOnMyVideo: UserNotificationSettingValue+ newCommentOnMyVideo: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -56,7 +56,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseAsModerator'))@Column- abuseAsModerator: UserNotificationSettingValue+ abuseAsModerator: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -65,7 +65,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'videoAutoBlacklistAsModerator'))@Column- videoAutoBlacklistAsModerator: UserNotificationSettingValue+ videoAutoBlacklistAsModerator: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -74,7 +74,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'blacklistOnMyVideo'))@Column- blacklistOnMyVideo: UserNotificationSettingValue+ blacklistOnMyVideo: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -83,7 +83,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoPublished'))@Column- myVideoPublished: UserNotificationSettingValue+ myVideoPublished: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -92,7 +92,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoImportFinished'))@Column- myVideoImportFinished: UserNotificationSettingValue+ myVideoImportFinished: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -101,7 +101,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newUserRegistration'))@Column- newUserRegistration: UserNotificationSettingValue+ newUserRegistration: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -110,7 +110,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newInstanceFollower'))@Column- newInstanceFollower: UserNotificationSettingValue+ newInstanceFollower: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -119,7 +119,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'autoInstanceFollowing'))@Column- autoInstanceFollowing: UserNotificationSettingValue+ autoInstanceFollowing: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -128,7 +128,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newFollow'))@Column- newFollow: UserNotificationSettingValue+ newFollow: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -137,7 +137,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'commentMention'))@Column- commentMention: UserNotificationSettingValue+ commentMention: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -146,7 +146,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseStateChange'))@Column- abuseStateChange: UserNotificationSettingValue+ abuseStateChange: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -155,7 +155,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseNewMessage'))@Column- abuseNewMessage: UserNotificationSettingValue+ abuseNewMessage: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -164,7 +164,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newPeerTubeVersion'))@Column- newPeerTubeVersion: UserNotificationSettingValue+ newPeerTubeVersion: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -173,7 +173,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'newPluginVersion'))@Column- newPluginVersion: UserNotificationSettingValue+ newPluginVersion: UserNotificationSettingValueType@AllowNull(false)@Default(null)@@ -182,7 +182,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<Uvalue => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoStudioEditionFinished'))@Column- myVideoStudioEditionFinished: UserNotificationSettingValue+ myVideoStudioEditionFinished: UserNotificationSettingValueType@ForeignKey(() => UserModel)@Column@@ -194,7 +194,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<U},onDelete: 'cascade'})- User: UserModel+ User: Awaited<UserModel>@CreatedAtcreatedAt: Datediff --git a/server/models/user/user-notification.ts b/server/server/models/user/user-notification.tssimilarity index 88%rename from server/models/user/user-notification.tsrename to server/server/models/user/user-notification.tsindex 667ee7f5f8..a96cb666cb 100644--- a/server/models/user/user-notification.ts+++ b/server/server/models/user/user-notification.ts@@ -1,26 +1,26 @@+import { forceNumber } from '@peertube/peertube-core-utils'+import { UserNotification, type UserNotificationType_Type } from '@peertube/peertube-models'+import { uuidToShort } from '@peertube/peertube-node-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { getBiggestActorImage } from '@server/lib/actor-image.js'+import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user/index.js'import { ModelIndexesOptions, Op, WhereOptions } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { getBiggestActorImage } from '@server/lib/actor-image'-import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user'-import { forceNumber } from '@shared/core-utils'-import { uuidToShort } from '@shared/extra-utils'-import { UserNotification, UserNotificationType } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { isBooleanValid } from '../../helpers/custom-validators/misc'-import { isUserNotificationTypeValid } from '../../helpers/custom-validators/user-notifications'-import { AbuseModel } from '../abuse/abuse'-import { AccountModel } from '../account/account'-import { ActorFollowModel } from '../actor/actor-follow'-import { ApplicationModel } from '../application/application'-import { PluginModel } from '../server/plugin'-import { throwIfNotValid } from '../shared'-import { VideoModel } from '../video/video'-import { VideoBlacklistModel } from '../video/video-blacklist'-import { VideoCommentModel } from '../video/video-comment'-import { VideoImportModel } from '../video/video-import'-import { UserNotificationListQueryBuilder } from './sql/user-notitication-list-query-builder'-import { UserModel } from './user'-import { UserRegistrationModel } from './user-registration'+import { isBooleanValid } from '../../helpers/custom-validators/misc.js'+import { isUserNotificationTypeValid } from '../../helpers/custom-validators/user-notifications.js'+import { AbuseModel } from '../abuse/abuse.js'+import { AccountModel } from '../account/account.js'+import { ActorFollowModel } from '../actor/actor-follow.js'+import { ApplicationModel } from '../application/application.js'+import { PluginModel } from '../server/plugin.js'+import { throwIfNotValid } from '../shared/index.js'+import { VideoBlacklistModel } from '../video/video-blacklist.js'+import { VideoCommentModel } from '../video/video-comment.js'+import { VideoImportModel } from '../video/video-import.js'+import { VideoModel } from '../video/video.js'+import { UserNotificationListQueryBuilder } from './sql/user-notitication-list-query-builder.js'+import { UserRegistrationModel } from './user-registration.js'+import { UserModel } from './user.js'@Table({tableName: 'userNotification',@@ -116,7 +116,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti@Default(null)@Is('UserNotificationType', value => throwIfNotValid(value, isUserNotificationTypeValid, 'type'))@Column- type: UserNotificationType+ type: UserNotificationType_Type@AllowNull(false)@Default(false)@@ -140,7 +140,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- User: UserModel+ User: Awaited<UserModel>@ForeignKey(() => VideoModel)@Column@@ -152,7 +152,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- Video: VideoModel+ Video: Awaited<VideoModel>@ForeignKey(() => VideoCommentModel)@Column@@ -164,7 +164,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- VideoComment: VideoCommentModel+ VideoComment: Awaited<VideoCommentModel>@ForeignKey(() => AbuseModel)@Column@@ -176,7 +176,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- Abuse: AbuseModel+ Abuse: Awaited<AbuseModel>@ForeignKey(() => VideoBlacklistModel)@Column@@ -188,7 +188,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- VideoBlacklist: VideoBlacklistModel+ VideoBlacklist: Awaited<VideoBlacklistModel>@ForeignKey(() => VideoImportModel)@Column@@ -200,7 +200,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- VideoImport: VideoImportModel+ VideoImport: Awaited<VideoImportModel>@ForeignKey(() => AccountModel)@Column@@ -212,7 +212,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- Account: AccountModel+ Account: Awaited<AccountModel>@ForeignKey(() => ActorFollowModel)@Column@@ -224,7 +224,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- ActorFollow: ActorFollowModel+ ActorFollow: Awaited<ActorFollowModel>@ForeignKey(() => PluginModel)@Column@@ -236,7 +236,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- Plugin: PluginModel+ Plugin: Awaited<PluginModel>@ForeignKey(() => ApplicationModel)@Column@@ -248,7 +248,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- Application: ApplicationModel+ Application: Awaited<ApplicationModel>@ForeignKey(() => UserRegistrationModel)@Column@@ -260,7 +260,7 @@ export class UserNotificationModel extends Model<Partial<AttributesOnly<UserNoti},onDelete: 'cascade'})- UserRegistration: UserRegistrationModel+ UserRegistration: Awaited<UserRegistrationModel>static listForApi (userId: number, start: number, count: number, sort: string, unread?: boolean) {const where = { userId }diff --git a/server/models/user/user-registration.ts b/server/server/models/user/user-registration.tssimilarity index 90%rename from server/models/user/user-registration.tsrename to server/server/models/user/user-registration.tsindex adda3cc7e6..c4bf50b1df 100644--- a/server/models/user/user-registration.ts+++ b/server/server/models/user/user-registration.ts@@ -1,3 +1,14 @@+import { UserRegistration, type UserRegistrationStateType } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import {+ isRegistrationModerationResponseValid,+ isRegistrationReasonValid,+ isRegistrationStateValid+} from '@server/helpers/custom-validators/user-registration.js'+import { isVideoChannelDisplayNameValid } from '@server/helpers/custom-validators/video-channels.js'+import { cryptPassword } from '@server/helpers/peertube-crypto.js'+import { USER_REGISTRATION_STATES } from '@server/initializers/constants.js'+import { MRegistration, MRegistrationFormattable } from '@server/types/models/index.js'import { FindOptions, Op, WhereOptions } from 'sequelize'import {AllowNull,@@ -13,20 +24,9 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import {- isRegistrationModerationResponseValid,- isRegistrationReasonValid,- isRegistrationStateValid-} from '@server/helpers/custom-validators/user-registration'-import { isVideoChannelDisplayNameValid } from '@server/helpers/custom-validators/video-channels'-import { cryptPassword } from '@server/helpers/peertube-crypto'-import { USER_REGISTRATION_STATES } from '@server/initializers/constants'-import { MRegistration, MRegistrationFormattable } from '@server/types/models'-import { UserRegistration, UserRegistrationState } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { isUserDisplayNameValid, isUserEmailVerifiedValid, isUserPasswordValid } from '../../helpers/custom-validators/users'-import { getSort, throwIfNotValid } from '../shared'-import { UserModel } from './user'+import { isUserDisplayNameValid, isUserEmailVerifiedValid, isUserPasswordValid } from '../../helpers/custom-validators/users.js'+import { getSort, throwIfNotValid } from '../shared/index.js'+import { UserModel } from './user.js'@Table({tableName: 'userRegistration',@@ -54,7 +54,7 @@ export class UserRegistrationModel extends Model<Partial<AttributesOnly<UserRegi@AllowNull(false)@Is('RegistrationState', value => throwIfNotValid(value, isRegistrationStateValid, 'state'))@Column- state: UserRegistrationState+ state: UserRegistrationStateType@AllowNull(false)@Is('RegistrationReason', value => throwIfNotValid(value, isRegistrationReasonValid, 'registration reason'))@@ -116,7 +116,7 @@ export class UserRegistrationModel extends Model<Partial<AttributesOnly<UserRegi},onDelete: 'SET NULL'})- User: UserModel+ User: Awaited<UserModel>@BeforeCreatestatic async cryptPasswordIfNeeded (instance: UserRegistrationModel) {diff --git a/server/models/user/user-video-history.ts b/server/server/models/user/user-video-history.tssimilarity index 81%rename from server/models/user/user-video-history.tsrename to server/server/models/user/user-video-history.tsindex f4d0889a10..4764f58ebc 100644--- a/server/models/user/user-video-history.ts+++ b/server/server/models/user/user-video-history.ts@@ -1,9 +1,10 @@import { DestroyOptions, Op, Transaction } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, IsInt, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { MUserAccountId, MUserId } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoModel } from '../video/video'-import { UserModel } from './user'+import { ResultList } from '@peertube/peertube-models'+import { MUserAccountId, MUserId } from '@server/types/models/index.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { VideoModel } from '../video/video.js'+import { UserModel } from './user.js'@Table({tableName: 'userVideoHistory',@@ -42,7 +43,7 @@ export class UserVideoHistoryModel extends Model<Partial<AttributesOnly<UserVide},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>@ForeignKey(() => UserModel)@Column@@ -54,9 +55,10 @@ export class UserVideoHistoryModel extends Model<Partial<AttributesOnly<UserVide},onDelete: 'CASCADE'})- User: UserModel+ User: Awaited<UserModel>- static listForApi (user: MUserAccountId, start: number, count: number, search?: string) {+ // FIXME: have to specify the result type to not break peertube typings generation+ static listForApi (user: MUserAccountId, start: number, count: number, search?: string): Promise<ResultList<VideoModel>> {return VideoModel.listForApi({start,count,diff --git a/server/models/user/user.ts b/server/server/models/user/user.tssimilarity index 93%rename from server/models/user/user.tsrename to server/server/models/user/user.tsindex ff6328d483..3c4495e3ea 100644--- a/server/models/user/user.ts+++ b/server/server/models/user/user.ts@@ -1,3 +1,26 @@+import { forceNumber, hasUserRight, USER_ROLE_LABELS } from '@peertube/peertube-core-utils'+import {+ AbuseState,+ MyUser,+ User,+ UserAdminFlag,+ UserRightType,+ VideoPlaylistType,+ type NSFWPolicyType,+ type UserAdminFlagType,+ type UserRoleType+} from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { TokensCache } from '@server/lib/auth/tokens-cache.js'+import { LiveQuotaStore } from '@server/lib/live/index.js'+import {+ MMyUserFormattable,+ MUser,+ MUserDefault,+ MUserFormattable,+ MUserNotifSettingChannelDefault,+ MUserWithNotificationSetting+} from '@server/types/models/index.js'import { col, FindOptions, fn, literal, Op, QueryTypes, where, WhereOptions } from 'sequelize'import {AfterDestroy,@@ -20,24 +43,7 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { TokensCache } from '@server/lib/auth/tokens-cache'-import { LiveQuotaStore } from '@server/lib/live'-import {- MMyUserFormattable,- MUser,- MUserDefault,- MUserFormattable,- MUserNotifSettingChannelDefault,- MUserWithNotificationSetting-} from '@server/types/models'-import { forceNumber } from '@shared/core-utils'-import { AttributesOnly } from '@shared/typescript-utils'-import { hasUserRight, USER_ROLE_LABELS } from '../../../shared/core-utils/users'-import { AbuseState, MyUser, UserRight, VideoPlaylistType } from '../../../shared/models'-import { User, UserRole } from '../../../shared/models/users'-import { UserAdminFlag } from '../../../shared/models/users/user-flag.model'-import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'-import { isThemeNameValid } from '../../helpers/custom-validators/plugins'+import { isThemeNameValid } from '../../helpers/custom-validators/plugins.js'import {isUserAdminFlagsValid,isUserAutoPlayNextVideoPlaylistValid,@@ -55,22 +61,22 @@ import {isUserVideoQuotaDailyValid,isUserVideoQuotaValid,isUserVideosHistoryEnabledValid-} from '../../helpers/custom-validators/users'-import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'-import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants'-import { getThemeOrDefault } from '../../lib/plugins/theme-utils'-import { AccountModel } from '../account/account'-import { ActorModel } from '../actor/actor'-import { ActorFollowModel } from '../actor/actor-follow'-import { ActorImageModel } from '../actor/actor-image'-import { OAuthTokenModel } from '../oauth/oauth-token'-import { getAdminUsersSort, throwIfNotValid } from '../shared'-import { VideoModel } from '../video/video'-import { VideoChannelModel } from '../video/video-channel'-import { VideoImportModel } from '../video/video-import'-import { VideoLiveModel } from '../video/video-live'-import { VideoPlaylistModel } from '../video/video-playlist'-import { UserNotificationSettingModel } from './user-notification-setting'+} from '../../helpers/custom-validators/users.js'+import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto.js'+import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants.js'+import { getThemeOrDefault } from '../../lib/plugins/theme-utils.js'+import { AccountModel } from '../account/account.js'+import { ActorFollowModel } from '../actor/actor-follow.js'+import { ActorImageModel } from '../actor/actor-image.js'+import { ActorModel } from '../actor/actor.js'+import { OAuthTokenModel } from '../oauth/oauth-token.js'+import { getAdminUsersSort, throwIfNotValid } from '../shared/index.js'+import { VideoChannelModel } from '../video/video-channel.js'+import { VideoImportModel } from '../video/video-import.js'+import { VideoLiveModel } from '../video/video-live.js'+import { VideoPlaylistModel } from '../video/video-playlist.js'+import { VideoModel } from '../video/video.js'+import { UserNotificationSettingModel } from './user-notification-setting.js'enum ScopeNames {FOR_ME_API = 'FOR_ME_API',@@ -326,7 +332,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {@Default(UserAdminFlag.NONE)@Is('UserAdminFlags', value => throwIfNotValid(value, isUserAdminFlagsValid, 'user admin flags'))@Column- adminFlags?: UserAdminFlag+ adminFlags?: UserAdminFlagType@AllowNull(false)@Default(false)@@ -343,7 +349,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {@AllowNull(false)@Is('UserRole', value => throwIfNotValid(value, isUserRoleValid, 'role'))@Column- role: number+ role: UserRoleType@AllowNull(false)@Is('UserVideoQuota', value => throwIfNotValid(value, isUserVideoQuotaValid, 'video quota'))@@ -425,26 +431,26 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {onDelete: 'cascade',hooks: true})- Account: AccountModel+ Account: Awaited<AccountModel>@HasOne(() => UserNotificationSettingModel, {foreignKey: 'userId',onDelete: 'cascade',hooks: true})- NotificationSetting: UserNotificationSettingModel+ NotificationSetting: Awaited<UserNotificationSettingModel>@HasMany(() => VideoImportModel, {foreignKey: 'userId',onDelete: 'cascade'})- VideoImports: VideoImportModel[]+ VideoImports: Awaited<VideoImportModel>[]@HasMany(() => OAuthTokenModel, {foreignKey: 'userId',onDelete: 'cascade'})- OAuthTokens: OAuthTokenModel[]+ OAuthTokens: Awaited<OAuthTokenModel>[]// Used if we already set an encrypted password in user modelskipPasswordEncryption = false@@ -513,9 +519,9 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {]).then(([ total, data ]) => ({ total, data }))}- static listWithRight (right: UserRight): Promise<MUserDefault[]> {+ static listWithRight (right: UserRightType): Promise<MUserDefault[]> {const roles = Object.keys(USER_ROLE_LABELS)- .map(k => parseInt(k, 10) as UserRole)+ .map(k => parseInt(k, 10) as UserRoleType).filter(role => hasUserRight(role, right))const query = {@@ -858,11 +864,11 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {.then(u => u.map(u => u.username))}- hasRight (right: UserRight) {+ hasRight (right: UserRightType) {return hasUserRight(this.role, right)}- hasAdminFlag (flag: UserAdminFlag) {+ hasAdminFlag (flag: UserAdminFlagType) {return this.adminFlags & flag}diff --git a/server/server/models/video/formatter/index.ts b/server/server/models/video/formatter/index.tsnew file mode 100644index 0000000000..856595ad5d--- /dev/null+++ b/server/server/models/video/formatter/index.ts@@ -0,0 +1,2 @@+export * from './video-activity-pub-format.js'+export * from './video-api-format.js'diff --git a/server/server/models/video/formatter/shared/index.ts b/server/server/models/video/formatter/shared/index.tsnew file mode 100644index 0000000000..66fe5ff5bd--- /dev/null+++ b/server/server/models/video/formatter/shared/index.ts@@ -0,0 +1 @@+export * from './video-format-utils.js'diff --git a/server/models/video/formatter/shared/video-format-utils.ts b/server/server/models/video/formatter/shared/video-format-utils.tssimilarity index 77%rename from server/models/video/formatter/shared/video-format-utils.tsrename to server/server/models/video/formatter/shared/video-format-utils.tsindex df3bbdf1c6..8a8d9f4b21 100644--- a/server/models/video/formatter/shared/video-format-utils.ts+++ b/server/server/models/video/formatter/shared/video-format-utils.ts@@ -1,4 +1,4 @@-import { MVideoFile } from '@server/types/models'+import { MVideoFile } from '@server/types/models/index.js'export function sortByResolutionDesc (fileA: MVideoFile, fileB: MVideoFile) {if (fileA.resolution < fileB.resolution) return 1diff --git a/server/models/video/formatter/video-activity-pub-format.ts b/server/server/models/video/formatter/video-activity-pub-format.tssimilarity index 94%rename from server/models/video/formatter/video-activity-pub-format.tsrename to server/server/models/video/formatter/video-activity-pub-format.tsindex 694c66c338..759e6dbbc6 100644--- a/server/models/video/formatter/video-activity-pub-format.ts+++ b/server/server/models/video/formatter/video-activity-pub-format.ts@@ -1,7 +1,7 @@-import { isArray } from '@server/helpers/custom-validators/misc'-import { generateMagnetUri } from '@server/helpers/webtorrent'-import { getActivityStreamDuration } from '@server/lib/activitypub/activity'-import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls'+import { isArray } from '@server/helpers/custom-validators/misc.js'+import { generateMagnetUri } from '@server/helpers/webtorrent.js'+import { getActivityStreamDuration } from '@server/lib/activitypub/activity.js'+import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls.js'import {ActivityIconObject,ActivityPlaylistUrlObject,@@ -10,18 +10,18 @@ import {ActivityTrackerUrlObject,ActivityUrlObject,VideoObject-} from '@shared/models'-import { MIMETYPES, WEBSERVER } from '../../../initializers/constants'+} from '@peertube/peertube-models'+import { MIMETYPES, WEBSERVER } from '../../../initializers/constants.js'import {getLocalVideoCommentsActivityPubUrl,getLocalVideoDislikesActivityPubUrl,getLocalVideoLikesActivityPubUrl,getLocalVideoSharesActivityPubUrl-} from '../../../lib/activitypub/url'-import { MStreamingPlaylistFiles, MUserId, MVideo, MVideoAP, MVideoFile } from '../../../types/models'-import { VideoCaptionModel } from '../video-caption'-import { sortByResolutionDesc } from './shared'-import { getCategoryLabel, getLanguageLabel, getLicenceLabel } from './video-api-format'+} from '../../../lib/activitypub/url.js'+import { MStreamingPlaylistFiles, MUserId, MVideo, MVideoAP, MVideoFile } from '../../../types/models/index.js'+import { VideoCaptionModel } from '../video-caption.js'+import { sortByResolutionDesc } from './shared/index.js'+import { getCategoryLabel, getLanguageLabel, getLicenceLabel } from './video-api-format.js'export function videoModelToActivityPubObject (video: MVideoAP): VideoObject {const language = video.languagediff --git a/server/models/video/formatter/video-api-format.ts b/server/server/models/video/formatter/video-api-format.tssimilarity index 95%rename from server/models/video/formatter/video-api-format.tsrename to server/server/models/video/formatter/video-api-format.tsindex 7a58f5d3c3..958832485e 100644--- a/server/models/video/formatter/video-api-format.ts+++ b/server/server/models/video/formatter/video-api-format.ts@@ -1,8 +1,8 @@-import { generateMagnetUri } from '@server/helpers/webtorrent'-import { tracer } from '@server/lib/opentelemetry/tracing'-import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls'-import { VideoViewsManager } from '@server/lib/views/video-views-manager'-import { uuidToShort } from '@shared/extra-utils'+import { generateMagnetUri } from '@server/helpers/webtorrent.js'+import { tracer } from '@server/lib/opentelemetry/tracing.js'+import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls.js'+import { VideoViewsManager } from '@server/lib/views/video-views-manager.js'+import { uuidToShort } from '@peertube/peertube-node-utils'import {Video,VideoAdditionalAttributes,@@ -11,12 +11,12 @@ import {VideoInclude,VideosCommonQueryAfterSanitize,VideoStreamingPlaylist-} from '@shared/models'-import { isArray } from '../../../helpers/custom-validators/misc'-import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES, VIDEO_STATES } from '../../../initializers/constants'-import { MServer, MStreamingPlaylistRedundanciesOpt, MVideoFormattable, MVideoFormattableDetails } from '../../../types/models'-import { MVideoFileRedundanciesOpt } from '../../../types/models/video/video-file'-import { sortByResolutionDesc } from './shared'+} from '@peertube/peertube-models'+import { isArray } from '../../../helpers/custom-validators/misc.js'+import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES, VIDEO_STATES } from '../../../initializers/constants.js'+import { MServer, MStreamingPlaylistRedundanciesOpt, MVideoFormattable, MVideoFormattableDetails } from '../../../types/models/index.js'+import { MVideoFileRedundanciesOpt } from '../../../types/models/video/video-file.js'+import { sortByResolutionDesc } from './shared/index.js'export type VideoFormattingJSONOptions = {completeDescription?: booleandiff --git a/server/models/video/schedule-video-update.ts b/server/server/models/video/schedule-video-update.tssimilarity index 73%rename from server/models/video/schedule-video-update.tsrename to server/server/models/video/schedule-video-update.tsindex b3cf269667..229610d875 100644--- a/server/models/video/schedule-video-update.ts+++ b/server/server/models/video/schedule-video-update.ts@@ -1,9 +1,9 @@import { Op, Transaction } from 'sequelize'-import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { MScheduleVideoUpdateFormattable, MScheduleVideoUpdate } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoPrivacy } from '../../../shared/models/videos'-import { VideoModel } from './video'+import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'+import { VideoPrivacy } from '@peertube/peertube-models'+import { MScheduleVideoUpdate, MScheduleVideoUpdateFormattable } from '@server/types/models/index.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { VideoModel } from './video.js'@Table({tableName: 'scheduleVideoUpdate',@@ -26,8 +26,8 @@ export class ScheduleVideoUpdateModel extends Model<Partial<AttributesOnly<Sched@AllowNull(true)@Default(null)- @Column- privacy: VideoPrivacy.PUBLIC | VideoPrivacy.UNLISTED | VideoPrivacy.INTERNAL+ @Column(DataType.INTEGER)+ privacy: typeof VideoPrivacy.PUBLIC | typeof VideoPrivacy.UNLISTED | typeof VideoPrivacy.INTERNAL@CreatedAtcreatedAt: Date@@ -45,7 +45,7 @@ export class ScheduleVideoUpdateModel extends Model<Partial<AttributesOnly<Sched},onDelete: 'cascade'})- Video: VideoModel+ Video: Awaited<VideoModel>static areVideosToUpdate () {const query = {diff --git a/server/models/video/sql/comment/video-comment-list-query-builder.ts b/server/server/models/video/sql/comment/video-comment-list-query-builder.tssimilarity index 98%rename from server/models/video/sql/comment/video-comment-list-query-builder.tsrename to server/server/models/video/sql/comment/video-comment-list-query-builder.tsindex a7eed22a14..0a9388fda7 100644--- a/server/models/video/sql/comment/video-comment-list-query-builder.ts+++ b/server/server/models/video/sql/comment/video-comment-list-query-builder.ts@@ -1,8 +1,8 @@import { Model, Sequelize, Transaction } from 'sequelize'-import { AbstractRunQuery, ModelBuilder } from '@server/models/shared'-import { ActorImageType, VideoPrivacy } from '@shared/models'-import { createSafeIn, getSort, parseRowCountResult } from '../../../shared'-import { VideoCommentTableAttributes } from './video-comment-table-attributes'+import { AbstractRunQuery, ModelBuilder } from '@server/models/shared/index.js'+import { ActorImageType, VideoPrivacy } from '@peertube/peertube-models'+import { createSafeIn, getSort, parseRowCountResult } from '../../../shared/index.js'+import { VideoCommentTableAttributes } from './video-comment-table-attributes.js'export interface ListVideoCommentsOptions {selectType: 'api' | 'feed' | 'comment-only'diff --git a/server/models/video/sql/comment/video-comment-table-attributes.ts b/server/server/models/video/sql/comment/video-comment-table-attributes.tssimilarity index 76%rename from server/models/video/sql/comment/video-comment-table-attributes.tsrename to server/server/models/video/sql/comment/video-comment-table-attributes.tsindex 87f8750c17..c7a8a97684 100644--- a/server/models/video/sql/comment/video-comment-table-attributes.ts+++ b/server/server/models/video/sql/comment/video-comment-table-attributes.ts@@ -1,9 +1,9 @@-import { Memoize } from '@server/helpers/memoize'-import { AccountModel } from '@server/models/account/account'-import { ActorModel } from '@server/models/actor/actor'-import { ActorImageModel } from '@server/models/actor/actor-image'-import { ServerModel } from '@server/models/server/server'-import { VideoCommentModel } from '../../video-comment'+import { Memoize } from '@server/helpers/memoize.js'+import { AccountModel } from '@server/models/account/account.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { ActorImageModel } from '@server/models/actor/actor-image.js'+import { ServerModel } from '@server/models/server/server.js'+import { VideoCommentModel } from '../../video-comment.js'export class VideoCommentTableAttributes {diff --git a/server/server/models/video/sql/video/index.ts b/server/server/models/video/sql/video/index.tsnew file mode 100644index 0000000000..003f59861f--- /dev/null+++ b/server/server/models/video/sql/video/index.ts@@ -0,0 +1,3 @@+export * from './video-model-get-query-builder.js'+export * from './videos-id-list-query-builder.js'+export * from './videos-model-list-query-builder.js'diff --git a/server/models/video/sql/video/shared/abstract-video-query-builder.ts b/server/server/models/video/sql/video/shared/abstract-video-query-builder.tssimilarity index 97%rename from server/models/video/sql/video/shared/abstract-video-query-builder.tsrename to server/server/models/video/sql/video/shared/abstract-video-query-builder.tsindex 56a00aa0c6..1175c75eb9 100644--- a/server/models/video/sql/video/shared/abstract-video-query-builder.ts+++ b/server/server/models/video/sql/video/shared/abstract-video-query-builder.ts@@ -1,10 +1,10 @@import { Sequelize } from 'sequelize'import validator from 'validator'-import { MUserAccountId } from '@server/types/models'-import { ActorImageType } from '@shared/models'-import { AbstractRunQuery } from '../../../../shared/abstract-run-query'-import { createSafeIn } from '../../../../shared'-import { VideoTableAttributes } from './video-table-attributes'+import { MUserAccountId } from '@server/types/models/index.js'+import { ActorImageType } from '@peertube/peertube-models'+import { AbstractRunQuery } from '../../../../shared/abstract-run-query.js'+import { createSafeIn } from '../../../../shared/index.js'+import { VideoTableAttributes } from './video-table-attributes.js'/***@@ -325,7 +325,7 @@ export class AbstractVideoQueryBuilder extends AbstractRunQuery {return}- if (validator.isInt('' + options.id)) {+ if (validator.default.isInt('' + options.id)) {this.where = 'WHERE "video".id = :videoId'} else {this.where = 'WHERE uuid = :videoId'diff --git a/server/models/video/sql/video/shared/video-file-query-builder.ts b/server/server/models/video/sql/video/shared/video-file-query-builder.tssimilarity index 99%rename from server/models/video/sql/video/shared/video-file-query-builder.tsrename to server/server/models/video/sql/video/shared/video-file-query-builder.tsindex 196b72b43f..b7d3e06d97 100644--- a/server/models/video/sql/video/shared/video-file-query-builder.ts+++ b/server/server/models/video/sql/video/shared/video-file-query-builder.ts@@ -1,5 +1,5 @@import { Sequelize, Transaction } from 'sequelize'-import { AbstractVideoQueryBuilder } from './abstract-video-query-builder'+import { AbstractVideoQueryBuilder } from './abstract-video-query-builder.js'export type FileQueryOptions = {id?: string | numberdiff --git a/server/models/video/sql/video/shared/video-model-builder.ts b/server/server/models/video/sql/video/shared/video-model-builder.tssimilarity index 93%rename from server/models/video/sql/video/shared/video-model-builder.tsrename to server/server/models/video/sql/video/shared/video-model-builder.tsindex 740aa842f0..d5746b41aa 100644--- a/server/models/video/sql/video/shared/video-model-builder.ts+++ b/server/server/models/video/sql/video/shared/video-model-builder.ts@@ -1,24 +1,23 @@--import { AccountModel } from '@server/models/account/account'-import { AccountBlocklistModel } from '@server/models/account/account-blocklist'-import { ActorModel } from '@server/models/actor/actor'-import { ActorImageModel } from '@server/models/actor/actor-image'-import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy'-import { ServerModel } from '@server/models/server/server'-import { ServerBlocklistModel } from '@server/models/server/server-blocklist'-import { TrackerModel } from '@server/models/server/tracker'-import { UserVideoHistoryModel } from '@server/models/user/user-video-history'-import { VideoInclude } from '@shared/models'-import { ScheduleVideoUpdateModel } from '../../../schedule-video-update'-import { TagModel } from '../../../tag'-import { ThumbnailModel } from '../../../thumbnail'-import { VideoModel } from '../../../video'-import { VideoBlacklistModel } from '../../../video-blacklist'-import { VideoChannelModel } from '../../../video-channel'-import { VideoFileModel } from '../../../video-file'-import { VideoLiveModel } from '../../../video-live'-import { VideoStreamingPlaylistModel } from '../../../video-streaming-playlist'-import { VideoTableAttributes } from './video-table-attributes'+import { VideoInclude, VideoIncludeType } from '@peertube/peertube-models'+import { AccountBlocklistModel } from '@server/models/account/account-blocklist.js'+import { AccountModel } from '@server/models/account/account.js'+import { ActorImageModel } from '@server/models/actor/actor-image.js'+import { ActorModel } from '@server/models/actor/actor.js'+import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy.js'+import { ServerBlocklistModel } from '@server/models/server/server-blocklist.js'+import { ServerModel } from '@server/models/server/server.js'+import { TrackerModel } from '@server/models/server/tracker.js'+import { UserVideoHistoryModel } from '@server/models/user/user-video-history.js'+import { ScheduleVideoUpdateModel } from '../../../schedule-video-update.js'+import { TagModel } from '../../../tag.js'+import { ThumbnailModel } from '../../../thumbnail.js'+import { VideoBlacklistModel } from '../../../video-blacklist.js'+import { VideoChannelModel } from '../../../video-channel.js'+import { VideoFileModel } from '../../../video-file.js'+import { VideoLiveModel } from '../../../video-live.js'+import { VideoStreamingPlaylistModel } from '../../../video-streaming-playlist.js'+import { VideoModel } from '../../../video.js'+import { VideoTableAttributes } from './video-table-attributes.js'type SQLRow = { [id: string]: string | number }@@ -59,7 +58,7 @@ export class VideoModelBuilder {buildVideosFromRows (options: {rows: SQLRow[]- include?: VideoInclude+ include?: VideoIncludeTyperowsWebVideoFiles?: SQLRow[]rowsStreamingPlaylist?: SQLRow[]}) {diff --git a/server/models/video/sql/video/shared/video-table-attributes.ts b/server/server/models/video/sql/video/shared/video-table-attributes.tssimilarity index 100%rename from server/models/video/sql/video/shared/video-table-attributes.tsrename to server/server/models/video/sql/video/shared/video-table-attributes.tsdiff --git a/server/models/video/sql/video/video-model-get-query-builder.ts b/server/server/models/video/sql/video/video-model-get-query-builder.tssimilarity index 97%rename from server/models/video/sql/video/video-model-get-query-builder.tsrename to server/server/models/video/sql/video/video-model-get-query-builder.tsindex 3f43d4d921..1d55e3e93b 100644--- a/server/models/video/sql/video/video-model-get-query-builder.ts+++ b/server/server/models/video/sql/video/video-model-get-query-builder.ts@@ -1,9 +1,9 @@import { Sequelize, Transaction } from 'sequelize'-import { pick } from '@shared/core-utils'-import { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder'-import { VideoFileQueryBuilder } from './shared/video-file-query-builder'-import { VideoModelBuilder } from './shared/video-model-builder'-import { VideoTableAttributes } from './shared/video-table-attributes'+import { pick } from '@peertube/peertube-core-utils'+import { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder.js'+import { VideoFileQueryBuilder } from './shared/video-file-query-builder.js'+import { VideoModelBuilder } from './shared/video-model-builder.js'+import { VideoTableAttributes } from './shared/video-table-attributes.js'/***diff --git a/server/models/video/sql/video/videos-id-list-query-builder.ts b/server/server/models/video/sql/video/videos-id-list-query-builder.tssimilarity index 97%rename from server/models/video/sql/video/videos-id-list-query-builder.tsrename to server/server/models/video/sql/video/videos-id-list-query-builder.tsindex 7f23761020..090eaddbc9 100644--- a/server/models/video/sql/video/videos-id-list-query-builder.ts+++ b/server/server/models/video/sql/video/videos-id-list-query-builder.ts@@ -1,13 +1,13 @@import { Sequelize, Transaction } from 'sequelize'import validator from 'validator'-import { exists } from '@server/helpers/custom-validators/misc'-import { WEBSERVER } from '@server/initializers/constants'-import { buildSortDirectionAndField } from '@server/models/shared'-import { MUserAccountId, MUserId } from '@server/types/models'-import { forceNumber } from '@shared/core-utils'-import { VideoInclude, VideoPrivacy, VideoState } from '@shared/models'-import { createSafeIn, parseRowCountResult } from '../../../shared'-import { AbstractRunQuery } from '../../../shared/abstract-run-query'+import { forceNumber } from '@peertube/peertube-core-utils'+import { VideoInclude, VideoIncludeType, VideoPrivacy, VideoPrivacyType, VideoState } from '@peertube/peertube-models'+import { exists } from '@server/helpers/custom-validators/misc.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { buildSortDirectionAndField } from '@server/models/shared/index.js'+import { MUserAccountId, MUserId } from '@server/types/models/index.js'+import { AbstractRunQuery } from '../../../shared/abstract-run-query.js'+import { createSafeIn, parseRowCountResult } from '../../../shared/index.js'/***@@ -35,14 +35,14 @@ export type BuildVideosListQueryOptions = {host?: stringisLive?: booleanisLocal?: boolean- include?: VideoInclude+ include?: VideoIncludeTypecategoryOneOf?: number[]licenceOneOf?: number[]languageOneOf?: string[]tagsOneOf?: string[]tagsAllOf?: string[]- privacyOneOf?: VideoPrivacy[]+ privacyOneOf?: VideoPrivacyType[]uuids?: string[]@@ -458,7 +458,7 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery {)}- private wherePrivacyOneOf (privacyOneOf: VideoPrivacy[]) {+ private wherePrivacyOneOf (privacyOneOf: VideoPrivacyType[]) {this.and.push('"video"."privacy" IN (:privacyOneOf)')this.replacements.privacyOneOf = privacyOneOf}@@ -568,7 +568,7 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery {' AND "video"."id" = "videoTag"."videoId"' +' )'- if (validator.isUUID(search)) {+ if (validator.default.isUUID(search)) {base += ` OR "video"."uuid" = ${escapedSearch}`}diff --git a/server/models/video/sql/video/videos-model-list-query-builder.ts b/server/server/models/video/sql/video/videos-model-list-query-builder.tssimilarity index 92%rename from server/models/video/sql/video/videos-model-list-query-builder.tsrename to server/server/models/video/sql/video/videos-model-list-query-builder.tsindex b73dc28cd5..9eb26085d2 100644--- a/server/models/video/sql/video/videos-model-list-query-builder.ts+++ b/server/server/models/video/sql/video/videos-model-list-query-builder.ts@@ -1,10 +1,10 @@import { Sequelize } from 'sequelize'-import { pick } from '@shared/core-utils'-import { VideoInclude } from '@shared/models'-import { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder'-import { VideoFileQueryBuilder } from './shared/video-file-query-builder'-import { VideoModelBuilder } from './shared/video-model-builder'-import { BuildVideosListQueryOptions, VideosIdListQueryBuilder } from './videos-id-list-query-builder'+import { pick } from '@peertube/peertube-core-utils'+import { VideoInclude } from '@peertube/peertube-models'+import { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder.js'+import { VideoFileQueryBuilder } from './shared/video-file-query-builder.js'+import { VideoModelBuilder } from './shared/video-model-builder.js'+import { BuildVideosListQueryOptions, VideosIdListQueryBuilder } from './videos-id-list-query-builder.js'/***diff --git a/server/models/video/storyboard.ts b/server/server/models/video/storyboard.tssimilarity index 89%rename from server/models/video/storyboard.tsrename to server/server/models/video/storyboard.tsindex 1c3c6d8505..1d0a8e429a 100644--- a/server/models/video/storyboard.ts+++ b/server/server/models/video/storyboard.ts@@ -1,13 +1,13 @@-import { remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'import { join } from 'path'import { AfterDestroy, AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { CONFIG } from '@server/initializers/config'-import { MStoryboard, MStoryboardVideo, MVideo } from '@server/types/models'-import { Storyboard } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { logger } from '../../helpers/logger'-import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, WEBSERVER } from '../../initializers/constants'-import { VideoModel } from './video'+import { CONFIG } from '@server/initializers/config.js'+import { MStoryboard, MStoryboardVideo, MVideo } from '@server/types/models/index.js'+import { Storyboard } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { logger } from '../../helpers/logger.js'+import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, WEBSERVER } from '../../initializers/constants.js'+import { VideoModel } from './video.js'import { Transaction } from 'sequelize'@Table({@@ -63,7 +63,7 @@ export class StoryboardModel extends Model<Partial<AttributesOnly<StoryboardMode},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>@CreatedAtcreatedAt: Datediff --git a/server/models/video/tag.ts b/server/server/models/video/tag.tssimilarity index 85%rename from server/models/video/tag.tsrename to server/server/models/video/tag.tsindex cebde3755e..dee954795c 100644--- a/server/models/video/tag.ts+++ b/server/server/models/video/tag.ts@@ -1,12 +1,12 @@import { col, fn, QueryTypes, Transaction } from 'sequelize'import { AllowNull, BelongsToMany, Column, CreatedAt, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { MTag } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoPrivacy, VideoState } from '../../../shared/models/videos'-import { isVideoTagValid } from '../../helpers/custom-validators/videos'-import { throwIfNotValid } from '../shared'-import { VideoModel } from './video'-import { VideoTagModel } from './video-tag'+import { VideoPrivacy, VideoState } from '@peertube/peertube-models'+import { MTag } from '@server/types/models/index.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isVideoTagValid } from '../../helpers/custom-validators/videos.js'+import { throwIfNotValid } from '../shared/index.js'+import { VideoTagModel } from './video-tag.js'+import { VideoModel } from './video.js'@Table({tableName: 'tag',@@ -40,7 +40,7 @@ export class TagModel extends Model<Partial<AttributesOnly<TagModel>>> {through: () => VideoTagModel,onDelete: 'CASCADE'})- Videos: VideoModel[]+ Videos: Awaited<VideoModel>[]static findOrCreateTags (tags: string[], transaction: Transaction): Promise<MTag[]> {if (tags === null) return Promise.resolve([])diff --git a/server/models/video/thumbnail.ts b/server/server/models/video/thumbnail.tssimilarity index 83%rename from server/models/video/thumbnail.tsrename to server/server/models/video/thumbnail.tsindex 1722acdb4d..4791b8b752 100644--- a/server/models/video/thumbnail.ts+++ b/server/server/models/video/thumbnail.ts@@ -1,4 +1,8 @@-import { remove } from 'fs-extra'+import { ThumbnailType, type ThumbnailType_Type } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { afterCommitIfTransaction } from '@server/helpers/database-utils.js'+import { MThumbnail, MThumbnailVideo, MVideo } from '@server/types/models/index.js'+import { remove } from 'fs-extra/esm'import { join } from 'path'import {AfterDestroy,@@ -15,15 +19,11 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { afterCommitIfTransaction } from '@server/helpers/database-utils'-import { MThumbnail, MThumbnailVideo, MVideo } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, WEBSERVER } from '../../initializers/constants'-import { VideoModel } from './video'-import { VideoPlaylistModel } from './video-playlist'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, WEBSERVER } from '../../initializers/constants.js'+import { VideoPlaylistModel } from './video-playlist.js'+import { VideoModel } from './video.js'@Table({tableName: 'thumbnail',@@ -59,7 +59,7 @@ export class ThumbnailModel extends Model<Partial<AttributesOnly<ThumbnailModel>@AllowNull(false)@Column- type: ThumbnailType+ type: ThumbnailType_Type@AllowNull(true)@Column(DataType.STRING(CONSTRAINTS_FIELDS.COMMONS.URL.max))@@ -83,7 +83,7 @@ export class ThumbnailModel extends Model<Partial<AttributesOnly<ThumbnailModel>},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>@ForeignKey(() => VideoPlaylistModel)@Column@@ -95,7 +95,7 @@ export class ThumbnailModel extends Model<Partial<AttributesOnly<ThumbnailModel>},onDelete: 'CASCADE'})- VideoPlaylist: VideoPlaylistModel+ VideoPlaylist: Awaited<VideoPlaylistModel>@CreatedAtcreatedAt: Date@@ -106,7 +106,7 @@ export class ThumbnailModel extends Model<Partial<AttributesOnly<ThumbnailModel>// If this thumbnail replaced existing one, track the old namepreviousThumbnailFilename: string- private static readonly types: { [ id in ThumbnailType ]: { label: string, directory: string, staticPath: string } } = {+ private static readonly types: { [ id in ThumbnailType_Type ]: { label: string, directory: string, staticPath: string } } = {[ThumbnailType.MINIATURE]: {label: 'miniature',directory: CONFIG.STORAGE.THUMBNAILS_DIR,@@ -134,7 +134,7 @@ export class ThumbnailModel extends Model<Partial<AttributesOnly<ThumbnailModel>.catch(err => logger.error('Cannot remove thumbnail file %s.', instance.filename, { err }))}- static loadByFilename (filename: string, thumbnailType: ThumbnailType): Promise<MThumbnail> {+ static loadByFilename (filename: string, thumbnailType: ThumbnailType_Type): Promise<MThumbnail> {const query = {where: {filename,@@ -145,7 +145,7 @@ export class ThumbnailModel extends Model<Partial<AttributesOnly<ThumbnailModel>return ThumbnailModel.findOne(query)}- static loadWithVideoByFilename (filename: string, thumbnailType: ThumbnailType): Promise<MThumbnailVideo> {+ static loadWithVideoByFilename (filename: string, thumbnailType: ThumbnailType_Type): Promise<MThumbnailVideo> {const query = {where: {filename,@@ -162,7 +162,7 @@ export class ThumbnailModel extends Model<Partial<AttributesOnly<ThumbnailModel>return ThumbnailModel.findOne(query)}- static buildPath (type: ThumbnailType, filename: string) {+ static buildPath (type: ThumbnailType_Type, filename: string) {const directory = ThumbnailModel.types[type].directoryreturn join(directory, filename)diff --git a/server/models/video/video-blacklist.ts b/server/server/models/video/video-blacklist.tssimilarity index 84%rename from server/models/video/video-blacklist.tsrename to server/server/models/video/video-blacklist.tsindex 9247d0e2b1..0f6930034c 100644--- a/server/models/video/video-blacklist.ts+++ b/server/server/models/video/video-blacklist.ts@@ -1,14 +1,14 @@+import { VideoBlacklist, type VideoBlacklistType_Type } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/types/models/index.js'import { FindOptions } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos'-import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { getBlacklistSort, searchAttribute, throwIfNotValid } from '../shared'-import { ThumbnailModel } from './thumbnail'-import { VideoModel } from './video'-import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel'+import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist.js'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { getBlacklistSort, searchAttribute, throwIfNotValid } from '../shared/index.js'+import { ThumbnailModel } from './thumbnail.js'+import { SummaryOptions, VideoChannelModel, ScopeNames as VideoChannelScopeNames } from './video-channel.js'+import { VideoModel } from './video.js'@Table({tableName: 'videoBlacklist',@@ -34,7 +34,7 @@ export class VideoBlacklistModel extends Model<Partial<AttributesOnly<VideoBlack@Default(null)@Is('VideoBlacklistType', value => throwIfNotValid(value, isVideoBlacklistTypeValid, 'type'))@Column- type: VideoBlacklistType+ type: VideoBlacklistType_Type@CreatedAtcreatedAt: Date@@ -52,14 +52,14 @@ export class VideoBlacklistModel extends Model<Partial<AttributesOnly<VideoBlack},onDelete: 'cascade'})- Video: VideoModel+ Video: Awaited<VideoModel>static listForApi (parameters: {start: numbercount: numbersort: stringsearch?: string- type?: VideoBlacklistType+ type?: VideoBlacklistType_Type}) {const { start, count, sort, search, type } = parametersdiff --git a/server/models/video/video-caption.ts b/server/server/models/video/video-caption.tssimilarity index 88%rename from server/models/video/video-caption.tsrename to server/server/models/video/video-caption.tsindex dd4cefd652..312f23a304 100644--- a/server/models/video/video-caption.ts+++ b/server/server/models/video/video-caption.ts@@ -1,4 +1,4 @@-import { remove } from 'fs-extra'+import { remove } from 'fs-extra/esm'import { join } from 'path'import { Op, OrderItem, Transaction } from 'sequelize'import {@@ -15,16 +15,22 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionLanguageUrl, MVideoCaptionVideo } from '@server/types/models'-import { buildUUID } from '@shared/extra-utils'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'-import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, VIDEO_LANGUAGES, WEBSERVER } from '../../initializers/constants'-import { buildWhereIdOrUUID, throwIfNotValid } from '../shared'-import { VideoModel } from './video'+import { VideoCaption } from '@peertube/peertube-models'+import {+ MVideo,+ MVideoCaption,+ MVideoCaptionFormattable,+ MVideoCaptionLanguageUrl,+ MVideoCaptionVideo+} from '@server/types/models/index.js'+import { buildUUID } from '@peertube/peertube-node-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, VIDEO_LANGUAGES, WEBSERVER } from '../../initializers/constants.js'+import { buildWhereIdOrUUID, throwIfNotValid } from '../shared/index.js'+import { VideoModel } from './video.js'export enum ScopeNames {WITH_VIDEO_UUID_AND_REMOTE = 'WITH_VIDEO_UUID_AND_REMOTE'@@ -88,7 +94,7 @@ export class VideoCaptionModel extends Model<Partial<AttributesOnly<VideoCaption},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>@BeforeDestroystatic async removeFiles (instance: VideoCaptionModel, options) {diff --git a/server/models/video/video-change-ownership.ts b/server/server/models/video/video-change-ownership.tssimilarity index 84%rename from server/models/video/video-change-ownership.tsrename to server/server/models/video/video-change-ownership.tsindex 26f072f4f6..152f85a222 100644--- a/server/models/video/video-change-ownership.ts+++ b/server/server/models/video/video-change-ownership.ts@@ -1,10 +1,10 @@+import { VideoChangeOwnership, type VideoChangeOwnershipStatusType } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { MVideoChangeOwnershipFormattable, MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership.js'import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'-import { MVideoChangeOwnershipFormattable, MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '../../../shared/models/videos'-import { AccountModel } from '../account/account'-import { getSort } from '../shared'-import { ScopeNames as VideoScopeNames, VideoModel } from './video'+import { AccountModel } from '../account/account.js'+import { getSort } from '../shared/index.js'+import { VideoModel, ScopeNames as VideoScopeNames } from './video.js'enum ScopeNames {WITH_ACCOUNTS = 'WITH_ACCOUNTS',@@ -63,7 +63,7 @@ export class VideoChangeOwnershipModel extends Model<Partial<AttributesOnly<Vide@AllowNull(false)@Column- status: VideoChangeOwnershipStatus+ status: VideoChangeOwnershipStatusType@ForeignKey(() => AccountModel)@Column@@ -76,7 +76,7 @@ export class VideoChangeOwnershipModel extends Model<Partial<AttributesOnly<Vide},onDelete: 'cascade'})- Initiator: AccountModel+ Initiator: Awaited<AccountModel>@ForeignKey(() => AccountModel)@Column@@ -89,7 +89,7 @@ export class VideoChangeOwnershipModel extends Model<Partial<AttributesOnly<Vide},onDelete: 'cascade'})- NextOwner: AccountModel+ NextOwner: Awaited<AccountModel>@ForeignKey(() => VideoModel)@Column@@ -101,7 +101,7 @@ export class VideoChangeOwnershipModel extends Model<Partial<AttributesOnly<Vide},onDelete: 'cascade'})- Video: VideoModel+ Video: Awaited<VideoModel>static listForApi (nextOwnerId: number, start: number, count: number, sort: string) {const query = {diff --git a/server/models/video/video-channel-sync.ts b/server/server/models/video/video-channel-sync.tssimilarity index 86%rename from server/models/video/video-channel-sync.tsrename to server/server/models/video/video-channel-sync.tsindex a4cbf51f52..da2a995936 100644--- a/server/models/video/video-channel-sync.ts+++ b/server/server/models/video/video-channel-sync.ts@@ -1,3 +1,9 @@+import { VideoChannelSync, VideoChannelSyncState, type VideoChannelSyncStateType } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc.js'+import { isVideoChannelSyncStateValid } from '@server/helpers/custom-validators/video-channel-syncs.js'+import { CONSTRAINTS_FIELDS, VIDEO_CHANNEL_SYNC_STATE } from '@server/initializers/constants.js'+import { MChannelSync, MChannelSyncChannel, MChannelSyncFormattable } from '@server/types/models/index.js'import { Op } from 'sequelize'import {AllowNull,@@ -13,16 +19,10 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { isUrlValid } from '@server/helpers/custom-validators/activitypub/misc'-import { isVideoChannelSyncStateValid } from '@server/helpers/custom-validators/video-channel-syncs'-import { CONSTRAINTS_FIELDS, VIDEO_CHANNEL_SYNC_STATE } from '@server/initializers/constants'-import { MChannelSync, MChannelSyncChannel, MChannelSyncFormattable } from '@server/types/models'-import { VideoChannelSync, VideoChannelSyncState } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { AccountModel } from '../account/account'-import { UserModel } from '../user/user'-import { getChannelSyncSort, throwIfNotValid } from '../shared'-import { VideoChannelModel } from './video-channel'+import { AccountModel } from '../account/account.js'+import { getChannelSyncSort, throwIfNotValid } from '../shared/index.js'+import { UserModel } from '../user/user.js'+import { VideoChannelModel } from './video-channel.js'@DefaultScope(() => ({include: [@@ -48,6 +48,16 @@ export class VideoChannelSyncModel extends Model<Partial<AttributesOnly<VideoCha@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNEL_SYNCS.EXTERNAL_CHANNEL_URL.max))externalChannelUrl: string+ @AllowNull(false)+ @Default(VideoChannelSyncState.WAITING_FIRST_RUN)+ @Is('VideoChannelSyncState', value => throwIfNotValid(value, isVideoChannelSyncStateValid, 'state'))+ @Column+ state: VideoChannelSyncStateType++ @AllowNull(true)+ @Column(DataType.DATE)+ lastSyncAt: Date+@CreatedAtcreatedAt: Date@@ -64,17 +74,7 @@ export class VideoChannelSyncModel extends Model<Partial<AttributesOnly<VideoCha},onDelete: 'cascade'})- VideoChannel: VideoChannelModel-- @AllowNull(false)- @Default(VideoChannelSyncState.WAITING_FIRST_RUN)- @Is('VideoChannelSyncState', value => throwIfNotValid(value, isVideoChannelSyncStateValid, 'state'))- @Column- state: VideoChannelSyncState-- @AllowNull(true)- @Column(DataType.DATE)- lastSyncAt: Date+ VideoChannel: Awaited<VideoChannelModel>static listByAccountForAPI (options: {accountId: numberdiff --git a/server/models/video/video-channel.ts b/server/server/models/video/video-channel.tssimilarity index 95%rename from server/models/video/video-channel.tsrename to server/server/models/video/video-channel.tsindex 2c38850d70..5a13fee243 100644--- a/server/models/video/video-channel.ts+++ b/server/server/models/video/video-channel.ts@@ -1,3 +1,9 @@+import { forceNumber, pick } from '@peertube/peertube-core-utils'+import { ActivityPubActor, VideoChannel, VideoChannelSummary } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { CONFIG } from '@server/initializers/config.js'+import { InternalEventEmitter } from '@server/lib/internal-event-emitter.js'+import { MAccountHost } from '@server/types/models/index.js'import { FindOptions, Includeable, literal, Op, QueryTypes, ScopeOptions, Transaction, WhereOptions } from 'sequelize'import {AfterCreate,@@ -20,34 +26,27 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { CONFIG } from '@server/initializers/config'-import { InternalEventEmitter } from '@server/lib/internal-event-emitter'-import { MAccountHost } from '@server/types/models'-import { forceNumber, pick } from '@shared/core-utils'-import { AttributesOnly } from '@shared/typescript-utils'-import { ActivityPubActor } from '../../../shared/models/activitypub'-import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos'import {isVideoChannelDescriptionValid,isVideoChannelDisplayNameValid,isVideoChannelSupportValid-} from '../../helpers/custom-validators/video-channels'-import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'-import { sendDeleteActor } from '../../lib/activitypub/send'+} from '../../helpers/custom-validators/video-channels.js'+import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants.js'+import { sendDeleteActor } from '../../lib/activitypub/send/index.js'import {- MChannel,MChannelActor,MChannelAP,MChannelBannerAccountDefault,MChannelFormattable,MChannelHost,- MChannelSummaryFormattable-} from '../../types/models/video'-import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account'-import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor'-import { ActorFollowModel } from '../actor/actor-follow'-import { ActorImageModel } from '../actor/actor-image'-import { ServerModel } from '../server/server'+ MChannelSummaryFormattable,+ type MChannel+} from '../../types/models/video/index.js'+import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account.js'+import { ActorFollowModel } from '../actor/actor-follow.js'+import { ActorImageModel } from '../actor/actor-image.js'+import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor.js'+import { ServerModel } from '../server/server.js'import {buildServerIdsFollowedBy,buildTrigramSearchIndex,@@ -55,9 +54,9 @@ import {getSort,setAsUpdated,throwIfNotValid-} from '../shared'-import { VideoModel } from './video'-import { VideoPlaylistModel } from './video-playlist'+} from '../shared/index.js'+import { VideoPlaylistModel } from './video-playlist.js'+import { VideoModel } from './video.js'export enum ScopeNames {FOR_API = 'FOR_API',@@ -389,7 +388,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannel},onDelete: 'cascade'})- Actor: ActorModel+ Actor: Awaited<ActorModel>@ForeignKey(() => AccountModel)@Column@@ -400,7 +399,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannelallowNull: false}})- Account: AccountModel+ Account: Awaited<AccountModel>@HasMany(() => VideoModel, {foreignKey: {@@ -410,7 +409,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannelonDelete: 'CASCADE',hooks: true})- Videos: VideoModel[]+ Videos: Awaited<VideoModel>[]@HasMany(() => VideoPlaylistModel, {foreignKey: {@@ -419,7 +418,7 @@ export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannelonDelete: 'CASCADE',hooks: true})- VideoPlaylists: VideoPlaylistModel[]+ VideoPlaylists: Awaited<VideoPlaylistModel>[]@AfterCreatestatic notifyCreate (channel: MChannel) {diff --git a/server/models/video/video-comment.ts b/server/server/models/video/video-comment.tssimilarity index 86%rename from server/models/video/video-comment.tsrename to server/server/models/video/video-comment.tsindex ff51428093..001ef85bbd 100644--- a/server/models/video/video-comment.ts+++ b/server/server/models/video/video-comment.ts@@ -13,17 +13,14 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { getServerActor } from '@server/models/application/application'-import { MAccount, MAccountId, MUserAccountId } from '@server/types/models'-import { pick, uniqify } from '@shared/core-utils'-import { AttributesOnly } from '@shared/typescript-utils'-import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects'-import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object'-import { VideoComment, VideoCommentAdmin } from '../../../shared/models/videos/comment/video-comment.model'-import { actorNameAlphabet } from '../../helpers/custom-validators/activitypub/actor'-import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'-import { regexpCapture } from '../../helpers/regexp'-import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'+import { pick } from '@peertube/peertube-core-utils'+import { ActivityTagObject, ActivityTombstoneObject, VideoComment, VideoCommentAdmin, VideoCommentObject } from '@peertube/peertube-models'+import { extractMentions } from '@server/helpers/mentions.js'+import { getServerActor } from '@server/models/application/application.js'+import { MAccount, MAccountId, MUserAccountId } from '@server/types/models/index.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'import {MComment,MCommentAdminFormattable,@@ -36,14 +33,14 @@ import {MCommentOwnerVideoFeed,MCommentOwnerVideoReply,MVideoImmutable-} from '../../types/models/video'-import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'-import { AccountModel } from '../account/account'-import { ActorModel } from '../actor/actor'-import { buildLocalAccountIdsIn, buildSQLAttributes, throwIfNotValid } from '../shared'-import { ListVideoCommentsOptions, VideoCommentListQueryBuilder } from './sql/comment/video-comment-list-query-builder'-import { VideoModel } from './video'-import { VideoChannelModel } from './video-channel'+} from '../../types/models/video/index.js'+import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse.js'+import { AccountModel } from '../account/account.js'+import { ActorModel } from '../actor/actor.js'+import { buildLocalAccountIdsIn, buildSQLAttributes, throwIfNotValid } from '../shared/index.js'+import { ListVideoCommentsOptions, VideoCommentListQueryBuilder } from './sql/comment/video-comment-list-query-builder.js'+import { VideoChannelModel } from './video-channel.js'+import { VideoModel } from './video.js'export enum ScopeNames {WITH_ACCOUNT = 'WITH_ACCOUNT',@@ -143,7 +140,7 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoCommentas: 'OriginVideoComment',onDelete: 'CASCADE'})- OriginVideoComment: VideoCommentModel+ OriginVideoComment: Awaited<VideoCommentModel>@ForeignKey(() => VideoCommentModel)@Column@@ -157,7 +154,7 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoCommentas: 'InReplyToVideoComment',onDelete: 'CASCADE'})- InReplyToVideoComment: VideoCommentModel | null+ InReplyToVideoComment: Awaited<VideoCommentModel> | null@ForeignKey(() => VideoModel)@Column@@ -169,7 +166,7 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>@ForeignKey(() => AccountModel)@Column@@ -181,7 +178,7 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment},onDelete: 'CASCADE'})- Account: AccountModel+ Account: Awaited<AccountModel>@HasMany(() => VideoCommentAbuseModel, {foreignKey: {@@ -190,7 +187,7 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment},onDelete: 'set null'})- CommentAbuses: VideoCommentAbuseModel[]+ CommentAbuses: Awaited<VideoCommentAbuseModel>[]// ---------------------------------------------------------------------------@@ -531,41 +528,7 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment}extractMentions () {- let result: string[] = []-- const localMention = `@(${actorNameAlphabet}+)`- const remoteMention = `${localMention}@${WEBSERVER.HOST}`-- const mentionRegex = this.isOwned()- ? '(?:(?:' + remoteMention + ')|(?:' + localMention + '))' // Include local mentions?- : '(?:' + remoteMention + ')'-- const firstMentionRegex = new RegExp(`^${mentionRegex} `, 'g')- const endMentionRegex = new RegExp(` ${mentionRegex}$`, 'g')- const remoteMentionsRegex = new RegExp(' ' + remoteMention + ' ', 'g')-- result = result.concat(- regexpCapture(this.text, firstMentionRegex)- .map(([ , username1, username2 ]) => username1 || username2),-- regexpCapture(this.text, endMentionRegex)- .map(([ , username1, username2 ]) => username1 || username2),-- regexpCapture(this.text, remoteMentionsRegex)- .map(([ , username ]) => username)- )-- // Include local mentions- if (this.isOwned()) {- const localMentionsRegex = new RegExp(' ' + localMention + ' ', 'g')-- result = result.concat(- regexpCapture(this.text, localMentionsRegex)- .map(([ , username ]) => username)- )- }-- return uniqify(result)+ return extractMentions(this.text, this.isOwned())}toFormattedJSON (this: MCommentFormattable) {diff --git a/server/models/video/video-file.ts b/server/server/models/video/video-file.tssimilarity index 93%rename from server/models/video/video-file.tsrename to server/server/models/video/video-file.tsindex ee34ad2ff0..735bda2d54 100644--- a/server/models/video/video-file.ts+++ b/server/server/models/video/video-file.ts@@ -1,4 +1,19 @@-import { remove } from 'fs-extra'+import { VideoResolution, VideoStorage, type VideoStorageType } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { logger } from '@server/helpers/logger.js'+import { extractVideo } from '@server/helpers/video.js'+import { CONFIG } from '@server/initializers/config.js'+import { buildRemoteVideoBaseUrl } from '@server/lib/activitypub/url.js'+import {+ getHLSPrivateFileUrl,+ getHLSPublicFileUrl,+ getWebVideoPrivateFileUrl,+ getWebVideoPublicFileUrl+} from '@server/lib/object-storage/index.js'+import { getFSTorrentFilePath } from '@server/lib/paths.js'+import { isVideoInPrivateDirectory } from '@server/lib/video-privacy.js'+import { MStreamingPlaylistVideo, MVideo, MVideoWithHost, isStreamingPlaylist } from '@server/types/models/index.js'+import { remove } from 'fs-extra/esm'import memoizee from 'memoizee'import { join } from 'path'import { FindOptions, Op, Transaction, WhereOptions } from 'sequelize'@@ -19,28 +34,13 @@ import {UpdatedAt} from 'sequelize-typescript'import validator from 'validator'-import { logger } from '@server/helpers/logger'-import { extractVideo } from '@server/helpers/video'-import { CONFIG } from '@server/initializers/config'-import { buildRemoteVideoBaseUrl } from '@server/lib/activitypub/url'-import {- getHLSPrivateFileUrl,- getHLSPublicFileUrl,- getWebVideoPrivateFileUrl,- getWebVideoPublicFileUrl-} from '@server/lib/object-storage'-import { getFSTorrentFilePath } from '@server/lib/paths'-import { isVideoInPrivateDirectory } from '@server/lib/video-privacy'-import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoWithHost } from '@server/types/models'-import { VideoResolution, VideoStorage } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'import {+ isVideoFPSResolutionValid,isVideoFileExtnameValid,isVideoFileInfoHashValid,isVideoFileResolutionValid,- isVideoFileSizeValid,- isVideoFPSResolutionValid-} from '../../helpers/custom-validators/videos'+ isVideoFileSizeValid+} from '../../helpers/custom-validators/videos.js'import {LAZY_STATIC_PATHS,MEMOIZE_LENGTH,@@ -48,12 +48,12 @@ import {STATIC_DOWNLOAD_PATHS,STATIC_PATHS,WEBSERVER-} from '../../initializers/constants'-import { MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '../../types/models/video/video-file'-import { VideoRedundancyModel } from '../redundancy/video-redundancy'-import { doesExist, parseAggregateResult, throwIfNotValid } from '../shared'-import { VideoModel } from './video'-import { VideoStreamingPlaylistModel } from './video-streaming-playlist'+} from '../../initializers/constants.js'+import { MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '../../types/models/video/video-file.js'+import { VideoRedundancyModel } from '../redundancy/video-redundancy.js'+import { doesExist, parseAggregateResult, throwIfNotValid } from '../shared/index.js'+import { VideoStreamingPlaylistModel } from './video-streaming-playlist.js'+import { VideoModel } from './video.js'export enum ScopeNames {WITH_VIDEO = 'WITH_VIDEO',@@ -225,7 +225,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>@AllowNull(false)@Default(VideoStorage.FILE_SYSTEM)@Column- storage: VideoStorage+ storage: VideoStorageType@BelongsTo(() => VideoModel, {foreignKey: {@@ -233,7 +233,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>@ForeignKey(() => VideoStreamingPlaylistModel)@Column@@ -245,7 +245,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>},onDelete: 'CASCADE'})- VideoStreamingPlaylist: VideoStreamingPlaylistModel+ VideoStreamingPlaylist: Awaited<VideoStreamingPlaylistModel>@HasMany(() => VideoRedundancyModel, {foreignKey: {@@ -254,7 +254,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>onDelete: 'CASCADE',hooks: true})- RedundancyVideos: VideoRedundancyModel[]+ RedundancyVideos: Awaited<VideoRedundancyModel>[]static doesInfohashExistCached = memoizee(VideoFileModel.doesInfohashExist, {promise: true,@@ -334,7 +334,7 @@ export class VideoFileModel extends Model<Partial<AttributesOnly<VideoFileModel>}static loadWithVideoOrPlaylist (id: number, videoIdOrUUID: number | string) {- const whereVideo = validator.isUUID(videoIdOrUUID + '')+ const whereVideo = validator.default.isUUID(videoIdOrUUID + '')? { uuid: videoIdOrUUID }: { id: videoIdOrUUID }diff --git a/server/models/video/video-import.ts b/server/server/models/video/video-import.tssimilarity index 90%rename from server/models/video/video-import.tsrename to server/server/models/video/video-import.tsindex c040e0fda6..4de0cb1047 100644--- a/server/models/video/video-import.ts+++ b/server/server/models/video/video-import.ts@@ -1,3 +1,7 @@+import { VideoImport, VideoImportState, type VideoImportStateType } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { afterCommitIfTransaction } from '@server/helpers/database-utils.js'+import { MVideoImportDefault, MVideoImportFormattable } from '@server/types/models/video/video-import.js'import { IncludeOptions, Op, WhereOptions } from 'sequelize'import {AfterUpdate,@@ -14,17 +18,13 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { afterCommitIfTransaction } from '@server/helpers/database-utils'-import { MVideoImportDefault, MVideoImportFormattable } from '@server/types/models/video/video-import'-import { VideoImport, VideoImportState } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { isVideoImportStateValid, isVideoImportTargetUrlValid } from '../../helpers/custom-validators/video-imports'-import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos'-import { CONSTRAINTS_FIELDS, VIDEO_IMPORT_STATES } from '../../initializers/constants'-import { UserModel } from '../user/user'-import { getSort, searchAttribute, throwIfNotValid } from '../shared'-import { ScopeNames as VideoModelScopeNames, VideoModel } from './video'-import { VideoChannelSyncModel } from './video-channel-sync'+import { isVideoImportStateValid, isVideoImportTargetUrlValid } from '../../helpers/custom-validators/video-imports.js'+import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos.js'+import { CONSTRAINTS_FIELDS, VIDEO_IMPORT_STATES } from '../../initializers/constants.js'+import { getSort, searchAttribute, throwIfNotValid } from '../shared/index.js'+import { UserModel } from '../user/user.js'+import { VideoChannelSyncModel } from './video-channel-sync.js'+import { VideoModel, ScopeNames as VideoModelScopeNames } from './video.js'const defaultVideoScope = () => {return VideoModel.scope([@@ -91,7 +91,7 @@ export class VideoImportModel extends Model<Partial<AttributesOnly<VideoImportMo@Default(null)@Is('VideoImportState', value => throwIfNotValid(value, isVideoImportStateValid, 'state'))@Column- state: VideoImportState+ state: VideoImportStateType@AllowNull(true)@Default(null)@@ -108,7 +108,7 @@ export class VideoImportModel extends Model<Partial<AttributesOnly<VideoImportMo},onDelete: 'cascade'})- User: UserModel+ User: Awaited<UserModel>@ForeignKey(() => VideoModel)@Column@@ -120,7 +120,7 @@ export class VideoImportModel extends Model<Partial<AttributesOnly<VideoImportMo},onDelete: 'set null'})- Video: VideoModel+ Video: Awaited<VideoModel>@ForeignKey(() => VideoChannelSyncModel)@Column@@ -132,7 +132,7 @@ export class VideoImportModel extends Model<Partial<AttributesOnly<VideoImportMo},onDelete: 'set null'})- VideoChannelSync: VideoChannelSyncModel+ VideoChannelSync: Awaited<VideoChannelSyncModel>@AfterUpdatestatic deleteVideoIfFailed (instance: VideoImportModel, options) {diff --git a/server/models/video/video-job-info.ts b/server/server/models/video/video-job-info.tssimilarity index 93%rename from server/models/video/video-job-info.tsrename to server/server/models/video/video-job-info.tsindex 5845b8c74b..4fd9565285 100644--- a/server/models/video/video-job-info.ts+++ b/server/server/models/video/video-job-info.ts@@ -1,8 +1,8 @@import { Op, QueryTypes, Transaction } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, IsInt, Model, Table, Unique, UpdatedAt } from 'sequelize-typescript'-import { forceNumber } from '@shared/core-utils'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoModel } from './video'+import { forceNumber } from '@peertube/peertube-core-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { VideoModel } from './video.js'export type VideoJobInfoColumnType = 'pendingMove' | 'pendingTranscode'@@ -50,7 +50,7 @@ export class VideoJobInfoModel extends Model<Partial<AttributesOnly<VideoJobInfo},onDelete: 'cascade'})- Video: VideoModel+ Video: Awaited<VideoModel>static load (videoId: number, transaction?: Transaction) {const where = {diff --git a/server/models/video/video-live-replay-setting.ts b/server/server/models/video/video-live-replay-setting.tssimilarity index 82%rename from server/models/video/video-live-replay-setting.tsrename to server/server/models/video/video-live-replay-setting.tsindex 1c824dfa2c..174d0c1f58 100644--- a/server/models/video/video-live-replay-setting.ts+++ b/server/server/models/video/video-live-replay-setting.ts@@ -1,9 +1,9 @@-import { isVideoPrivacyValid } from '@server/helpers/custom-validators/videos'-import { MLiveReplaySetting } from '@server/types/models/video/video-live-replay-setting'-import { VideoPrivacy } from '@shared/models/videos/video-privacy.enum'+import { type VideoPrivacyType } from '@peertube/peertube-models'+import { isVideoPrivacyValid } from '@server/helpers/custom-validators/videos.js'+import { MLiveReplaySetting } from '@server/types/models/video/video-live-replay-setting.js'import { Transaction } from 'sequelize'import { AllowNull, Column, CreatedAt, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { throwIfNotValid } from '../shared/sequelize-helpers'+import { throwIfNotValid } from '../shared/sequelize-helpers.js'@Table({tableName: 'videoLiveReplaySetting'@@ -19,7 +19,7 @@ export class VideoLiveReplaySettingModel extends Model<VideoLiveReplaySettingMod@AllowNull(false)@Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy'))@Column- privacy: VideoPrivacy+ privacy: VideoPrivacyTypestatic load (id: number, transaction?: Transaction): Promise<MLiveReplaySetting> {return VideoLiveReplaySettingModel.findOne({diff --git a/server/models/video/video-live-session.ts b/server/server/models/video/video-live-session.tssimilarity index 90%rename from server/models/video/video-live-session.tsrename to server/server/models/video/video-live-session.tsindex 9426f5d115..33bd40d897 100644--- a/server/models/video/video-live-session.ts+++ b/server/server/models/video/video-live-session.ts@@ -1,3 +1,7 @@+import { LiveVideoSession, type LiveVideoErrorType } from '@peertube/peertube-models'+import { uuidToShort } from '@peertube/peertube-node-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { MVideoLiveSession, MVideoLiveSessionReplay } from '@server/types/models/index.js'import { FindOptions } from 'sequelize'import {AllowNull,@@ -12,12 +16,8 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { MVideoLiveSession, MVideoLiveSessionReplay } from '@server/types/models'-import { uuidToShort } from '@shared/extra-utils'-import { LiveVideoError, LiveVideoSession } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoModel } from './video'-import { VideoLiveReplaySettingModel } from './video-live-replay-setting'+import { VideoLiveReplaySettingModel } from './video-live-replay-setting.js'+import { VideoModel } from './video.js'export enum ScopeNames {WITH_REPLAY = 'WITH_REPLAY'@@ -72,7 +72,7 @@ export class VideoLiveSessionModel extends Model<Partial<AttributesOnly<VideoLiv@AllowNull(true)@Column- error: LiveVideoError+ error: LiveVideoErrorType@AllowNull(false)@Column@@ -94,7 +94,7 @@ export class VideoLiveSessionModel extends Model<Partial<AttributesOnly<VideoLivas: 'ReplayVideo',onDelete: 'set null'})- ReplayVideo: VideoModel+ ReplayVideo: Awaited<VideoModel>@ForeignKey(() => VideoModel)@Column@@ -108,7 +108,7 @@ export class VideoLiveSessionModel extends Model<Partial<AttributesOnly<VideoLivas: 'LiveVideo',onDelete: 'set null'})- LiveVideo: VideoModel+ LiveVideo: Awaited<VideoModel>@ForeignKey(() => VideoLiveReplaySettingModel)@Column@@ -120,7 +120,7 @@ export class VideoLiveSessionModel extends Model<Partial<AttributesOnly<VideoLiv},onDelete: 'set null'})- ReplaySetting: VideoLiveReplaySettingModel+ ReplaySetting: Awaited<VideoLiveReplaySettingModel>@BeforeDestroystatic deleteReplaySetting (instance: VideoLiveSessionModel) {diff --git a/server/models/video/video-live.ts b/server/server/models/video/video-live.tssimilarity index 86%rename from server/models/video/video-live.tsrename to server/server/models/video/video-live.tsindex ca11186410..fefaa053a6 100644--- a/server/models/video/video-live.ts+++ b/server/server/models/video/video-live.ts@@ -1,3 +1,8 @@+import { LiveVideo, VideoState, type LiveVideoLatencyModeType } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { CONFIG } from '@server/initializers/config.js'+import { WEBSERVER } from '@server/initializers/constants.js'+import { MVideoLive, MVideoLiveVideoWithSetting } from '@server/types/models/index.js'import { Transaction } from 'sequelize'import {AllowNull,@@ -12,14 +17,9 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { CONFIG } from '@server/initializers/config'-import { WEBSERVER } from '@server/initializers/constants'-import { MVideoLive, MVideoLiveVideoWithSetting } from '@server/types/models'-import { LiveVideo, LiveVideoLatencyMode, VideoState } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoModel } from './video'-import { VideoBlacklistModel } from './video-blacklist'-import { VideoLiveReplaySettingModel } from './video-live-replay-setting'+import { VideoBlacklistModel } from './video-blacklist.js'+import { VideoLiveReplaySettingModel } from './video-live-replay-setting.js'+import { VideoModel } from './video.js'@DefaultScope(() => ({include: [@@ -68,7 +68,7 @@ export class VideoLiveModel extends Model<Partial<AttributesOnly<VideoLiveModel>@AllowNull(false)@Column- latencyMode: LiveVideoLatencyMode+ latencyMode: LiveVideoLatencyModeType@CreatedAtcreatedAt: Date@@ -86,7 +86,7 @@ export class VideoLiveModel extends Model<Partial<AttributesOnly<VideoLiveModel>},onDelete: 'cascade'})- Video: VideoModel+ Video: Awaited<VideoModel>@ForeignKey(() => VideoLiveReplaySettingModel)@Column@@ -98,7 +98,7 @@ export class VideoLiveModel extends Model<Partial<AttributesOnly<VideoLiveModel>},onDelete: 'set null'})- ReplaySetting: VideoLiveReplaySettingModel+ ReplaySetting: Awaited<VideoLiveReplaySettingModel>@BeforeDestroystatic deleteReplaySetting (instance: VideoLiveModel, options: { transaction: Transaction }) {diff --git a/server/models/video/video-password.ts b/server/server/models/video/video-password.tssimilarity index 88%rename from server/models/video/video-password.tsrename to server/server/models/video/video-password.tsindex 648366c3b7..f841f320e7 100644--- a/server/models/video/video-password.ts+++ b/server/server/models/video/video-password.ts@@ -1,12 +1,12 @@import { AllowNull, BelongsTo, Column, CreatedAt, DefaultScope, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { VideoModel } from './video'-import { AttributesOnly } from '@shared/typescript-utils'-import { ResultList, VideoPassword } from '@shared/models'-import { getSort, throwIfNotValid } from '../shared'+import { VideoModel } from './video.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { ResultList, VideoPassword } from '@peertube/peertube-models'+import { getSort, throwIfNotValid } from '../shared/index.js'import { FindOptions, Transaction } from 'sequelize'-import { MVideoPassword } from '@server/types/models'-import { isPasswordValid } from '@server/helpers/custom-validators/videos'-import { pick } from '@shared/core-utils'+import { MVideoPassword } from '@server/types/models/index.js'+import { isPasswordValid } from '@server/helpers/custom-validators/videos.js'+import { pick } from '@peertube/peertube-core-utils'@DefaultScope(() => ({include: [@@ -48,7 +48,7 @@ export class VideoPasswordModel extends Model<Partial<AttributesOnly<VideoPasswo},onDelete: 'cascade'})- Video: VideoModel+ Video: Awaited<VideoModel>static async countByVideoId (videoId: number, t?: Transaction) {const query: FindOptions = {diff --git a/server/models/video/video-playlist-element.ts b/server/server/models/video/video-playlist-element.tssimilarity index 89%rename from server/models/video/video-playlist-element.tsrename to server/server/models/video/video-playlist-element.tsindex 61ae6b9fe1..62b0e34342 100644--- a/server/models/video/video-playlist-element.ts+++ b/server/server/models/video/video-playlist-element.ts@@ -15,25 +15,29 @@ import {UpdatedAt} from 'sequelize-typescript'import validator from 'validator'-import { MUserAccountId } from '@server/types/models'+import { forceNumber } from '@peertube/peertube-core-utils'+import {+ PlaylistElementObject,+ VideoPlaylistElement,+ VideoPlaylistElementType,+ VideoPrivacy,+ VideoPrivacyType+} from '@peertube/peertube-models'+import { MUserAccountId } from '@server/types/models/index.js'import {MVideoPlaylistElement,MVideoPlaylistElementAP,MVideoPlaylistElementFormattable,MVideoPlaylistElementVideoUrlPlaylistPrivacy,MVideoPlaylistVideoThumbnail-} from '@server/types/models/video/video-playlist-element'-import { forceNumber } from '@shared/core-utils'-import { AttributesOnly } from '@shared/typescript-utils'-import { PlaylistElementObject } from '../../../shared/models/activitypub/objects/playlist-element-object'-import { VideoPrivacy } from '../../../shared/models/videos'-import { VideoPlaylistElement, VideoPlaylistElementType } from '../../../shared/models/videos/playlist/video-playlist-element.model'-import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { AccountModel } from '../account/account'-import { getSort, throwIfNotValid } from '../shared'-import { ForAPIOptions, ScopeNames as VideoScopeNames, VideoModel } from './video'-import { VideoPlaylistModel } from './video-playlist'+} from '@server/types/models/video/video-playlist-element.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { AccountModel } from '../account/account.js'+import { getSort, throwIfNotValid } from '../shared/index.js'+import { VideoPlaylistModel } from './video-playlist.js'+import { ForAPIOptions, ScopeNames as VideoScopeNames, VideoModel } from './video.js'@Table({tableName: 'videoPlaylistElement',@@ -91,7 +95,7 @@ export class VideoPlaylistElementModel extends Model<Partial<AttributesOnly<Vide},onDelete: 'CASCADE'})- VideoPlaylist: VideoPlaylistModel+ VideoPlaylist: Awaited<VideoPlaylistModel>@ForeignKey(() => VideoModel)@Column@@ -103,7 +107,7 @@ export class VideoPlaylistElementModel extends Model<Partial<AttributesOnly<Vide},onDelete: 'set null'})- Video: VideoModel+ Video: Awaited<VideoModel>static deleteAllOf (videoPlaylistId: number, transaction?: Transaction) {const query = {@@ -186,7 +190,7 @@ export class VideoPlaylistElementModel extends Model<Partial<AttributesOnly<VideplaylistId: number | string,playlistElementId: number): Promise<MVideoPlaylistElementVideoUrlPlaylistPrivacy> {- const playlistWhere = validator.isUUID('' + playlistId)+ const playlistWhere = validator.default.isUUID('' + playlistId)? { uuid: playlistId }: { id: playlistId }@@ -337,7 +341,8 @@ export class VideoPlaylistElementModel extends Model<Partial<AttributesOnly<Videif (video.privacy === VideoPrivacy.INTERNAL && accountId) return VideoPlaylistElementType.REGULAR// Private, internal and password protected videos cannot be read without appropriate access (ownership, internal)- if (new Set([ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL, VideoPrivacy.PASSWORD_PROTECTED ]).has(video.privacy)) {+ const protectedPrivacy = new Set<VideoPrivacyType>([ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL, VideoPrivacy.PASSWORD_PROTECTED ])+ if (protectedPrivacy.has(video.privacy)) {return VideoPlaylistElementType.PRIVATE}diff --git a/server/models/video/video-playlist.ts b/server/server/models/video/video-playlist.tssimilarity index 92%rename from server/models/video/video-playlist.tsrename to server/server/models/video/video-playlist.tsindex 15999d409a..716e78c4c6 100644--- a/server/models/video/video-playlist.ts+++ b/server/server/models/video/video-playlist.ts@@ -1,3 +1,17 @@+import { buildPlaylistEmbedPath, buildPlaylistWatchPath, pick } from '@peertube/peertube-core-utils'+import {+ ActivityIconObject,+ PlaylistObject,+ VideoPlaylist,+ VideoPlaylistPrivacy,+ VideoPlaylistType,+ type VideoPlaylistPrivacyType,+ type VideoPlaylistType_Type+} from '@peertube/peertube-models'+import { buildUUID, uuidToShort } from '@peertube/peertube-node-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { activityPubCollectionPagination } from '@server/lib/activitypub/collection.js'+import { MAccountId, MChannelId } from '@server/types/models/index.js'import { join } from 'path'import { FindOptions, Includeable, literal, Op, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize'import {@@ -17,18 +31,12 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { activityPubCollectionPagination } from '@server/lib/activitypub/collection'-import { MAccountId, MChannelId } from '@server/types/models'-import { buildPlaylistEmbedPath, buildPlaylistWatchPath, pick } from '@shared/core-utils'-import { buildUUID, uuidToShort } from '@shared/extra-utils'-import { ActivityIconObject, PlaylistObject, VideoPlaylist, VideoPlaylistPrivacy, VideoPlaylistType } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'+import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'import {isVideoPlaylistDescriptionValid,isVideoPlaylistNameValid,isVideoPlaylistPrivacyValid-} from '../../helpers/custom-validators/video-playlists'+} from '../../helpers/custom-validators/video-playlists.js'import {ACTIVITY_PUB,CONSTRAINTS_FIELDS,@@ -37,8 +45,8 @@ import {VIDEO_PLAYLIST_PRIVACIES,VIDEO_PLAYLIST_TYPES,WEBSERVER-} from '../../initializers/constants'-import { MThumbnail } from '../../types/models/video/thumbnail'+} from '../../initializers/constants.js'+import { MThumbnail } from '../../types/models/video/thumbnail.js'import {MVideoPlaylistAccountThumbnail,MVideoPlaylistAP,@@ -46,9 +54,9 @@ import {MVideoPlaylistFull,MVideoPlaylistFullSummary,MVideoPlaylistSummaryWithElements-} from '../../types/models/video/video-playlist'-import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions } from '../account/account'-import { ActorModel } from '../actor/actor'+} from '../../types/models/video/video-playlist.js'+import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions } from '../account/account.js'+import { ActorModel } from '../actor/actor.js'import {buildServerIdsFollowedBy,buildTrigramSearchIndex,@@ -58,10 +66,10 @@ import {isOutdated,setAsUpdated,throwIfNotValid-} from '../shared'-import { ThumbnailModel } from './thumbnail'-import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel'-import { VideoPlaylistElementModel } from './video-playlist-element'+} from '../shared/index.js'+import { ThumbnailModel } from './thumbnail.js'+import { VideoChannelModel, ScopeNames as VideoChannelScopeNames } from './video-channel.js'+import { VideoPlaylistElementModel } from './video-playlist-element.js'enum ScopeNames {AVAILABLE_FOR_LIST = 'AVAILABLE_FOR_LIST',@@ -74,7 +82,7 @@ enum ScopeNames {type AvailableForListOptions = {followerActorId?: number- type?: VideoPlaylistType+ type?: VideoPlaylistType_TypeaccountId?: numbervideoChannelId?: numberlistMyPlaylists?: boolean@@ -299,7 +307,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli@AllowNull(false)@Is('VideoPlaylistPrivacy', value => throwIfNotValid(value, isVideoPlaylistPrivacyValid, 'privacy'))@Column- privacy: VideoPlaylistPrivacy+ privacy: VideoPlaylistPrivacyType@AllowNull(false)@Is('VideoPlaylistUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))@@ -315,7 +323,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli@AllowNull(false)@Default(VideoPlaylistType.REGULAR)@Column- type: VideoPlaylistType+ type: VideoPlaylistType_Type@ForeignKey(() => AccountModel)@Column@@ -327,7 +335,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli},onDelete: 'CASCADE'})- OwnerAccount: AccountModel+ OwnerAccount: Awaited<AccountModel>@ForeignKey(() => VideoChannelModel)@Column@@ -339,7 +347,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli},onDelete: 'CASCADE'})- VideoChannel: VideoChannelModel+ VideoChannel: Awaited<VideoChannelModel>@HasMany(() => VideoPlaylistElementModel, {foreignKey: {@@ -348,7 +356,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli},onDelete: 'CASCADE'})- VideoPlaylistElements: VideoPlaylistElementModel[]+ VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]@HasOne(() => ThumbnailModel, {foreignKey: {@@ -358,7 +366,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlaylionDelete: 'CASCADE',hooks: true})- Thumbnail: ThumbnailModel+ Thumbnail: Awaited<ThumbnailModel>static listForApi (options: AvailableForListOptions & {start: number@@ -550,11 +558,11 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli.findOne(query)}- static getPrivacyLabel (privacy: VideoPlaylistPrivacy) {+ static getPrivacyLabel (privacy: VideoPlaylistPrivacyType) {return VIDEO_PLAYLIST_PRIVACIES[privacy] || 'Unknown'}- static getTypeLabel (type: VideoPlaylistType) {+ static getTypeLabel (type: VideoPlaylistType_Type) {return VIDEO_PLAYLIST_TYPES[type] || 'Unknown'}diff --git a/server/models/video/video-share.ts b/server/server/models/video/video-share.tssimilarity index 93%rename from server/models/video/video-share.tsrename to server/server/models/video/video-share.tsindex b4de2b20fe..a3f571fed9 100644--- a/server/models/video/video-share.ts+++ b/server/server/models/video/video-share.ts@@ -1,14 +1,14 @@import { literal, Op, QueryTypes, Transaction } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'-import { forceNumber } from '@shared/core-utils'-import { AttributesOnly } from '@shared/typescript-utils'-import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'-import { CONSTRAINTS_FIELDS } from '../../initializers/constants'-import { MActorDefault, MActorFollowersUrl, MActorId } from '../../types/models'-import { MVideoShareActor, MVideoShareFull } from '../../types/models/video'-import { ActorModel } from '../actor/actor'-import { buildLocalActorIdsIn, throwIfNotValid } from '../shared'-import { VideoModel } from './video'+import { forceNumber } from '@peertube/peertube-core-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'+import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'+import { MActorDefault, MActorFollowersUrl, MActorId } from '../../types/models/index.js'+import { MVideoShareActor, MVideoShareFull } from '../../types/models/video/index.js'+import { ActorModel } from '../actor/actor.js'+import { buildLocalActorIdsIn, throwIfNotValid } from '../shared/index.js'+import { VideoModel } from './video.js'enum ScopeNames {FULL = 'FULL',@@ -75,7 +75,7 @@ export class VideoShareModel extends Model<Partial<AttributesOnly<VideoShareMode},onDelete: 'cascade'})- Actor: ActorModel+ Actor: Awaited<ActorModel>@ForeignKey(() => VideoModel)@Column@@ -87,7 +87,7 @@ export class VideoShareModel extends Model<Partial<AttributesOnly<VideoShareMode},onDelete: 'cascade'})- Video: VideoModel+ Video: Awaited<VideoModel>static load (actorId: number | string, videoId: number | string, t?: Transaction): Promise<MVideoShareActor> {return VideoShareModel.scope(ScopeNames.WITH_ACTOR).findOne({diff --git a/server/models/video/video-source.ts b/server/server/models/video/video-source.tssimilarity index 81%rename from server/models/video/video-source.tsrename to server/server/models/video/video-source.tsindex 1b6868b857..32743e796c 100644--- a/server/models/video/video-source.ts+++ b/server/server/models/video/video-source.ts@@ -1,9 +1,9 @@import { Transaction } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { VideoSource } from '@shared/models/videos/video-source'-import { AttributesOnly } from '@shared/typescript-utils'-import { getSort } from '../shared'-import { VideoModel } from './video'+import { VideoSource } from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { getSort } from '../shared/index.js'+import { VideoModel } from './video.js'@Table({tableName: 'videoSource',@@ -37,7 +37,7 @@ export class VideoSourceModel extends Model<Partial<AttributesOnly<VideoSourceMo},onDelete: 'cascade'})- Video: VideoModel+ Video: Awaited<VideoModel>static loadLatest (videoId: number, transaction?: Transaction) {return VideoSourceModel.findOne({diff --git a/server/models/video/video-streaming-playlist.ts b/server/server/models/video/video-streaming-playlist.tssimilarity index 89%rename from server/models/video/video-streaming-playlist.tsrename to server/server/models/video/video-streaming-playlist.tsindex a85c79c9f1..0c4043c448 100644--- a/server/models/video/video-streaming-playlist.ts+++ b/server/server/models/video/video-streaming-playlist.ts@@ -1,3 +1,17 @@+import {+ VideoStorage,+ VideoStreamingPlaylistType,+ type VideoStorageType,+ type VideoStreamingPlaylistType_Type+} from '@peertube/peertube-models'+import { sha1 } from '@peertube/peertube-node-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { CONFIG } from '@server/initializers/config.js'+import { getHLSPrivateFileUrl, getHLSPublicFileUrl } from '@server/lib/object-storage/index.js'+import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename } from '@server/lib/paths.js'+import { isVideoInPrivateDirectory } from '@server/lib/video-privacy.js'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { MStreamingPlaylist, MStreamingPlaylistFilesVideo, MVideo } from '@server/types/models/index.js'import memoizee from 'memoizee'import { join } from 'path'import { Op, Transaction } from 'sequelize'@@ -15,19 +29,9 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { CONFIG } from '@server/initializers/config'-import { getHLSPrivateFileUrl, getHLSPublicFileUrl } from '@server/lib/object-storage'-import { generateHLSMasterPlaylistFilename, generateHlsSha256SegmentsFilename } from '@server/lib/paths'-import { isVideoInPrivateDirectory } from '@server/lib/video-privacy'-import { VideoFileModel } from '@server/models/video/video-file'-import { MStreamingPlaylist, MStreamingPlaylistFilesVideo, MVideo } from '@server/types/models'-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 { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'-import { isArrayOf } from '../../helpers/custom-validators/misc'-import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos'+import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'+import { isArrayOf } from '../../helpers/custom-validators/misc.js'+import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos.js'import {CONSTRAINTS_FIELDS,MEMOIZE_LENGTH,@@ -35,10 +39,10 @@ import {P2P_MEDIA_LOADER_PEER_VERSION,STATIC_PATHS,WEBSERVER-} from '../../initializers/constants'-import { VideoRedundancyModel } from '../redundancy/video-redundancy'-import { doesExist, throwIfNotValid } from '../shared'-import { VideoModel } from './video'+} from '../../initializers/constants.js'+import { VideoRedundancyModel } from '../redundancy/video-redundancy.js'+import { doesExist, throwIfNotValid } from '../shared/index.js'+import { VideoModel } from './video.js'@Table({tableName: 'videoStreamingPlaylist',@@ -65,7 +69,7 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi@AllowNull(false)@Column- type: VideoStreamingPlaylistType+ type: VideoStreamingPlaylistType_Type@AllowNull(false)@Column@@ -101,7 +105,7 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi@AllowNull(false)@Default(VideoStorage.FILE_SYSTEM)@Column- storage: VideoStorage+ storage: VideoStorageType@BelongsTo(() => VideoModel, {foreignKey: {@@ -109,7 +113,7 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>@HasMany(() => VideoFileModel, {foreignKey: {@@ -117,7 +121,7 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<Vi},onDelete: 'CASCADE'})- VideoFiles: VideoFileModel[]+ VideoFiles: Awaited<VideoFileModel>[]@HasMany(() => VideoRedundancyModel, {foreignKey: {@@ -126,7 +130,7 @@ export class VideoStreamingPlaylistModel extends Model<Partial<AttributesOnly<VionDelete: 'CASCADE',hooks: true})- RedundancyVideos: VideoRedundancyModel[]+ RedundancyVideos: Awaited<VideoRedundancyModel>[]static doesInfohashExistCached = memoizee(VideoStreamingPlaylistModel.doesInfohashExist, {promise: true,diff --git a/server/models/video/video-tag.ts b/server/server/models/video/video-tag.tssimilarity index 77%rename from server/models/video/video-tag.tsrename to server/server/models/video/video-tag.tsindex 7e880c9680..5c36a8de54 100644--- a/server/models/video/video-tag.ts+++ b/server/server/models/video/video-tag.ts@@ -1,7 +1,7 @@import { Column, CreatedAt, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'-import { AttributesOnly } from '@shared/typescript-utils'-import { TagModel } from './tag'-import { VideoModel } from './video'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { TagModel } from './tag.js'+import { VideoModel } from './video.js'@Table({tableName: 'videoTag',diff --git a/server/models/video/video.ts b/server/server/models/video/video.tssimilarity index 91%rename from server/models/video/video.tsrename to server/server/models/video/video.tsindex 73308182d9..a6383b7c7e 100644--- a/server/models/video/video.ts+++ b/server/server/models/video/video.ts@@ -1,7 +1,45 @@+import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@peertube/peertube-core-utils'+import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAudioStream } from '@peertube/peertube-ffmpeg'+import {+ ResultList,+ ThumbnailType,+ UserRight,+ Video,+ VideoDetails,+ VideoFile,+ VideoInclude,+ VideoIncludeType,+ VideoObject,+ VideoPrivacy,+ VideoRateType,+ VideoState,+ VideoStorage,+ VideoStreamingPlaylistType,+ type VideoPrivacyType,+ type VideoStateType+} from '@peertube/peertube-models'+import { uuidToShort } from '@peertube/peertube-node-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video.js'+import { InternalEventEmitter } from '@server/lib/internal-event-emitter.js'+import { LiveManager } from '@server/lib/live/live-manager.js'+import {+ removeHLSFileObjectStorageByFilename,+ removeHLSObjectStorage,+ removeWebVideoObjectStorage+} from '@server/lib/object-storage/index.js'+import { tracer } from '@server/lib/opentelemetry/tracing.js'+import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths.js'+import { Hooks } from '@server/lib/plugins/hooks.js'+import { VideoPathManager } from '@server/lib/video-path-manager.js'+import { isVideoInPrivateDirectory } from '@server/lib/video-privacy.js'+import { getServerActor } from '@server/models/application/application.js'+import { ModelCache } from '@server/models/shared/model-cache.js'import Bluebird from 'bluebird'-import { remove } from 'fs-extra'-import { maxBy, minBy } from 'lodash'-import { FindOptions, Includeable, IncludeOptions, Op, QueryTypes, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize'+import { remove } from 'fs-extra/esm'+import maxBy from 'lodash-es/maxBy.js'+import minBy from 'lodash-es/minBy.js'+import { FindOptions, IncludeOptions, Includeable, Op, QueryTypes, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize'import {AfterCreate,AfterDestroy,@@ -26,39 +64,9 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video'-import { InternalEventEmitter } from '@server/lib/internal-event-emitter'-import { LiveManager } from '@server/lib/live/live-manager'-import { removeHLSFileObjectStorageByFilename, removeHLSObjectStorage, removeWebVideoObjectStorage } from '@server/lib/object-storage'-import { tracer } from '@server/lib/opentelemetry/tracing'-import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from '@server/lib/paths'-import { Hooks } from '@server/lib/plugins/hooks'-import { VideoPathManager } from '@server/lib/video-path-manager'-import { isVideoInPrivateDirectory } from '@server/lib/video-privacy'-import { getServerActor } from '@server/models/application/application'-import { ModelCache } from '@server/models/shared/model-cache'-import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils'-import { uuidToShort } from '@shared/extra-utils'-import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS, hasAudioStream } from '@shared/ffmpeg'-import {- ResultList,- ThumbnailType,- UserRight,- Video,- VideoDetails,- VideoFile,- VideoInclude,- VideoObject,- VideoPrivacy,- VideoRateType,- VideoState,- VideoStorage,- VideoStreamingPlaylistType-} from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { peertubeTruncate } from '../../helpers/core-utils'-import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'-import { exists, isArray, isBooleanValid, isUUIDValid } from '../../helpers/custom-validators/misc'+import { peertubeTruncate } from '../../helpers/core-utils.js'+import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc.js'+import { exists, isArray, isBooleanValid, isUUIDValid } from '../../helpers/custom-validators/misc.js'import {isVideoDescriptionValid,isVideoDurationValid,@@ -66,11 +74,11 @@ import {isVideoPrivacyValid,isVideoStateValid,isVideoSupportValid-} from '../../helpers/custom-validators/videos'-import { logger } from '../../helpers/logger'-import { CONFIG } from '../../initializers/config'-import { ACTIVITY_PUB, API_VERSION, CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'-import { sendDeleteVideo } from '../../lib/activitypub/send'+} from '../../helpers/custom-validators/videos.js'+import { logger } from '../../helpers/logger.js'+import { CONFIG } from '../../initializers/config.js'+import { ACTIVITY_PUB, API_VERSION, CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants.js'+import { sendDeleteVideo } from '../../lib/activitypub/send/index.js'import {MChannel,MChannelAccountDefault,@@ -80,72 +88,72 @@ import {MStreamingPlaylistFilesVideo,MUserAccountId,MUserId,- MVideo,- MVideoAccountLight,- MVideoAccountLightBlacklistAllFiles,MVideoAP,MVideoAPLight,+ MVideoAccountLightBlacklistAllFiles,MVideoCaptionLanguageUrl,MVideoDetails,MVideoFileVideo,+ MVideoForUser,MVideoFormattable,MVideoFormattableDetails,- MVideoForUser,MVideoFullLight,MVideoId,MVideoImmutable,MVideoThumbnail,MVideoThumbnailBlacklist,MVideoWithAllFiles,- MVideoWithFile-} from '../../types/models'-import { MThumbnail } from '../../types/models/video/thumbnail'-import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../types/models/video/video-file'-import { VideoAbuseModel } from '../abuse/video-abuse'-import { AccountModel } from '../account/account'-import { AccountVideoRateModel } from '../account/account-video-rate'-import { ActorModel } from '../actor/actor'-import { ActorImageModel } from '../actor/actor-image'-import { VideoRedundancyModel } from '../redundancy/video-redundancy'-import { ServerModel } from '../server/server'-import { TrackerModel } from '../server/tracker'-import { VideoTrackerModel } from '../server/video-tracker'-import { buildTrigramSearchIndex, buildWhereIdOrUUID, getVideoSort, isOutdated, setAsUpdated, throwIfNotValid } from '../shared'-import { UserModel } from '../user/user'-import { UserVideoHistoryModel } from '../user/user-video-history'-import { VideoViewModel } from '../view/video-view'-import { videoModelToActivityPubObject } from './formatter/video-activity-pub-format'+ MVideoWithFile,+ type MVideo,+ type MVideoAccountLight+} from '../../types/models/index.js'+import { MThumbnail } from '../../types/models/video/thumbnail.js'+import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../types/models/video/video-file.js'+import { VideoAbuseModel } from '../abuse/video-abuse.js'+import { AccountVideoRateModel } from '../account/account-video-rate.js'+import { AccountModel } from '../account/account.js'+import { ActorImageModel } from '../actor/actor-image.js'+import { ActorModel } from '../actor/actor.js'+import { VideoRedundancyModel } from '../redundancy/video-redundancy.js'+import { ServerModel } from '../server/server.js'+import { TrackerModel } from '../server/tracker.js'+import { VideoTrackerModel } from '../server/video-tracker.js'+import { buildTrigramSearchIndex, buildWhereIdOrUUID, getVideoSort, isOutdated, setAsUpdated, throwIfNotValid } from '../shared/index.js'+import { UserVideoHistoryModel } from '../user/user-video-history.js'+import { UserModel } from '../user/user.js'+import { VideoViewModel } from '../view/video-view.js'+import { videoModelToActivityPubObject } from './formatter/video-activity-pub-format.js'import {- videoFilesModelToFormattedJSON,VideoFormattingJSONOptions,+ videoFilesModelToFormattedJSON,videoModelToFormattedDetailsJSON,videoModelToFormattedJSON-} from './formatter/video-api-format'-import { ScheduleVideoUpdateModel } from './schedule-video-update'+} from './formatter/video-api-format.js'+import { ScheduleVideoUpdateModel } from './schedule-video-update.js'import {BuildVideosListQueryOptions,DisplayOnlyForFollowerOptions,VideoModelGetQueryBuilder,VideosIdListQueryBuilder,VideosModelListQueryBuilder-} from './sql/video'-import { StoryboardModel } from './storyboard'-import { TagModel } from './tag'-import { ThumbnailModel } from './thumbnail'-import { VideoBlacklistModel } from './video-blacklist'-import { VideoCaptionModel } from './video-caption'-import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel'-import { VideoCommentModel } from './video-comment'-import { VideoFileModel } from './video-file'-import { VideoImportModel } from './video-import'-import { VideoJobInfoModel } from './video-job-info'-import { VideoLiveModel } from './video-live'-import { VideoPasswordModel } from './video-password'-import { VideoPlaylistElementModel } from './video-playlist-element'-import { VideoShareModel } from './video-share'-import { VideoSourceModel } from './video-source'-import { VideoStreamingPlaylistModel } from './video-streaming-playlist'-import { VideoTagModel } from './video-tag'+} from './sql/video/index.js'+import { StoryboardModel } from './storyboard.js'+import { TagModel } from './tag.js'+import { ThumbnailModel } from './thumbnail.js'+import { VideoBlacklistModel } from './video-blacklist.js'+import { VideoCaptionModel } from './video-caption.js'+import { SummaryOptions, VideoChannelModel, ScopeNames as VideoChannelScopeNames } from './video-channel.js'+import { VideoCommentModel } from './video-comment.js'+import { VideoFileModel } from './video-file.js'+import { VideoImportModel } from './video-import.js'+import { VideoJobInfoModel } from './video-job-info.js'+import { VideoLiveModel } from './video-live.js'+import { VideoPasswordModel } from './video-password.js'+import { VideoPlaylistElementModel } from './video-playlist-element.js'+import { VideoShareModel } from './video-share.js'+import { VideoSourceModel } from './video-source.js'+import { VideoStreamingPlaylistModel } from './video-streaming-playlist.js'+import { VideoTagModel } from './video-tag.js'export enum ScopeNames {FOR_API = 'FOR_API',@@ -468,8 +476,8 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {@AllowNull(false)@Is('VideoPrivacy', value => throwIfNotValid(value, isVideoPrivacyValid, 'privacy'))- @Column- privacy: VideoPrivacy+ @Column(DataType.INTEGER)+ privacy: VideoPrivacyType@AllowNull(false)@Is('VideoNSFW', value => throwIfNotValid(value, isBooleanValid, 'NSFW boolean'))@@ -544,7 +552,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {@Default(null)@Is('VideoState', value => throwIfNotValid(value, isVideoStateValid, 'state'))@Column- state: VideoState+ state: VideoStateType// We already have the information in videoSource table for local videos, but we prefer to normalize it for performance// And also to store the info from remote instances@@ -578,21 +586,21 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'cascade'})- VideoChannel: VideoChannelModel+ VideoChannel: Awaited<VideoChannelModel>@BelongsToMany(() => TagModel, {foreignKey: 'videoId',through: () => VideoTagModel,onDelete: 'CASCADE'})- Tags: TagModel[]+ Tags: Awaited<TagModel>[]@BelongsToMany(() => TrackerModel, {foreignKey: 'videoId',through: () => VideoTrackerModel,onDelete: 'CASCADE'})- Trackers: TrackerModel[]+ Trackers: Awaited<TrackerModel>[]@HasMany(() => ThumbnailModel, {foreignKey: {@@ -602,7 +610,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {hooks: true,onDelete: 'cascade'})- Thumbnails: ThumbnailModel[]+ Thumbnails: Awaited<ThumbnailModel>[]@HasMany(() => VideoPlaylistElementModel, {foreignKey: {@@ -611,7 +619,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'set null'})- VideoPlaylistElements: VideoPlaylistElementModel[]+ VideoPlaylistElements: Awaited<VideoPlaylistElementModel>[]@HasOne(() => VideoSourceModel, {foreignKey: {@@ -620,7 +628,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'CASCADE'})- VideoSource: VideoSourceModel+ VideoSource: Awaited<VideoSourceModel>@HasMany(() => VideoAbuseModel, {foreignKey: {@@ -629,7 +637,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'set null'})- VideoAbuses: VideoAbuseModel[]+ VideoAbuses: Awaited<VideoAbuseModel>[]@HasMany(() => VideoFileModel, {foreignKey: {@@ -639,7 +647,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {hooks: true,onDelete: 'cascade'})- VideoFiles: VideoFileModel[]+ VideoFiles: Awaited<VideoFileModel>[]@HasMany(() => VideoStreamingPlaylistModel, {foreignKey: {@@ -649,7 +657,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {hooks: true,onDelete: 'cascade'})- VideoStreamingPlaylists: VideoStreamingPlaylistModel[]+ VideoStreamingPlaylists: Awaited<VideoStreamingPlaylistModel>[]@HasMany(() => VideoShareModel, {foreignKey: {@@ -658,7 +666,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'cascade'})- VideoShares: VideoShareModel[]+ VideoShares: Awaited<VideoShareModel>[]@HasMany(() => AccountVideoRateModel, {foreignKey: {@@ -667,7 +675,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'cascade'})- AccountVideoRates: AccountVideoRateModel[]+ AccountVideoRates: Awaited<AccountVideoRateModel>[]@HasMany(() => VideoCommentModel, {foreignKey: {@@ -677,7 +685,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {onDelete: 'cascade',hooks: true})- VideoComments: VideoCommentModel[]+ VideoComments: Awaited<VideoCommentModel>[]@HasMany(() => VideoViewModel, {foreignKey: {@@ -686,7 +694,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'cascade'})- VideoViews: VideoViewModel[]+ VideoViews: Awaited<VideoViewModel>[]@HasMany(() => UserVideoHistoryModel, {foreignKey: {@@ -695,7 +703,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'cascade'})- UserVideoHistories: UserVideoHistoryModel[]+ UserVideoHistories: Awaited<UserVideoHistoryModel>[]@HasOne(() => ScheduleVideoUpdateModel, {foreignKey: {@@ -704,7 +712,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'cascade'})- ScheduleVideoUpdate: ScheduleVideoUpdateModel+ ScheduleVideoUpdate: Awaited<ScheduleVideoUpdateModel>@HasOne(() => VideoBlacklistModel, {foreignKey: {@@ -713,7 +721,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'cascade'})- VideoBlacklist: VideoBlacklistModel+ VideoBlacklist: Awaited<VideoBlacklistModel>@HasOne(() => VideoLiveModel, {foreignKey: {@@ -723,7 +731,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {hooks: true,onDelete: 'cascade'})- VideoLive: VideoLiveModel+ VideoLive: Awaited<VideoLiveModel>@HasOne(() => VideoImportModel, {foreignKey: {@@ -732,7 +740,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'set null'})- VideoImport: VideoImportModel+ VideoImport: Awaited<VideoImportModel>@HasMany(() => VideoCaptionModel, {foreignKey: {@@ -743,7 +751,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {hooks: true,['separate' as any]: true})- VideoCaptions: VideoCaptionModel[]+ VideoCaptions: Awaited<VideoCaptionModel>[]@HasMany(() => VideoPasswordModel, {foreignKey: {@@ -752,7 +760,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'cascade'})- VideoPasswords: VideoPasswordModel[]+ VideoPasswords: Awaited<VideoPasswordModel>[]@HasOne(() => VideoJobInfoModel, {foreignKey: {@@ -761,7 +769,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {},onDelete: 'cascade'})- VideoJobInfo: VideoJobInfoModel+ VideoJobInfo: Awaited<VideoJobInfoModel>@HasOne(() => StoryboardModel, {foreignKey: {@@ -771,7 +779,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {onDelete: 'cascade',hooks: true})- Storyboard: StoryboardModel+ Storyboard: Awaited<StoryboardModel>@AfterCreatestatic notifyCreate (video: MVideo) {@@ -1110,7 +1118,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {nsfw: booleanisLive?: booleanisLocal?: boolean- include?: VideoInclude+ include?: VideoIncludeTypehasFiles?: boolean // default false@@ -1124,7 +1132,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {languageOneOf?: string[]tagsOneOf?: string[]tagsAllOf?: string[]- privacyOneOf?: VideoPrivacy[]+ privacyOneOf?: VideoPrivacyType[]accountId?: numbervideoChannelId?: number@@ -1202,14 +1210,14 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {nsfw?: booleanisLive?: booleanisLocal?: boolean- include?: VideoInclude+ include?: VideoIncludeTypecategoryOneOf?: number[]licenceOneOf?: number[]languageOneOf?: string[]tagsOneOf?: string[]tagsAllOf?: string[]- privacyOneOf?: VideoPrivacy[]+ privacyOneOf?: VideoPrivacyType[]displayOnlyForFollower: DisplayOnlyForFollowerOptions | null@@ -1637,19 +1645,19 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {}}- private static throwIfPrivateIncludeWithoutUser (include: VideoInclude, user: MUserAccountId) {+ private static throwIfPrivateIncludeWithoutUser (include: VideoIncludeType, user: MUserAccountId) {if (VideoModel.isPrivateInclude(include) && !user?.hasRight(UserRight.SEE_ALL_VIDEOS)) {throw new Error('Try to include protected videos but user cannot see all videos')}}- private static throwIfPrivacyOneOfWithoutUser (privacyOneOf: VideoPrivacy[], user: MUserAccountId) {+ private static throwIfPrivacyOneOfWithoutUser (privacyOneOf: VideoPrivacyType[], user: MUserAccountId) {if (privacyOneOf && !user?.hasRight(UserRight.SEE_ALL_VIDEOS)) {throw new Error('Try to choose video privacies but user cannot see all videos')}}- private static isPrivateInclude (include: VideoInclude) {+ private static isPrivateInclude (include: VideoIncludeType) {return include & VideoInclude.BLACKLISTED ||include & VideoInclude.BLOCKED_OWNER ||include & VideoInclude.NOT_PUBLISHED_STATE@@ -1975,7 +1983,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {return isStateForFederation(this.state)}- isNewVideo (newPrivacy: VideoPrivacy) {+ isNewVideo (newPrivacy: VideoPrivacyType) {return this.hasPrivacyForFederation() === false && isPrivacyForFederation(newPrivacy) === true}@@ -2016,7 +2024,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {// ---------------------------------------------------------------------------- async setNewState (newState: VideoState, isNewVideo: boolean, transaction: Transaction) {+ async setNewState (newState: VideoStateType, isNewVideo: boolean, transaction: Transaction) {if (this.state === newState) throw new Error('Cannot use same state ' + newState)this.state = newStatediff --git a/server/models/view/local-video-viewer-watch-section.ts b/server/server/models/view/local-video-viewer-watch-section.tssimilarity index 87%rename from server/models/view/local-video-viewer-watch-section.tsrename to server/server/models/view/local-video-viewer-watch-section.tsindex e29bb78478..b04dcf4bd8 100644--- a/server/models/view/local-video-viewer-watch-section.ts+++ b/server/server/models/view/local-video-viewer-watch-section.ts@@ -1,8 +1,8 @@import { Transaction } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Model, Table } from 'sequelize-typescript'-import { MLocalVideoViewerWatchSection } from '@server/types/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { LocalVideoViewerModel } from './local-video-viewer'+import { MLocalVideoViewerWatchSection } from '@server/types/models/index.js'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { LocalVideoViewerModel } from './local-video-viewer.js'@Table({tableName: 'localVideoViewerWatchSection',@@ -35,7 +35,7 @@ export class LocalVideoViewerWatchSectionModel extends Model<Partial<AttributesO},onDelete: 'CASCADE'})- LocalVideoViewer: LocalVideoViewerModel+ LocalVideoViewer: Awaited<LocalVideoViewerModel>static async bulkCreateSections (options: {localVideoViewerId: numberdiff --git a/server/models/view/local-video-viewer.ts b/server/server/models/view/local-video-viewer.tssimilarity index 96%rename from server/models/view/local-video-viewer.tsrename to server/server/models/view/local-video-viewer.tsindex c7ac51a034..b3d1ada79e 100644--- a/server/models/view/local-video-viewer.ts+++ b/server/server/models/view/local-video-viewer.ts@@ -1,12 +1,18 @@import { QueryTypes } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, HasMany, IsUUID, Model, Table } from 'sequelize-typescript'-import { getActivityStreamDuration } from '@server/lib/activitypub/activity'-import { buildGroupByAndBoundaries } from '@server/lib/timeserie'-import { MLocalVideoViewer, MLocalVideoViewerWithWatchSections, MVideo } from '@server/types/models'-import { VideoStatsOverall, VideoStatsRetention, VideoStatsTimeserie, VideoStatsTimeserieMetric, WatchActionObject } from '@shared/models'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoModel } from '../video/video'-import { LocalVideoViewerWatchSectionModel } from './local-video-viewer-watch-section'+import { getActivityStreamDuration } from '@server/lib/activitypub/activity.js'+import { buildGroupByAndBoundaries } from '@server/lib/timeserie.js'+import { MLocalVideoViewer, MLocalVideoViewerWithWatchSections, MVideo } from '@server/types/models/index.js'+import {+ VideoStatsOverall,+ VideoStatsRetention,+ VideoStatsTimeserie,+ VideoStatsTimeserieMetric,+ WatchActionObject+} from '@peertube/peertube-models'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { VideoModel } from '../video/video.js'+import { LocalVideoViewerWatchSectionModel } from './local-video-viewer-watch-section.js'/***@@ -68,7 +74,7 @@ export class LocalVideoViewerModel extends Model<Partial<AttributesOnly<LocalVid},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>@HasMany(() => LocalVideoViewerWatchSectionModel, {foreignKey: {@@ -76,7 +82,7 @@ export class LocalVideoViewerModel extends Model<Partial<AttributesOnly<LocalVid},onDelete: 'cascade'})- WatchSections: LocalVideoViewerWatchSectionModel[]+ WatchSections: Awaited<LocalVideoViewerWatchSectionModel>[]static loadByUrl (url: string): Promise<MLocalVideoViewer> {return this.findOne({diff --git a/server/models/view/video-view.ts b/server/server/models/view/video-view.tssimilarity index 89%rename from server/models/view/video-view.tsrename to server/server/models/view/video-view.tsindex 1504a364eb..a7aaccf26c 100644--- a/server/models/view/video-view.ts+++ b/server/server/models/view/video-view.ts@@ -1,7 +1,7 @@import { literal, Op } from 'sequelize'import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Model, Table } from 'sequelize-typescript'-import { AttributesOnly } from '@shared/typescript-utils'-import { VideoModel } from '../video/video'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'+import { VideoModel } from '../video/video.js'/***@@ -48,7 +48,7 @@ export class VideoViewModel extends Model<Partial<AttributesOnly<VideoViewModel>},onDelete: 'CASCADE'})- Video: VideoModel+ Video: Awaited<VideoModel>static removeOldRemoteViewsHistory (beforeDate: string) {const query = {diff --git a/server/static/dnt-policy/dnt-policy-1.0.txt b/server/server/static/dnt-policy/dnt-policy-1.0.txtsimilarity index 100%rename from server/static/dnt-policy/dnt-policy-1.0.txtrename to server/server/static/dnt-policy/dnt-policy-1.0.txtdiff --git a/server/types/activitypub-processor.model.ts b/server/server/types/activitypub-processor.model.tssimilarity index 55%rename from server/types/activitypub-processor.model.tsrename to server/server/types/activitypub-processor.model.tsindex 7ed3a65b15..0cb4297703 100644--- a/server/types/activitypub-processor.model.ts+++ b/server/server/types/activitypub-processor.model.ts@@ -1,5 +1,5 @@-import { Activity } from '../../shared/models/activitypub'-import { MActorDefault, MActorSignature } from './models'+import { Activity } from '@peertube/peertube-models'+import { MActorDefault, MActorSignature } from './models/index.js'export type APProcessorOptions<T extends Activity> = {activity: Tdiff --git a/server/types/express-handler.ts b/server/server/types/express-handler.tssimilarity index 100%rename from server/types/express-handler.tsrename to server/server/types/express-handler.tsdiff --git a/server/types/express.d.ts b/server/server/types/express.d.tssimilarity index 93%rename from server/types/express.d.tsrename to server/server/types/express.d.tsindex 4729c45341..3ead23b40b 100644--- a/server/types/express.d.ts+++ b/server/server/types/express.d.ts@@ -1,6 +1,7 @@import { OutgoingHttpHeaders } from 'http'import { Writable } from 'stream'-import { RegisterServerAuthExternalOptions } from '@server/types'+import { HttpMethodType, PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@peertube/peertube-models'+import { RegisterServerAuthExternalOptions } from '@server/types/index.js'import {MAbuseMessage,MAbuseReporter,@@ -21,15 +22,14 @@ import {MVideoPassword,MVideoPlaylistFull,MVideoPlaylistFullSummary-} from '@server/types/models'-import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'-import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'-import { MVideoImportDefault } from '@server/types/models/video/video-import'-import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'-import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'-import { HttpMethod, PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models'+} from '@server/types/models/index.js'+import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token.js'+import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server.js'+import { MVideoImportDefault } from '@server/types/models/video/video-import.js'+import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element.js'+import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate.js'import { File as UploadXFile, Metadata } from '@uploadx/core'-import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'+import { RegisteredPlugin } from '../../lib/plugins/plugin-manager.js'import {MAccountDefault,MActorAccountChannelId,@@ -44,14 +44,14 @@ import {MVideoRedundancyVideo,MVideoShareActor,MVideoThumbnail-} from './models'-import { MRunner, MRunnerJobRunner, MRunnerRegistrationToken } from './models/runners'-import { MVideoSource } from './models/video/video-source'+} from './models/index.js'+import { MRunner, MRunnerJobRunner, MRunnerRegistrationToken } from './models/runners/index.js'+import { MVideoSource } from './models/video/video-source.js'declare module 'express' {export interface Request {query: any- method: HttpMethod+ method: HttpMethodType}// Upload using multer or uploadx middlewarediff --git a/server/server/types/index.ts b/server/server/types/index.tsnew file mode 100644index 0000000000..4afef90a83--- /dev/null+++ b/server/server/types/index.ts@@ -0,0 +1,3 @@+export * from './plugins/index.js'+export * from './activitypub-processor.model.js'+export * from './sequelize.js'diff --git a/server/types/lib.d.ts b/server/server/types/lib.d.tssimilarity index 100%rename from server/types/lib.d.tsrename to server/server/types/lib.d.tsdiff --git a/server/types/models/abuse/abuse-message.ts b/server/server/types/models/abuse/abuse-message.tssimilarity index 75%rename from server/types/models/abuse/abuse-message.tsrename to server/server/types/models/abuse/abuse-message.tsindex 2d7d093167..85ea028d27 100644--- a/server/types/models/abuse/abuse-message.ts+++ b/server/server/types/models/abuse/abuse-message.ts@@ -1,7 +1,7 @@-import { AbuseMessageModel } from '@server/models/abuse/abuse-message'-import { PickWith } from '@shared/typescript-utils'-import { AbuseModel } from '../../../models/abuse/abuse'-import { MAccountFormattable } from '../account'+import { AbuseMessageModel } from '@server/models/abuse/abuse-message.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { AbuseModel } from '../../../models/abuse/abuse.js'+import { MAccountFormattable } from '../account/index.js'type Use<K extends keyof AbuseMessageModel, M> = PickWith<AbuseMessageModel, K, M>diff --git a/server/types/models/abuse/abuse.ts b/server/server/types/models/abuse/abuse.tssimilarity index 94%rename from server/types/models/abuse/abuse.tsrename to server/server/types/models/abuse/abuse.tsindex 1b45b3879f..bf6680470c 100644--- a/server/types/models/abuse/abuse.ts+++ b/server/server/types/models/abuse/abuse.ts@@ -1,11 +1,11 @@-import { VideoAbuseModel } from '@server/models/abuse/video-abuse'-import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'-import { VideoCommentModel } from '@server/models/video/video-comment'-import { PickWith } from '@shared/typescript-utils'-import { AbuseModel } from '../../../models/abuse/abuse'-import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl } from '../account'-import { MComment, MCommentOwner, MCommentUrl, MCommentVideo, MVideoUrl } from '../video'-import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video'+import { VideoAbuseModel } from '@server/models/abuse/video-abuse.js'+import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse.js'+import { VideoCommentModel } from '@server/models/video/video-comment.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { AbuseModel } from '../../../models/abuse/abuse.js'+import { MAccountDefault, MAccountFormattable, MAccountLight, MAccountUrl } from '../account/index.js'+import { MComment, MCommentOwner, MCommentUrl, MCommentVideo, MVideoUrl } from '../video/index.js'+import { MVideo, MVideoAccountLightBlacklistAllFiles } from '../video/video.js'type Use<K extends keyof AbuseModel, M> = PickWith<AbuseModel, K, M>type UseVideoAbuse<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>diff --git a/server/server/types/models/abuse/index.ts b/server/server/types/models/abuse/index.tsnew file mode 100644index 0000000000..fe6b95af37--- /dev/null+++ b/server/server/types/models/abuse/index.ts@@ -0,0 +1,2 @@+export * from './abuse.js'+export * from './abuse-message.js'diff --git a/server/types/models/account/account-blocklist.ts b/server/server/types/models/account/account-blocklist.tssimilarity index 85%rename from server/types/models/account/account-blocklist.tsrename to server/server/types/models/account/account-blocklist.tsindex 9dae10915f..d761b2de4f 100644--- a/server/types/models/account/account-blocklist.ts+++ b/server/server/types/models/account/account-blocklist.ts@@ -1,6 +1,6 @@-import { AccountBlocklistModel } from '../../../models/account/account-blocklist'-import { PickWith } from '@shared/typescript-utils'-import { MAccountDefault, MAccountFormattable } from './account'+import { AccountBlocklistModel } from '../../../models/account/account-blocklist.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MAccountDefault, MAccountFormattable } from './account.js'type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M>diff --git a/server/types/models/account/account.ts b/server/server/types/models/account/account.tssimilarity index 89%rename from server/types/models/account/account.tsrename to server/server/types/models/account/account.tsindex d10b904abf..4a5e80725a 100644--- a/server/types/models/account/account.ts+++ b/server/server/types/models/account/account.ts@@ -1,5 +1,5 @@-import { FunctionProperties, PickWith } from '@shared/typescript-utils'-import { AccountModel } from '../../../models/account/account'+import { FunctionProperties, PickWith } from '@peertube/peertube-typescript-utils'+import { AccountModel } from '../../../models/account/account.js'import {MActor,MActorAPAccount,@@ -13,9 +13,9 @@ import {MActorSummary,MActorSummaryFormattable,MActorUrl-} from '../actor'-import { MChannelDefault } from '../video/video-channels'-import { MAccountBlocklistId } from './account-blocklist'+} from '../actor/index.js'+import { MChannelDefault } from '../video/video-channels.js'+import { MAccountBlocklistId } from './account-blocklist.js'type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>diff --git a/server/types/models/account/actor-custom-page.ts b/server/server/types/models/account/actor-custom-page.tssimilarity index 86%rename from server/types/models/account/actor-custom-page.tsrename to server/server/types/models/account/actor-custom-page.tsindex fcd8069be5..de2cfd41e5 100644--- a/server/types/models/account/actor-custom-page.ts+++ b/server/server/types/models/account/actor-custom-page.ts@@ -1,3 +1,3 @@-import { ActorCustomPageModel } from '../../../models/account/actor-custom-page'+import { ActorCustomPageModel } from '../../../models/account/actor-custom-page.js'export type MActorCustomPage = Omit<ActorCustomPageModel, 'Actor'>diff --git a/server/server/types/models/account/index.ts b/server/server/types/models/account/index.tsnew file mode 100644index 0000000000..e00026a6f4--- /dev/null+++ b/server/server/types/models/account/index.ts@@ -0,0 +1,3 @@+export * from './account.js'+export * from './actor-custom-page.js'+export * from './account-blocklist.js'diff --git a/server/types/models/actor/actor-follow.ts b/server/server/types/models/actor/actor-follow.tssimilarity index 95%rename from server/types/models/actor/actor-follow.tsrename to server/server/types/models/actor/actor-follow.tsindex 84042e2283..a130751f92 100644--- a/server/types/models/actor/actor-follow.ts+++ b/server/server/types/models/actor/actor-follow.ts@@ -1,5 +1,5 @@-import { PickWith } from '@shared/typescript-utils'-import { ActorFollowModel } from '../../../models/actor/actor-follow'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { ActorFollowModel } from '../../../models/actor/actor-follow.js'import {MActor,MActorChannelAccountActor,@@ -9,7 +9,7 @@ import {MActorFormattable,MActorHostOnly,MActorUsername-} from './actor'+} from './actor.js'type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>diff --git a/server/types/models/actor/actor-image.ts b/server/server/types/models/actor/actor-image.tssimilarity index 81%rename from server/types/models/actor/actor-image.tsrename to server/server/types/models/actor/actor-image.tsindex e8f32b71e9..de8a62216b 100644--- a/server/types/models/actor/actor-image.ts+++ b/server/server/types/models/actor/actor-image.ts@@ -1,5 +1,5 @@-import { FunctionProperties } from '@shared/typescript-utils'-import { ActorImageModel } from '../../../models/actor/actor-image'+import { FunctionProperties } from '@peertube/peertube-typescript-utils'+import { ActorImageModel } from '../../../models/actor/actor-image.js'export type MActorImage = ActorImageModeldiff --git a/server/types/models/actor/actor.ts b/server/server/types/models/actor/actor.tssimilarity index 94%rename from server/types/models/actor/actor.tsrename to server/server/types/models/actor/actor.tsindex 47e7b7091f..0d594545f5 100644--- a/server/types/models/actor/actor.ts+++ b/server/server/types/models/actor/actor.ts@@ -1,9 +1,9 @@-import { FunctionProperties, PickWith, PickWithOpt } from '@shared/typescript-utils'-import { ActorModel } from '../../../models/actor/actor'-import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from '../account'-import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'-import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'-import { MActorImage, MActorImageFormattable } from './actor-image'+import { FunctionProperties, PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'+import { ActorModel } from '../../../models/actor/actor.js'+import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from '../account/index.js'+import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server/index.js'+import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video/index.js'+import { MActorImage, MActorImageFormattable } from './actor-image.js'type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>type UseOpt<K extends keyof ActorModel, M> = PickWithOpt<ActorModel, K, M>diff --git a/server/server/types/models/actor/index.ts b/server/server/types/models/actor/index.tsnew file mode 100644index 0000000000..f7724f54a5--- /dev/null+++ b/server/server/types/models/actor/index.ts@@ -0,0 +1,3 @@+export * from './actor-follow.js'+export * from './actor-image.js'+export * from './actor.js'diff --git a/server/types/models/application/application.ts b/server/server/types/models/application/application.tssimilarity index 94%rename from server/types/models/application/application.tsrename to server/server/types/models/application/application.tsindex 9afb9ad705..bffd6d7181 100644--- a/server/types/models/application/application.ts+++ b/server/server/types/models/application/application.ts@@ -1,4 +1,4 @@-import { ApplicationModel } from '@server/models/application/application'+import { ApplicationModel } from '@server/models/application/application.js'// ############################################################################diff --git a/server/server/types/models/application/index.ts b/server/server/types/models/application/index.tsnew file mode 100644index 0000000000..fbbab97605--- /dev/null+++ b/server/server/types/models/application/index.ts@@ -0,0 +1 @@+export * from './application.js'diff --git a/server/server/types/models/index.ts b/server/server/types/models/index.tsnew file mode 100644index 0000000000..8c90db53ca--- /dev/null+++ b/server/server/types/models/index.ts@@ -0,0 +1,8 @@+export * from './abuse/index.js'+export * from './account/index.js'+export * from './actor/index.js'+export * from './application/index.js'+export * from './oauth/index.js'+export * from './server/index.js'+export * from './user/index.js'+export * from './video/index.js'diff --git a/server/server/types/models/oauth/index.ts b/server/server/types/models/oauth/index.tsnew file mode 100644index 0000000000..c9bbaa53dd--- /dev/null+++ b/server/server/types/models/oauth/index.ts@@ -0,0 +1,2 @@+export * from './oauth-client.js'+export * from './oauth-token.js'diff --git a/server/types/models/oauth/oauth-client.ts b/server/server/types/models/oauth/oauth-client.tssimilarity index 94%rename from server/types/models/oauth/oauth-client.tsrename to server/server/types/models/oauth/oauth-client.tsindex 904a07863f..589a69d169 100644--- a/server/types/models/oauth/oauth-client.ts+++ b/server/server/types/models/oauth/oauth-client.ts@@ -1,3 +1,3 @@-import { OAuthClientModel } from '@server/models/oauth/oauth-client'+import { OAuthClientModel } from '@server/models/oauth/oauth-client.js'export type MOAuthClient = Omit<OAuthClientModel, 'OAuthTokens'>diff --git a/server/types/models/oauth/oauth-token.ts b/server/server/types/models/oauth/oauth-token.tssimilarity index 77%rename from server/types/models/oauth/oauth-token.tsrename to server/server/types/models/oauth/oauth-token.tsindex 6af087e3c1..cf44129386 100644--- a/server/types/models/oauth/oauth-token.ts+++ b/server/server/types/models/oauth/oauth-token.ts@@ -1,6 +1,6 @@-import { OAuthTokenModel } from '@server/models/oauth/oauth-token'-import { PickWith } from '@shared/typescript-utils'-import { MUserAccountUrl } from '../user/user'+import { OAuthTokenModel } from '@server/models/oauth/oauth-token.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MUserAccountUrl } from '../user/user.js'type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M>diff --git a/server/server/types/models/runners/index.ts b/server/server/types/models/runners/index.tsnew file mode 100644index 0000000000..94f33a47a4--- /dev/null+++ b/server/server/types/models/runners/index.ts@@ -0,0 +1,3 @@+export * from './runner.js'+export * from './runner-job.js'+export * from './runner-registration-token.js'diff --git a/server/types/models/runners/runner-job.ts b/server/server/types/models/runners/runner-job.tssimilarity index 84%rename from server/types/models/runners/runner-job.tsrename to server/server/types/models/runners/runner-job.tsindex ec983ba32a..4fa024f57e 100644--- a/server/types/models/runners/runner-job.ts+++ b/server/server/types/models/runners/runner-job.ts@@ -1,6 +1,6 @@-import { RunnerJobModel } from '@server/models/runner/runner-job'-import { PickWith } from '@shared/typescript-utils'-import { MRunner } from './runner'+import { RunnerJobModel } from '@server/models/runner/runner-job.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MRunner } from './runner.js'type Use<K extends keyof RunnerJobModel, M> = PickWith<RunnerJobModel, K, M>diff --git a/server/types/models/runners/runner-registration-token.ts b/server/server/types/models/runners/runner-registration-token.tssimilarity index 87%rename from server/types/models/runners/runner-registration-token.tsrename to server/server/types/models/runners/runner-registration-token.tsindex 83b8614add..5dd18a3389 100644--- a/server/types/models/runners/runner-registration-token.ts+++ b/server/server/types/models/runners/runner-registration-token.ts@@ -1,4 +1,4 @@-import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token'+import { RunnerRegistrationTokenModel } from '@server/models/runner/runner-registration-token.js'// ############################################################################diff --git a/server/types/models/runners/runner.ts b/server/server/types/models/runners/runner.tssimilarity index 70%rename from server/types/models/runners/runner.tsrename to server/server/types/models/runners/runner.tsindex d35356378e..bde83145e8 100644--- a/server/types/models/runners/runner.ts+++ b/server/server/types/models/runners/runner.ts@@ -1,4 +1,4 @@-import { RunnerModel } from '@server/models/runner/runner'+import { RunnerModel } from '@server/models/runner/runner.js'// ############################################################################diff --git a/server/server/types/models/server/index.ts b/server/server/types/models/server/index.tsnew file mode 100644index 0000000000..ed5482b70a--- /dev/null+++ b/server/server/types/models/server/index.ts@@ -0,0 +1,3 @@+export * from './plugin.js'+export * from './server.js'+export * from './server-blocklist.js'diff --git a/server/types/models/server/plugin.ts b/server/server/types/models/server/plugin.tssimilarity index 85%rename from server/types/models/server/plugin.tsrename to server/server/types/models/server/plugin.tsindex 83eb837948..0d5a8fb02d 100644--- a/server/types/models/server/plugin.ts+++ b/server/server/types/models/server/plugin.ts@@ -1,4 +1,4 @@-import { PluginModel } from '@server/models/server/plugin'+import { PluginModel } from '@server/models/server/plugin.js'export type MPlugin = PluginModeldiff --git a/server/types/models/server/server-blocklist.ts b/server/server/types/models/server/server-blocklist.tssimilarity index 85%rename from server/types/models/server/server-blocklist.tsrename to server/server/types/models/server/server-blocklist.tsindex 71a4ea963e..e944e7328f 100644--- a/server/types/models/server/server-blocklist.ts+++ b/server/server/types/models/server/server-blocklist.ts@@ -1,7 +1,7 @@-import { ServerBlocklistModel } from '@server/models/server/server-blocklist'-import { PickWith } from '@shared/typescript-utils'-import { MAccountDefault, MAccountFormattable } from '../account/account'-import { MServer, MServerFormattable } from './server'+import { ServerBlocklistModel } from '@server/models/server/server-blocklist.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MAccountDefault, MAccountFormattable } from '../account/account.js'+import { MServer, MServerFormattable } from './server.js'type Use<K extends keyof ServerBlocklistModel, M> = PickWith<ServerBlocklistModel, K, M>diff --git a/server/types/models/server/server.ts b/server/server/types/models/server/server.tssimilarity index 78%rename from server/types/models/server/server.tsrename to server/server/types/models/server/server.tsindex 0b16186cd6..fe3d362b52 100644--- a/server/types/models/server/server.ts+++ b/server/server/types/models/server/server.ts@@ -1,6 +1,6 @@-import { FunctionProperties, PickWith } from '@shared/typescript-utils'-import { ServerModel } from '../../../models/server/server'-import { MAccountBlocklistId } from '../account'+import { FunctionProperties, PickWith } from '@peertube/peertube-typescript-utils'+import { ServerModel } from '../../../models/server/server.js'+import { MAccountBlocklistId } from '../account/index.js'type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M>diff --git a/server/types/models/server/tracker.ts b/server/server/types/models/server/tracker.tssimilarity index 73%rename from server/types/models/server/tracker.tsrename to server/server/types/models/server/tracker.tsindex 5fe03f8c00..adcd3f4356 100644--- a/server/types/models/server/tracker.ts+++ b/server/server/types/models/server/tracker.ts@@ -1,4 +1,4 @@-import { TrackerModel } from '../../../models/server/tracker'+import { TrackerModel } from '../../../models/server/tracker.js'export type MTracker = Omit<TrackerModel, 'Videos'>diff --git a/server/server/types/models/user/index.ts b/server/server/types/models/user/index.tsnew file mode 100644index 0000000000..53db3944d7--- /dev/null+++ b/server/server/types/models/user/index.ts@@ -0,0 +1,5 @@+export * from './user.js'+export * from './user-notification.js'+export * from './user-notification-setting.js'+export * from './user-registration.js'+export * from './user-video-history.js'diff --git a/server/types/models/user/user-notification-setting.ts b/server/server/types/models/user/user-notification-setting.tssimilarity index 91%rename from server/types/models/user/user-notification-setting.tsrename to server/server/types/models/user/user-notification-setting.tsindex d1db645e72..61f93b6fae 100644--- a/server/types/models/user/user-notification-setting.ts+++ b/server/server/types/models/user/user-notification-setting.ts@@ -1,4 +1,4 @@-import { UserNotificationSettingModel } from '@server/models/user/user-notification-setting'+import { UserNotificationSettingModel } from '@server/models/user/user-notification-setting.js'export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'>diff --git a/server/types/models/user/user-notification.ts b/server/server/types/models/user/user-notification.tssimilarity index 89%rename from server/types/models/user/user-notification.tsrename to server/server/types/models/user/user-notification.tsindex a732c8aa96..5a0b57e7a3 100644--- a/server/types/models/user/user-notification.ts+++ b/server/server/types/models/user/user-notification.ts@@ -1,21 +1,21 @@-import { VideoAbuseModel } from '@server/models/abuse/video-abuse'-import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'-import { ApplicationModel } from '@server/models/application/application'-import { PluginModel } from '@server/models/server/plugin'-import { UserNotificationModel } from '@server/models/user/user-notification'-import { UserRegistrationModel } from '@server/models/user/user-registration'-import { PickWith, PickWithOpt } from '@shared/typescript-utils'-import { AbuseModel } from '../../../models/abuse/abuse'-import { AccountModel } from '../../../models/account/account'-import { ActorModel } from '../../../models/actor/actor'-import { ActorFollowModel } from '../../../models/actor/actor-follow'-import { ActorImageModel } from '../../../models/actor/actor-image'-import { ServerModel } from '../../../models/server/server'-import { VideoModel } from '../../../models/video/video'-import { VideoBlacklistModel } from '../../../models/video/video-blacklist'-import { VideoChannelModel } from '../../../models/video/video-channel'-import { VideoCommentModel } from '../../../models/video/video-comment'-import { VideoImportModel } from '../../../models/video/video-import'+import { VideoAbuseModel } from '@server/models/abuse/video-abuse.js'+import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse.js'+import { ApplicationModel } from '@server/models/application/application.js'+import { PluginModel } from '@server/models/server/plugin.js'+import { UserNotificationModel } from '@server/models/user/user-notification.js'+import { UserRegistrationModel } from '@server/models/user/user-registration.js'+import { PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'+import { AbuseModel } from '../../../models/abuse/abuse.js'+import { AccountModel } from '../../../models/account/account.js'+import { ActorModel } from '../../../models/actor/actor.js'+import { ActorFollowModel } from '../../../models/actor/actor-follow.js'+import { ActorImageModel } from '../../../models/actor/actor-image.js'+import { ServerModel } from '../../../models/server/server.js'+import { VideoModel } from '../../../models/video/video.js'+import { VideoBlacklistModel } from '../../../models/video/video-blacklist.js'+import { VideoChannelModel } from '../../../models/video/video-channel.js'+import { VideoCommentModel } from '../../../models/video/video-comment.js'+import { VideoImportModel } from '../../../models/video/video-import.js'type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationModel, K, M>diff --git a/server/types/models/user/user-registration.ts b/server/server/types/models/user/user-registration.tssimilarity index 80%rename from server/types/models/user/user-registration.tsrename to server/server/types/models/user/user-registration.tsindex 216423cc99..bcbe52fbde 100644--- a/server/types/models/user/user-registration.ts+++ b/server/server/types/models/user/user-registration.ts@@ -1,6 +1,6 @@-import { UserRegistrationModel } from '@server/models/user/user-registration'-import { PickWith } from '@shared/typescript-utils'-import { MUserId } from './user'+import { UserRegistrationModel } from '@server/models/user/user-registration.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MUserId } from './user.js'type Use<K extends keyof UserRegistrationModel, M> = PickWith<UserRegistrationModel, K, M>diff --git a/server/types/models/user/user-video-history.ts b/server/server/types/models/user/user-video-history.tssimilarity index 92%rename from server/types/models/user/user-video-history.tsrename to server/server/types/models/user/user-video-history.tsindex 34e2930e7d..d617420703 100644--- a/server/types/models/user/user-video-history.ts+++ b/server/server/types/models/user/user-video-history.ts@@ -1,4 +1,4 @@-import { UserVideoHistoryModel } from '../../../models/user/user-video-history'+import { UserVideoHistoryModel } from '../../../models/user/user-video-history.js'export type MUserVideoHistory = Omit<UserVideoHistoryModel, 'Video' | 'User'>diff --git a/server/types/models/user/user.ts b/server/server/types/models/user/user.tssimilarity index 85%rename from server/types/models/user/user.tsrename to server/server/types/models/user/user.tsindex 89092c2426..4a655c7922 100644--- a/server/types/models/user/user.ts+++ b/server/server/types/models/user/user.ts@@ -1,7 +1,7 @@-import { AccountModel } from '@server/models/account/account'-import { UserModel } from '@server/models/user/user'-import { MVideoPlaylist } from '@server/types/models'-import { PickWith, PickWithOpt } from '@shared/typescript-utils'+import { AccountModel } from '@server/models/account/account.js'+import { UserModel } from '@server/models/user/user.js'+import { MVideoPlaylist } from '@server/types/models/index.js'+import { PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'import {MAccount,MAccountDefault,@@ -10,9 +10,9 @@ import {MAccountId,MAccountIdActorId,MAccountUrl-} from '../account'-import { MChannelFormattable } from '../video/video-channels'-import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting'+} from '../account/index.js'+import { MChannelFormattable } from '../video/video-channels.js'+import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting.js'type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M>diff --git a/server/server/types/models/video/index.ts b/server/server/types/models/video/index.tsnew file mode 100644index 0000000000..f88198b67f--- /dev/null+++ b/server/server/types/models/video/index.ts@@ -0,0 +1,26 @@+export * from './local-video-viewer-watch-section.js'+export * from './local-video-viewer-watch-section.js'+export * from './local-video-viewer.js'+export * from './storyboard.js'+export * from './schedule-video-update.js'+export * from './tag.js'+export * from './thumbnail.js'+export * from './video.js'+export * from './video-blacklist.js'+export * from './video-caption.js'+export * from './video-change-ownership.js'+export * from './video-channel-sync.js'+export * from './video-channels.js'+export * from './video-comment.js'+export * from './video-file.js'+export * from './video-import.js'+export * from './video-live-replay-setting.js'+export * from './video-live-session.js'+export * from './video-live.js'+export * from './video-password.js'+export * from './video-playlist.js'+export * from './video-playlist-element.js'+export * from './video-rate.js'+export * from './video-redundancy.js'+export * from './video-share.js'+export * from './video-streaming-playlist.js'diff --git a/server/types/models/video/local-video-viewer-watch-section.ts b/server/server/types/models/video/local-video-viewer-watch-section.tssimilarity index 85%rename from server/types/models/video/local-video-viewer-watch-section.tsrename to server/server/types/models/video/local-video-viewer-watch-section.tsindex be7a3bba06..c621dd1cc4 100644--- a/server/types/models/video/local-video-viewer-watch-section.ts+++ b/server/server/types/models/video/local-video-viewer-watch-section.ts@@ -1,4 +1,4 @@-import { LocalVideoViewerWatchSectionModel } from '@server/models/view/local-video-viewer-watch-section'+import { LocalVideoViewerWatchSectionModel } from '@server/models/view/local-video-viewer-watch-section.js'// ############################################################################diff --git a/server/types/models/video/local-video-viewer.ts b/server/server/types/models/video/local-video-viewer.tssimilarity index 81%rename from server/types/models/video/local-video-viewer.tsrename to server/server/types/models/video/local-video-viewer.tsindex b78ef5507d..90535dac02 100644--- a/server/types/models/video/local-video-viewer.ts+++ b/server/server/types/models/video/local-video-viewer.ts@@ -1,7 +1,7 @@-import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'-import { PickWith } from '@shared/typescript-utils'-import { MLocalVideoViewerWatchSection } from './local-video-viewer-watch-section'-import { MVideo } from './video'+import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MLocalVideoViewerWatchSection } from './local-video-viewer-watch-section.js'+import { MVideo } from './video.js'type Use<K extends keyof LocalVideoViewerModel, M> = PickWith<LocalVideoViewerModel, K, M>diff --git a/server/types/models/video/schedule-video-update.ts b/server/server/types/models/video/schedule-video-update.tssimilarity index 94%rename from server/types/models/video/schedule-video-update.tsrename to server/server/types/models/video/schedule-video-update.tsindex 39fd735018..7bf998b490 100644--- a/server/types/models/video/schedule-video-update.ts+++ b/server/server/types/models/video/schedule-video-update.ts@@ -1,4 +1,4 @@-import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'+import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update.js'// ############################################################################diff --git a/server/types/models/video/storyboard.ts b/server/server/types/models/video/storyboard.tssimilarity index 80%rename from server/types/models/video/storyboard.tsrename to server/server/types/models/video/storyboard.tsindex a0403d4f04..d8a0e39ea1 100644--- a/server/types/models/video/storyboard.ts+++ b/server/server/types/models/video/storyboard.ts@@ -1,6 +1,6 @@-import { StoryboardModel } from '@server/models/video/storyboard'-import { PickWith } from '@shared/typescript-utils'-import { MVideo } from './video'+import { StoryboardModel } from '@server/models/video/storyboard.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MVideo } from './video.js'type Use<K extends keyof StoryboardModel, M> = PickWith<StoryboardModel, K, M>diff --git a/server/server/types/models/video/tag.ts b/server/server/types/models/video/tag.tsnew file mode 100644index 0000000000..23fdf89e03--- /dev/null+++ b/server/server/types/models/video/tag.ts@@ -0,0 +1,3 @@+import { TagModel } from '../../../models/video/tag.js'++export type MTag = Omit<TagModel, 'Videos'>diff --git a/server/types/models/video/thumbnail.ts b/server/server/types/models/video/thumbnail.tssimilarity index 69%rename from server/types/models/video/thumbnail.tsrename to server/server/types/models/video/thumbnail.tsindex c3b27681f7..b952c06a01 100644--- a/server/types/models/video/thumbnail.ts+++ b/server/server/types/models/video/thumbnail.ts@@ -1,6 +1,6 @@-import { PickWith } from '@shared/typescript-utils'-import { ThumbnailModel } from '../../../models/video/thumbnail'-import { MVideo } from './video'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { ThumbnailModel } from '../../../models/video/thumbnail.js'+import { MVideo } from './video.js'type Use<K extends keyof ThumbnailModel, M> = PickWith<ThumbnailModel, K, M>diff --git a/server/types/models/video/video-blacklist.ts b/server/server/types/models/video/video-blacklist.tssimilarity index 87%rename from server/types/models/video/video-blacklist.tsrename to server/server/types/models/video/video-blacklist.tsindex 048b63bd20..b202e9261f 100644--- a/server/types/models/video/video-blacklist.ts+++ b/server/server/types/models/video/video-blacklist.ts@@ -1,6 +1,6 @@-import { PickWith } from '@shared/typescript-utils'-import { VideoBlacklistModel } from '../../../models/video/video-blacklist'-import { MVideo, MVideoFormattable } from './video'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { VideoBlacklistModel } from '../../../models/video/video-blacklist.js'+import { MVideo, MVideoFormattable } from './video.js'type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M>diff --git a/server/types/models/video/video-caption.ts b/server/server/types/models/video/video-caption.tssimilarity index 88%rename from server/types/models/video/video-caption.tsrename to server/server/types/models/video/video-caption.tsindex d3adec362b..8e8393d921 100644--- a/server/types/models/video/video-caption.ts+++ b/server/server/types/models/video/video-caption.ts@@ -1,6 +1,6 @@-import { PickWith } from '@shared/typescript-utils'-import { VideoCaptionModel } from '../../../models/video/video-caption'-import { MVideo, MVideoUUID } from './video'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { VideoCaptionModel } from '../../../models/video/video-caption.js'+import { MVideo, MVideoUUID } from './video.js'type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M>diff --git a/server/types/models/video/video-change-ownership.ts b/server/server/types/models/video/video-change-ownership.tssimilarity index 84%rename from server/types/models/video/video-change-ownership.tsrename to server/server/types/models/video/video-change-ownership.tsindex d99f25071f..70753e30b2 100644--- a/server/types/models/video/video-change-ownership.ts+++ b/server/server/types/models/video/video-change-ownership.ts@@ -1,7 +1,7 @@-import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'-import { PickWith } from '@shared/typescript-utils'-import { MAccountDefault, MAccountFormattable } from '../account/account'-import { MVideoFormattable, MVideoWithAllFiles } from './video'+import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MAccountDefault, MAccountFormattable } from '../account/account.js'+import { MVideoFormattable, MVideoWithAllFiles } from './video.js'type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>diff --git a/server/types/models/video/video-channel-sync.ts b/server/server/types/models/video/video-channel-sync.tssimilarity index 82%rename from server/types/models/video/video-channel-sync.tsrename to server/server/types/models/video/video-channel-sync.tsindex 429ab70b0b..2b3a3930f1 100644--- a/server/types/models/video/video-channel-sync.ts+++ b/server/server/types/models/video/video-channel-sync.ts@@ -1,6 +1,6 @@-import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'-import { FunctionProperties, PickWith } from '@shared/typescript-utils'-import { MChannelAccountDefault, MChannelFormattable } from './video-channels'+import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync.js'+import { FunctionProperties, PickWith } from '@peertube/peertube-typescript-utils'+import { MChannelAccountDefault, MChannelFormattable } from './video-channels.js'type Use<K extends keyof VideoChannelSyncModel, M> = PickWith<VideoChannelSyncModel, K, M>diff --git a/server/types/models/video/video-channels.ts b/server/server/types/models/video/video-channels.tssimilarity index 94%rename from server/types/models/video/video-channels.tsrename to server/server/types/models/video/video-channels.tsindex 57e9914949..e8cb9cb26d 100644--- a/server/types/models/video/video-channels.ts+++ b/server/server/types/models/video/video-channels.ts@@ -1,5 +1,5 @@-import { FunctionProperties, PickWith, PickWithOpt } from '@shared/typescript-utils'-import { VideoChannelModel } from '../../../models/video/video-channel'+import { FunctionProperties, PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'+import { VideoChannelModel } from '../../../models/video/video-channel.js'import {MAccountActor,MAccountAPI,@@ -10,7 +10,7 @@ import {MAccountSummaryFormattable,MAccountUrl,MAccountUserId-} from '../account'+} from '../account/index.js'import {MActor,MActorAccountChannelId,@@ -26,8 +26,8 @@ import {MActorSummary,MActorSummaryFormattable,MActorUrl-} from '../actor'-import { MVideo } from './video'+} from '../actor/index.js'+import { MVideo } from './video.js'type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>diff --git a/server/types/models/video/video-comment.ts b/server/server/types/models/video/video-comment.tssimilarity index 93%rename from server/types/models/video/video-comment.tsrename to server/server/types/models/video/video-comment.tsindex b66de064f4..d4fd34f7c9 100644--- a/server/types/models/video/video-comment.ts+++ b/server/server/types/models/video/video-comment.ts@@ -1,7 +1,7 @@-import { PickWith, PickWithOpt } from '@shared/typescript-utils'-import { VideoCommentModel } from '../../../models/video/video-comment'-import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'-import { MVideo, MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'+import { PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'+import { VideoCommentModel } from '../../../models/video/video-comment.js'+import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account/index.js'+import { MVideo, MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video.js'type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>diff --git a/server/types/models/video/video-file.ts b/server/server/types/models/video/video-file.tssimilarity index 88%rename from server/types/models/video/video-file.tsrename to server/server/types/models/video/video-file.tsindex 68106788d3..8431b6f5a8 100644--- a/server/types/models/video/video-file.ts+++ b/server/server/types/models/video/video-file.ts@@ -1,8 +1,8 @@-import { PickWith, PickWithOpt } from '@shared/typescript-utils'-import { VideoFileModel } from '../../../models/video/video-file'-import { MVideo, MVideoUUID } from './video'-import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'-import { MStreamingPlaylist, MStreamingPlaylistVideo } from './video-streaming-playlist'+import { PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'+import { VideoFileModel } from '../../../models/video/video-file.js'+import { MVideo, MVideoUUID } from './video.js'+import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy.js'+import { MStreamingPlaylist, MStreamingPlaylistVideo } from './video-streaming-playlist.js'type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>diff --git a/server/types/models/video/video-import.ts b/server/server/types/models/video/video-import.tssimilarity index 85%rename from server/types/models/video/video-import.tsrename to server/server/types/models/video/video-import.tsindex 650c293f79..4920dfac39 100644--- a/server/types/models/video/video-import.ts+++ b/server/server/types/models/video/video-import.ts@@ -1,7 +1,7 @@-import { VideoImportModel } from '@server/models/video/video-import'-import { PickWith, PickWithOpt } from '@shared/typescript-utils'-import { MUser } from '../user/user'-import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video'+import { VideoImportModel } from '@server/models/video/video-import.js'+import { PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'+import { MUser } from '../user/user.js'+import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video.js'type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>diff --git a/server/types/models/video/video-live-replay-setting.ts b/server/server/types/models/video/video-live-replay-setting.tssimilarity index 83%rename from server/types/models/video/video-live-replay-setting.tsrename to server/server/types/models/video/video-live-replay-setting.tsindex c5a5adf548..a7e1be8e40 100644--- a/server/types/models/video/video-live-replay-setting.ts+++ b/server/server/types/models/video/video-live-replay-setting.ts@@ -1,3 +1,3 @@-import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting'+import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting.js'export type MLiveReplaySetting = Omit<VideoLiveReplaySettingModel, 'VideoLive' | 'VideoLiveSession'>diff --git a/server/types/models/video/video-live-session.ts b/server/server/types/models/video/video-live-session.tssimilarity index 74%rename from server/types/models/video/video-live-session.tsrename to server/server/types/models/video/video-live-session.tsindex 852e2c24b8..994726244d 100644--- a/server/types/models/video/video-live-session.ts+++ b/server/server/types/models/video/video-live-session.ts@@ -1,7 +1,7 @@-import { VideoLiveSessionModel } from '@server/models/video/video-live-session'-import { PickWith } from '@shared/typescript-utils'-import { MVideo } from './video'-import { MLiveReplaySetting } from './video-live-replay-setting'+import { VideoLiveSessionModel } from '@server/models/video/video-live-session.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MVideo } from './video.js'+import { MLiveReplaySetting } from './video-live-replay-setting.js'type Use<K extends keyof VideoLiveSessionModel, M> = PickWith<VideoLiveSessionModel, K, M>diff --git a/server/types/models/video/video-live.ts b/server/server/types/models/video/video-live.tssimilarity index 70%rename from server/types/models/video/video-live.tsrename to server/server/types/models/video/video-live.tsindex a899edfa60..6a3ca8f496 100644--- a/server/types/models/video/video-live.ts+++ b/server/server/types/models/video/video-live.ts@@ -1,7 +1,7 @@-import { VideoLiveModel } from '@server/models/video/video-live'-import { PickWith } from '@shared/typescript-utils'-import { MVideo } from './video'-import { MLiveReplaySetting } from './video-live-replay-setting'+import { VideoLiveModel } from '@server/models/video/video-live.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MVideo } from './video.js'+import { MLiveReplaySetting } from './video-live-replay-setting.js'type Use<K extends keyof VideoLiveModel, M> = PickWith<VideoLiveModel, K, M>diff --git a/server/types/models/video/video-password.ts b/server/server/types/models/video/video-password.tssimilarity index 91%rename from server/types/models/video/video-password.tsrename to server/server/types/models/video/video-password.tsindex 313cc3e0cd..6e0e1a5e74 100644--- a/server/types/models/video/video-password.ts+++ b/server/server/types/models/video/video-password.ts@@ -1,3 +1,3 @@-import { VideoPasswordModel } from '@server/models/video/video-password'+import { VideoPasswordModel } from '@server/models/video/video-password.js'export type MVideoPassword = Omit<VideoPasswordModel, 'Video'>diff --git a/server/types/models/video/video-playlist-element.ts b/server/server/types/models/video/video-playlist-element.tssimilarity index 89%rename from server/types/models/video/video-playlist-element.tsrename to server/server/types/models/video/video-playlist-element.tsindex eae6760961..bf8ff6daf8 100644--- a/server/types/models/video/video-playlist-element.ts+++ b/server/server/types/models/video/video-playlist-element.ts@@ -1,7 +1,7 @@-import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'-import { PickWith } from '@shared/typescript-utils'-import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video'-import { MVideoPlaylistPrivacy } from './video-playlist'+import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video.js'+import { MVideoPlaylistPrivacy } from './video-playlist.js'type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M>diff --git a/server/types/models/video/video-playlist.ts b/server/server/types/models/video/video-playlist.tssimilarity index 92%rename from server/types/models/video/video-playlist.tsrename to server/server/types/models/video/video-playlist.tsindex 40f0dfc141..3d99bf4e50 100644--- a/server/types/models/video/video-playlist.ts+++ b/server/server/types/models/video/video-playlist.ts@@ -1,9 +1,9 @@-import { MVideoPlaylistElementLight } from '@server/types/models/video/video-playlist-element'-import { PickWith } from '@shared/typescript-utils'-import { VideoPlaylistModel } from '../../../models/video/video-playlist'-import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'-import { MThumbnail } from './thumbnail'-import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'+import { MVideoPlaylistElementLight } from '@server/types/models/video/video-playlist-element.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { VideoPlaylistModel } from '../../../models/video/video-playlist.js'+import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account/index.js'+import { MThumbnail } from './thumbnail.js'+import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels.js'type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>diff --git a/server/types/models/video/video-rate.ts b/server/server/types/models/video/video-rate.tssimilarity index 85%rename from server/types/models/video/video-rate.tsrename to server/server/types/models/video/video-rate.tsindex 0dbdf3c41e..873b289e64 100644--- a/server/types/models/video/video-rate.ts+++ b/server/server/types/models/video/video-rate.ts@@ -1,7 +1,7 @@-import { AccountVideoRateModel } from '@server/models/account/account-video-rate'-import { PickWith } from '@shared/typescript-utils'-import { MAccountAudience, MAccountUrl } from '../account/account'-import { MVideo, MVideoFormattable } from './video'+import { AccountVideoRateModel } from '@server/models/account/account-video-rate.js'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { MAccountAudience, MAccountUrl } from '../account/account.js'+import { MVideo, MVideoFormattable } from './video.js'type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>diff --git a/server/types/models/video/video-redundancy.ts b/server/server/types/models/video/video-redundancy.tssimilarity index 83%rename from server/types/models/video/video-redundancy.tsrename to server/server/types/models/video/video-redundancy.tsindex e2a9beb936..55014cdf6d 100644--- a/server/types/models/video/video-redundancy.ts+++ b/server/server/types/models/video/video-redundancy.ts@@ -1,10 +1,10 @@-import { VideoFileModel } from '@server/models/video/video-file'-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'-import { PickWith, PickWithOpt } from '@shared/typescript-utils'-import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'-import { MVideoUrl } from './video'-import { MVideoFile, MVideoFileVideo } from './video-file'-import { MStreamingPlaylistVideo } from './video-streaming-playlist'+import { VideoFileModel } from '@server/models/video/video-file.js'+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist.js'+import { PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'+import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy.js'+import { MVideoUrl } from './video.js'+import { MVideoFile, MVideoFileVideo } from './video-file.js'+import { MStreamingPlaylistVideo } from './video-streaming-playlist.js'type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>diff --git a/server/types/models/video/video-share.ts b/server/server/types/models/video/video-share.tssimilarity index 75%rename from server/types/models/video/video-share.tsrename to server/server/types/models/video/video-share.tsindex ffc0edad62..52e98d8ec9 100644--- a/server/types/models/video/video-share.ts+++ b/server/server/types/models/video/video-share.ts@@ -1,7 +1,7 @@-import { PickWith } from '@shared/typescript-utils'-import { VideoShareModel } from '../../../models/video/video-share'-import { MActorDefault } from '../actor'-import { MVideo } from './video'+import { PickWith } from '@peertube/peertube-typescript-utils'+import { VideoShareModel } from '../../../models/video/video-share.js'+import { MActorDefault } from '../actor/index.js'+import { MVideo } from './video.js'type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>diff --git a/server/types/models/video/video-source.ts b/server/server/types/models/video/video-source.tssimilarity index 93%rename from server/types/models/video/video-source.tsrename to server/server/types/models/video/video-source.tsindex 0948f3b2e0..e29feec149 100644--- a/server/types/models/video/video-source.ts+++ b/server/server/types/models/video/video-source.ts@@ -1,3 +1,3 @@-import { VideoSourceModel } from '@server/models/video/video-source'+import { VideoSourceModel } from '@server/models/video/video-source.js'export type MVideoSource = Omit<VideoSourceModel, 'Video'>diff --git a/server/types/models/video/video-streaming-playlist.ts b/server/server/types/models/video/video-streaming-playlist.tssimilarity index 87%rename from server/types/models/video/video-streaming-playlist.tsrename to server/server/types/models/video/video-streaming-playlist.tsindex 1c2f834892..a416469691 100644--- a/server/types/models/video/video-streaming-playlist.ts+++ b/server/server/types/models/video/video-streaming-playlist.ts@@ -1,8 +1,8 @@-import { PickWith, PickWithOpt } from '@shared/typescript-utils'-import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'-import { MVideo } from './video'-import { MVideoFile } from './video-file'-import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'+import { PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'+import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist.js'+import { MVideo } from './video.js'+import { MVideoFile } from './video-file.js'+import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy.js'type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>diff --git a/server/types/models/video/video.ts b/server/server/types/models/video/video.tssimilarity index 92%rename from server/types/models/video/video.tsrename to server/server/types/models/video/video.tsindex 53ee94269c..b7f8652be1 100644--- a/server/types/models/video/video.ts+++ b/server/server/types/models/video/video.ts@@ -1,13 +1,13 @@-import { PickWith, PickWithOpt } from '@shared/typescript-utils'-import { VideoModel } from '../../../models/video/video'-import { MTrackerUrl } from '../server/tracker'-import { MUserVideoHistoryTime } from '../user/user-video-history'-import { MScheduleVideoUpdate } from './schedule-video-update'-import { MStoryboard } from './storyboard'-import { MTag } from './tag'-import { MThumbnail } from './thumbnail'-import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'-import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption'+import { PickWith, PickWithOpt } from '@peertube/peertube-typescript-utils'+import { VideoModel } from '../../../models/video/video.js'+import { MTrackerUrl } from '../server/tracker.js'+import { MUserVideoHistoryTime } from '../user/user-video-history.js'+import { MScheduleVideoUpdate } from './schedule-video-update.js'+import { MStoryboard } from './storyboard.js'+import { MTag } from './tag.js'+import { MThumbnail } from './thumbnail.js'+import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist.js'+import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption.js'import {MChannelAccountDefault,MChannelAccountLight,@@ -16,15 +16,15 @@ import {MChannelFormattable,MChannelHostOnly,MChannelUserId-} from './video-channels'-import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file'-import { MVideoLive } from './video-live'+} from './video-channels.js'+import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file.js'+import { MVideoLive } from './video-live.js'import {MStreamingPlaylistFiles,MStreamingPlaylistRedundancies,MStreamingPlaylistRedundanciesAll,MStreamingPlaylistRedundanciesOpt-} from './video-streaming-playlist'+} from './video-streaming-playlist.js'type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>diff --git a/server/server/types/plugins/index.ts b/server/server/types/plugins/index.tsnew file mode 100644index 0000000000..f50ac6fe92--- /dev/null+++ b/server/server/types/plugins/index.ts@@ -0,0 +1,4 @@+export * from './plugin-library.model.js'+export * from './register-server-auth.model.js'+export * from './register-server-option.model.js'+export * from './register-server-websocket-route.model.js'diff --git a/server/types/plugins/plugin-library.model.ts b/server/server/types/plugins/plugin-library.model.tssimilarity index 95%rename from server/types/plugins/plugin-library.model.tsrename to server/server/types/plugins/plugin-library.model.tsindex 5b517ee9f2..e8992ce85e 100644--- a/server/types/plugins/plugin-library.model.ts+++ b/server/server/types/plugins/plugin-library.model.ts@@ -1,4 +1,4 @@-import { RegisterServerOptions } from './register-server-option.model'+import { RegisterServerOptions } from './register-server-option.model.js'export interface PluginLibrary {register: (options: RegisterServerOptions) => Promise<any>diff --git a/server/types/plugins/register-server-auth.model.ts b/server/server/types/plugins/register-server-auth.model.tssimilarity index 92%rename from server/types/plugins/register-server-auth.model.tsrename to server/server/types/plugins/register-server-auth.model.tsindex e10968c20f..377682af6e 100644--- a/server/types/plugins/register-server-auth.model.ts+++ b/server/server/types/plugins/register-server-auth.model.ts@@ -1,6 +1,6 @@import express from 'express'-import { UserAdminFlag, UserRole } from '@shared/models'-import { MOAuthToken, MUser } from '../models'+import { UserAdminFlagType, UserRoleType } from '@peertube/peertube-models'+import { MOAuthToken, MUser } from '../models/index.js'export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions@@ -18,11 +18,11 @@ export interface RegisterServerAuthenticatedResult {username: stringemail: string- role?: UserRole+ role?: UserRoleTypedisplayName?: string// PeerTube >= 5.1- adminFlags?: UserAdminFlag+ adminFlags?: UserAdminFlagType// PeerTube >= 5.1videoQuota?: numberdiff --git a/server/types/plugins/register-server-option.model.ts b/server/server/types/plugins/register-server-option.model.tssimilarity index 94%rename from server/types/plugins/register-server-option.model.tsrename to server/server/types/plugins/register-server-option.model.tsindex 103ef234b0..e31aca1b81 100644--- a/server/types/plugins/register-server-option.model.ts+++ b/server/server/types/plugins/register-server-option.model.ts@@ -1,7 +1,6 @@import { Response, Router } from 'express'import { Server } from 'http'import { Logger } from 'winston'-import { ActorModel } from '@server/models/actor/actor'import {PluginPlaylistPrivacyManager,PluginSettingsManager,@@ -14,16 +13,17 @@ import {RegisterServerHookOptions,RegisterServerSettingOptions,ServerConfig,- ThumbnailType,+ ThumbnailType_Type,VideoBlacklistCreate-} from '@shared/models'-import { MUserDefault, MVideo, MVideoThumbnail, UserNotificationModelForApi } from '../models'+} from '@peertube/peertube-models'+import { ActorModel } from '@server/models/actor/actor.js'+import { MUserDefault, MVideo, MVideoThumbnail, UserNotificationModelForApi } from '../models/index.js'import {RegisterServerAuthExternalOptions,RegisterServerAuthExternalResult,RegisterServerAuthPassOptions-} from './register-server-auth.model'-import { RegisterServerWebSocketRouteOptions } from './register-server-websocket-route.model'+} from './register-server-auth.model.js'+import { RegisterServerWebSocketRouteOptions } from './register-server-websocket-route.model.js'export type PeerTubeHelpers = {logger: Logger@@ -72,7 +72,7 @@ export type PeerTubeHelpers = {}thumbnails: {- type: ThumbnailType+ type: ThumbnailType_Typepath: string}[]}>diff --git a/server/types/plugins/register-server-websocket-route.model.ts b/server/server/types/plugins/register-server-websocket-route.model.tssimilarity index 100%rename from server/types/plugins/register-server-websocket-route.model.tsrename to server/server/types/plugins/register-server-websocket-route.model.tsdiff --git a/server/types/sequelize.ts b/server/server/types/sequelize.tssimilarity index 90%rename from server/types/sequelize.tsrename to server/server/types/sequelize.tsindex e399c3d5d8..cf0d040ae1 100644--- a/server/types/sequelize.ts+++ b/server/server/types/sequelize.ts@@ -1,4 +1,4 @@-import { AttributesOnly } from '@shared/typescript-utils'+import { AttributesOnly } from '@peertube/peertube-typescript-utils'import { Model } from 'sequelize'// Thanks to sequelize-typescript: https://github.com/RobinBuschmann/sequelize-typescriptdiff --git a/server/tests/api/activitypub/index.ts b/server/tests/api/activitypub/index.tsdeleted file mode 100644index 324b444e4c..0000000000--- a/server/tests/api/activitypub/index.ts+++ /dev/null@@ -1,6 +0,0 @@-import './cleaner'-import './client'-import './fetch'-import './refresher'-import './helpers'-import './security'diff --git a/server/tests/api/check-params/index.ts b/server/tests/api/check-params/index.tsdeleted file mode 100644index c2a7ccd786..0000000000--- a/server/tests/api/check-params/index.ts+++ /dev/null@@ -1,45 +0,0 @@-import './abuses'-import './accounts'-import './blocklist'-import './bulk'-import './channel-import-videos'-import './config'-import './contact-form'-import './custom-pages'-import './debug'-import './follows'-import './jobs'-import './live'-import './logs'-import './metrics'-import './my-user'-import './plugins'-import './redundancy'-import './registrations'-import './runners'-import './search'-import './services'-import './transcoding'-import './two-factor'-import './upload-quota'-import './user-notifications'-import './user-subscriptions'-import './users-admin'-import './users-emails'-import './video-blacklist'-import './video-captions'-import './video-channel-syncs'-import './video-channels'-import './video-comments'-import './video-files'-import './video-imports'-import './video-playlists'-import './video-storyboards'-import './video-source'-import './video-studio'-import './video-token'-import './videos-common-filters'-import './videos-history'-import './videos-overviews'-import './videos'-import './views'diff --git a/server/tests/api/index.ts b/server/tests/api/index.tsdeleted file mode 100644index ef0c832944..0000000000--- a/server/tests/api/index.ts+++ /dev/null@@ -1,13 +0,0 @@-// Order of the tests we want to execute-import './activitypub'-import './check-params'-import './moderation'-import './object-storage'-import './notifications'-import './redundancy'-import './runners'-import './search'-import './server'-import './transcoding'-import './users'-import './videos'diff --git a/server/tests/api/live/index.ts b/server/tests/api/live/index.tsdeleted file mode 100644index c88943f652..0000000000--- a/server/tests/api/live/index.ts+++ /dev/null@@ -1,7 +0,0 @@-import './live-constraints'-import './live-fast-restream'-import './live-socket-messages'-import './live-permanent'-import './live-rtmps'-import './live-save-replay'-import './live'diff --git a/server/tests/api/moderation/index.ts b/server/tests/api/moderation/index.tsdeleted file mode 100644index 874be03d5f..0000000000--- a/server/tests/api/moderation/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './abuses'-export * from './blocklist-notification'-export * from './blocklist'-export * from './video-blacklist'diff --git a/server/tests/api/notifications/index.ts b/server/tests/api/notifications/index.tsdeleted file mode 100644index c0216b74fd..0000000000--- a/server/tests/api/notifications/index.ts+++ /dev/null@@ -1,6 +0,0 @@-import './admin-notifications'-import './comments-notifications'-import './moderation-notifications'-import './notifications-api'-import './registrations-notifications'-import './user-notifications'diff --git a/server/tests/api/object-storage/index.ts b/server/tests/api/object-storage/index.tsdeleted file mode 100644index 1f4489fa30..0000000000--- a/server/tests/api/object-storage/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './live'-export * from './video-imports'-export * from './video-static-file-privacy'-export * from './videos'diff --git a/server/tests/api/redundancy/index.ts b/server/tests/api/redundancy/index.tsdeleted file mode 100644index 37dc3f88c1..0000000000--- a/server/tests/api/redundancy/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import './redundancy-constraints'-import './redundancy'-import './manage-redundancy'diff --git a/server/tests/api/runners/index.ts b/server/tests/api/runners/index.tsdeleted file mode 100644index 642a3a96d1..0000000000--- a/server/tests/api/runners/index.ts+++ /dev/null@@ -1,5 +0,0 @@-export * from './runner-common'-export * from './runner-live-transcoding'-export * from './runner-socket'-export * from './runner-studio-transcoding'-export * from './runner-vod-transcoding'diff --git a/server/tests/api/search/index.ts b/server/tests/api/search/index.tsdeleted file mode 100644index a976d210de..0000000000--- a/server/tests/api/search/index.ts+++ /dev/null@@ -1,7 +0,0 @@-import './search-activitypub-video-playlists'-import './search-activitypub-video-channels'-import './search-activitypub-videos'-import './search-channels'-import './search-index'-import './search-playlists'-import './search-videos'diff --git a/server/tests/api/server/index.ts b/server/tests/api/server/index.tsdeleted file mode 100644index 78522c2460..0000000000--- a/server/tests/api/server/index.ts+++ /dev/null@@ -1,22 +0,0 @@-import './auto-follows'-import './bulk'-import './config-defaults'-import './config'-import './contact-form'-import './email'-import './follow-constraints'-import './follows'-import './follows-moderation'-import './homepage'-import './handle-down'-import './jobs'-import './logs'-import './reverse-proxy'-import './services'-import './slow-follows'-import './stats'-import './tracker'-import './no-client'-import './open-telemetry'-import './plugins'-import './proxy'diff --git a/server/tests/api/transcoding/index.ts b/server/tests/api/transcoding/index.tsdeleted file mode 100644index 9866418d6e..0000000000--- a/server/tests/api/transcoding/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './audio-only'-export * from './create-transcoding'-export * from './hls'-export * from './transcoder'-export * from './update-while-transcoding'-export * from './video-studio'diff --git a/server/tests/api/users/index.ts b/server/tests/api/users/index.tsdeleted file mode 100644index a4443a8ec9..0000000000--- a/server/tests/api/users/index.ts+++ /dev/null@@ -1,8 +0,0 @@-import './oauth'-import './registrations`'-import './two-factor'-import './user-subscriptions'-import './user-videos'-import './users'-import './users-multiple-servers'-import './users-email-verification'diff --git a/server/tests/api/videos/index.ts b/server/tests/api/videos/index.tsdeleted file mode 100644index 01d0c58523..0000000000--- a/server/tests/api/videos/index.ts+++ /dev/null@@ -1,23 +0,0 @@-import './multiple-servers'-import './resumable-upload'-import './single-server'-import './video-captions'-import './video-change-ownership'-import './video-channels'-import './channel-import-videos'-import './video-channel-syncs'-import './video-comments'-import './video-description'-import './video-files'-import './video-imports'-import './video-nsfw'-import './video-playlists'-import './video-playlist-thumbnails'-import './video-source'-import './video-privacy'-import './video-schedule-update'-import './videos-common-filters'-import './videos-history'-import './videos-overview'-import './video-static-file-privacy'-import './video-storyboard'diff --git a/server/tests/api/views/index.ts b/server/tests/api/views/index.tsdeleted file mode 100644index 5e06b31fb6..0000000000--- a/server/tests/api/views/index.ts+++ /dev/null@@ -1,5 +0,0 @@-export * from './video-views-counter'-export * from './video-views-overall-stats'-export * from './video-views-retention-stats'-export * from './video-views-timeserie-stats'-export * from './videos-views-cleaner'diff --git a/server/tests/helpers/comment-model.ts b/server/tests/helpers/comment-model.tsdeleted file mode 100644index e39cae442e..0000000000--- a/server/tests/helpers/comment-model.ts+++ /dev/null@@ -1,24 +0,0 @@-/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */--import { expect } from 'chai'-import { VideoCommentModel } from '../../models/video/video-comment'--class CommentMock {- text: string-- extractMentions = VideoCommentModel.prototype.extractMentions-- isOwned = () => true-}--describe('Comment model', function () {- it('Should correctly extract mentions', async function () {- const comment = new CommentMock()-- comment.text = '@florian @jean@localhost:9000 @flo @another@localhost:9000 @[email protected] hello ' +- 'email@localhost:9000 coucou.com no? @chocobozzz @chocobozzz @end'- const result = comment.extractMentions().sort((a, b) => a.localeCompare(b))-- expect(result).to.deep.equal([ 'another', 'chocobozzz', 'end', 'flo', 'florian', 'jean' ])- })-})diff --git a/server/tests/helpers/index.ts b/server/tests/helpers/index.tsdeleted file mode 100644index 073ae64551..0000000000--- a/server/tests/helpers/index.ts+++ /dev/null@@ -1,9 +0,0 @@-import './comment-model'-import './core-utils'-import './crypto'-import './dns'-import './image'-import './markdown'-import './request'-import './validator'-import './version'diff --git a/server/tests/index.ts b/server/tests/index.tsdeleted file mode 100644index 4ec1ebe67c..0000000000--- a/server/tests/index.ts+++ /dev/null@@ -1,10 +0,0 @@-// Order of the tests we want to execute-import './client'-import './misc-endpoints'-import './feeds/'-import './cli/'-import './api/'-import './peertube-runner/'-import './plugins/'-import './helpers/'-import './lib/'diff --git a/server/tests/lib/index.ts b/server/tests/lib/index.tsdeleted file mode 100644index a40df35fd7..0000000000--- a/server/tests/lib/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './video-constant-registry-factory'diff --git a/server/tests/peertube-runner/index.ts b/server/tests/peertube-runner/index.tsdeleted file mode 100644index 4703164173..0000000000--- a/server/tests/peertube-runner/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './client-cli'-export * from './live-transcoding'-export * from './studio-transcoding'-export * from './vod-transcoding'diff --git a/server/tests/shared/index.ts b/server/tests/shared/index.tsdeleted file mode 100644index eda24adb50..0000000000--- a/server/tests/shared/index.ts+++ /dev/null@@ -1,19 +0,0 @@-export * from './mock-servers'-export * from './actors'-export * from './captions'-export * from './checks'-export * from './directories'-export * from './generate'-export * from './live'-export * from './notifications'-export * from './peertube-runner-process'-export * from './video-playlists'-export * from './plugins'-export * from './requests'-export * from './sql-command'-export * from './streaming-playlists'-export * from './tests'-export * from './tracker'-export * from './videos'-export * from './views'-export * from './webtorrent'diff --git a/server/tests/shared/mock-servers/index.ts b/server/tests/shared/mock-servers/index.tsdeleted file mode 100644index 1fa9831166..0000000000--- a/server/tests/shared/mock-servers/index.ts+++ /dev/null@@ -1,8 +0,0 @@-export * from './mock-429'-export * from './mock-email'-export * from './mock-http'-export * from './mock-instances-index'-export * from './mock-joinpeertube-versions'-export * from './mock-object-storage'-export * from './mock-plugin-blocklist'-export * from './mock-proxy'diff --git a/server/tools/README.md b/server/tools/README.mddeleted file mode 100644index d7ecd40042..0000000000--- a/server/tools/README.md+++ /dev/null@@ -1,3 +0,0 @@-# PeerTube CLI--See https://docs.joinpeertube.org/maintain/tools#remote-toolsdiff --git a/server/tools/package.json b/server/tools/package.jsondeleted file mode 100644index b20f38244a..0000000000--- a/server/tools/package.json+++ /dev/null@@ -1,11 +0,0 @@-{- "name": "@peertube/cli",- "version": "1.0.0",- "private": true,- "dependencies": {- "application-config": "^2.0.0",- "cli-table3": "^0.6.0",- "netrc-parser": "^3.1.6"- },- "devDependencies": {}-}diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.tsdeleted file mode 100644index c853469c27..0000000000--- a/server/tools/peertube-auth.ts+++ /dev/null@@ -1,171 +0,0 @@-import CliTable3 from 'cli-table3'-import { OptionValues, program } from 'commander'-import { isUserUsernameValid } from '../helpers/custom-validators/users'-import { assignToken, buildServer, getNetrc, getSettings, writeSettings } from './shared'--import prompt = require('prompt')--async function delInstance (url: string) {- const [ settings, netrc ] = await Promise.all([ getSettings(), getNetrc() ])-- const index = settings.remotes.indexOf(url)- settings.remotes.splice(index)-- if (settings.default === index) settings.default = -1-- await writeSettings(settings)-- delete netrc.machines[url]-- await netrc.save()-}--async function setInstance (url: string, username: string, password: string, isDefault: boolean) {- const [ settings, netrc ] = await Promise.all([ getSettings(), getNetrc() ])-- if (settings.remotes.includes(url) === false) {- settings.remotes.push(url)- }-- if (isDefault || settings.remotes.length === 1) {- settings.default = settings.remotes.length - 1- }-- await writeSettings(settings)-- netrc.machines[url] = { login: username, password }- await netrc.save()-}--function isURLaPeerTubeInstance (url: string) {- return url.startsWith('http://') || url.startsWith('https://')-}--function stripExtraneousFromPeerTubeUrl (url: string) {- // Get everything before the 3rd /.- const urlLength = url.includes('/', 8)- ? url.indexOf('/', 8)- : url.length-- return url.substring(0, urlLength)-}--program- .name('auth')- .usage('[command] [options]')--program- .command('add')- .description('remember your accounts on remote instances for easier use')- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .option('--default', 'add the entry as the new default')- .action((options: OptionValues) => {- /* eslint-disable no-import-assign */- prompt.override = options- prompt.start()- prompt.get({- properties: {- url: {- description: 'instance url',- conform: (value) => isURLaPeerTubeInstance(value),- message: 'It should be an URL (https://peertube.example.com)',- required: true- },- username: {- conform: (value) => isUserUsernameValid(value),- message: 'Name must be only letters, spaces, or dashes',- required: true- },- password: {- hidden: true,- replace: '*',- required: true- }- }- }, async (_, result) => {-- // Check credentials- try {- // Strip out everything after the domain:port.- // See https://github.com/Chocobozzz/PeerTube/issues/3520- result.url = stripExtraneousFromPeerTubeUrl(result.url)-- const server = buildServer(result.url)- await assignToken(server, result.username, result.password)- } catch (err) {- console.error(err.message)- process.exit(-1)- }-- await setInstance(result.url, result.username, result.password, options.default)-- process.exit(0)- })- })--program- .command('del <url>')- .description('unregisters a remote instance')- .action(async url => {- await delInstance(url)-- process.exit(0)- })--program- .command('list')- .description('lists registered remote instances')- .action(async () => {- const [ settings, netrc ] = await Promise.all([ getSettings(), getNetrc() ])-- const table = new CliTable3({- head: [ 'instance', 'login' ],- colWidths: [ 30, 30 ]- }) as any-- settings.remotes.forEach(element => {- if (!netrc.machines[element]) return-- table.push([- element,- netrc.machines[element].login- ])- })-- console.log(table.toString())-- process.exit(0)- })--program- .command('set-default <url>')- .description('set an existing entry as default')- .action(async url => {- const settings = await getSettings()- const instanceExists = settings.remotes.includes(url)-- if (instanceExists) {- settings.default = settings.remotes.indexOf(url)- await writeSettings(settings)-- process.exit(0)- } else {- console.log('<url> is not a registered instance.')- process.exit(-1)- }- })--program.addHelpText('after', '\n\n Examples:\n\n' +- ' $ peertube auth add -u https://peertube.cpy.re -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD"\n' +- ' $ peertube auth add -u https://peertube.cpy.re -U root\n' +- ' $ peertube auth list\n' +- ' $ peertube auth del https://peertube.cpy.re\n'-)--if (!process.argv.slice(2).length) {- program.outputHelp()-}--program.parse(process.argv)diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.tsdeleted file mode 100644index 71a4826e8f..0000000000--- a/server/tools/peertube-get-access-token.ts+++ /dev/null@@ -1,34 +0,0 @@-import { program } from 'commander'-import { assignToken, buildServer } from './shared'--program- .option('-u, --url <url>', 'Server url')- .option('-n, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .parse(process.argv)--const options = program.opts()--if (- !options.url ||- !options.username ||- !options.password-) {- if (!options.url) console.error('--url field is required.')- if (!options.username) console.error('--username field is required.')- if (!options.password) console.error('--password field is required.')-- process.exit(-1)-}--const server = buildServer(options.url)--assignToken(server, options.username, options.password)- .then(() => {- console.log(server.accessToken)- process.exit(0)- })- .catch(err => {- console.error(err)- process.exit(-1)- })diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.tsdeleted file mode 100644index bbdaa09c0b..0000000000--- a/server/tools/peertube-import-videos.ts+++ /dev/null@@ -1,351 +0,0 @@-import { program } from 'commander'-import { accessSync, constants } from 'fs'-import { remove } from 'fs-extra'-import { join } from 'path'-import { YoutubeDLCLI, YoutubeDLInfo, YoutubeDLInfoBuilder } from '@server/helpers/youtube-dl'-import { wait } from '@shared/core-utils'-import { sha256 } from '@shared/extra-utils'-import { doRequestAndSaveToFile } from '../helpers/requests'-import {- assignToken,- buildCommonVideoOptions,- buildServer,- buildVideoAttributesFromCommander,- getLogger,- getServerCredentials-} from './shared'--import prompt = require('prompt')--const processOptions = {- maxBuffer: Infinity-}--let command = program- .name('import-videos')--command = buildCommonVideoOptions(command)--command- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .option('--target-url <targetUrl>', 'Video target URL')- .option('--since <since>', 'Publication date (inclusive) since which the videos can be imported (YYYY-MM-DD)', parseDate)- .option('--until <until>', 'Publication date (inclusive) until which the videos can be imported (YYYY-MM-DD)', parseDate)- .option('--first <first>', 'Process first n elements of returned playlist')- .option('--last <last>', 'Process last n elements of returned playlist')- .option('--wait-interval <waitInterval>', 'Duration between two video imports (in seconds)', convertIntoMs)- .option('-T, --tmpdir <tmpdir>', 'Working directory', __dirname)- .usage('[global options] [ -- youtube-dl options]')- .parse(process.argv)--const options = command.opts()--const log = getLogger(options.verbose)--getServerCredentials(command)- .then(({ url, username, password }) => {- if (!options.targetUrl) {- exitError('--target-url field is required.')- }-- try {- accessSync(options.tmpdir, constants.R_OK | constants.W_OK)- } catch (e) {- exitError('--tmpdir %s: directory does not exist or is not accessible', options.tmpdir)- }-- url = normalizeTargetUrl(url)- options.targetUrl = normalizeTargetUrl(options.targetUrl)-- run(url, username, password)- .catch(err => exitError(err))- })- .catch(err => console.error(err))--async function run (url: string, username: string, password: string) {- if (!password) password = await promptPassword()-- const youtubeDLBinary = await YoutubeDLCLI.safeGet()-- let info = await getYoutubeDLInfo(youtubeDLBinary, options.targetUrl, command.args)-- if (!Array.isArray(info)) info = [ info ]-- // Try to fix youtube channels upload- const uploadsObject = info.find(i => !i.ie_key && !i.duration && i.title === 'Uploads')-- if (uploadsObject) {- console.log('Fixing URL to %s.', uploadsObject.url)-- info = await getYoutubeDLInfo(youtubeDLBinary, uploadsObject.url, command.args)- }-- let infoArray: any[]-- infoArray = [].concat(info)- if (options.first) {- infoArray = infoArray.slice(0, options.first)- } else if (options.last) {- infoArray = infoArray.slice(-options.last)- }-- log.info('Will download and upload %d videos.\n', infoArray.length)-- let skipInterval = true- for (const [ index, info ] of infoArray.entries()) {- try {- if (index > 0 && options.waitInterval && !skipInterval) {- log.info('Wait for %d seconds before continuing.', options.waitInterval / 1000)- await wait(options.waitInterval)- }-- skipInterval = await processVideo({- cwd: options.tmpdir,- url,- username,- password,- youtubeInfo: info- })- } catch (err) {- console.error('Cannot process video.', { info, url, err })- }- }-- log.info('Video/s for user %s imported: %s', username, options.targetUrl)- process.exit(0)-}--async function processVideo (parameters: {- cwd: string- url: string- username: string- password: string- youtubeInfo: any-}) {- const { youtubeInfo, cwd, url, username, password } = parameters-- log.debug('Fetching object.', youtubeInfo)-- const videoInfo = await fetchObject(youtubeInfo)- log.debug('Fetched object.', videoInfo)-- if (- options.since &&- videoInfo.originallyPublishedAtWithoutTime &&- videoInfo.originallyPublishedAtWithoutTime.getTime() < options.since.getTime()- ) {- log.info('Video "%s" has been published before "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.since))- return true- }-- if (- options.until &&- videoInfo.originallyPublishedAtWithoutTime &&- videoInfo.originallyPublishedAtWithoutTime.getTime() > options.until.getTime()- ) {- log.info('Video "%s" has been published after "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.until))- return true- }-- const server = buildServer(url)- const { data } = await server.search.advancedVideoSearch({- search: {- search: videoInfo.name,- sort: '-match',- searchTarget: 'local'- }- })-- log.info('############################################################\n')-- if (data.find(v => v.name === videoInfo.name)) {- log.info('Video "%s" already exists, don\'t reupload it.\n', videoInfo.name)- return true- }-- const path = join(cwd, sha256(videoInfo.url) + '.mp4')-- log.info('Downloading video "%s"...', videoInfo.name)-- try {- const youtubeDLBinary = await YoutubeDLCLI.safeGet()- const output = await youtubeDLBinary.download({- url: videoInfo.url,- format: YoutubeDLCLI.getYoutubeDLVideoFormat([], false),- output: path,- additionalYoutubeDLArgs: command.args,- processOptions- })-- log.info(output.join('\n'))- await uploadVideoOnPeerTube({- cwd,- url,- username,- password,- videoInfo,- videoPath: path- })- } catch (err) {- log.error(err.message)- }-- return false-}--async function uploadVideoOnPeerTube (parameters: {- videoInfo: YoutubeDLInfo- videoPath: string- cwd: string- url: string- username: string- password: string-}) {- const { videoInfo, videoPath, cwd, url, username, password } = parameters-- const server = buildServer(url)- await assignToken(server, username, password)-- let thumbnailfile: string- if (videoInfo.thumbnailUrl) {- thumbnailfile = join(cwd, sha256(videoInfo.thumbnailUrl) + '.jpg')-- await doRequestAndSaveToFile(videoInfo.thumbnailUrl, thumbnailfile)- }-- const baseAttributes = await buildVideoAttributesFromCommander(server, program, videoInfo)-- const attributes = {- ...baseAttributes,-- originallyPublishedAtWithoutTime: videoInfo.originallyPublishedAtWithoutTime- ? videoInfo.originallyPublishedAtWithoutTime.toISOString()- : null,-- thumbnailfile,- previewfile: thumbnailfile,- fixture: videoPath- }-- log.info('\nUploading on PeerTube video "%s".', attributes.name)-- try {- await server.videos.upload({ attributes })- } catch (err) {- if (err.message.indexOf('401') !== -1) {- log.info('Got 401 Unauthorized, token may have expired, renewing token and retry.')-- server.accessToken = await server.login.getAccessToken(username, password)-- await server.videos.upload({ attributes })- } else {- exitError(err.message)- }- }-- await remove(videoPath)- if (thumbnailfile) await remove(thumbnailfile)-- log.info('Uploaded video "%s"!\n', attributes.name)-}--/* ---------------------------------------------------------- */--async function fetchObject (info: any) {- const url = buildUrl(info)-- const youtubeDLCLI = await YoutubeDLCLI.safeGet()- const result = await youtubeDLCLI.getInfo({- url,- format: YoutubeDLCLI.getYoutubeDLVideoFormat([], false),- processOptions- })-- const builder = new YoutubeDLInfoBuilder(result)-- const videoInfo = builder.getInfo()-- return { ...videoInfo, url }-}--function buildUrl (info: any) {- const webpageUrl = info.webpage_url as string- if (webpageUrl?.match(/^https?:\/\//)) return webpageUrl-- const url = info.url as string- if (url?.match(/^https?:\/\//)) return url-- // It seems youtube-dl does not return the video url- return 'https://www.youtube.com/watch?v=' + info.id-}--function normalizeTargetUrl (url: string) {- let normalizedUrl = url.replace(/\/+$/, '')-- if (!normalizedUrl.startsWith('http://') && !normalizedUrl.startsWith('https://')) {- normalizedUrl = 'https://' + normalizedUrl- }-- return normalizedUrl-}--async function promptPassword () {- return new Promise<string>((res, rej) => {- prompt.start()- const schema = {- properties: {- password: {- hidden: true,- required: true- }- }- }- prompt.get(schema, function (err, result) {- if (err) {- return rej(err)- }- return res(result.password)- })- })-}--function parseDate (dateAsStr: string): Date {- if (!/\d{4}-\d{2}-\d{2}/.test(dateAsStr)) {- exitError(`Invalid date passed: ${dateAsStr}. Expected format: YYYY-MM-DD. See help for usage.`)- }- const date = new Date(dateAsStr)- date.setHours(0, 0, 0)- if (isNaN(date.getTime())) {- exitError(`Invalid date passed: ${dateAsStr}. See help for usage.`)- }- return date-}--function formatDate (date: Date): string {- return date.toISOString().split('T')[0]-}--function convertIntoMs (secondsAsStr: string): number {- const seconds = parseInt(secondsAsStr, 10)- if (seconds <= 0) {- exitError(`Invalid duration passed: ${seconds}. Expected duration to be strictly positive and in seconds`)- }- return Math.round(seconds * 1000)-}--function exitError (message: string, ...meta: any[]) {- // use console.error instead of log.error here- console.error(message, ...meta)- process.exit(-1)-}--function getYoutubeDLInfo (youtubeDLCLI: YoutubeDLCLI, url: string, args: string[]) {- return youtubeDLCLI.getInfo({- url,- format: YoutubeDLCLI.getYoutubeDLVideoFormat([], false),- additionalYoutubeDLArgs: [ '-j', '--flat-playlist', '--playlist-reverse', ...args ],- processOptions- })-}diff --git a/server/tools/peertube-plugins.ts b/server/tools/peertube-plugins.tsdeleted file mode 100644index 0660c855f6..0000000000--- a/server/tools/peertube-plugins.ts+++ /dev/null@@ -1,165 +0,0 @@-import CliTable3 from 'cli-table3'-import { Command, OptionValues, program } from 'commander'-import { isAbsolute } from 'path'-import { PluginType } from '../../shared/models'-import { assignToken, buildServer, getServerCredentials } from './shared'--program- .name('plugins')- .usage('[command] [options]')--program- .command('list')- .description('List installed plugins')- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .option('-t, --only-themes', 'List themes only')- .option('-P, --only-plugins', 'List plugins only')- .action((options, command) => pluginsListCLI(command, options))--program- .command('install')- .description('Install a plugin or a theme')- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .option('-P --path <path>', 'Install from a path')- .option('-n, --npm-name <npmName>', 'Install from npm')- .option('--plugin-version <pluginVersion>', 'Specify the plugin version to install (only available when installing from npm)')- .action((options, command) => installPluginCLI(command, options))--program- .command('update')- .description('Update a plugin or a theme')- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .option('-P --path <path>', 'Update from a path')- .option('-n, --npm-name <npmName>', 'Update from npm')- .action((options, command) => updatePluginCLI(command, options))--program- .command('uninstall')- .description('Uninstall a plugin or a theme')- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .option('-n, --npm-name <npmName>', 'NPM plugin/theme name')- .action((options, command) => uninstallPluginCLI(command, options))--if (!process.argv.slice(2).length) {- program.outputHelp()-}--program.parse(process.argv)--// ------------------------------------------------------------------------------async function pluginsListCLI (command: Command, options: OptionValues) {- const { url, username, password } = await getServerCredentials(command)- const server = buildServer(url)- await assignToken(server, username, password)-- let pluginType: PluginType- if (options.onlyThemes) pluginType = PluginType.THEME- if (options.onlyPlugins) pluginType = PluginType.PLUGIN-- const { data } = await server.plugins.list({ start: 0, count: 100, sort: 'name', pluginType })-- const table = new CliTable3({- head: [ 'name', 'version', 'homepage' ],- colWidths: [ 50, 20, 50 ]- }) as any-- for (const plugin of data) {- const npmName = plugin.type === PluginType.PLUGIN- ? 'peertube-plugin-' + plugin.name- : 'peertube-theme-' + plugin.name-- table.push([- npmName,- plugin.version,- plugin.homepage- ])- }-- console.log(table.toString())- process.exit(0)-}--async function installPluginCLI (command: Command, options: OptionValues) {- if (!options.path && !options.npmName) {- console.error('You need to specify the npm name or the path of the plugin you want to install.\n')- program.outputHelp()- process.exit(-1)- }-- if (options.path && !isAbsolute(options.path)) {- console.error('Path should be absolute.')- process.exit(-1)- }-- const { url, username, password } = await getServerCredentials(command)- const server = buildServer(url)- await assignToken(server, username, password)-- try {- await server.plugins.install({ npmName: options.npmName, path: options.path, pluginVersion: options.pluginVersion })- } catch (err) {- console.error('Cannot install plugin.', err)- process.exit(-1)- }-- console.log('Plugin installed.')- process.exit(0)-}--async function updatePluginCLI (command: Command, options: OptionValues) {- if (!options.path && !options.npmName) {- console.error('You need to specify the npm name or the path of the plugin you want to update.\n')- program.outputHelp()- process.exit(-1)- }-- if (options.path && !isAbsolute(options.path)) {- console.error('Path should be absolute.')- process.exit(-1)- }-- const { url, username, password } = await getServerCredentials(command)- const server = buildServer(url)- await assignToken(server, username, password)-- try {- await server.plugins.update({ npmName: options.npmName, path: options.path })- } catch (err) {- console.error('Cannot update plugin.', err)- process.exit(-1)- }-- console.log('Plugin updated.')- process.exit(0)-}--async function uninstallPluginCLI (command: Command, options: OptionValues) {- if (!options.npmName) {- console.error('You need to specify the npm name of the plugin/theme you want to uninstall.\n')- program.outputHelp()- process.exit(-1)- }-- const { url, username, password } = await getServerCredentials(command)- const server = buildServer(url)- await assignToken(server, username, password)-- try {- await server.plugins.uninstall({ npmName: options.npmName })- } catch (err) {- console.error('Cannot uninstall plugin.', err)- process.exit(-1)- }-- console.log('Plugin uninstalled.')- process.exit(0)-}diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.tsdeleted file mode 100644index c24eb5233b..0000000000--- a/server/tools/peertube-redundancy.ts+++ /dev/null@@ -1,172 +0,0 @@-import CliTable3 from 'cli-table3'-import { Command, program } from 'commander'-import { URL } from 'url'-import validator from 'validator'-import { forceNumber, uniqify } from '@shared/core-utils'-import { HttpStatusCode, VideoRedundanciesTarget } from '@shared/models'-import { assignToken, buildServer, getServerCredentials } from './shared'--import bytes = require('bytes')-program- .name('redundancy')- .usage('[command] [options]')--program- .command('list-remote-redundancies')- .description('List remote redundancies on your videos')- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .action(() => listRedundanciesCLI('my-videos'))--program- .command('list-my-redundancies')- .description('List your redundancies of remote videos')- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .action(() => listRedundanciesCLI('remote-videos'))--program- .command('add')- .description('Duplicate a video in your redundancy system')- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .option('-v, --video <videoId>', 'Video id to duplicate')- .action((options, command) => addRedundancyCLI(options, command))--program- .command('remove')- .description('Remove a video from your redundancies')- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .option('-v, --video <videoId>', 'Video id to remove from redundancies')- .action((options, command) => removeRedundancyCLI(options, command))--if (!process.argv.slice(2).length) {- program.outputHelp()-}--program.parse(process.argv)--// ------------------------------------------------------------------------------async function listRedundanciesCLI (target: VideoRedundanciesTarget) {- const { url, username, password } = await getServerCredentials(program)- const server = buildServer(url)- await assignToken(server, username, password)-- const { data } = await server.redundancy.listVideos({ start: 0, count: 100, sort: 'name', target })-- const table = new CliTable3({- head: [ 'video id', 'video name', 'video url', 'files', 'playlists', 'by instances', 'total size' ]- }) as any-- for (const redundancy of data) {- const webVideoFiles = redundancy.redundancies.files- const streamingPlaylists = redundancy.redundancies.streamingPlaylists-- let totalSize = ''- if (target === 'remote-videos') {- const tmp = webVideoFiles.concat(streamingPlaylists)- .reduce((a, b) => a + b.size, 0)-- totalSize = bytes(tmp)- }-- const instances = uniqify(- webVideoFiles.concat(streamingPlaylists)- .map(r => r.fileUrl)- .map(u => new URL(u).host)- )-- table.push([- redundancy.id.toString(),- redundancy.name,- redundancy.url,- webVideoFiles.length,- streamingPlaylists.length,- instances.join('\n'),- totalSize- ])- }-- console.log(table.toString())- process.exit(0)-}--async function addRedundancyCLI (options: { video: number }, command: Command) {- const { url, username, password } = await getServerCredentials(command)- const server = buildServer(url)- await assignToken(server, username, password)-- if (!options.video || validator.isInt('' + options.video) === false) {- console.error('You need to specify the video id to duplicate and it should be a number.\n')- command.outputHelp()- process.exit(-1)- }-- try {- await server.redundancy.addVideo({ videoId: options.video })-- console.log('Video will be duplicated by your instance!')-- process.exit(0)- } catch (err) {- if (err.message.includes(HttpStatusCode.CONFLICT_409)) {- console.error('This video is already duplicated by your instance.')- } else if (err.message.includes(HttpStatusCode.NOT_FOUND_404)) {- console.error('This video id does not exist.')- } else {- console.error(err)- }-- process.exit(-1)- }-}--async function removeRedundancyCLI (options: { video: number }, command: Command) {- const { url, username, password } = await getServerCredentials(command)- const server = buildServer(url)- await assignToken(server, username, password)-- if (!options.video || validator.isInt('' + options.video) === false) {- console.error('You need to specify the video id to remove from your redundancies.\n')- command.outputHelp()- process.exit(-1)- }-- const videoId = forceNumber(options.video)-- const myVideoRedundancies = await server.redundancy.listVideos({ target: 'my-videos' })- let videoRedundancy = myVideoRedundancies.data.find(r => videoId === r.id)-- if (!videoRedundancy) {- const remoteVideoRedundancies = await server.redundancy.listVideos({ target: 'remote-videos' })- videoRedundancy = remoteVideoRedundancies.data.find(r => videoId === r.id)- }-- if (!videoRedundancy) {- console.error('Video redundancy not found.')- process.exit(-1)- }-- try {- const ids = videoRedundancy.redundancies.files- .concat(videoRedundancy.redundancies.streamingPlaylists)- .map(r => r.id)-- for (const id of ids) {- await server.redundancy.removeVideo({ redundancyId: id })- }-- console.log('Video redundancy removed!')-- process.exit(0)- } catch (err) {- console.error(err)- process.exit(-1)- }-}diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.tsdeleted file mode 100644index 87da550050..0000000000--- a/server/tools/peertube-upload.ts+++ /dev/null@@ -1,77 +0,0 @@-import { program } from 'commander'-import { access, constants } from 'fs-extra'-import { isAbsolute } from 'path'-import { assignToken, buildCommonVideoOptions, buildServer, buildVideoAttributesFromCommander, getServerCredentials } from './shared'--let command = program- .name('upload')--command = buildCommonVideoOptions(command)--command- .option('-u, --url <url>', 'Server url')- .option('-U, --username <username>', 'Username')- .option('-p, --password <token>', 'Password')- .option('-b, --thumbnail <thumbnailPath>', 'Thumbnail path')- .option('-v, --preview <previewPath>', 'Preview path')- .option('-f, --file <file>', 'Video absolute file path')- .parse(process.argv)--const options = command.opts()--getServerCredentials(command)- .then(({ url, username, password }) => {- if (!options.videoName || !options.file) {- if (!options.videoName) console.error('--video-name is required.')- if (!options.file) console.error('--file is required.')-- process.exit(-1)- }-- if (isAbsolute(options.file) === false) {- console.error('File path should be absolute.')- process.exit(-1)- }-- run(url, username, password).catch(err => {- console.error(err)- process.exit(-1)- })- })- .catch(err => console.error(err))--async function run (url: string, username: string, password: string) {- const server = buildServer(url)- await assignToken(server, username, password)-- await access(options.file, constants.F_OK)-- console.log('Uploading %s video...', options.videoName)-- const baseAttributes = await buildVideoAttributesFromCommander(server, program)-- const attributes = {- ...baseAttributes,-- fixture: options.file,- thumbnailfile: options.thumbnail,- previewfile: options.preview- }-- try {- await server.videos.upload({ attributes })- console.log(`Video ${options.videoName} uploaded.`)- process.exit(0)- } catch (err) {- const message = err.message || ''- if (message.includes('413')) {- console.error('Aborted: user quota is exceeded or video file is too big for this PeerTube instance.')- } else {- console.error(require('util').inspect(err))- }-- process.exit(-1)- }-}--// ----------------------------------------------------------------------------diff --git a/server/tools/shared/index.ts b/server/tools/shared/index.tsdeleted file mode 100644index 8a3f31e2f3..0000000000--- a/server/tools/shared/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './cli'diff --git a/server/tools/tsconfig.json b/server/tools/tsconfig.jsondeleted file mode 100644index 39f8e74e4b..0000000000--- a/server/tools/tsconfig.json+++ /dev/null@@ -1,12 +0,0 @@-{- "extends": "../../tsconfig.json",- "compilerOptions": {- "outDir": "../../dist/server/tools"- },- "include": [ ".", "../typings" ],- "references": [- { "path": "../" }- ],- "files": [],- "exclude": [ ] // Overwrite exclude property-}diff --git a/server/tsconfig.json b/server/tsconfig.jsonindex 240bd3bfed..2b799749f1 100644--- a/server/tsconfig.json+++ b/server/tsconfig.json@@ -1,13 +1,22 @@{"extends": "../tsconfig.base.json","compilerOptions": {- "outDir": "../dist/server"+ "outDir": "../dist",+ "baseUrl": "../",+ "rootDir": ".",+ "tsBuildInfoFile": "../dist/.tsbuildinfo",+ "paths": {+ "@server/*": [ "server/server/*" ]+ }},"references": [- { "path": "../shared" }+ { "path": "../packages/core-utils" },+ { "path": "../packages/ffmpeg" },+ { "path": "../packages/models" },+ { "path": "../packages/node-utils" },+ { "path": "../packages/typescript-utils" }],- "exclude": [- "tools/",- "tests/fixtures"+ "include": [+ "./**/*.ts"]}diff --git a/server/tsconfig.lib.json b/server/tsconfig.lib.jsonnew file mode 100644index 0000000000..dfc83c0ec7--- /dev/null+++ b/server/tsconfig.lib.json@@ -0,0 +1,12 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "outDir": "./dist",+ "tsBuildInfoFile": "./dist/.tsbuildinfo",+ "baseUrl": "../",+ "rootDir": ".",+ "paths": {+ "@server/*": [ "server/server/*" ]+ }+ }+}diff --git a/server/tsconfig.types.json b/server/tsconfig.types.jsonindex da6b572eac..696fe7059c 100644--- a/server/tsconfig.types.json+++ b/server/tsconfig.types.json@@ -1,16 +1,21 @@{"extends": "./tsconfig.json","compilerOptions": {- "outDir": "../packages/types/dist/server",+ "outDir": "../packages/types-generator/dist/server",+ "tsBuildInfoFile": "../packages/types-generator/dist/server/.tsbuildinfo","stripInternal": true,"removeComments": false,"emitDeclarationOnly": true},"references": [- { "path": "../shared/tsconfig.types.json" }+ { "path": "../packages/core-utils" },+ { "path": "../packages/ffmpeg" },+ { "path": "../packages/models" },+ { "path": "../packages/node-utils" },+ { "path": "../packages/server-commands" },+ { "path": "../packages/typescript-utils" }],"exclude": [- "tools/","tests/"]}diff --git a/server/types/index.ts b/server/types/index.tsdeleted file mode 100644index 18d3827a5f..0000000000--- a/server/types/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './plugins'-export * from './activitypub-processor.model'-export * from './sequelize'diff --git a/server/types/models/abuse/index.ts b/server/types/models/abuse/index.tsdeleted file mode 100644index 1ed91b2491..0000000000--- a/server/types/models/abuse/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './abuse'-export * from './abuse-message'diff --git a/server/types/models/account/index.ts b/server/types/models/account/index.tsdeleted file mode 100644index 9679c01e44..0000000000--- a/server/types/models/account/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './account'-export * from './actor-custom-page'-export * from './account-blocklist'diff --git a/server/types/models/actor/index.ts b/server/types/models/actor/index.tsdeleted file mode 100644index b278152553..0000000000--- a/server/types/models/actor/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './actor-follow'-export * from './actor-image'-export * from './actor'diff --git a/server/types/models/application/index.ts b/server/types/models/application/index.tsdeleted file mode 100644index 26e4b031fe..0000000000--- a/server/types/models/application/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './application'diff --git a/server/types/models/index.ts b/server/types/models/index.tsdeleted file mode 100644index 704cb9844c..0000000000--- a/server/types/models/index.ts+++ /dev/null@@ -1,8 +0,0 @@-export * from './abuse'-export * from './account'-export * from './actor'-export * from './application'-export * from './oauth'-export * from './server'-export * from './user'-export * from './video'diff --git a/server/types/models/oauth/index.ts b/server/types/models/oauth/index.tsdeleted file mode 100644index 36b7ea8ca6..0000000000--- a/server/types/models/oauth/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './oauth-client'-export * from './oauth-token'diff --git a/server/types/models/runners/index.ts b/server/types/models/runners/index.tsdeleted file mode 100644index e94d4794e7..0000000000--- a/server/types/models/runners/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './runner'-export * from './runner-job'-export * from './runner-registration-token'diff --git a/server/types/models/server/index.ts b/server/types/models/server/index.tsdeleted file mode 100644index c853795add..0000000000--- a/server/types/models/server/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './plugin'-export * from './server'-export * from './server-blocklist'diff --git a/server/types/models/user/index.ts b/server/types/models/user/index.tsdeleted file mode 100644index 5738f4107c..0000000000--- a/server/types/models/user/index.ts+++ /dev/null@@ -1,5 +0,0 @@-export * from './user'-export * from './user-notification'-export * from './user-notification-setting'-export * from './user-registration'-export * from './user-video-history'diff --git a/server/types/models/video/index.ts b/server/types/models/video/index.tsdeleted file mode 100644index 7f05db666e..0000000000--- a/server/types/models/video/index.ts+++ /dev/null@@ -1,26 +0,0 @@-export * from './local-video-viewer-watch-section'-export * from './local-video-viewer-watch-section'-export * from './local-video-viewer'-export * from './storyboard'-export * from './schedule-video-update'-export * from './tag'-export * from './thumbnail'-export * from './video'-export * from './video-blacklist'-export * from './video-caption'-export * from './video-change-ownership'-export * from './video-channel-sync'-export * from './video-channels'-export * from './video-comment'-export * from './video-file'-export * from './video-import'-export * from './video-live-replay-setting'-export * from './video-live-session'-export * from './video-live'-export * from './video-password'-export * from './video-playlist'-export * from './video-playlist-element'-export * from './video-rate'-export * from './video-redundancy'-export * from './video-share'-export * from './video-streaming-playlist'diff --git a/server/types/models/video/tag.ts b/server/types/models/video/tag.tsdeleted file mode 100644index 64a68873e9..0000000000--- a/server/types/models/video/tag.ts+++ /dev/null@@ -1,3 +0,0 @@-import { TagModel } from '../../../models/video/tag'--export type MTag = Omit<TagModel, 'Videos'>diff --git a/server/types/plugins/index.ts b/server/types/plugins/index.tsdeleted file mode 100644index bf9c35d49e..0000000000--- a/server/types/plugins/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './plugin-library.model'-export * from './register-server-auth.model'-export * from './register-server-option.model'-export * from './register-server-websocket-route.model'diff --git a/shared/core-utils/abuse/index.ts b/shared/core-utils/abuse/index.tsdeleted file mode 100644index 244b83cff4..0000000000--- a/shared/core-utils/abuse/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './abuse-predefined-reasons'diff --git a/shared/core-utils/common/index.ts b/shared/core-utils/common/index.tsdeleted file mode 100644index 8d63ee1b21..0000000000--- a/shared/core-utils/common/index.ts+++ /dev/null@@ -1,12 +0,0 @@-export * from './array'-export * from './random'-export * from './date'-export * from './env'-export * from './number'-export * from './object'-export * from './path'-export * from './regexp'-export * from './time'-export * from './promises'-export * from './url'-export * from './version'diff --git a/shared/core-utils/common/path.ts b/shared/core-utils/common/path.tsdeleted file mode 100644index 0065053166..0000000000--- a/shared/core-utils/common/path.ts+++ /dev/null@@ -1,48 +0,0 @@-import { basename, extname, isAbsolute, join, resolve } from 'path'--let rootPath: string--function root () {- if (rootPath) return rootPath-- rootPath = __dirname-- if (basename(rootPath) === 'tools') rootPath = resolve(rootPath, '..')- if (basename(rootPath) === 'scripts') rootPath = resolve(rootPath, '..')- if (basename(rootPath) === 'common') rootPath = resolve(rootPath, '..')- if (basename(rootPath) === 'core-utils') rootPath = resolve(rootPath, '..')- if (basename(rootPath) === 'shared') rootPath = resolve(rootPath, '..')- if (basename(rootPath) === 'server') rootPath = resolve(rootPath, '..')- if (basename(rootPath) === 'dist') rootPath = resolve(rootPath, '..')-- return rootPath-}--function buildPath (path: string) {- if (isAbsolute(path)) return path-- return join(root(), path)-}--function getLowercaseExtension (filename: string) {- const ext = extname(filename) || ''-- return ext.toLowerCase()-}--function buildAbsoluteFixturePath (path: string, customCIPath = false) {- if (isAbsolute(path)) return path-- if (customCIPath && process.env.GITHUB_WORKSPACE) {- return join(process.env.GITHUB_WORKSPACE, 'fixtures', path)- }-- return join(root(), 'server', 'tests', 'fixtures', path)-}--export {- root,- buildPath,- buildAbsoluteFixturePath,- getLowercaseExtension-}diff --git a/shared/core-utils/i18n/index.ts b/shared/core-utils/i18n/index.tsdeleted file mode 100644index 8f7cbe2c70..0000000000--- a/shared/core-utils/i18n/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './i18n'diff --git a/shared/core-utils/index.ts b/shared/core-utils/index.tsdeleted file mode 100644index 8daaa2d04a..0000000000--- a/shared/core-utils/index.ts+++ /dev/null@@ -1,7 +0,0 @@-export * from './abuse'-export * from './common'-export * from './i18n'-export * from './plugins'-export * from './renderer'-export * from './users'-export * from './videos'diff --git a/shared/core-utils/plugins/index.ts b/shared/core-utils/plugins/index.tsdeleted file mode 100644index fc78d35129..0000000000--- a/shared/core-utils/plugins/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './hooks'diff --git a/shared/core-utils/renderer/index.ts b/shared/core-utils/renderer/index.tsdeleted file mode 100644index 0ad29d7829..0000000000--- a/shared/core-utils/renderer/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './markdown'-export * from './html'diff --git a/shared/core-utils/users/index.ts b/shared/core-utils/users/index.tsdeleted file mode 100644index 1cbf0af1b1..0000000000--- a/shared/core-utils/users/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './user-role'diff --git a/shared/core-utils/videos/index.ts b/shared/core-utils/videos/index.tsdeleted file mode 100644index 2cf319395e..0000000000--- a/shared/core-utils/videos/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './bitrate'-export * from './common'diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.tsdeleted file mode 100644index d4cfcbec83..0000000000--- a/shared/extra-utils/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './crypto'-export * from './file'-export * from './uuid'diff --git a/shared/ffmpeg/index.ts b/shared/ffmpeg/index.tsdeleted file mode 100644index 1dab292dab..0000000000--- a/shared/ffmpeg/index.ts+++ /dev/null@@ -1,9 +0,0 @@-export * from './ffmpeg-command-wrapper'-export * from './ffmpeg-default-transcoding-profile'-export * from './ffmpeg-edition'-export * from './ffmpeg-images'-export * from './ffmpeg-live'-export * from './ffmpeg-utils'-export * from './ffmpeg-version'-export * from './ffmpeg-vod'-export * from './ffprobe'diff --git a/shared/ffmpeg/shared/index.ts b/shared/ffmpeg/shared/index.tsdeleted file mode 100644index 51de0316f4..0000000000--- a/shared/ffmpeg/shared/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './encoder-options'-export * from './presets'diff --git a/shared/models/activitypub/index.ts b/shared/models/activitypub/index.tsdeleted file mode 100644index fa07b6a64d..0000000000--- a/shared/models/activitypub/index.ts+++ /dev/null@@ -1,9 +0,0 @@-export * from './objects'-export * from './activity'-export * from './activitypub-actor'-export * from './activitypub-collection'-export * from './activitypub-ordered-collection'-export * from './activitypub-root'-export * from './activitypub-signature'-export * from './context'-export * from './webfinger'diff --git a/shared/models/activitypub/objects/activitypub-object.ts b/shared/models/activitypub/objects/activitypub-object.tsdeleted file mode 100644index faeac26183..0000000000--- a/shared/models/activitypub/objects/activitypub-object.ts+++ /dev/null@@ -1,17 +0,0 @@-import { AbuseObject } from './abuse-object'-import { CacheFileObject } from './cache-file-object'-import { PlaylistObject } from './playlist-object'-import { VideoCommentObject } from './video-comment-object'-import { VideoObject } from './video-object'-import { WatchActionObject } from './watch-action-object'--export type ActivityObject =- VideoObject |- AbuseObject |- VideoCommentObject |- CacheFileObject |- PlaylistObject |- WatchActionObject |- string--export type APObjectId = string | { id: string }diff --git a/shared/models/activitypub/objects/index.ts b/shared/models/activitypub/objects/index.tsdeleted file mode 100644index 753e020030..0000000000--- a/shared/models/activitypub/objects/index.ts+++ /dev/null@@ -1,9 +0,0 @@-export * from './abuse-object'-export * from './activitypub-object'-export * from './cache-file-object'-export * from './common-objects'-export * from './playlist-element-object'-export * from './playlist-object'-export * from './video-comment-object'-export * from './video-object'-export * from './watch-action-object'diff --git a/shared/models/actors/actor-image.type.ts b/shared/models/actors/actor-image.type.tsdeleted file mode 100644index ac8eb6bf20..0000000000--- a/shared/models/actors/actor-image.type.ts+++ /dev/null@@ -1,4 +0,0 @@-export const enum ActorImageType {- AVATAR = 1,- BANNER = 2-}diff --git a/shared/models/actors/index.ts b/shared/models/actors/index.tsdeleted file mode 100644index e03f168cdf..0000000000--- a/shared/models/actors/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './account.model'-export * from './actor-image.model'-export * from './actor-image.type'-export * from './actor.model'-export * from './custom-page.model'-export * from './follow.model'diff --git a/shared/models/bulk/index.ts b/shared/models/bulk/index.tsdeleted file mode 100644index 168c8cd486..0000000000--- a/shared/models/bulk/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './bulk-remove-comments-of-body.model'diff --git a/shared/models/common/index.ts b/shared/models/common/index.tsdeleted file mode 100644index 4db85eff24..0000000000--- a/shared/models/common/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './result-list.model'diff --git a/shared/models/custom-markup/index.ts b/shared/models/custom-markup/index.tsdeleted file mode 100644index 2898dfa90a..0000000000--- a/shared/models/custom-markup/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './custom-markup-data.model'diff --git a/shared/models/feeds/feed-format.enum.ts b/shared/models/feeds/feed-format.enum.tsdeleted file mode 100644index d3d5743312..0000000000--- a/shared/models/feeds/feed-format.enum.ts+++ /dev/null@@ -1,5 +0,0 @@-export const enum FeedFormat {- RSS = 'xml',- ATOM = 'atom',- JSON = 'json'-}diff --git a/shared/models/feeds/index.ts b/shared/models/feeds/index.tsdeleted file mode 100644index d56c8458ca..0000000000--- a/shared/models/feeds/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './feed-format.enum'diff --git a/shared/models/http/index.ts b/shared/models/http/index.tsdeleted file mode 100644index ec991afe08..0000000000--- a/shared/models/http/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './http-error-codes'-export * from './http-methods'diff --git a/shared/models/index.ts b/shared/models/index.tsdeleted file mode 100644index 78f6e73e38..0000000000--- a/shared/models/index.ts+++ /dev/null@@ -1,19 +0,0 @@-export * from './activitypub'-export * from './actors'-export * from './bulk'-export * from './common'-export * from './custom-markup'-export * from './feeds'-export * from './http'-export * from './joinpeertube'-export * from './metrics'-export * from './moderation'-export * from './overviews'-export * from './plugins'-export * from './redundancy'-export * from './runners'-export * from './search'-export * from './server'-export * from './tokens'-export * from './users'-export * from './videos'diff --git a/shared/models/joinpeertube/index.ts b/shared/models/joinpeertube/index.tsdeleted file mode 100644index 9681c35ad5..0000000000--- a/shared/models/joinpeertube/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './versions.model'diff --git a/shared/models/metrics/index.ts b/shared/models/metrics/index.tsdeleted file mode 100644index 24194cce37..0000000000--- a/shared/models/metrics/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './playback-metric-create.model'diff --git a/shared/models/moderation/abuse/abuse-reason.model.ts b/shared/models/moderation/abuse/abuse-reason.model.tsdeleted file mode 100644index 57359aef66..0000000000--- a/shared/models/moderation/abuse/abuse-reason.model.ts+++ /dev/null@@ -1,20 +0,0 @@-export const enum AbusePredefinedReasons {- VIOLENT_OR_REPULSIVE = 1,- HATEFUL_OR_ABUSIVE,- SPAM_OR_MISLEADING,- PRIVACY,- RIGHTS,- SERVER_RULES,- THUMBNAILS,- CAPTIONS-}--export type AbusePredefinedReasonsString =- 'violentOrRepulsive' |- 'hatefulOrAbusive' |- 'spamOrMisleading' |- 'privacy' |- 'rights' |- 'serverRules' |- 'thumbnails' |- 'captions'diff --git a/shared/models/moderation/abuse/abuse-state.model.ts b/shared/models/moderation/abuse/abuse-state.model.tsdeleted file mode 100644index 8ef6fdada5..0000000000--- a/shared/models/moderation/abuse/abuse-state.model.ts+++ /dev/null@@ -1,5 +0,0 @@-export const enum AbuseState {- PENDING = 1,- REJECTED = 2,- ACCEPTED = 3-}diff --git a/shared/models/moderation/abuse/abuse-update.model.ts b/shared/models/moderation/abuse/abuse-update.model.tsdeleted file mode 100644index 4360fe7aca..0000000000--- a/shared/models/moderation/abuse/abuse-update.model.ts+++ /dev/null@@ -1,7 +0,0 @@-import { AbuseState } from './abuse-state.model'--export interface AbuseUpdate {- moderationComment?: string-- state?: AbuseState-}diff --git a/shared/models/moderation/abuse/index.ts b/shared/models/moderation/abuse/index.tsdeleted file mode 100644index b518517a6f..0000000000--- a/shared/models/moderation/abuse/index.ts+++ /dev/null@@ -1,8 +0,0 @@-export * from './abuse-create.model'-export * from './abuse-filter.type'-export * from './abuse-message.model'-export * from './abuse-reason.model'-export * from './abuse-state.model'-export * from './abuse-update.model'-export * from './abuse-video-is.type'-export * from './abuse.model'diff --git a/shared/models/moderation/index.ts b/shared/models/moderation/index.tsdeleted file mode 100644index f8e6d351cf..0000000000--- a/shared/models/moderation/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './abuse'-export * from './block-status.model'-export * from './account-block.model'-export * from './server-block.model'diff --git a/shared/models/nodeinfo/index.ts b/shared/models/nodeinfo/index.tsdeleted file mode 100644index faa64302a4..0000000000--- a/shared/models/nodeinfo/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './nodeinfo.model'diff --git a/shared/models/overviews/index.ts b/shared/models/overviews/index.tsdeleted file mode 100644index 468507c6bd..0000000000--- a/shared/models/overviews/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './videos-overview.model'diff --git a/shared/models/plugins/client/index.ts b/shared/models/plugins/client/index.tsdeleted file mode 100644index f3e3fcbcfd..0000000000--- a/shared/models/plugins/client/index.ts+++ /dev/null@@ -1,8 +0,0 @@-export * from './client-hook.model'-export * from './plugin-client-scope.type'-export * from './plugin-element-placeholder.type'-export * from './plugin-selector-id.type'-export * from './register-client-form-field.model'-export * from './register-client-hook.model'-export * from './register-client-route.model'-export * from './register-client-settings-script.model'diff --git a/shared/models/plugins/hook-type.enum.ts b/shared/models/plugins/hook-type.enum.tsdeleted file mode 100644index a96c943f1a..0000000000--- a/shared/models/plugins/hook-type.enum.ts+++ /dev/null@@ -1,5 +0,0 @@-export const enum HookType {- STATIC = 1,- ACTION = 2,- FILTER = 3-}diff --git a/shared/models/plugins/index.ts b/shared/models/plugins/index.tsdeleted file mode 100644index cbbe4916ef..0000000000--- a/shared/models/plugins/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './client'-export * from './plugin-index'-export * from './server'-export * from './hook-type.enum'-export * from './plugin-package-json.model'-export * from './plugin.type'diff --git a/shared/models/plugins/plugin-index/index.ts b/shared/models/plugins/plugin-index/index.tsdeleted file mode 100644index 9138466382..0000000000--- a/shared/models/plugins/plugin-index/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './peertube-plugin-index-list.model'-export * from './peertube-plugin-index.model'-export * from './peertube-plugin-latest-version.model'diff --git a/shared/models/plugins/plugin.type.ts b/shared/models/plugins/plugin.type.tsdeleted file mode 100644index 016219cebc..0000000000--- a/shared/models/plugins/plugin.type.ts+++ /dev/null@@ -1,4 +0,0 @@-export const enum PluginType {- PLUGIN = 1,- THEME = 2-}diff --git a/shared/models/plugins/server/api/index.ts b/shared/models/plugins/server/api/index.tsdeleted file mode 100644index eb59a03f0a..0000000000--- a/shared/models/plugins/server/api/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './install-plugin.model'-export * from './manage-plugin.model'-export * from './peertube-plugin.model'diff --git a/shared/models/plugins/server/index.ts b/shared/models/plugins/server/index.tsdeleted file mode 100644index d3ff49d3b6..0000000000--- a/shared/models/plugins/server/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './api'-export * from './managers'-export * from './settings'-export * from './plugin-translation.model'-export * from './register-server-hook.model'-export * from './server-hook.model'diff --git a/shared/models/plugins/server/managers/index.ts b/shared/models/plugins/server/managers/index.tsdeleted file mode 100644index 49365a8548..0000000000--- a/shared/models/plugins/server/managers/index.ts+++ /dev/null@@ -1,9 +0,0 @@--export * from './plugin-playlist-privacy-manager.model'-export * from './plugin-settings-manager.model'-export * from './plugin-storage-manager.model'-export * from './plugin-transcoding-manager.model'-export * from './plugin-video-category-manager.model'-export * from './plugin-video-language-manager.model'-export * from './plugin-video-licence-manager.model'-export * from './plugin-video-privacy-manager.model'diff --git a/shared/models/plugins/server/settings/index.ts b/shared/models/plugins/server/settings/index.tsdeleted file mode 100644index b456de0193..0000000000--- a/shared/models/plugins/server/settings/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './public-server.setting'-export * from './register-server-setting.model'diff --git a/shared/models/redundancy/index.ts b/shared/models/redundancy/index.tsdeleted file mode 100644index 641a5d625c..0000000000--- a/shared/models/redundancy/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './video-redundancies-filters.model'-export * from './video-redundancy-config-filter.type'-export * from './video-redundancy.model'-export * from './videos-redundancy-strategy.model'diff --git a/shared/models/runners/index.ts b/shared/models/runners/index.tsdeleted file mode 100644index a52b82d2e9..0000000000--- a/shared/models/runners/index.ts+++ /dev/null@@ -1,21 +0,0 @@-export * from './abort-runner-job-body.model'-export * from './accept-runner-job-body.model'-export * from './accept-runner-job-result.model'-export * from './error-runner-job-body.model'-export * from './list-runner-jobs-query.model'-export * from './list-runner-registration-tokens.model'-export * from './list-runners-query.model'-export * from './register-runner-body.model'-export * from './register-runner-result.model'-export * from './request-runner-job-body.model'-export * from './request-runner-job-result.model'-export * from './runner-job-payload.model'-export * from './runner-job-private-payload.model'-export * from './runner-job-state.model'-export * from './runner-job-success-body.model'-export * from './runner-job-type.type'-export * from './runner-job-update-body.model'-export * from './runner-job.model'-export * from './runner-registration-token'-export * from './runner.model'-export * from './unregister-runner-body.model'diff --git a/shared/models/runners/runner-job-state.model.ts b/shared/models/runners/runner-job-state.model.tsdeleted file mode 100644index 7ed34b3bf1..0000000000--- a/shared/models/runners/runner-job-state.model.ts+++ /dev/null@@ -1,11 +0,0 @@-export enum RunnerJobState {- PENDING = 1,- PROCESSING = 2,- COMPLETED = 3,- ERRORED = 4,- WAITING_FOR_PARENT_JOB = 5,- CANCELLED = 6,- PARENT_ERRORED = 7,- PARENT_CANCELLED = 8,- COMPLETING = 9-}diff --git a/shared/models/search/index.ts b/shared/models/search/index.tsdeleted file mode 100644index 50aeeddc8e..0000000000--- a/shared/models/search/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './boolean-both-query.model'-export * from './search-target-query.model'-export * from './videos-common-query.model'-export * from './video-channels-search-query.model'-export * from './video-playlists-search-query.model'-export * from './videos-search-query.model'diff --git a/shared/models/server/index.ts b/shared/models/server/index.tsdeleted file mode 100644index a9136f3d4b..0000000000--- a/shared/models/server/index.ts+++ /dev/null@@ -1,16 +0,0 @@-export * from './about.model'-export * from './broadcast-message-level.type'-export * from './client-log-create.model'-export * from './client-log-level.type'-export * from './contact-form.model'-export * from './custom-config.model'-export * from './debug.model'-export * from './emailer.model'-export * from './job.model'-export * from './peertube-problem-document.model'-export * from './server-config.model'-export * from './server-debug.model'-export * from './server-error-code.enum'-export * from './server-follow-create.model'-export * from './server-log-level.type'-export * from './server-stats.model'diff --git a/shared/models/tokens/index.ts b/shared/models/tokens/index.tsdeleted file mode 100644index fe130f1539..0000000000--- a/shared/models/tokens/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './oauth-client-local.model'diff --git a/shared/models/users/index.ts b/shared/models/users/index.tsdeleted file mode 100644index 4a050c870c..0000000000--- a/shared/models/users/index.ts+++ /dev/null@@ -1,16 +0,0 @@-export * from './registration'-export * from './two-factor-enable-result.model'-export * from './user-create-result.model'-export * from './user-create.model'-export * from './user-flag.model'-export * from './user-login.model'-export * from './user-notification-setting.model'-export * from './user-notification.model'-export * from './user-refresh-token.model'-export * from './user-right.enum'-export * from './user-role'-export * from './user-scoped-token'-export * from './user-update-me.model'-export * from './user-update.model'-export * from './user-video-quota.model'-export * from './user.model'diff --git a/shared/models/users/registration/index.ts b/shared/models/users/registration/index.tsdeleted file mode 100644index 593740c4f5..0000000000--- a/shared/models/users/registration/index.ts+++ /dev/null@@ -1,5 +0,0 @@-export * from './user-register.model'-export * from './user-registration-request.model'-export * from './user-registration-state.model'-export * from './user-registration-update-state.model'-export * from './user-registration.model'diff --git a/shared/models/users/registration/user-registration-state.model.ts b/shared/models/users/registration/user-registration-state.model.tsdeleted file mode 100644index e4c835f78c..0000000000--- a/shared/models/users/registration/user-registration-state.model.ts+++ /dev/null@@ -1,5 +0,0 @@-export const enum UserRegistrationState {- PENDING = 1,- REJECTED = 2,- ACCEPTED = 3-}diff --git a/shared/models/users/user-flag.model.ts b/shared/models/users/user-flag.model.tsdeleted file mode 100644index b791a1263c..0000000000--- a/shared/models/users/user-flag.model.ts+++ /dev/null@@ -1,4 +0,0 @@-export const enum UserAdminFlag {- NONE = 0,- BYPASS_VIDEO_AUTO_BLACKLIST = 1 << 0-}diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.tsdeleted file mode 100644index 278a05e7a5..0000000000--- a/shared/models/users/user-notification-setting.model.ts+++ /dev/null@@ -1,32 +0,0 @@-export const enum UserNotificationSettingValue {- NONE = 0,- WEB = 1 << 0,- EMAIL = 1 << 1-}--export interface UserNotificationSetting {- abuseAsModerator: UserNotificationSettingValue- videoAutoBlacklistAsModerator: UserNotificationSettingValue- newUserRegistration: UserNotificationSettingValue-- newVideoFromSubscription: UserNotificationSettingValue-- blacklistOnMyVideo: UserNotificationSettingValue- myVideoPublished: UserNotificationSettingValue- myVideoImportFinished: UserNotificationSettingValue-- commentMention: UserNotificationSettingValue- newCommentOnMyVideo: UserNotificationSettingValue-- newFollow: UserNotificationSettingValue- newInstanceFollower: UserNotificationSettingValue- autoInstanceFollowing: UserNotificationSettingValue-- abuseStateChange: UserNotificationSettingValue- abuseNewMessage: UserNotificationSettingValue-- newPeerTubeVersion: UserNotificationSettingValue- newPluginVersion: UserNotificationSettingValue-- myVideoStudioEditionFinished: UserNotificationSettingValue-}diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.tsdeleted file mode 100644index a5a770b75d..0000000000--- a/shared/models/users/user-right.enum.ts+++ /dev/null@@ -1,51 +0,0 @@-export const enum UserRight {- ALL = 0,-- MANAGE_USERS = 1,-- MANAGE_SERVER_FOLLOW = 2,-- MANAGE_LOGS = 3,-- MANAGE_DEBUG = 4,-- MANAGE_SERVER_REDUNDANCY = 5,-- MANAGE_ABUSES = 6,-- MANAGE_JOBS = 7,-- MANAGE_CONFIGURATION = 8,- MANAGE_INSTANCE_CUSTOM_PAGE = 9,-- MANAGE_ACCOUNTS_BLOCKLIST = 10,- MANAGE_SERVERS_BLOCKLIST = 11,-- MANAGE_VIDEO_BLACKLIST = 12,- MANAGE_ANY_VIDEO_CHANNEL = 13,-- REMOVE_ANY_VIDEO = 14,- REMOVE_ANY_VIDEO_PLAYLIST = 15,- REMOVE_ANY_VIDEO_COMMENT = 16,-- UPDATE_ANY_VIDEO = 17,- UPDATE_ANY_VIDEO_PLAYLIST = 18,-- GET_ANY_LIVE = 19,- SEE_ALL_VIDEOS = 20,- SEE_ALL_COMMENTS = 21,- CHANGE_VIDEO_OWNERSHIP = 22,-- MANAGE_PLUGINS = 23,-- MANAGE_VIDEOS_REDUNDANCIES = 24,-- MANAGE_VIDEO_FILES = 25,- RUN_VIDEO_TRANSCODING = 26,-- MANAGE_VIDEO_IMPORTS = 27,-- MANAGE_REGISTRATIONS = 28,-- MANAGE_RUNNERS = 29-}diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.tsdeleted file mode 100644index 687a2aa0d5..0000000000--- a/shared/models/users/user-role.ts+++ /dev/null@@ -1,6 +0,0 @@-// Keep the order-export const enum UserRole {- ADMINISTRATOR = 0,- MODERATOR = 1,- USER = 2-}diff --git a/shared/models/videos/blacklist/index.ts b/shared/models/videos/blacklist/index.tsdeleted file mode 100644index 66082be346..0000000000--- a/shared/models/videos/blacklist/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './video-blacklist.model'-export * from './video-blacklist-create.model'-export * from './video-blacklist-update.model'diff --git a/shared/models/videos/blacklist/video-blacklist.model.ts b/shared/models/videos/blacklist/video-blacklist.model.tsdeleted file mode 100644index 982a34592d..0000000000--- a/shared/models/videos/blacklist/video-blacklist.model.ts+++ /dev/null@@ -1,18 +0,0 @@-import { Video } from '../video.model'--export const enum VideoBlacklistType {- MANUAL = 1,- AUTO_BEFORE_PUBLISHED = 2-}--export interface VideoBlacklist {- id: number- unfederated: boolean- reason?: string- type: VideoBlacklistType-- video: Video-- createdAt: Date- updatedAt: Date-}diff --git a/shared/models/videos/caption/index.ts b/shared/models/videos/caption/index.tsdeleted file mode 100644index 2a5ff512d4..0000000000--- a/shared/models/videos/caption/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './video-caption.model'-export * from './video-caption-update.model'diff --git a/shared/models/videos/change-ownership/index.ts b/shared/models/videos/change-ownership/index.tsdeleted file mode 100644index a942fb2cd2..0000000000--- a/shared/models/videos/change-ownership/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './video-change-ownership-accept.model'-export * from './video-change-ownership-create.model'-export * from './video-change-ownership.model'diff --git a/shared/models/videos/change-ownership/video-change-ownership.model.ts b/shared/models/videos/change-ownership/video-change-ownership.model.tsdeleted file mode 100644index 3d31cad0a8..0000000000--- a/shared/models/videos/change-ownership/video-change-ownership.model.ts+++ /dev/null@@ -1,17 +0,0 @@-import { Account } from '../../actors'-import { Video } from '../video.model'--export interface VideoChangeOwnership {- id: number- status: VideoChangeOwnershipStatus- initiatorAccount: Account- nextOwnerAccount: Account- video: Video- createdAt: Date-}--export const enum VideoChangeOwnershipStatus {- WAITING = 'WAITING',- ACCEPTED = 'ACCEPTED',- REFUSED = 'REFUSED'-}diff --git a/shared/models/videos/channel-sync/index.ts b/shared/models/videos/channel-sync/index.tsdeleted file mode 100644index 7d25aaac39..0000000000--- a/shared/models/videos/channel-sync/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './video-channel-sync-state.enum'-export * from './video-channel-sync.model'-export * from './video-channel-sync-create.model'diff --git a/shared/models/videos/channel-sync/video-channel-sync-state.enum.ts b/shared/models/videos/channel-sync/video-channel-sync-state.enum.tsdeleted file mode 100644index 3e9f5ddc25..0000000000--- a/shared/models/videos/channel-sync/video-channel-sync-state.enum.ts+++ /dev/null@@ -1,6 +0,0 @@-export const enum VideoChannelSyncState {- WAITING_FIRST_RUN = 1,- PROCESSING = 2,- SYNCED = 3,- FAILED = 4-}diff --git a/shared/models/videos/channel/index.ts b/shared/models/videos/channel/index.tsdeleted file mode 100644index 6cdabffbd6..0000000000--- a/shared/models/videos/channel/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './video-channel-create-result.model'-export * from './video-channel-create.model'-export * from './video-channel-update.model'-export * from './video-channel.model'diff --git a/shared/models/videos/comment/index.ts b/shared/models/videos/comment/index.tsdeleted file mode 100644index 80c6c0724d..0000000000--- a/shared/models/videos/comment/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './video-comment-create.model'-export * from './video-comment.model'diff --git a/shared/models/videos/file/index.ts b/shared/models/videos/file/index.tsdeleted file mode 100644index 78a784a3cd..0000000000--- a/shared/models/videos/file/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './video-file-metadata.model'-export * from './video-file.model'-export * from './video-resolution.enum'diff --git a/shared/models/videos/file/video-resolution.enum.ts b/shared/models/videos/file/video-resolution.enum.tsdeleted file mode 100644index 5b48ad3534..0000000000--- a/shared/models/videos/file/video-resolution.enum.ts+++ /dev/null@@ -1,11 +0,0 @@-export const enum VideoResolution {- H_NOVIDEO = 0,- H_144P = 144,- H_240P = 240,- H_360P = 360,- H_480P = 480,- H_720P = 720,- H_1080P = 1080,- H_1440P = 1440,- H_4K = 2160-}diff --git a/shared/models/videos/import/index.ts b/shared/models/videos/import/index.tsdeleted file mode 100644index b38a67b5f8..0000000000--- a/shared/models/videos/import/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './video-import-create.model'-export * from './video-import-state.enum'-export * from './video-import.model'-export * from './videos-import-in-channel-create.model'diff --git a/shared/models/videos/import/video-import-state.enum.ts b/shared/models/videos/import/video-import-state.enum.tsdeleted file mode 100644index ff5c6beff7..0000000000--- a/shared/models/videos/import/video-import-state.enum.ts+++ /dev/null@@ -1,8 +0,0 @@-export const enum VideoImportState {- PENDING = 1,- SUCCESS = 2,- FAILED = 3,- REJECTED = 4,- CANCELLED = 5,- PROCESSING = 6-}diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.tsdeleted file mode 100644index f8f1ce0811..0000000000--- a/shared/models/videos/index.ts+++ /dev/null@@ -1,42 +0,0 @@-export * from './blacklist'-export * from './caption'-export * from './change-ownership'-export * from './channel'-export * from './comment'-export * from './studio'-export * from './live'-export * from './file'-export * from './import'-export * from './playlist'-export * from './rate'-export * from './stats'-export * from './transcoding'-export * from './channel-sync'--export * from './nsfw-policy.type'--export * from './storyboard.model'-export * from './thumbnail.type'--export * from './video-constant.model'-export * from './video-create.model'--export * from './video-privacy.enum'-export * from './video-include.enum'-export * from './video-rate.type'--export * from './video-schedule-update.model'-export * from './video-sort-field.type'-export * from './video-state.enum'-export * from './video-storage.enum'--export * from './video-streaming-playlist.model'-export * from './video-streaming-playlist.type'--export * from './video-token.model'--export * from './video-update.model'-export * from './video-view.model'-export * from './video.model'-export * from './video-create-result.model'-export * from './video-password.model'diff --git a/shared/models/videos/live/index.ts b/shared/models/videos/live/index.tsdeleted file mode 100644index 07b59fe2c1..0000000000--- a/shared/models/videos/live/index.ts+++ /dev/null@@ -1,8 +0,0 @@-export * from './live-video-create.model'-export * from './live-video-error.enum'-export * from './live-video-event-payload.model'-export * from './live-video-event.type'-export * from './live-video-latency-mode.enum'-export * from './live-video-session.model'-export * from './live-video-update.model'-export * from './live-video.model'diff --git a/shared/models/videos/live/live-video-create.model.ts b/shared/models/videos/live/live-video-create.model.tsdeleted file mode 100644index f8ae9e5a91..0000000000--- a/shared/models/videos/live/live-video-create.model.ts+++ /dev/null@@ -1,11 +0,0 @@-import { VideoCreate } from '../video-create.model'-import { VideoPrivacy } from '../video-privacy.enum'-import { LiveVideoLatencyMode } from './live-video-latency-mode.enum'--export interface LiveVideoCreate extends VideoCreate {- permanentLive?: boolean- latencyMode?: LiveVideoLatencyMode-- saveReplay?: boolean- replaySettings?: { privacy: VideoPrivacy }-}diff --git a/shared/models/videos/live/live-video-error.enum.ts b/shared/models/videos/live/live-video-error.enum.tsdeleted file mode 100644index a264535053..0000000000--- a/shared/models/videos/live/live-video-error.enum.ts+++ /dev/null@@ -1,9 +0,0 @@-export const enum LiveVideoError {- BAD_SOCKET_HEALTH = 1,- DURATION_EXCEEDED = 2,- QUOTA_EXCEEDED = 3,- FFMPEG_ERROR = 4,- BLACKLISTED = 5,- RUNNER_JOB_ERROR = 6,- RUNNER_JOB_CANCEL = 7-}diff --git a/shared/models/videos/live/live-video-event-payload.model.ts b/shared/models/videos/live/live-video-event-payload.model.tsdeleted file mode 100644index 646856ac39..0000000000--- a/shared/models/videos/live/live-video-event-payload.model.ts+++ /dev/null@@ -1,7 +0,0 @@-import { VideoState } from '../video-state.enum'--export interface LiveVideoEventPayload {- state?: VideoState-- viewers?: number-}diff --git a/shared/models/videos/live/live-video-latency-mode.enum.ts b/shared/models/videos/live/live-video-latency-mode.enum.tsdeleted file mode 100644index 4285e1d41d..0000000000--- a/shared/models/videos/live/live-video-latency-mode.enum.ts+++ /dev/null@@ -1,5 +0,0 @@-export const enum LiveVideoLatencyMode {- DEFAULT = 1,- HIGH_LATENCY = 2,- SMALL_LATENCY = 3-}diff --git a/shared/models/videos/live/live-video-update.model.ts b/shared/models/videos/live/live-video-update.model.tsdeleted file mode 100644index d6aa6fb377..0000000000--- a/shared/models/videos/live/live-video-update.model.ts+++ /dev/null@@ -1,9 +0,0 @@-import { VideoPrivacy } from '../video-privacy.enum'-import { LiveVideoLatencyMode } from './live-video-latency-mode.enum'--export interface LiveVideoUpdate {- permanentLive?: boolean- saveReplay?: boolean- replaySettings?: { privacy: VideoPrivacy }- latencyMode?: LiveVideoLatencyMode-}diff --git a/shared/models/videos/live/live-video.model.ts b/shared/models/videos/live/live-video.model.tsdeleted file mode 100644index fd84541237..0000000000--- a/shared/models/videos/live/live-video.model.ts+++ /dev/null@@ -1,14 +0,0 @@-import { VideoPrivacy } from '../video-privacy.enum'-import { LiveVideoLatencyMode } from './live-video-latency-mode.enum'--export interface LiveVideo {- // If owner- rtmpUrl?: string- rtmpsUrl?: string- streamKey?: string-- saveReplay: boolean- replaySettings?: { privacy: VideoPrivacy }- permanentLive: boolean- latencyMode: LiveVideoLatencyMode-}diff --git a/shared/models/videos/playlist/index.ts b/shared/models/videos/playlist/index.tsdeleted file mode 100644index a9e8ce496c..0000000000--- a/shared/models/videos/playlist/index.ts+++ /dev/null@@ -1,12 +0,0 @@-export * from './video-exist-in-playlist.model'-export * from './video-playlist-create-result.model'-export * from './video-playlist-create.model'-export * from './video-playlist-element-create-result.model'-export * from './video-playlist-element-create.model'-export * from './video-playlist-element-update.model'-export * from './video-playlist-element.model'-export * from './video-playlist-privacy.model'-export * from './video-playlist-reorder.model'-export * from './video-playlist-type.model'-export * from './video-playlist-update.model'-export * from './video-playlist.model'diff --git a/shared/models/videos/playlist/video-playlist-element.model.ts b/shared/models/videos/playlist/video-playlist-element.model.tsdeleted file mode 100644index df9e3b5cf7..0000000000--- a/shared/models/videos/playlist/video-playlist-element.model.ts+++ /dev/null@@ -1,19 +0,0 @@-import { Video } from '../video.model'--export const enum VideoPlaylistElementType {- REGULAR = 0,- DELETED = 1,- PRIVATE = 2,- UNAVAILABLE = 3 // Blacklisted, blocked by the user/instance, NSFW...-}--export interface VideoPlaylistElement {- id: number- position: number- startTimestamp: number- stopTimestamp: number-- type: VideoPlaylistElementType-- video?: Video-}diff --git a/shared/models/videos/playlist/video-playlist-privacy.model.ts b/shared/models/videos/playlist/video-playlist-privacy.model.tsdeleted file mode 100644index 480e1f1049..0000000000--- a/shared/models/videos/playlist/video-playlist-privacy.model.ts+++ /dev/null@@ -1,5 +0,0 @@-export const enum VideoPlaylistPrivacy {- PUBLIC = 1,- UNLISTED = 2,- PRIVATE = 3-}diff --git a/shared/models/videos/playlist/video-playlist-type.model.ts b/shared/models/videos/playlist/video-playlist-type.model.tsdeleted file mode 100644index 7f51a6354a..0000000000--- a/shared/models/videos/playlist/video-playlist-type.model.ts+++ /dev/null@@ -1,4 +0,0 @@-export const enum VideoPlaylistType {- REGULAR = 1,- WATCH_LATER = 2-}diff --git a/shared/models/videos/playlist/video-playlist.model.ts b/shared/models/videos/playlist/video-playlist.model.tsdeleted file mode 100644index b8a9955d9b..0000000000--- a/shared/models/videos/playlist/video-playlist.model.ts+++ /dev/null@@ -1,34 +0,0 @@-import { AccountSummary } from '../../actors/index'-import { VideoChannelSummary, VideoConstant } from '..'-import { VideoPlaylistPrivacy } from './video-playlist-privacy.model'-import { VideoPlaylistType } from './video-playlist-type.model'--export interface VideoPlaylist {- id: number- uuid: string- shortUUID: string-- isLocal: boolean-- url: string-- displayName: string- description: string- privacy: VideoConstant<VideoPlaylistPrivacy>-- thumbnailPath: string- thumbnailUrl?: string-- videosLength: number-- type: VideoConstant<VideoPlaylistType>-- embedPath: string- embedUrl?: string-- createdAt: Date | string- updatedAt: Date | string-- ownerAccount: AccountSummary- videoChannel?: VideoChannelSummary-}diff --git a/shared/models/videos/rate/account-video-rate.model.ts b/shared/models/videos/rate/account-video-rate.model.tsdeleted file mode 100644index e789367dc5..0000000000--- a/shared/models/videos/rate/account-video-rate.model.ts+++ /dev/null@@ -1,7 +0,0 @@-import { UserVideoRateType } from './user-video-rate.type'-import { Video } from '../video.model'--export interface AccountVideoRate {- video: Video- rating: UserVideoRateType-}diff --git a/shared/models/videos/rate/index.ts b/shared/models/videos/rate/index.tsdeleted file mode 100644index 06aa691bd7..0000000000--- a/shared/models/videos/rate/index.ts+++ /dev/null@@ -1,5 +0,0 @@--export * from './user-video-rate-update.model'-export * from './user-video-rate.model'-export * from './account-video-rate.model'-export * from './user-video-rate.type'diff --git a/shared/models/videos/stats/index.ts b/shared/models/videos/stats/index.tsdeleted file mode 100644index a9b203f586..0000000000--- a/shared/models/videos/stats/index.ts+++ /dev/null@@ -1,6 +0,0 @@-export * from './video-stats-overall-query.model'-export * from './video-stats-overall.model'-export * from './video-stats-retention.model'-export * from './video-stats-timeserie-query.model'-export * from './video-stats-timeserie-metric.type'-export * from './video-stats-timeserie.model'diff --git a/shared/models/videos/studio/index.ts b/shared/models/videos/studio/index.tsdeleted file mode 100644index a1eb98a495..0000000000--- a/shared/models/videos/studio/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './video-studio-create-edit.model'diff --git a/shared/models/videos/thumbnail.type.ts b/shared/models/videos/thumbnail.type.tsdeleted file mode 100644index 6907b28027..0000000000--- a/shared/models/videos/thumbnail.type.ts+++ /dev/null@@ -1,4 +0,0 @@-export const enum ThumbnailType {- MINIATURE = 1,- PREVIEW = 2-}diff --git a/shared/models/videos/transcoding/index.ts b/shared/models/videos/transcoding/index.tsdeleted file mode 100644index 14472d900e..0000000000--- a/shared/models/videos/transcoding/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './video-transcoding-create.model'-export * from './video-transcoding-fps.model'-export * from './video-transcoding.model'diff --git a/shared/models/videos/video-include.enum.ts b/shared/models/videos/video-include.enum.tsdeleted file mode 100644index 32ee12e86e..0000000000--- a/shared/models/videos/video-include.enum.ts+++ /dev/null@@ -1,8 +0,0 @@-export const enum VideoInclude {- NONE = 0,- NOT_PUBLISHED_STATE = 1 << 0,- BLACKLISTED = 1 << 1,- BLOCKED_OWNER = 1 << 2,- FILES = 1 << 3,- CAPTIONS = 1 << 4-}diff --git a/shared/models/videos/video-privacy.enum.ts b/shared/models/videos/video-privacy.enum.tsdeleted file mode 100644index 12e1d196f4..0000000000--- a/shared/models/videos/video-privacy.enum.ts+++ /dev/null@@ -1,7 +0,0 @@-export const enum VideoPrivacy {- PUBLIC = 1,- UNLISTED = 2,- PRIVATE = 3,- INTERNAL = 4,- PASSWORD_PROTECTED = 5-}diff --git a/shared/models/videos/video-schedule-update.model.ts b/shared/models/videos/video-schedule-update.model.tsdeleted file mode 100644index 87d74f654a..0000000000--- a/shared/models/videos/video-schedule-update.model.ts+++ /dev/null@@ -1,6 +0,0 @@-import { VideoPrivacy } from './video-privacy.enum'--export interface VideoScheduleUpdate {- updateAt: Date | string- privacy?: VideoPrivacy.PUBLIC | VideoPrivacy.UNLISTED | VideoPrivacy.INTERNAL // Cannot schedule an update to PRIVATE-}diff --git a/shared/models/videos/video-state.enum.ts b/shared/models/videos/video-state.enum.tsdeleted file mode 100644index e45e4adc26..0000000000--- a/shared/models/videos/video-state.enum.ts+++ /dev/null@@ -1,11 +0,0 @@-export const enum VideoState {- PUBLISHED = 1,- TO_TRANSCODE = 2,- TO_IMPORT = 3,- WAITING_FOR_LIVE = 4,- LIVE_ENDED = 5,- TO_MOVE_TO_EXTERNAL_STORAGE = 6,- TRANSCODING_FAILED = 7,- TO_MOVE_TO_EXTERNAL_STORAGE_FAILED = 8,- TO_EDIT = 9-}diff --git a/shared/models/videos/video-storage.enum.ts b/shared/models/videos/video-storage.enum.tsdeleted file mode 100644index 7c6690db2a..0000000000--- a/shared/models/videos/video-storage.enum.ts+++ /dev/null@@ -1,4 +0,0 @@-export const enum VideoStorage {- FILE_SYSTEM,- OBJECT_STORAGE,-}diff --git a/shared/models/videos/video-streaming-playlist.type.ts b/shared/models/videos/video-streaming-playlist.type.tsdeleted file mode 100644index e2e2b93ea2..0000000000--- a/shared/models/videos/video-streaming-playlist.type.ts+++ /dev/null@@ -1,3 +0,0 @@-export const enum VideoStreamingPlaylistType {- HLS = 1-}diff --git a/shared/server-commands/bulk/index.ts b/shared/server-commands/bulk/index.tsdeleted file mode 100644index 391597243f..0000000000--- a/shared/server-commands/bulk/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './bulk-command'diff --git a/shared/server-commands/cli/index.ts b/shared/server-commands/cli/index.tsdeleted file mode 100644index 91b5abfbee..0000000000--- a/shared/server-commands/cli/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './cli-command'diff --git a/shared/server-commands/custom-pages/index.ts b/shared/server-commands/custom-pages/index.tsdeleted file mode 100644index 58aed04f22..0000000000--- a/shared/server-commands/custom-pages/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './custom-pages-command'diff --git a/shared/server-commands/feeds/index.ts b/shared/server-commands/feeds/index.tsdeleted file mode 100644index 662a22b6fa..0000000000--- a/shared/server-commands/feeds/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './feeds-command'diff --git a/shared/server-commands/index.ts b/shared/server-commands/index.tsdeleted file mode 100644index a4581dbc0b..0000000000--- a/shared/server-commands/index.ts+++ /dev/null@@ -1,14 +0,0 @@-export * from './bulk'-export * from './cli'-export * from './custom-pages'-export * from './feeds'-export * from './logs'-export * from './moderation'-export * from './overviews'-export * from './requests'-export * from './runners'-export * from './search'-export * from './server'-export * from './socket'-export * from './users'-export * from './videos'diff --git a/shared/server-commands/logs/index.ts b/shared/server-commands/logs/index.tsdeleted file mode 100644index 69452d7f0c..0000000000--- a/shared/server-commands/logs/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './logs-command'diff --git a/shared/server-commands/moderation/index.ts b/shared/server-commands/moderation/index.tsdeleted file mode 100644index b376439565..0000000000--- a/shared/server-commands/moderation/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './abuses-command'diff --git a/shared/server-commands/overviews/index.ts b/shared/server-commands/overviews/index.tsdeleted file mode 100644index e195519077..0000000000--- a/shared/server-commands/overviews/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './overviews-command'diff --git a/shared/server-commands/requests/index.ts b/shared/server-commands/requests/index.tsdeleted file mode 100644index 8029823012..0000000000--- a/shared/server-commands/requests/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './requests'diff --git a/shared/server-commands/runners/index.ts b/shared/server-commands/runners/index.tsdeleted file mode 100644index 9e8e1baf29..0000000000--- a/shared/server-commands/runners/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './runner-jobs-command'-export * from './runner-registration-tokens-command'-export * from './runners-command'diff --git a/shared/server-commands/search/index.ts b/shared/server-commands/search/index.tsdeleted file mode 100644index 48dbe8ae98..0000000000--- a/shared/server-commands/search/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './search-command'diff --git a/shared/server-commands/server/index.ts b/shared/server-commands/server/index.tsdeleted file mode 100644index 9a2fbf8d33..0000000000--- a/shared/server-commands/server/index.ts+++ /dev/null@@ -1,15 +0,0 @@-export * from './config-command'-export * from './contact-form-command'-export * from './debug-command'-export * from './follows-command'-export * from './follows'-export * from './jobs'-export * from './jobs-command'-export * from './metrics-command'-export * from './object-storage-command'-export * from './plugins-command'-export * from './redundancy-command'-export * from './server'-export * from './servers-command'-export * from './servers'-export * from './stats-command'diff --git a/shared/server-commands/shared/index.ts b/shared/server-commands/shared/index.tsdeleted file mode 100644index e807ab4f7c..0000000000--- a/shared/server-commands/shared/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './abstract-command'diff --git a/shared/server-commands/socket/index.ts b/shared/server-commands/socket/index.tsdeleted file mode 100644index 594329b2f9..0000000000--- a/shared/server-commands/socket/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './socket-io-command'diff --git a/shared/server-commands/users/index.ts b/shared/server-commands/users/index.tsdeleted file mode 100644index 404756539f..0000000000--- a/shared/server-commands/users/index.ts+++ /dev/null@@ -1,10 +0,0 @@-export * from './accounts-command'-export * from './accounts'-export * from './blocklist-command'-export * from './login'-export * from './login-command'-export * from './notifications-command'-export * from './registrations-command'-export * from './subscriptions-command'-export * from './two-factor-command'-export * from './users-command'diff --git a/shared/server-commands/videos/index.ts b/shared/server-commands/videos/index.tsdeleted file mode 100644index 106d80af0c..0000000000--- a/shared/server-commands/videos/index.ts+++ /dev/null@@ -1,21 +0,0 @@-export * from './blacklist-command'-export * from './captions-command'-export * from './change-ownership-command'-export * from './channels'-export * from './channels-command'-export * from './channel-syncs-command'-export * from './comments-command'-export * from './history-command'-export * from './imports-command'-export * from './live-command'-export * from './live'-export * from './playlists-command'-export * from './services-command'-export * from './storyboard-command'-export * from './streaming-playlists-command'-export * from './comments-command'-export * from './video-studio-command'-export * from './video-token-command'-export * from './views-command'-export * from './videos-command'-export * from './video-passwords-command'diff --git a/shared/tsconfig.json b/shared/tsconfig.jsondeleted file mode 100644index 95892077b8..0000000000--- a/shared/tsconfig.json+++ /dev/null@@ -1,6 +0,0 @@-{- "extends": "../tsconfig.base.json",- "compilerOptions": {- "outDir": "../dist/shared"- }-}diff --git a/shared/typescript-utils/index.ts b/shared/typescript-utils/index.tsdeleted file mode 100644index c9f6f047dc..0000000000--- a/shared/typescript-utils/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './types'diff --git a/support/doc/api/embeds.md b/support/doc/api/embeds.mdindex fd5507e387..989c8e98e3 100644--- a/support/doc/api/embeds.md+++ b/support/doc/api/embeds.md@@ -20,7 +20,7 @@ yarn add @peertube/embed-apiNow just use the `PeerTubePlayer` class exported by the module:```typescript-import { PeerTubePlayer } from '@peertube/embed-api'+import { PeerTubePlayer } from '@peertube/embed-api.js'...```diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yamlindex 0cbc58678b..5d54a7a51f 100644--- a/support/doc/api/openapi.yaml+++ b/support/doc/api/openapi.yaml@@ -53,7 +53,7 @@ info:}```- We provide error `type` values for [a growing number of cases](https://github.com/Chocobozzz/PeerTube/blob/develop/shared/models/server/server-error-code.enum.ts),+ We provide error `type` values for [a growing number of cases](https://github.com/Chocobozzz/PeerTube/blob/develop/packages/models/server/server-error-code.enum.ts),but it is still optional. Types are used to disambiguate errors that bear the same status codeand are non-obvious:@@ -8752,7 +8752,7 @@ components:password:$ref: '#/components/schemas/password'UpdateMe:- # see shared/models/users/user-update-me.model.ts:+ # see packages/models/users/user-update-me.model.ts:properties:password:$ref: '#/components/schemas/password'diff --git a/support/doc/development/lib.md b/support/doc/development/lib.mdindex 25fe3068e7..1ea09f2bc0 100644--- a/support/doc/development/lib.md+++ b/support/doc/development/lib.md@@ -18,7 +18,7 @@ The complete types package is generated via:```npm run generate-types-package 4.x.x-cd packages/types/dist+cd packages/types-generator/distnpm publish --access=public```diff --git a/support/doc/development/localization.md b/support/doc/development/localization.mdindex a38ed6f55a..4aca9b18b6 100644--- a/support/doc/development/localization.md+++ b/support/doc/development/localization.md@@ -26,7 +26,7 @@ Nothing to do here, Github will automatically send a webhook to Weblate that wil## Support a new language- * Add it to [/shared/models/i18n/i18n.ts](/shared/models/i18n/i18n.ts)+ * Add it to [/packages/models/i18n/i18n.ts](/packages/models/i18n/i18n.ts)* Add it to [/scripts/build/client.sh](/scripts/build/client.sh)* Add it to [/client/angular.json](/client/angular.json)* Add it to [/scripts/i18n/update.sh](/scripts/i18n/update.sh)diff --git a/support/doc/development/monitoring.md b/support/doc/development/monitoring.mdindex 93fd1403ea..023be9e926 100644--- a/support/doc/development/monitoring.md+++ b/support/doc/development/monitoring.md@@ -13,11 +13,11 @@ npm run build -- --analyze-bundle && npm run client-reportTo benchmark the REST API and save result in `benchmark.json`:```-node dist/scripts/benchmark.js -o benchmark.json+npm run benchmark-server -- -o benchmark.json```You can also grep on a specific test:```-node dist/scripts/benchmark.js --grep homepage+npm run benchmark-server -- --grep homepage```diff --git a/support/doc/development/server.md b/support/doc/development/server.mdindex 7a9fa571f6..5c83af7049 100644--- a/support/doc/development/server.md+++ b/support/doc/development/server.md@@ -1,11 +1,11 @@-# Server code+ # Server code## Database model typingSequelize models contain optional fields corresponding to table joins.For example, `VideoModel` has a `VideoChannel?: VideoChannelModel` field. It can be filled if the SQL query joined with the `videoChannel` table or empty if not.It can be difficult in TypeScript to understand if a function argument expects associations to be filled or not.-To improve clarity and reduce bugs, PeerTube defines multiple versions of a database model depending on its associations in `server/types/models/`.+To improve clarity and reduce bugs, PeerTube defines multiple versions of a database model depending on its associations in `server/server/types/models/`.These models start with `M` and by default do not include any association. `MVideo` for example corresponds to `VideoModel` without any association, where `VideoChannel` attribute doesn't exist. On the other hand, `MVideoWithChannel` is a `MVideo` that has a `VideoChannel` field. This way, a function that accepts `video: MVideoWithChannel` argument expects a video with channel populated. Main PeerTube code should never use `...Model` (`VideoModel`) database type, but always `M...` instead (`MVideo`, `MVideoChannel` etc).## Add a new feature walkthrough@@ -16,67 +16,67 @@ Some of these may be optional (for example your new endpoint may not need to sen* Configuration:- Add you new configuration key in `config/default.yaml` and `config/production.yaml`- If you configuration needs to be different in dev or tests environments, also update `config/dev.yaml` and `config/test.yaml`- - Load your configuration in `server/initializers/config.ts`- - Check new configuration keys are set in `server/initializers/checker-before-init.ts`- - You can also ensure configuration consistency in `server/initializers/checker-after-init.ts`+ - Load your configuration in `server/server/initializers/config.ts`+ - Check new configuration keys are set in `server/server/initializers/checker-before-init.ts`+ - You can also ensure configuration consistency in `server/server/initializers/checker-after-init.ts`- If you want your configuration to be available in the client:- + Add your field in `shared/models/server/server-config.model.ts`- + Update `server/lib/server-config-manager.ts` to include your new configuration+ + Add your field in `packages/models/server/server/server-config.model.ts`+ + Update `server/server/lib/server-config-manager.ts` to include your new configuration- If you want your configuration to be updatable by the web admin in the client:- + Add your field in `shared/models/server/custom-config.model.ts`- + Add the configuration to the config object in the `server/controllers/api/config.ts` controller+ + Add your field in `packages/models/server/server/custom-config.model.ts`+ + Add the configuration to the config object in the `server/server/controllers/api/config.ts` controller* Controllers:- Create the controller file and fill it with your REST API routes- Import and use your controller in the parent controller* Middlewares:- - Create your validator middleware in `server/middlewares/validators` that will be used by your controllers- - Add your new middleware file `server/middlewares/validators/index.ts` so it's easier to import- - Create the entry in `server/types/express.d.ts` to attach the database model loaded by your middleware to the express response+ - Create your validator middleware in `server/server/middlewares/validators` that will be used by your controllers+ - Add your new middleware file `server/server/middlewares/validators/index.ts` so it's easier to import+ - Create the entry in `server/server/types/express.d.ts` to attach the database model loaded by your middleware to the express response* Validators:- - Create your validators that will be used by your middlewares in `server/helpers/custom-validators`+ - Create your validators that will be used by your middlewares in `server/server/helpers/custom-validators`* Typescript models:- - Create the API models (request parameters or response) in `shared/models`+ - Create the API models (request parameters or response) in `packages/models`- Add your models in `index.ts` of current directory to facilitate the imports* Sequelize model (BDD):- If you need to create a new table:- + Create the Sequelize model in `server/models/`:+ + Create the Sequelize model in `server/server/models/`:* Create the `@Column`* Add some indexes if you need* Create static methods to load a specific from the database `loadBy...`* Create static methods to load a list of models from the database `listBy...`* Create the instance method `toFormattedJSON` that creates the JSON to send to the REST API from the model- + Add your new Sequelize model to `server/initializers/database.ts`- + Create a new file in `server/types` to define multiple versions of your Sequelize model depending on database associations- + Add this new file to `server/types/*/index.ts` to facilitate the imports+ + Add your new Sequelize model to `server/server/initializers/database.ts`+ + Create a new file in `server/server/types` to define multiple versions of your Sequelize model depending on database associations+ + Add this new file to `server/server/types/*/index.ts` to facilitate the imports+ Create database migrations:- * Create the migration file in `server/initializers/migrations` using raw SQL (copy the same SQL query as at PeerTube startup)- * Update `LAST_MIGRATION_VERSION` in `server/initializers/constants.ts`+ * Create the migration file in `server/server/initializers/migrations` using raw SQL (copy the same SQL query as at PeerTube startup)+ * Update `LAST_MIGRATION_VERSION` in `server/server/initializers/constants.ts`- If updating database schema (adding/removing/renaming a column):- + Update the sequelize models in `server/models/`+ + Update the sequelize models in `server/server/models/`+ Add migrations:* Create the migration file in `initializers/migrations` using Sequelize Query Interface (`.addColumn`, `.dropTable`, `.changeColumn`)- * Update `LAST_MIGRATION_VERSION` in `server/initializers/constants.ts`+ * Update `LAST_MIGRATION_VERSION` in `server/server/initializers/constants.ts`* Notifications:- - Create the new notification model in `shared/models/users/user-notification.model.ts`- - Create the notification logic in `server/lib/notifier/shared`:+ - Create the new notification model in `packages/models/users/user-notification.model.ts`+ - Create the notification logic in `server/server/lib/notifier/shared`:+ Email subject has a common prefix (defined by the admin in PeerTube configuration)- - Add your notification to `server/lib/notifier/notifier.ts`- - Create the email template in `server/lib/emails`:+ - Add your notification to `server/server/lib/notifier/notifier.ts`+ - Create the email template in `server/server/lib/emails`:+ A text version is automatically generated from the HTML+ The template usually extends `../common/grettings` that already says "Hi" and "Cheers". You just have to write the title and the content blocks that will be inserted in the appropriate places in the HTML template- If you need to associate a new table with `userNotification`:+ Associate the new table in `UserNotificationModel` (don't forget the index)- + Add the object property in the API model definition (`shared/models/users/user-notification.model.ts`)+ + Add the object property in the API model definition (`packages/models/users/user-notification.model.ts`)+ Add the object in `UserNotificationModel.toFormattedJSON`+ Handle this new notification type in client (`UserNotificationsComponent`)+ Handle the new object property in client model (`UserNotification`)* Tests:- - Create your command class in `shared/server-commands/` that will wrap HTTP requests to your new endpoint+ - Create your command class in `packages/server-commands/` that will wrap HTTP requests to your new endpoint- Add your command file in `index.ts` of current directory- - Instantiate your command class in `shared/server-commands/server/server.ts`- - Create your test file in `server/tests/api/check-params` to test middleware validators/authentification/user rights (offensive tests)- - Add it to `server/tests/api/check-params/index.ts`- - Create your test file in `server/tests/api` to test your new endpoints+ - Instantiate your command class in `packages/server-commands/server/server/server.ts`+ - Create your test file in `server/server/tests/api/check-params` to test middleware validators/authentification/user rights (offensive tests)+ - Add it to `server/server/tests/api/check-params/index.ts`+ - Create your test file in `server/server/tests/api` to test your new endpoints- Add it to `index.ts` of current directory- - Add your notification test in `server/tests/api/notifications`+ - Add your notification test in `server/server/tests/api/notifications`* Update REST API documentation in `support/doc/api/openapi.yaml`diff --git a/support/doc/development/tests.md b/support/doc/development/tests.mdindex 1c2589c8a9..2e4c6ff6a7 100644--- a/support/doc/development/tests.md+++ b/support/doc/development/tests.md@@ -8,7 +8,7 @@ Prepare PostgreSQL user so PeerTube can delete/create the test databases:sudo -u postgres createuser you_username --createdb --superuser```-Prepare databases:+Prepare the databases:```bashnpm run clean:server:test@@ -45,22 +45,19 @@ sudo apt-get install parallel libimage-exiftool-perl### Test-To run all test suites:+To run all test suites (can be long!):```bashnpm run test # See scripts/test.sh to run a particular suite```-Most of tests can be run using:+To run a specific test:```bash-TS_NODE_TRANSPILE_ONLY=true npm run mocha -- --timeout 30000 --exit -r ts-node/register -r tsconfig-paths/register --bail server/tests/api/videos/video-transcoder.ts-```--`server/tests/api/activitypub` tests will need different options:+npm run mocha -- --exit --bail packages/tests/src/your-test.ts-```-TS_NODE_FILES=true mocha -- --timeout 30000 --exit -r ts-node/register -r tsconfig-paths/register --bail server/tests/api/activitypub/security.ts+# For example+npm run mocha -- --exit --bail packages/tests/src/api/videos/single-server.ts```### Configurationdiff --git a/support/doc/plugins/guide.md b/support/doc/plugins/guide.mdindex ff08ce8c45..07f484934a 100644--- a/support/doc/plugins/guide.md+++ b/support/doc/plugins/guide.md@@ -387,7 +387,7 @@ function register (...) {displayName: 'User display name',// Custom admin flags (bypass video auto moderation etc.)- // https://github.com/Chocobozzz/PeerTube/blob/develop/shared/models/users/user-flag.model.ts+ // https://github.com/Chocobozzz/PeerTube/blob/develop/packages/models/users/user-flag.model.ts// PeerTube >= 5.1adminFlags: 0,// Quota in bytes@@ -977,7 +977,7 @@ npm install --save-dev @peertube/peertube-typesThis package exposes *server* definition files by default:```ts-import { RegisterServerOptions } from '@peertube/peertube-types'+import { RegisterServerOptions } from '@peertube/peertube-types.js'export async function register ({ registerHook }: RegisterServerOptions) {registerHook({@@ -989,8 +989,8 @@ export async function register ({ registerHook }: RegisterServerOptions) {But it also exposes client types and various models used in __PeerTube__:```ts-import { Video } from '@peertube/peertube-types';-import { RegisterClientOptions } from '@peertube/peertube-types/client';+import { Video } from '@peertube/peertube-types.js';+import { RegisterClientOptions } from '@peertube/peertube-types/client.js';function register({ registerHook, peertubeHelpers }: RegisterClientOptions) {registerHook({@@ -1032,7 +1032,7 @@ If you want to translate strings of your plugin (like labels of your registered}```-The key should be one of the locales defined in [i18n.ts](https://github.com/Chocobozzz/PeerTube/blob/develop/shared/models/i18n/i18n.ts).+The key should be one of the locales defined in [i18n.ts](https://github.com/Chocobozzz/PeerTube/blob/develop/packages/models/i18n/i18n.ts).Translation files are just objects, with the english sentence as the key and the translation as the value.`fr.json` could contain for example:@@ -1070,40 +1070,25 @@ You built files are in the `dist/` directory. Check `package.json` to correctly### Test your plugin/theme-PeerTube dev server (ran with `npm run dev` on `localhost:3000`) can't inject plugin CSS.-It's the reason why we don't use the dev mode but build PeerTube instead.+You need to have a running PeerTube instance with an administrator account.+If you're using dev server on your local computer, test your plugin on `localhost:9000` using `npm run dev` because plugin CSS is not injected in Angular webserver (`localhost:3000`).-You'll need to have a local PeerTube instance:- * Follow the [dev prerequisites](https://github.com/Chocobozzz/PeerTube/blob/develop/.github/CONTRIBUTING.md#prerequisites)- (to clone the repository, install dependencies and prepare the database)- * Build PeerTube:+Install PeerTube CLI (can be installed on another computer/server than the PeerTube instance):-```sh-npm run build-```-- * Build the CLI:--```sh-npm run setup:cli-```-- * Run PeerTube (you can access to your instance on `localhost:9000`):--```sh-NODE_ENV=dev npm start+```bash+npm install -g @peertube/peertube-cli```- * Register the instance via the CLI:+Register the PeerTube instance via the CLI:```sh-node ./dist/server/tools/peertube.js auth add -u 'http://localhost:9000' -U 'root' --password 'test'+peertube-cli auth add -u 'https://peertube.example.com' -U 'root' --password 'test'```-Then, you can install or reinstall your local plugin/theme by running:+Then, you can install your local plugin/theme by running:```sh-node ./dist/server/tools/peertube.js plugins install --path /your/absolute/plugin-or-theme/path+peertube-cli plugins install --path /your/absolute/plugin-or-theme/path```### Publishdiff --git a/support/doc/tools.md b/support/doc/tools.mdindex 2b3ebf159f..40d9ec66a2 100644--- a/support/doc/tools.md+++ b/support/doc/tools.md@@ -4,59 +4,48 @@## Remote PeerTube CLI-You need at least 512MB RAM to run the script.-Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.-You need to follow all the following steps even if you are on a PeerTube server (including cloning the git repository in a different directory than your production installation because the scripts utilize non-production dependencies).--### Dependencies--Install the [PeerTube dependencies](/support/doc/dependencies.md) except PostgreSQL and Redis.+`peertube-cli` is a tool that communicates with a PeerTube instance using its [REST API](https://docs.joinpeertube.org/api-rest-reference.html).+It can be launched from a remote server/computer to easily upload videos, manage plugins, redundancies etc.### Installation-Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):+Ensure you have `node` installed on your system:```bash-git clone https://github.com/Chocobozzz/PeerTube.git-CLONE="$(pwd)/PeerTube"-cd ${CLONE}+node --version # Should be >= 16.x```-Install dependencies and build CLI tools:+Then install the CLI:```bash-NOCLIENT=1 yarn install --pure-lockfile-npm run setup:cli+sudo npm install -g @peertube/peertube-cli```### CLI wrapper-The wrapper provides a convenient interface to the following scripts.-You can access it as `peertube` via an alias in your `.bashrc` like `alias peertube="cd /your/peertube/directory/ && node ./dist/server/tools/peertube.js"` (you have to keep the `cd` command):+The wrapper provides a convenient interface to the following sub-commands.```- Usage: peertube [command] [options]-- Options:+Usage: peertube-cli [command] [options]- -v, --version output the version number- -h, --help output usage information+Options:+ -v, --version output the version number+ -h, --help display help for command- Commands:-- auth [action] register your accounts on remote instances to use them with other commands- upload|up upload a video- import-videos|import import a video from a streaming platform- plugins|p [action] manage instance plugins- redundancy|r [action] manage video redundancies- help [cmd] display help for [cmd]+Commands:+ auth Register your accounts on remote instances to use them with other commands+ upload|up [options] Upload a video on a PeerTube instance+ redundancy|r Manage instance redundancies+ plugins|p Manage instance plugins/themes+ get-access-token|token [options] Get a peertube access token+ help [command] display help for command```The wrapper can keep track of instances you have an account on. We limit to one account per instance for now.```bash-peertube auth add -u 'PEERTUBE_URL' -U 'PEERTUBE_USER' --password 'PEERTUBE_PASSWORD'-peertube auth list+peertube-cli auth add -u 'PEERTUBE_URL' -U 'PEERTUBE_USER' --password 'PEERTUBE_PASSWORD'+peertube-cli auth list┌──────────────────────────────┬──────────────────────────────┐│ instance │ login │├──────────────────────────────┼──────────────────────────────┤@@ -64,124 +53,142 @@ peertube auth list└──────────────────────────────┴──────────────────────────────┘```-You can now use that account to upload videos without feeding the same parameters again.+You can now use that account to execute sub-commands without feeding the `--url`, `--username` and `--password` parameters:```bash-peertube up <videoFile>+peertube-cli upload <videoFile>+peertube-cli plugins list+...```-To list, install, uninstall dynamically plugins/themes of an instance:+#### peertube-cli upload++You can use this script to upload videos directly from the CLI.++Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).```bash-peertube plugins list-peertube plugins install --path /local/plugin/path-peertube plugins install --npm-name peertube-plugin-myplugin-peertube plugins uninstall --npm-name peertube-plugin-myplugin+cd ${CLONE}+peertube-cli upload --help```-#### peertube-import-videos.js+#### peertube-cli plugins++Install/update/uninstall or list local or NPM PeerTube plugins:-You can use this script to import videos from all [supported sites of youtube-dl](https://rg3.github.io/youtube-dl/supportedsites.html) into PeerTube.-Be sure you own the videos or have the author's authorization to do so.+```bash+cd ${CLONE}+peertube-cli plugins --help+peertube-cli plugins list --help+peertube-cli plugins install --help+peertube-cli plugins update --help+peertube-cli plugins uninstall --help-```sh-node dist/server/tools/peertube-import-videos.js \- -u 'PEERTUBE_URL' \- -U 'PEERTUBE_USER' \- --password 'PEERTUBE_PASSWORD' \- --target-url 'TARGET_URL'+peertube-cli plugins install --path /my/plugin/path+peertube-cli plugins install --npm-name peertube-theme-example```-* `PEERTUBE_URL` : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re-* `PEERTUBE_USER` : your PeerTube account where videos will be uploaded-* `PEERTUBE_PASSWORD` : password of your PeerTube account (if `--password PEERTUBE_PASSWORD` is omitted, you will be prompted for it)-* `TARGET_URL` : the target url you want to import. Examples:- * YouTube:- * Channel: https://www.youtube.com/channel/ChannelId- * User https://www.youtube.com/c/UserName or https://www.youtube.com/user/UserName- * Video https://www.youtube.com/watch?v=blabla- * Vimeo: https://vimeo.com/xxxxxx- * Dailymotion: https://www.dailymotion.com/xxxxx+#### peertube-cli redundancy-The script will get all public videos from Youtube, download them and upload to PeerTube.-Already downloaded videos will not be uploaded twice, so you can run and re-run the script in case of crash, disconnection...+Manage (list/add/remove) video redundancies:-Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).+To list your videos that are duplicated by remote instances:++```bash+peertube-cli redundancy list-remote-redundancies+```-**NB**: If you want to synchronize a Youtube channel to your PeerTube instance (ensure you have the agreement from the author),-you can add a [crontab rule](https://help.ubuntu.com/community/CronHowto) (or an equivalent of your OS) and insert-these rules (ensure to customize them to your needs):+To list remote videos that your instance duplicated:+```bash+peertube-cli redundancy list-my-redundancies+```++To duplicate a specific video in your redundancy system:++```bash+peertube-cli redundancy add --video 823```-# Update youtube-dl every day at midnight-0 0 * * * /usr/bin/npm rebuild youtube-dl --prefix /PATH/TO/PEERTUBE/-# Synchronize the YT channel every sunday at 22:00 all the videos published since last monday included-0 22 * * 0 /usr/bin/node /PATH/TO/PEERTUBE/dist/server/tools/peertube-import-videos.js -u '__PEERTUBE_URL__' -U '__USER__' --password '__PASSWORD__' --target-url 'https://www.youtube.com/channel/___CHANNEL__' --since $(date --date="-6 days" +\%Y-\%m-\%d)+To remove a video redundancy:++```bash+peertube-cli redundancy remove --video 823```-Also you may want to subscribe to the PeerTube channel in order to manually check the synchronization is successful.-#### peertube-upload.js+## PeerTube runner-You can use this script to import videos directly from the CLI.+PeerTube >= 5.2 supports VOD or Live transcoding by a remote PeerTube runner.-Videos will be publicly available after transcoding (you can see them before that in your account on the web interface).+### Installation++Ensure you have `node`, `ffmpeg` and `ffprobe` installed on your system:```bash-cd ${CLONE}-node dist/server/tools/peertube-upload.js --help+node --version # Should be >= 16.x+ffprobe -version # Should be >= 4.3+ffmpeg -version # Should be >= 4.3```-#### peertube-plugins.js--Install/update/uninstall or list local or NPM PeerTube plugins:+Then install the CLI:```bash-cd ${CLONE}-node dist/server/tools/peertube-plugins.js --help-node dist/server/tools/peertube-plugins.js list --help-node dist/server/tools/peertube-plugins.js install --help-node dist/server/tools/peertube-plugins.js update --help-node dist/server/tools/peertube-plugins.js uninstall --help+sudo npm install -g @peertube/peertube-runner+```++### Configuration++The runner uses env paths like `~/.config`, `~/.cache` and `~/.local/share` directories to store runner configuration or temporary files.++Multiple PeerTube runners can run on the same OS by using the `--id` CLI option (each runner uses its own config/tmp directories):-node dist/server/tools/peertube-plugins.js install --path /my/plugin/path-node dist/server/tools/peertube-plugins.js install --npm-name peertube-theme-example+```bash+peertube-runner [commands] --id instance-1+peertube-runner [commands] --id instance-2+peertube-runner [commands] --id instance-3```-#### peertube-redundancy.js+You can change the runner configuration (jobs concurrency, ffmpeg threads/nice etc) by editing `~/.config/peertube-runner-nodejs/[id]/config.toml`.-Manage (list/add/remove) video redundancies:+### Run the server-To list your videos that are duplicated by remote instances:+You need to run the runner in server mode first so it can run transcoding jobs of registered PeerTube instances:```bash-node dist/server/tools/peertube.js redundancy list-remote-redundancies+peertube-runner server```-To list remote videos that your instance duplicated:+### Register++Then, you can register the runner to process transcoding job of a remote PeerTube instance:```bash-node dist/server/tools/peertube.js redundancy list-my-redundancies+peertube-runner register --url http://peertube.example.com --registration-token ptrrt-... --runner-name my-runner-name```-To duplicate a specific video in your redundancy system:+The runner will then use a websocket connection with the PeerTube instance to be notified about new available transcoding jobs.++### Unregister++To unregister a PeerTube instance:```bash-node dist/server/tools/peertube.js redundancy add --video 823+peertube-runner unregister --url http://peertube.example.com --runner-name my-runner-name```-To remove a video redundancy:+### List registered instances```bash-node dist/server/tools/peertube.js redundancy remove --video 823+peertube-runner list-registered```## Server tools-These scripts should be run on the server, in `peertube-latest` directory.+Server tools are scripts that interect directly with the code of your PeerTube instance.+They must be run on the server, in `peertube-latest` directory.-### parse-log+### Parse logsTo parse PeerTube last log file:@@ -209,9 +216,7 @@ cd /var/www/peertube-dockerdocker-compose exec -u peertube peertube npm run parse-log -- --level debug --not-tags http sql```-### regenerate-thumbnails.js--**PeerTube >= 3.2**+### Regenerate video thumbnailsRegenerating local video thumbnails could be useful because new PeerTube releases may increase thumbnail sizes:@@ -225,7 +230,7 @@ cd /var/www/peertube-dockerdocker-compose exec -u peertube peertube npm run regenerate-thumbnails```-### create-import-video-file-job.js+### Add or replace specific video fileYou can use this script to import a video file to replace an already uploaded file or to add a new web compatible resolution to a video. PeerTube needs to be running.You can then create a transcoding job using the web interface if you need to optimize your file or create an HLS version of it.@@ -240,9 +245,7 @@ cd /var/www/peertube-dockerdocker-compose exec -u peertube peertube npm run create-import-video-file-job -- -v [videoUUID] -i [videoFile]```-### create-move-video-storage-job.js--**PeerTube >= 4.0**+### Move video files to object storageUse this script to move all video files or a specific video file to object storage.@@ -269,7 +272,7 @@ docker-compose exec -u peertube peertube npm run create-move-video-storage-job -```<!-- TODO: uncomment when PeerTube 6 is released-### create-generate-storyboard-job+### Generate storyboard**PeerTube >= 6.0**@@ -298,7 +301,7 @@ docker-compose exec -u peertube peertube npm run create-generate-storyboard-job```-->-### prune-storage.js+### Prune filesystem storageSome transcoded videos or shutdown at a bad time can leave some unused files on your storage.Stop PeerTube and delete these files (a confirmation will be demanded first):@@ -308,8 +311,7 @@ cd /var/www/peertube/peertube-latestsudo systemctl stop peertube && sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run prune-storage```--### update-host.js+### Update PeerTube instance domain name**Changing the hostname is unsupported and may be a risky operation, especially if you have already federated.**If you started PeerTube with a domain, and then changed it you will have@@ -326,7 +328,7 @@ cd /var/www/peertube-dockerdocker-compose exec -u peertube peertube npm run update-host```-### reset-password.js+### Reset user passwordTo reset a user password from CLI, run:@@ -341,7 +343,7 @@ docker-compose exec -u peertube peertube npm run reset-password -- -u target_use```-### plugin install/uninstall+### Install or uninstall pluginsThe difference with `peertube plugins` CLI is that these scripts can be used even if PeerTube is not running.If PeerTube is running, you need to restart it for the changes to take effect (whereas with `peertube plugins` CLI, plugins/themes are dynamically loaded on the server).@@ -378,69 +380,3 @@ sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npcd /var/www/peertube-dockerdocker-compose exec -u peertube peertube npm run plugin:uninstall -- --npm-name peertube-plugin-myplugin```--## PeerTube runner--PeerTube >= 5.2 supports VOD or Live transcoding by a remote PeerTube runner.---### Installation--Ensure you have `ffmpeg` and `ffprobe` installed on your system:--```bash-ffprobe -version # Should be >= 4.3-ffmpeg -version # Should be >= 4.3-```--Then install the CLI:--```bash-sudo npm install -g @peertube/peertube-runner-```--### Configuration--The runner uses env paths like `~/.config`, `~/.cache` and `~/.local/share` directories to store runner configuration or temporary files.--Multiple PeerTube runners can run on the same OS by using the `--id` CLI option (each runner uses its own config/tmp directories):--```bash-peertube-runner [commands] --id instance-1-peertube-runner [commands] --id instance-2-peertube-runner [commands] --id instance-3-```--You can change the runner configuration (jobs concurrency, ffmpeg threads/nice etc) by editing `~/.config/peertube-runner-nodejs/[id]/config.toml`.--### Run the server--You need to run the runner in server mode first so it can run transcoding jobs of registered PeerTube instances:--```bash-peertube-runner server-```--### Register--Then, you can register the runner to process transcoding job of a remote PeerTube instance:--```bash-peertube-runner register --url http://peertube.example.com --registration-token ptrrt-... --runner-name my-runner-name-```--The runner will then use a websocket connection with the PeerTube instance to be notified about new available transcoding jobs.--### Unregister--To unregister a PeerTube instance:--```bash-peertube-runner unregister --url http://peertube.example.com --runner-name my-runner-name-```--### List registered instances--```bash-peertube-runner list-registered-```diff --git a/support/nginx/peertube b/support/nginx/peertubeindex 5ce59a1121..7028566c7f 100644--- a/support/nginx/peertube+++ b/support/nginx/peertube@@ -183,7 +183,7 @@ server {#client_body_temp_path /var/www/peertube/storage/nginx/;# Bypass PeerTube for performance reasons. Optional.- # Should be consistent with client-overrides assets list in /server/controllers/client.ts+ # Should be consistent with client-overrides assets list in client.ts server controllerlocation ~ ^/client/(assets/images/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png|default-playlist\.jpg|default-avatar-account\.png|default-avatar-account-48x48\.png|default-avatar-video-channel\.png|default-avatar-video-channel-48x48\.png))$ {add_header Cache-Control "public, max-age=31536000, immutable"; # Cache 1 yeardiff --git a/tsconfig.base.json b/tsconfig.base.jsonindex 18ba8f06c8..cce74235bc 100644--- a/tsconfig.base.json+++ b/tsconfig.base.json@@ -1,11 +1,12 @@{"compilerOptions": {- "module": "commonjs",- "target": "es2015",+ "module": "NodeNext",+ "target": "ES2017","noImplicitAny": false,"sourceMap": true,"experimentalDecorators": true,"emitDecoratorMetadata": true,+ "isolatedModules": true,"importHelpers": true,"removeComments": true,"esModuleInterop": true,@@ -19,11 +20,6 @@"es2019"],"baseUrl": "./",- "paths": {- "@server/*": [ "server/*" ],- "@shared/*": [ "shared/*" ],- "@client/*": [ "client/src/*" ]- },"resolveJsonModule": true,"strict": false,"strictBindCallApply": true,diff --git a/tsconfig.eslint.json b/tsconfig.eslint.jsonnew file mode 100644index 0000000000..c2e8681735--- /dev/null+++ b/tsconfig.eslint.json@@ -0,0 +1,32 @@+{+ "extends": "./tsconfig.base.json",+ "compilerOptions": {+ "outDir": "./dist/",+ "baseUrl": "./",+ "paths": {+ "@server/*": [ "server/*" ]+ },+ "typeRoots": [+ "node_modules/@types"+ ]+ },+ "include": [+ "./server.ts",+ "server/**/*.ts",+ "packages/**/*.ts",+ "apps/**/*.ts",+ "scripts/**/*.ts"+ ],+ "references": [+ { "path": "./server" },+ { "path": "./scripts" },+ { "path": "./apps/peertube-runner" },+ { "path": "./apps/peertube-cli" },+ { "path": "./packages/core-utils" },+ { "path": "./packages/ffmpeg" },+ { "path": "./packages/models" },+ { "path": "./packages/node-utils" },+ { "path": "./packages/server-commands" },+ { "path": "./packages/typescript-utils" }+ ]+}diff --git a/tsconfig.json b/tsconfig.jsondeleted file mode 100644index 8bcd944e3c..0000000000--- a/tsconfig.json+++ /dev/null@@ -1,20 +0,0 @@-{- "extends": "./tsconfig.base.json",- "compilerOptions": {- "outDir": "./dist/",- "baseUrl": "./",- "paths": {- "@server/*": [ "server/*" ],- "@shared/*": [ "shared/*" ]- },- "typeRoots": [- "node_modules/@types"- ]- },- "references": [- { "path": "./shared" },- { "path": "./server" },- { "path": "./scripts" }- ],- "files": [ "server.ts", "server/types/express.d.ts", "server/types/lib.d.ts" ]-}diff --git a/yarn.lock b/yarn.lockindex 2686c4d4ae..e9c5c22d1b 100644--- a/yarn.lock+++ b/yarn.lock@@ -1269,12 +1269,10 @@resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==-"@cspotcode/source-map-support@^0.8.0":- version "0.8.1"- resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1"- integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==- dependencies:- "@jridgewell/trace-mapping" "0.3.9"+"@commander-js/extra-typings@^11.0.0":+ version "11.0.0"+ resolved "https://registry.yarnpkg.com/@commander-js/extra-typings/-/extra-typings-11.0.0.tgz#eb922a59550454cad1f319d3d33e675e12e92fa0"+ integrity sha512-06ol6Kn5gPjFY6v0vWOZ84nQwyqhZdaeZCHYH3vhwewjpOEjniF1KHZxh18887G3poWiJ8qyq5pb6ANuiddfPQ=="@dabh/diagnostics@^2.0.2":version "2.0.3"@@ -1294,6 +1292,250 @@ky-universal "^0.11.0"undici "^5.21.2"+"@esbuild-kit/cjs-loader@^2.4.2":+ version "2.4.2"+ resolved "https://registry.yarnpkg.com/@esbuild-kit/cjs-loader/-/cjs-loader-2.4.2.tgz#cb4dde00fbf744a68c4f20162ea15a8242d0fa54"+ integrity sha512-BDXFbYOJzT/NBEtp71cvsrGPwGAMGRB/349rwKuoxNSiKjPraNNnlK6MIIabViCjqZugu6j+xeMDlEkWdHHJSg==+ dependencies:+ "@esbuild-kit/core-utils" "^3.0.0"+ get-tsconfig "^4.4.0"++"@esbuild-kit/core-utils@^3.0.0":+ version "3.1.0"+ resolved "https://registry.yarnpkg.com/@esbuild-kit/core-utils/-/core-utils-3.1.0.tgz#49945d533dbd5e1b7620aa0fc522c15e6ec089c5"+ integrity sha512-Uuk8RpCg/7fdHSceR1M6XbSZFSuMrxcePFuGgyvsBn+u339dk5OeL4jv2EojwTN2st/unJGsVm4qHWjWNmJ/tw==+ dependencies:+ esbuild "~0.17.6"+ source-map-support "^0.5.21"++"@esbuild-kit/esm-loader@^2.5.5":+ version "2.5.5"+ resolved "https://registry.yarnpkg.com/@esbuild-kit/esm-loader/-/esm-loader-2.5.5.tgz#b82da14fcee3fc1d219869756c06f43f67d1ca71"+ integrity sha512-Qwfvj/qoPbClxCRNuac1Du01r9gvNOT+pMYtJDapfB1eoGN1YlJ1BixLyL9WVENRx5RXgNLdfYdx/CuswlGhMw==+ dependencies:+ "@esbuild-kit/core-utils" "^3.0.0"+ get-tsconfig "^4.4.0"++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd"+ integrity sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.0.tgz#c5ea635bdbe9b83d1f78a711120814e716439029"+ integrity sha512-AzsozJnB+RNaDncBCs3Ys5g3kqhPFUueItfEaCpp89JH2naFNX2mYDIvUgPYMqqjm8hiFoo+jklb3QHZyR3ubw==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d"+ integrity sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.0.tgz#6eb6e1fbc0dbfafa035aaef8b5ecde25b539fcf9"+ integrity sha512-GAkjUyHgWTYuex3evPd5V7uV/XS4LMKr1PWHRPW1xNyy/Jx08x3uTrDFRefBYLKT/KpaWM8/YMQcwbp5a3yIDA==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1"+ integrity sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.0.tgz#99f154f71f5b92e778468bcf0f425d166c17bf20"+ integrity sha512-SUG8/qiVhljBDpdkHQ9DvOWbp7hFFIP0OzxOTptbmVsgBgzY6JWowmMd6yJuOhapfxmj/DrvwKmjRLvVSIAKZg==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz#584c34c5991b95d4d48d333300b1a4e2ff7be276"+ integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.0.tgz#2fcc11abf95fbabbf9167db6a11d899385bd777b"+ integrity sha512-HkxZ8k3Jvcw0FORPNTavA8BMgQjLOB6AajT+iXmil7BwY3gU1hWvJJAyWyEogCmA4LdbGvKF8vEykdmJ4xNJJQ==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb"+ integrity sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.0.tgz#b5bbde35468db093fdf994880b0eb4b62613b67c"+ integrity sha512-9IRWJjqpWFHM9a5Qs3r3bK834NCFuDY5ZaLrmTjqE+10B6w65UMQzeZjh794JcxpHolsAHqwsN/33crUXNCM2Q==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2"+ integrity sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.0.tgz#3f64c76dc590f79cc40acef6b22dd5eb89fc2125"+ integrity sha512-s7i2WcXcK0V1PJHVBe7NsGddsL62a9Vhpz2U7zapPrwKoFuxPP9jybwX8SXnropR/AOj3ppt2ern4ItblU6UQQ==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4"+ integrity sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.0.tgz#14d497e9e858fba2bb9b16130602b7f5944bc09c"+ integrity sha512-NMdBSSdgwHCqCsucU5k1xflIIRU0qi1QZnM6+vdGy5fvxm1c8rKh50VzsWsIVTFUG3l91AtRxVwoz3Lcvy3I5w==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb"+ integrity sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.0.tgz#0f2f4d8889f7dc89681c306d7312aa76445a5f65"+ integrity sha512-I4zvE2srSZxRPapFnNqj+NL3sDJ1wkvEZqt903OZUlBBgigrQMvzUowvP/TTTu2OGYe1oweg5MFilfyrElIFag==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a"+ integrity sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.0.tgz#0b0f79dc72884f0ad02c0aabfc969a0bee7f6775"+ integrity sha512-2F1+lH7ZBcCcgxiSs8EXQV0PPJJdTNiNcXxDb61vzxTRJJkXX1I/ye9mAhfHyScXzHaEibEXg1Jq9SW586zz7w==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a"+ integrity sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.0.tgz#dfcece1f5e74d0e7db090475e48b28d9aa270687"+ integrity sha512-dz2Q7+P92r1Evc8kEN+cQnB3qqPjmCrOZ+EdBTn8lEc1yN8WDgaDORQQiX+mxaijbH8npXBT9GxUqE52Gt6Y+g==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72"+ integrity sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.0.tgz#710f5bd55db3f5d9ebac8773ea49795261a35ca7"+ integrity sha512-IcVJovJVflih4oFahhUw+N7YgNbuMSVFNr38awb0LNzfaiIfdqIh518nOfYaNQU3aVfiJnOIRVJDSAP4k35WxA==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289"+ integrity sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.0.tgz#a918b310f9bf31fced3853ca52fee6e7acc09824"+ integrity sha512-bZGRAGySMquWsKw0gIdsClwfvgbsSq/7oq5KVu1H1r9Il+WzOcfkV1hguntIuBjRVL8agI95i4AukjdAV2YpUw==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7"+ integrity sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.0.tgz#104771ef6ce2719ac17031f6b9ed8aa98f8e5faf"+ integrity sha512-3LC6H5/gCDorxoRBUdpLV/m7UthYSdar0XcCu+ypycQxMS08MabZ06y1D1yZlDzL/BvOYliRNRWVG/YJJvQdbg==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09"+ integrity sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.0.tgz#83beafa472ad4224adcd4d7469e3a17ba1fbd976"+ integrity sha512-jfvdKjWk+Cp2sgLtEEdSHXO7qckrw2B2eFBaoRdmfhThqZs29GMMg7q/LsQpybA7BxCLLEs4di5ucsWzZC5XPA==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829"+ integrity sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.0.tgz#edc26cb41d8745716bda9c26bac1f0001eaad029"+ integrity sha512-ofcucfNLkoXmcnJaw9ugdEOf40AWKGt09WBFCkpor+vFJVvmk/8OPjl/qRtks2Z7BuZbG3ztJuK1zS9z5Cgx9A==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4"+ integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.0.tgz#80a6b5e55ad454e0c0af5bdb267335287e331007"+ integrity sha512-Fpf7zNDBti3xrQKQKLdXT0hTyOxgFdRJIMtNy8x1az9ATR9/GJ1brYbB/GLWoXhKiHsoWs+2DLkFVNNMTCLEwA==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462"+ integrity sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.0.tgz#2e6e8d869b58aea34bab9c0c47f15ae1bda29a90"+ integrity sha512-AMQAp/5oENgDOvVhvOlbhVe1pWii7oFAMRHlmTjSEMcpjTpIHtFXhv9uAFgUERHm3eYtNvS9Vf+gT55cwuI6Aw==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691"+ integrity sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.0.tgz#ca0817d3ab332afb0d8d96a2eb42b4d8ebaa8715"+ integrity sha512-fDztEve1QUs3h/Dw2AUmBlWGkNQbhDoD05ppm5jKvzQv+HVuV13so7m5RYeiSMIC2XQy7PAjZh+afkxAnCRZxA==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273"+ integrity sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.0.tgz#8de27de2563cb3eb6c1af066b6d7fcb1229fe3d4"+ integrity sha512-bKZzJ2/rvUjDzA5Ddyva2tMk89WzNJEibZEaq+wY6SiqPlwgFbqyQLimouxLHiHh1itb5P3SNCIF1bc2bw5H9w==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f"+ integrity sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.0.tgz#67c2b410ff8862be2cd61145ad21e11be00fb914"+ integrity sha512-NQJ+4jmnA79saI+sE+QzcEls19uZkoEmdxo7r//PDOjIpX8pmoWtTnWg6XcbnO7o4fieyAwb5U2LvgWynF4diA==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03"+ integrity sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.0.tgz#cac8992219c6d943bb22226e4afeb3774a29cca1"+ integrity sha512-uyxiZAnsfu9diHm9/rIH2soecF/HWLXYUhJKW4q1+/LLmNQ+55lRjvSUDhUmsgJtSUscRJB/3S4RNiTb9o9mCg==++"@esbuild/[email protected]":+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061"+ integrity sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==++"@esbuild/[email protected]":+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.0.tgz#fa5f12c96811cec3233a53bdbf61d1a05ba9018f"+ integrity sha512-jl+NXUjK2StMgqnZnqgNjZuerFG8zQqWXMBZdMMv4W/aO1ZKQaYWZBxTrtWKphkCBVEMh0wMVfGgOd2BjOZqUQ==+"@eslint-community/eslint-utils@^4.1.2", "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":version "4.4.0"resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"@@ -1634,11 +1876,6 @@resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==-"@jridgewell/resolve-uri@^3.0.3":- version "3.1.1"- resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721"- integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==-"@jridgewell/set-array@^1.0.1":version "1.1.2"resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"@@ -1654,14 +1891,6 @@resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==-"@jridgewell/[email protected]":- version "0.3.9"- resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9"- integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==- dependencies:- "@jridgewell/resolve-uri" "^3.0.3"- "@jridgewell/sourcemap-codec" "^1.4.10"-"@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9":version "0.3.18"resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6"@@ -1828,176 +2057,196 @@resolved "https://registry.yarnpkg.com/@opentelemetry/api/-/api-1.4.1.tgz#ff22eb2e5d476fbc2450a196e40dd243cc20c28f"integrity sha512-O2yRJce1GOc6PAy3QxFM4NzFiWzvScDC1/5ihYBL6BUEVdq0XMWN01sppE+H6bBXbaFYipjwFLEWLg5PaSOThA==-"@opentelemetry/[email protected]":- version "1.13.0"- resolved "https://registry.yarnpkg.com/@opentelemetry/context-async-hooks/-/context-async-hooks-1.13.0.tgz#b697317c1670eaa9b1c23201d09dd29250dcc8fa"- integrity sha512-pS5fU4lrRjOIPZQqA2V1SUM9QUFXbO+8flubAiy6ntLjnAjJJUdRFOUOxK6v86ZHI2p2S8A0vD0BTu95FZYvjA==+"@opentelemetry/[email protected]":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/context-async-hooks/-/context-async-hooks-1.15.1.tgz#694798afeb83eab5fe31c6e15762815b27615c65"+ integrity sha512-JHPs/o15OO902lI5jkWWPz0JyOpQav7hfOY20MZFH/elq6kSvjBTw5cCu1v7SJwN0Ac3n08fOjYK+jtNlYP0LA==-"@opentelemetry/[email protected]", "@opentelemetry/core@^1.8.0":+"@opentelemetry/[email protected]", "@opentelemetry/core@^1.1.0", "@opentelemetry/core@^1.13.0":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/core/-/core-1.15.1.tgz#a580a547c1006cc411ae7aacd4991b52555b3f1d"+ integrity sha512-V6GoRTY6aANMDDOQ9CiHOiLWEK2b2b3OGZK+zk05Li5merb9jadFeV5ooTSGtjxfxVNMpQUaQERO1cdbdbeEGg==+ dependencies:+ "@opentelemetry/semantic-conventions" "1.15.1"++"@opentelemetry/core@^1.8.0":version "1.13.0"resolved "https://registry.yarnpkg.com/@opentelemetry/core/-/core-1.13.0.tgz#7cdcb4176d260d279b0aa31456c4ce2ba7f410aa"integrity sha512-2dBX3Sj99H96uwJKvc2w9NOiNgbvAO6mOFJFramNkKfS9O4Um+VWgpnlAazoYjT6kUJ1MP70KQ5ngD4ed+4NUw==dependencies:"@opentelemetry/semantic-conventions" "1.13.0"-"@opentelemetry/exporter-jaeger@^1.3.1":- version "1.13.0"- resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-jaeger/-/exporter-jaeger-1.13.0.tgz#e96436438d3f8cc7b262ab4e517d55f96f413161"- integrity sha512-ke/STs/erRDqKmNv6Dv+5SetXsVD+Zm1/Wo8cLdAGrZn6kG6Fyp5EXVO/BJuzx6q+jHCdODm8jV4veXl4m71nQ==+"@opentelemetry/exporter-jaeger@^1.15.1":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-jaeger/-/exporter-jaeger-1.15.1.tgz#2081eae6ea7906ff39ad82b4aeed0f8913692fe9"+ integrity sha512-Rh+0OQXeOzyTpDJ48+iJRIp7Sq1RKTycG9seoiBecwxyevnNLPghAZvj/DgOc7SGK8kmK2CQ0aqkhBE3kT6hKw==dependencies:- "@opentelemetry/core" "1.13.0"- "@opentelemetry/sdk-trace-base" "1.13.0"- "@opentelemetry/semantic-conventions" "1.13.0"+ "@opentelemetry/core" "1.15.1"+ "@opentelemetry/sdk-trace-base" "1.15.1"+ "@opentelemetry/semantic-conventions" "1.15.1"jaeger-client "^3.15.0"-"@opentelemetry/exporter-prometheus@~0.39.1":- version "0.39.1"- resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-prometheus/-/exporter-prometheus-0.39.1.tgz#2ce574e54faae628a260579b4ffa7b73456fb331"- integrity sha512-FRedkVIUgLApKd9aF7cpflXzXRkHxKiV9pJwvY8dqk9amP5QuZKZgP3d+2L1IIKe10+JbcKIrijddZnT9jID2g==+"@opentelemetry/exporter-prometheus@~0.41.1":+ version "0.41.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/exporter-prometheus/-/exporter-prometheus-0.41.1.tgz#1721c918908f71cdfc5174bb8d2fa0b59eb760e9"+ integrity sha512-6XpRLbzZ0AWmECSa3mpHcN7E5ilfUf2dbBB0VhdnNvTycBnLNMbFFJ06lVVLFLg8BgnxH+S30KaPP8Jng979pA==dependencies:- "@opentelemetry/core" "1.13.0"- "@opentelemetry/resources" "1.13.0"- "@opentelemetry/sdk-metrics" "1.13.0"+ "@opentelemetry/core" "1.15.1"+ "@opentelemetry/resources" "1.15.1"+ "@opentelemetry/sdk-metrics" "1.15.1"-"@opentelemetry/instrumentation-dns@^0.31.2":- version "0.31.4"- resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-dns/-/instrumentation-dns-0.31.4.tgz#515dc3afac32fdf192e3b91553baade738634145"- integrity sha512-TUNybmyCYxKQwvFo+6gzaTBYP5aO9i2wqo/gBCAgd/TnHZzzEpRl4PZIwU1qzNRTcHUzpHXYA05F7GyQGebEVw==+"@opentelemetry/instrumentation-dns@^0.32.0":+ version "0.32.0"+ resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-dns/-/instrumentation-dns-0.32.0.tgz#2262e6b68bb415508cde4958b914a17ea5356c0b"+ integrity sha512-Q6RHePHnMQdKsAKzKvPSN0nPfKVlzFlbPa9/nb3r0FhThCP/Ucjob138X4LEDy0ZyZs3mq8Vqr9riyyRHIW6iA==dependencies:- "@opentelemetry/instrumentation" "^0.39.1"+ "@opentelemetry/instrumentation" "^0.41.0""@opentelemetry/semantic-conventions" "^1.0.0"semver "^7.3.2"+ tslib "^2.3.1"-"@opentelemetry/instrumentation-express@^0.32.1":- version "0.32.3"- resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-express/-/instrumentation-express-0.32.3.tgz#cd381cbcf048146731f407ce7aaef19e272ae197"- integrity sha512-/A9eJAA7XXj6GkktlsM9YKORQiIpgFRZT3J79MEGNbMwNHTPh4sOuzjAnARcpUQ3JKuYs7T98fs35aRH+Ms43w==+"@opentelemetry/instrumentation-express@^0.33.0":+ version "0.33.0"+ resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-express/-/instrumentation-express-0.33.0.tgz#d972ef43420759761f7dbfe78a6ae159cd925a69"+ integrity sha512-Cem3AssubzUoBK5ab89rBt2kY90i/FFyQwMC9wPjBQldkOaT4cR+5ufvWritXRfoPltqEeX2imLavujNH6EzCw==dependencies:"@opentelemetry/core" "^1.8.0"- "@opentelemetry/instrumentation" "^0.39.1"+ "@opentelemetry/instrumentation" "^0.41.0""@opentelemetry/semantic-conventions" "^1.0.0""@types/express" "4.17.13"+ tslib "^2.3.1"-"@opentelemetry/instrumentation-fs@^0.7.0":- version "0.7.3"- resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-fs/-/instrumentation-fs-0.7.3.tgz#3fd631f0606ea25fc08936b7e8a89f6eb3571cb3"- integrity sha512-GUJvcU6/lZI4gpA3Mu7FP7hVHYk9IS6C2gGJlEhzzBOrStIw+xWzupFbra+sA2+ds1IPDUdAOBvNp0fhBrou5A==+"@opentelemetry/instrumentation-fs@^0.8.0":+ version "0.8.0"+ resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-fs/-/instrumentation-fs-0.8.0.tgz#63d6936b7e5d3de6aeffb4a37b0c5f65accd132c"+ integrity sha512-uZMLqy1LKkLlRKC84HkjU3DYmVixTzRlxdfINHFyStBEEw345fI4xPs0cXg1KcQDoxWscFyX2nhB/Q6cpHurbA==dependencies:"@opentelemetry/core" "^1.8.0"- "@opentelemetry/instrumentation" "^0.39.1"+ "@opentelemetry/instrumentation" "^0.41.0""@opentelemetry/semantic-conventions" "^1.0.0"+ tslib "^2.3.1"-"@opentelemetry/instrumentation-http@^0.39.1":- version "0.39.1"- resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-http/-/instrumentation-http-0.39.1.tgz#1bc63d4773fe7996a933a1351877e9a6ea73859a"- integrity sha512-JX1HTvNOqqel2fuMSRiSzFREyk2iMQ2B4/1Y46AGa0u6i4XQRCbCuy64FZ1YYMrQ2e5P917iiGrEUFkB+33Tlw==+"@opentelemetry/instrumentation-http@^0.41.1":+ version "0.41.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-http/-/instrumentation-http-0.41.1.tgz#94bc5df488db9f46d65ce22d83bf7dbe256205bd"+ integrity sha512-fhLBlSxTg+jw5HZVzOvH4tIUQHJkP8L2dyYYXu60sppYZHFVltL/DyfoMErdq5cSn97WHWfRqnbYrG0wlPJedA==dependencies:- "@opentelemetry/core" "1.13.0"- "@opentelemetry/instrumentation" "0.39.1"- "@opentelemetry/semantic-conventions" "1.13.0"- semver "^7.3.5"+ "@opentelemetry/core" "1.15.1"+ "@opentelemetry/instrumentation" "0.41.1"+ "@opentelemetry/semantic-conventions" "1.15.1"+ semver "^7.5.1"-"@opentelemetry/instrumentation-ioredis@^0.34.2":- version "0.34.2"- resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-ioredis/-/instrumentation-ioredis-0.34.2.tgz#3810c34cd30bd39523fcaae6c6250048f92eb5ad"- integrity sha512-tlXYJzBUytjN3UbFFVxuCJkZc6y/OmeAuH4VKoCV1fwx8iveQar1I9+mzf6H2Ur8CnzoCv4cq7bEhZAJepLN8g==+"@opentelemetry/instrumentation-ioredis@^0.35.0":+ version "0.35.0"+ resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-ioredis/-/instrumentation-ioredis-0.35.0.tgz#aa6fb1ff9965980e407950bc44f6e5127eb877df"+ integrity sha512-tdM1BkrYmx+fXH+t1DViTXqFr9LUJHl0Qdcr6G8PjscsK+bVssSHhi5a3zYPFFFHpjks1mXMZHMr/Vsj2hNQAw==dependencies:- "@opentelemetry/instrumentation" "^0.39.1"- "@opentelemetry/redis-common" "^0.35.1"+ "@opentelemetry/instrumentation" "^0.41.0"+ "@opentelemetry/redis-common" "^0.36.0""@opentelemetry/semantic-conventions" "^1.0.0""@types/ioredis4" "npm:@types/ioredis@^4.28.10"+ tslib "^2.3.1"-"@opentelemetry/instrumentation-pg@^0.35.2":- version "0.35.2"- resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-pg/-/instrumentation-pg-0.35.2.tgz#2eb56e24318aa67f8b8a3ac4d8314a1622385c82"- integrity sha512-DsRHUgacDZKc2obohpgCeVSyew3lWH7QHqk6awfz/e2/i+Zl6KvhcOUH3H3pFbcXScWliJlLlNa8XE6omFiI/Q==+"@opentelemetry/instrumentation-pg@^0.36.0":+ version "0.36.0"+ resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-pg/-/instrumentation-pg-0.36.0.tgz#43270d2849a0e074ec6eb705dc12216e5c7cc84c"+ integrity sha512-S9RmzTILWTl7AVfdp/e8lWQTlpwrpoPbpxAfEJ1ENzTlPMmdw0jWPAQTgrTLQa6cpzhiypDHts3g2b6hc1zFYQ==dependencies:"@opentelemetry/core" "^1.8.0"- "@opentelemetry/instrumentation" "^0.39.1"+ "@opentelemetry/instrumentation" "^0.41.0""@opentelemetry/semantic-conventions" "^1.0.0"+ "@opentelemetry/sql-common" "^0.40.0""@types/pg" "8.6.1""@types/pg-pool" "2.0.3"+ tslib "^2.3.1"-"@opentelemetry/[email protected]", "@opentelemetry/instrumentation@^0.39.1":- version "0.39.1"- resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation/-/instrumentation-0.39.1.tgz#46d03b4c7ce9f8d08f575d756acc801fa1283615"- integrity sha512-s7/9tPmM0l5KCd07VQizC4AO2/5UJdkXq5gMSHPdCeiMKSeBEdyDyQX7A+Cq+RYZM452qzFmrJ4ut628J5bnSg==+"@opentelemetry/[email protected]", "@opentelemetry/instrumentation@^0.41.0", "@opentelemetry/instrumentation@^0.41.1":+ version "0.41.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation/-/instrumentation-0.41.1.tgz#20b8b1b15812a18acfa3b744abf90223b1d26eb0"+ integrity sha512-IsOidIIgI7Sg2NhWGYRZRifiv9kLyrxT89hBK1YVPDetuBEBUgFzD5VXdwqwfOKL3kgT4KiERMmLJ8gqig0o1A==dependencies:- require-in-the-middle "^7.1.0"- semver "^7.3.2"+ "@types/shimmer" "^1.0.2"+ import-in-the-middle "1.4.1"+ require-in-the-middle "^7.1.1"+ semver "^7.5.1"shimmer "^1.2.1"-"@opentelemetry/instrumentation@^0.35.1":- version "0.35.1"- resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation/-/instrumentation-0.35.1.tgz#065bdbc4771137347e648eb4c6c6de6e9e97e4d1"- integrity sha512-EZsvXqxenbRTSNsft6LDcrT4pjAiyZOx3rkDNeqKpwZZe6GmZtsXaZZKuDkJtz9fTjOGjDHjZj9/h80Ya9iIJw==+"@opentelemetry/[email protected]":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/propagator-b3/-/propagator-b3-1.15.1.tgz#d3c625d18945c9fd501ed7e2a628f56d0a80c378"+ integrity sha512-Rgzp5CgxSLDLdtiUx/nv+1jkyyU/qbhTqTBxMUvk4fqPfddzQNZyllyJ9IMNp9Xh4pzYlPP5ZBlN5Sw5isjuaw==dependencies:- require-in-the-middle "^5.0.3"- semver "^7.3.2"- shimmer "^1.2.1"+ "@opentelemetry/core" "1.15.1"-"@opentelemetry/[email protected]":- version "1.13.0"- resolved "https://registry.yarnpkg.com/@opentelemetry/propagator-b3/-/propagator-b3-1.13.0.tgz#30a19a24e61ae8dbc26c2d7d7d3423d804d48f07"- integrity sha512-HOo91EI4UbuG8xQVLFziTzrcIn0MJQhy8m9jorh8aonb94jFVFi3CFNIiAnIGOabmnshJLOABxpYXsiPB8Xnzg==+"@opentelemetry/[email protected]":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.15.1.tgz#1af170b9cee5cba556ccb2e21d547260cb5c33ad"+ integrity sha512-27cljZFnbUv5e459e2BhcsHCn2yePYq+07dZNW51e6F05GDWHC86fpwdh+WKvrfKSRMddUMkufHyoBWxtUN/Vg==dependencies:- "@opentelemetry/core" "1.13.0"+ "@opentelemetry/core" "1.15.1"-"@opentelemetry/[email protected]":- version "1.13.0"- resolved "https://registry.yarnpkg.com/@opentelemetry/propagator-jaeger/-/propagator-jaeger-1.13.0.tgz#94a79d5301409d49b149227ee5568fcf6b21f9fe"- integrity sha512-IV9TO+u1Jzm9mUDAD3gyXf89eyvgEJUY1t+GB5QmS4wjVeWrSMUtD0JjH3yG9SNqkrQOqOGJq7YUSSetW+Lf5Q==+"@opentelemetry/redis-common@^0.36.0":+ version "0.36.0"+ resolved "https://registry.yarnpkg.com/@opentelemetry/redis-common/-/redis-common-0.36.0.tgz#5b992d76838a385820f452235b7714e0f270e4ac"+ integrity sha512-rTKuBszerwzKm0uBmffJ8j47+5YBGu6HGUWnez5gev2B4by8TKkY37E/QMq7/3KRL9NkZ08VJCtl3piCCFW30g==dependencies:- "@opentelemetry/core" "1.13.0"--"@opentelemetry/redis-common@^0.35.1":- version "0.35.1"- resolved "https://registry.yarnpkg.com/@opentelemetry/redis-common/-/redis-common-0.35.1.tgz#01356f6845d4f9f9fdfd2c4c562a74316d2d24d3"- integrity sha512-qLXe7h9VzFLx3LaizFiUlpuohCRyvHlDW5b9synE6omHKTZr/n0EHEdmhp3GezBeAqMGI+q499Mht4SmStaSqQ==+ tslib "^2.3.1"-"@opentelemetry/[email protected]", "@opentelemetry/resources@^1.3.1":- version "1.13.0"- resolved "https://registry.yarnpkg.com/@opentelemetry/resources/-/resources-1.13.0.tgz#436b33ea950004e66fce6575f2776a05faca7f8e"- integrity sha512-euqjOkiN6xhjE//0vQYGvbStxoD/WWQRhDiO0OTLlnLBO9Yw2Gd/VoSx2H+svsebjzYk5OxLuREBmcdw6rbUNg==+"@opentelemetry/[email protected]", "@opentelemetry/resources@^1.15.1":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/resources/-/resources-1.15.1.tgz#6a0da2eb5d394d302701d428a1cbbb2cd924ac50"+ integrity sha512-15JcpyKZHhFYQ1uiC08vR02sRY/2seSnqSJ0tIUhcdYDzOhd0FrqPYpLj3WkLhVdQP6vgJ+pelAmSaOrCxCpKA==dependencies:- "@opentelemetry/core" "1.13.0"- "@opentelemetry/semantic-conventions" "1.13.0"+ "@opentelemetry/core" "1.15.1"+ "@opentelemetry/semantic-conventions" "1.15.1"-"@opentelemetry/[email protected]", "@opentelemetry/sdk-metrics@^1.8.0":- version "1.13.0"- resolved "https://registry.yarnpkg.com/@opentelemetry/sdk-metrics/-/sdk-metrics-1.13.0.tgz#4e859107a7a4389bcda7b37d3952bc7dd34211d7"- integrity sha512-MOjZX6AnSOqLliCcZUrb+DQKjAWXBiGeICGbHAGe5w0BB18PJIeIo995lO5JSaFfHpmUMgJButTPfJJD27W3Vg==+"@opentelemetry/[email protected]", "@opentelemetry/sdk-metrics@^1.15.1":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/sdk-metrics/-/sdk-metrics-1.15.1.tgz#e0d2844191ecd7fce3fccf18ae50ed35389f0885"+ integrity sha512-ojcrzexOQfto83NvKfIvsJap4SHH3ZvLjsDGhQ04AfvWWGR7mPcqLSlLedoSkEdIe0k1H6uBEsHBtIprkMpTHA==dependencies:- "@opentelemetry/core" "1.13.0"- "@opentelemetry/resources" "1.13.0"- lodash.merge "4.6.2"+ "@opentelemetry/core" "1.15.1"+ "@opentelemetry/resources" "1.15.1"+ lodash.merge "^4.6.2"-"@opentelemetry/[email protected]", "@opentelemetry/sdk-trace-base@^1.3.1":- version "1.13.0"- resolved "https://registry.yarnpkg.com/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.13.0.tgz#096cc2759430d880c5d886e009df2605097403dc"- integrity sha512-moTiQtc0uPR1hQLt6gLDJH9IIkeBhgRb71OKjNHZPE1VF45fHtD6nBDi5J/DkTHTwYP5X3kBJLa3xN7ub6J4eg==+"@opentelemetry/[email protected]", "@opentelemetry/sdk-trace-base@^1.15.1":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.15.1.tgz#8eabc0827769d91ac86cde8a86ebf0bf2a7d22ad"+ integrity sha512-5hccBe2yXzzXyExJNkTsIzDe1AM7HK0al+y/D2yEpslJqS1HUzsUSuCMY7Z4+Sfz5Gf0kTa6KYEt1QUQppnoBA==dependencies:- "@opentelemetry/core" "1.13.0"- "@opentelemetry/resources" "1.13.0"- "@opentelemetry/semantic-conventions" "1.13.0"+ "@opentelemetry/core" "1.15.1"+ "@opentelemetry/resources" "1.15.1"+ "@opentelemetry/semantic-conventions" "1.15.1"-"@opentelemetry/sdk-trace-node@^1.3.1":- version "1.13.0"- resolved "https://registry.yarnpkg.com/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.13.0.tgz#baadf62218ca69e37486debfbcf15b2563f75979"- integrity sha512-FXA85lXKTsnbOflA/TBuBf2pmhD3c8uDjNjG0YqK+ap8UayfALmfJhf+aG1yBOUHevCY0JXJ4/xtbXExxpsMog==- dependencies:- "@opentelemetry/context-async-hooks" "1.13.0"- "@opentelemetry/core" "1.13.0"- "@opentelemetry/propagator-b3" "1.13.0"- "@opentelemetry/propagator-jaeger" "1.13.0"- "@opentelemetry/sdk-trace-base" "1.13.0"- semver "^7.3.5"+"@opentelemetry/sdk-trace-node@^1.15.1":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/sdk-trace-node/-/sdk-trace-node-1.15.1.tgz#d1589ead5fe8aa2dc6789ec31e16965b4dcaf259"+ integrity sha512-aZDcuYHwh+qyOD/FLFAEAh32V2DlAp8Ubyaohh51oSssC3cxmN9JmpkyPbp2PQX3Mn48gBubwTXr9g++3+NB5w==+ dependencies:+ "@opentelemetry/context-async-hooks" "1.15.1"+ "@opentelemetry/core" "1.15.1"+ "@opentelemetry/propagator-b3" "1.15.1"+ "@opentelemetry/propagator-jaeger" "1.15.1"+ "@opentelemetry/sdk-trace-base" "1.15.1"+ semver "^7.5.1"-"@opentelemetry/[email protected]", "@opentelemetry/semantic-conventions@^1.0.0", "@opentelemetry/semantic-conventions@^1.3.1", "@opentelemetry/semantic-conventions@^1.8.0":+"@opentelemetry/[email protected]", "@opentelemetry/semantic-conventions@^1.0.0":version "1.13.0"resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-1.13.0.tgz#0290398b3eaebc6029c348988a78c3b688fe9219"integrity sha512-LMGqfSZkaMQXqewO0o1wvWr/2fQdCh4a3Sqlxka/UsJCe0cfLulh6x2aqnKLnsrSGiCq5rSCwvINd152i0nCqw==+"@opentelemetry/[email protected]", "@opentelemetry/semantic-conventions@^1.14.0", "@opentelemetry/semantic-conventions@^1.15.1":+ version "1.15.1"+ resolved "https://registry.yarnpkg.com/@opentelemetry/semantic-conventions/-/semantic-conventions-1.15.1.tgz#3d745996b2bd11095b515515fd3d68d46092a02d"+ integrity sha512-n8Kur1/CZlYG32YCEj30CoUqA8R7UyDVZzoEU6SDP+13+kXDT2kFVu6MpcnEUTyGP3i058ID6Qjp5h6IJxdPPQ==++"@opentelemetry/sql-common@^0.40.0":+ version "0.40.0"+ resolved "https://registry.yarnpkg.com/@opentelemetry/sql-common/-/sql-common-0.40.0.tgz#8cbed0722354d62997c3b9e1adf0e16257be6b15"+ integrity sha512-vSqRJYUPJVjMFQpYkQS3ruexCPSZJ8esne3LazLwtCPaPRvzZ7WG3tX44RouAn7w4wMp8orKguBqtt+ng2UTnw==+ dependencies:+ "@opentelemetry/core" "^1.1.0"+"@peertube/feed@^5.1.0":version "5.1.0"resolved "https://registry.yarnpkg.com/@peertube/feed/-/feed-5.1.0.tgz#e2fec950459ebaa32ea35791c45177f8b6fa85e9"@@ -2026,6 +2275,15 @@smtp-server "^3.9.0"wildstring "1.0.9"+"@peertube/resolve-tspaths@^0.8.14":+ version "0.8.14"+ resolved "https://registry.yarnpkg.com/@peertube/resolve-tspaths/-/resolve-tspaths-0.8.14.tgz#a4acee0b6ff713fe38c92e6e7f4f4c0c3eabce3c"+ integrity sha512-EnYh2GSY5qDPJ0TVt/UexuLQrB1vshOFXOM6OnqaV4e1WOYpxmtzu5amPFBRBLcGH9aJ4HM5eyDR3ka7Corjjw==+ dependencies:+ ansi-colors "4.1.3"+ commander "11.0.0"+ fast-glob "3.3.1"+"@selderee/plugin-htmlparser2@^0.10.0":version "0.10.0"resolved "https://registry.yarnpkg.com/@selderee/plugin-htmlparser2/-/plugin-htmlparser2-0.10.0.tgz#8a304d18df907e086f3cfc71ea0ced52d6524430"@@ -2042,10 +2300,10 @@domhandler "^5.0.3"selderee "^0.11.0"-"@sindresorhus/is@^4.0.0":- version "4.6.0"- resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f"- integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==+"@sindresorhus/is@^5.2.0":+ version "5.6.0"+ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-5.6.0.tgz#41dd6093d34652cddb5d5bdeee04eafc33826668"+ integrity sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g=="@smithy/protocol-http@^1.0.1":version "1.0.1"@@ -2067,38 +2325,18 @@resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553"integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==-"@szmarczak/http-timer@^4.0.5":- version "4.0.6"- resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz#b4a914bb62e7c272d4e5989fe4440f812ab1d807"- integrity sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==+"@szmarczak/http-timer@^5.0.1":+ version "5.0.1"+ resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a"+ integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==dependencies:- defer-to-connect "^2.0.0"+ defer-to-connect "^2.0.1""@tokenizer/token@^0.3.0":version "0.3.0"resolved "https://registry.yarnpkg.com/@tokenizer/token/-/token-0.3.0.tgz#fe98a93fe789247e998c75e74e9c7c63217aa276"integrity sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==-"@tsconfig/node10@^1.0.7":- version "1.0.9"- resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2"- integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==--"@tsconfig/node12@^1.0.7":- version "1.0.11"- resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d"- integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==--"@tsconfig/node14@^1.0.0":- version "1.0.3"- resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1"- integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==--"@tsconfig/node16@^1.0.2":- version "1.0.4"- resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9"- integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==-"@types/bcrypt@^5.0.0":version "5.0.0"resolved "https://registry.yarnpkg.com/@types/bcrypt/-/bcrypt-5.0.0.tgz#a835afa2882d165aff5690893db314eaa98b9f20"@@ -2138,16 +2376,6 @@resolved "https://registry.yarnpkg.com/@types/bytes/-/bytes-3.1.1.tgz#67a876422e660dc4c10a27f3e5bcfbd5455f01d0"integrity sha512-lOGyCnw+2JVPKU3wIV0srU0NyALwTBJlVSx5DfMQOFuuohA8y9S8orImpuIQikZ0uIQ8gehrRjxgQC1rLRi11w==-"@types/cacheable-request@^6.0.1":- version "6.0.3"- resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.3.tgz#a430b3260466ca7b5ca5bfd735693b36e7a9d183"- integrity sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==- dependencies:- "@types/http-cache-semantics" "*"- "@types/keyv" "^3.1.4"- "@types/node" "*"- "@types/responselike" "^1.0.0"-"@types/caseless@*":version "0.12.2"resolved "https://registry.yarnpkg.com/@types/caseless/-/caseless-0.12.2.tgz#f65d3d6389e01eeb458bd54dc8f52b95a9463bc8"@@ -2270,7 +2498,7 @@"@types/jsonfile" "*""@types/node" "*"-"@types/http-cache-semantics@*":+"@types/http-cache-semantics@^4.0.1":version "4.0.1"resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812"integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==@@ -2299,17 +2527,22 @@dependencies:"@types/node" "*"-"@types/keyv@^3.1.4":- version "3.1.4"- resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.4.tgz#3ccdb1c6751b0c7e52300bcdacd5bcbf8faa75b6"- integrity sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==+"@types/jsonld@^1.5.9":+ version "1.5.9"+ resolved "https://registry.yarnpkg.com/@types/jsonld/-/jsonld-1.5.9.tgz#aca18d90b91488d15f8b4e941f660da4093be783"+ integrity sha512-K76ImkErPYL2wGPZpNFSKp6wE+h/APecZLJrU7UfDaGqt/f+D9Rrg1aR7VdRrQ6k5DUNRZ2vn9yACwmpOr9QcA==++"@types/lodash-es@^4.17.8":+ version "4.17.8"+ resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.8.tgz#cfffd0969507830c22da18dbb20d2ca126fdaa8b"+ integrity sha512-euY3XQcZmIzSy7YH5+Unb3b2X12Wtk54YWINBvvGQ5SmMvwb11JQskGsfkH/5HXK77Kr8GF0wkVDIxzAisWtog==dependencies:- "@types/node" "*"+ "@types/lodash" "*"-"@types/lodash@^4.14.64":- version "4.14.194"- resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.194.tgz#b71eb6f7a0ff11bff59fc987134a093029258a76"- integrity sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==+"@types/lodash@*":+ version "4.14.196"+ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.196.tgz#a7c3d6fc52d8d71328b764e28e080b4169ec7a95"+ integrity sha512-22y3o88f4a94mKljsZcanlNWPzO0uBsBdzLAngf2tp533LzZcQzb6+eZPJ+vCTt+bqF2XnvT9gejTLsAcJAJyQ=="@types/magnet-uri@*", "@types/magnet-uri@^5.1.1":version "5.1.3"@@ -2385,9 +2618,9 @@integrity sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw=="@types/node@^18.13.0":- version "18.16.14"- resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.14.tgz#ab67bb907f1146afc6fedb9ce60ae8a99c989631"- integrity sha512-+ImzUB3mw2c5ISJUq0punjDilUQ5GnUim0ZRvchHIWJmOC0G+p0kzhXBqj6cDjK0QdPFwzrHWgrJp3RPvCG5qg==+ version "18.17.1"+ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.17.1.tgz#84c32903bf3a09f7878c391d31ff08f6fe7d8335"+ integrity sha512-xlR1jahfizdplZYRU59JlUx9uzF1ARa8jbhM11ccpCJya8kvos5jwdm2ZAgxSCwOl0fq21svP18EVwPBXMQudw=="@types/nodemailer@^6.2.0":version "6.4.8"@@ -2469,13 +2702,6 @@"@types/tough-cookie" "*"form-data "^2.5.0"-"@types/responselike@^1.0.0":- version "1.0.0"- resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29"- integrity sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==- dependencies:- "@types/node" "*"-"@types/sax@^1.2.1":version "1.2.4"resolved "https://registry.yarnpkg.com/@types/sax/-/sax-1.2.4.tgz#8221affa7f4f3cb21abd22f244cfabfa63e6a69e"@@ -2504,6 +2730,11 @@"@types/mime" "*""@types/node" "*"+"@types/shimmer@^1.0.2":+ version "1.0.2"+ resolved "https://registry.yarnpkg.com/@types/shimmer/-/shimmer-1.0.2.tgz#93eb2c243c351f3f17d5c580c7467ae5d686b65f"+ integrity sha512-dKkr1bTxbEsFlh2ARpKzcaAmsYixqt9UyCdoEZk8rHyE4iQYcDCyvSjDSf7JUWJHlJiTtbIoQjxKh6ViywqDAg==+"@types/simple-peer@*":version "9.11.5"resolved "https://registry.yarnpkg.com/@types/simple-peer/-/simple-peer-9.11.5.tgz#6baa00edbbd0f632f8561e8fb03b4d21d62f076e"@@ -2541,11 +2772,16 @@resolved "https://registry.yarnpkg.com/@types/tv4/-/tv4-1.2.31.tgz#b33f3e6f082782a90f1fc5f414ad8722db8c9baa"integrity sha512-P97XU07fcpauSw3/fE2Q7eF6bHl4oHhwkikjnM7zlQLENrdC2rZuHSdNlMBhnW82NyBEsVJHII1Jk3d/MtQsQQ==-"@types/validator@^13.0.0", "@types/validator@^13.7.1":+"@types/validator@^13.7.1":version "13.7.17"resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.7.17.tgz#0a6d1510395065171e3378a4afc587a3aefa7cc1"integrity sha512-aqayTNmeWrZcvnG2MG9eGYI6b7S5fl+yKgPs6bAjOTwPS316R5SxBGKvtSExfyoJU7pIeHJfsHI0Ji41RVMkvQ==+"@types/validator@^13.9.0":+ version "13.9.0"+ resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.9.0.tgz#e7a96da3ea6a936222c6e76bb54abdd3dc4c9e4a"+ integrity sha512-NclP0IbzHj/4tJZKFqKh8E7kZdgss+MCUYV9G+TLltFfDA4lFgE4PKPpDIyS2FlcdANIfSx273emkupvChigbw==+"@types/webtorrent@^0.109.0":version "0.109.3"resolved "https://registry.yarnpkg.com/@types/webtorrent/-/webtorrent-0.109.3.tgz#95df708d98bcea235b37f49a9a348b11f3511670"@@ -2742,26 +2978,31 @@ accepts@~1.3.4, accepts@~1.3.8:mime-types "~2.1.34"negotiator "0.6.3"+acorn-import-assertions@^1.9.0:+ version "1.9.0"+ resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz#507276249d684797c84e0734ef84860334cfb1ac"+ integrity sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==+acorn-jsx@^5.3.2:version "5.3.2"resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==-acorn-walk@^8.1.1:- version "8.2.0"- resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"- integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==-acorn@^7.1.1:version "7.4.1"resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==-acorn@^8.4.1, acorn@^8.8.0:+acorn@^8.8.0:version "8.8.2"resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a"integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==+acorn@^8.8.2:+ version "8.10.0"+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5"+ integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==+addr-to-ip-port@^1.0.1, addr-to-ip-port@^1.5.4:version "1.5.4"resolved "https://registry.yarnpkg.com/addr-to-ip-port/-/addr-to-ip-port-1.5.4.tgz#9542b1c6219fdb8c9ce6cc72c14ee880ab7ddd88"@@ -2877,11 +3118,6 @@ are-we-there-yet@^2.0.0:delegates "^1.0.0"readable-stream "^3.6.0"-arg@^4.1.0:- version "4.1.3"- resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"- integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==-arg@^5.0.0:version "5.0.2"resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c"@@ -3087,6 +3323,11 @@ [email protected]:resolved "https://registry.yarnpkg.com/base32.js/-/base32.js-0.1.0.tgz#b582dec693c2f11e893cf064ee6ac5b6131a2202"integrity sha512-n3TkB02ixgBOhTvANakDb4xaMXnYUVkNoRFJjQflcqMQhyEKxEHdj3E6N8t8sUQ0mjH/3/JxzlXuz3ul/J90pQ==+base64-arraybuffer@^1.0.2:+ version "1.0.2"+ resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz#1c37589a7c4b0746e34bd1feb951da2df01c1bdc"+ integrity sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==+base64-js@^1.0.2, base64-js@^1.2.0, base64-js@^1.3.1:version "1.5.1"resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"@@ -3134,6 +3375,13 @@ bencode@^2.0.0, bencode@^2.0.1, bencode@^2.0.2, bencode@^2.0.3:resolved "https://registry.yarnpkg.com/bencode/-/bencode-2.0.3.tgz#89b9c80ea1b8573554915a7d0c15f62b0aa7fc52"integrity sha512-D/vrAD4dLVX23NalHwb8dSvsUsxeRPO8Y7ToKA015JQYq69MLDOMkC0uGZYA/MPpltLO8rt8eqFC2j8DxjTZ/w==+bencode@^3.1.1:+ version "3.1.1"+ resolved "https://registry.yarnpkg.com/bencode/-/bencode-3.1.1.tgz#359901f9a93724ee0c709f9f8265456b368c60e6"+ integrity sha512-btsxX9201yoWh45TdqYg6+OZ5O1xTYKTYSGvJndICDFtznE/9zXgow8yjMvvhOqKKuzuL7h+iiCMpfkG8+QuBA==+ dependencies:+ uint8-util "^2.1.6"+bep53-range@^1.1.0:version "1.1.1"resolved "https://registry.yarnpkg.com/bep53-range/-/bep53-range-1.1.1.tgz#20fd125b00a413254a77d42f63a43750ca7e64ac"@@ -3446,23 +3694,23 @@ cache-chunk-store@^3.2.2:lru "^3.1.0"queue-microtask "^1.2.3"-cacheable-lookup@^5.0.3:- version "5.0.4"- resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz#5a6b865b2c44357be3d5ebc2a467b032719a7005"- integrity sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==--cacheable-request@^7.0.2:- version "7.0.2"- resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.2.tgz#ea0d0b889364a25854757301ca12b2da77f91d27"- integrity sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==- dependencies:- clone-response "^1.0.2"- get-stream "^5.1.0"- http-cache-semantics "^4.0.0"- keyv "^4.0.0"- lowercase-keys "^2.0.0"- normalize-url "^6.0.1"- responselike "^2.0.0"+cacheable-lookup@^7.0.0:+ version "7.0.0"+ resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz#3476a8215d046e5a3202a9209dd13fec1f933a27"+ integrity sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==++cacheable-request@^10.2.8:+ version "10.2.13"+ resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-10.2.13.tgz#b7012bb4a2acdb18cb54d2dff751d766b3500842"+ integrity sha512-3SD4rrMu1msNGEtNSt8Od6enwdo//U9s4ykmXfA2TD58kcLkCobtCDiby7kNyj7a/Q7lz/mAesAFI54rTdnvBA==+ dependencies:+ "@types/http-cache-semantics" "^4.0.1"+ get-stream "^6.0.1"+ http-cache-semantics "^4.1.1"+ keyv "^4.5.3"+ mimic-response "^4.0.0"+ normalize-url "^8.0.0"+ responselike "^3.0.0"call-bind@^1.0.0, call-bind@^1.0.2:version "1.0.2"@@ -3664,6 +3912,11 @@ cidr-regex@^3.1.1:dependencies:ip-regex "^4.1.0"+cjs-module-lexer@^1.2.2:+ version "1.2.3"+ resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz#6c370ab19f8a3394e318fe682686ec0ac684d107"+ integrity sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==+cli-table3@^0.6.0:version "0.6.3"resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.3.tgz#61ab765aac156b52f222954ffc607a6f01dbeeb2"@@ -3700,13 +3953,6 @@ cliui@^8.0.1:strip-ansi "^6.0.1"wrap-ansi "^7.0.0"-clone-response@^1.0.2:- version "1.0.3"- resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.3.tgz#af2032aa47816399cf5f0a1d0db902f517abb8c3"- integrity sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==- dependencies:- mimic-response "^1.0.0"-clone@^2.0.0:version "2.1.2"resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f"@@ -3795,10 +4041,10 @@ combined-stream@^1.0.6, combined-stream@^1.0.8:dependencies:delayed-stream "~1.0.0"- version "10.0.0"- resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.0.tgz#71797971162cd3cf65f0b9d24eb28f8d303acdf1"- integrity sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==+ version "11.0.0"+ resolved "https://registry.yarnpkg.com/commander/-/commander-11.0.0.tgz#43e19c25dbedc8256203538e8d7e9346877a6f67"+ integrity sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==commander@^10.0.0:version "10.0.1"@@ -3968,11 +4214,6 @@ cpus@^1.0.3:resolved "https://registry.yarnpkg.com/cpus/-/cpus-1.0.3.tgz#4ef6deea461968d6329d07dd01205685df2934a2"integrity sha512-PXHBvGLuL69u55IkLa5e5838fLhIMHxmkV4ge42a8alGyn7BtawYgI0hQ849EedvtHIOLNNH3i6eQU1BiE9SUA==-create-require@^1.1.0:- version "1.1.1"- resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"- integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==-create-torrent@^5, create-torrent@^5.0.9:version "5.0.9"resolved "https://registry.yarnpkg.com/create-torrent/-/create-torrent-5.0.9.tgz#850f198f7568e3d0e1e73b6858d43d44659a69d0"@@ -4140,7 +4381,7 @@ deepmerge@^4.2.2, deepmerge@^4.3.0, deepmerge@^4.3.1:resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a"integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==-defer-to-connect@^2.0.0:+defer-to-connect@^2.0.1:version "2.0.1"resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587"integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==@@ -4245,11 +4486,6 @@ [email protected]:resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b"integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==-diff@^4.0.1:- version "4.0.2"- resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"- integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==-dir-glob@^3.0.1:version "3.0.1"resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f"@@ -4605,6 +4841,62 @@ es6-weak-map@^2.0.3:es6-iterator "^2.0.3"es6-symbol "^3.1.1"+esbuild@^0.19.0:+ version "0.19.0"+ resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.0.tgz#f187e4ce3bcc7396d13f408a991655efeba65282"+ integrity sha512-i7i8TP4vuG55bKeLyqqk5sTPu1ZjPH3wkcLvAj/0X/222iWFo3AJUYRKjbOoY6BWFMH3teizxHEdV9Su5ESl0w==+ optionalDependencies:+ "@esbuild/android-arm" "0.19.0"+ "@esbuild/android-arm64" "0.19.0"+ "@esbuild/android-x64" "0.19.0"+ "@esbuild/darwin-arm64" "0.19.0"+ "@esbuild/darwin-x64" "0.19.0"+ "@esbuild/freebsd-arm64" "0.19.0"+ "@esbuild/freebsd-x64" "0.19.0"+ "@esbuild/linux-arm" "0.19.0"+ "@esbuild/linux-arm64" "0.19.0"+ "@esbuild/linux-ia32" "0.19.0"+ "@esbuild/linux-loong64" "0.19.0"+ "@esbuild/linux-mips64el" "0.19.0"+ "@esbuild/linux-ppc64" "0.19.0"+ "@esbuild/linux-riscv64" "0.19.0"+ "@esbuild/linux-s390x" "0.19.0"+ "@esbuild/linux-x64" "0.19.0"+ "@esbuild/netbsd-x64" "0.19.0"+ "@esbuild/openbsd-x64" "0.19.0"+ "@esbuild/sunos-x64" "0.19.0"+ "@esbuild/win32-arm64" "0.19.0"+ "@esbuild/win32-ia32" "0.19.0"+ "@esbuild/win32-x64" "0.19.0"++esbuild@~0.17.6:+ version "0.17.19"+ resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.19.tgz#087a727e98299f0462a3d0bcdd9cd7ff100bd955"+ integrity sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==+ optionalDependencies:+ "@esbuild/android-arm" "0.17.19"+ "@esbuild/android-arm64" "0.17.19"+ "@esbuild/android-x64" "0.17.19"+ "@esbuild/darwin-arm64" "0.17.19"+ "@esbuild/darwin-x64" "0.17.19"+ "@esbuild/freebsd-arm64" "0.17.19"+ "@esbuild/freebsd-x64" "0.17.19"+ "@esbuild/linux-arm" "0.17.19"+ "@esbuild/linux-arm64" "0.17.19"+ "@esbuild/linux-ia32" "0.17.19"+ "@esbuild/linux-loong64" "0.17.19"+ "@esbuild/linux-mips64el" "0.17.19"+ "@esbuild/linux-ppc64" "0.17.19"+ "@esbuild/linux-riscv64" "0.17.19"+ "@esbuild/linux-s390x" "0.17.19"+ "@esbuild/linux-x64" "0.17.19"+ "@esbuild/netbsd-x64" "0.17.19"+ "@esbuild/openbsd-x64" "0.17.19"+ "@esbuild/sunos-x64" "0.17.19"+ "@esbuild/win32-arm64" "0.17.19"+ "@esbuild/win32-ia32" "0.17.19"+ "@esbuild/win32-x64" "0.17.19"+escalade@^3.1.1:version "3.1.1"resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"@@ -4904,7 +5196,7 @@ eventemitter-asyncresource@^1.0.0:resolved "https://registry.yarnpkg.com/eventemitter-asyncresource/-/eventemitter-asyncresource-1.0.0.tgz#734ff2e44bf448e627f7748f905d6bdd57bdb65b"integrity sha512-39F7TBIV0G7gTelxwbEqnwhp90eqCPON1k0NwNfwhgKn4Co4ybUbj2pECcXT0B3ztRKZ7Pw1JujUUgmQJHcVAQ==-eventemitter3@^4.0.4:+eventemitter3@^4.0.7:version "4.0.7"resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==@@ -5047,7 +5339,18 @@ fast-fifo@^1.1.0:resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.2.0.tgz#2ee038da2468e8623066dee96958b0c1763aa55a"integrity sha512-NcvQXt7Cky1cNau15FWy64IjuO8X0JijhTBBrJj1YlxlDfRkJXNaK9RFUjwpfDPzMdv7wB38jr53l9tkNLxnWg==[email protected], fast-glob@^3.2.9:+ version "3.3.1"+ resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4"+ integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==+ dependencies:+ "@nodelib/fs.stat" "^2.0.2"+ "@nodelib/fs.walk" "^1.2.3"+ glob-parent "^5.1.2"+ merge2 "^1.3.0"+ micromatch "^4.0.4"++fast-glob@^3.2.9:version "3.2.12"resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80"integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==@@ -5221,6 +5524,11 @@ for-each@^0.3.3:dependencies:is-callable "^1.1.3"+form-data-encoder@^2.1.2:+ version "2.1.4"+ resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-2.1.4.tgz#261ea35d2a70d48d30ec7a9603130fa5515e9cd5"+ integrity sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==+form-data@^2.5.0:version "2.5.1"resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4"@@ -5395,14 +5703,7 @@ get-stream@^3.0.0:resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"integrity sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==-get-stream@^5.1.0:- version "5.2.0"- resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"- integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==- dependencies:- pump "^3.0.0"--get-stream@^6.0.0:+get-stream@^6.0.0, get-stream@^6.0.1:version "6.0.1"resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==@@ -5415,6 +5716,13 @@ get-symbol-description@^1.0.0:call-bind "^1.0.2"get-intrinsic "^1.1.1"+get-tsconfig@^4.4.0:+ version "4.6.2"+ resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.6.2.tgz#831879a5e6c2aa24fe79b60340e2233a1e0f472e"+ integrity sha512-E5XrT4CbbXcXWy+1jChlZmrmCwd5KGx502kDCXJJ7y898TtWW9FwoG5HfOLVRKmlmDGkWN2HM9Ho+/Y8F0sJDg==+ dependencies:+ resolve-pkg-maps "^1.0.0"+getpass@^0.1.1:version "0.1.7"resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"@@ -5525,22 +5833,22 @@ gopd@^1.0.1:dependencies:get-intrinsic "^1.1.3"-got@^11.8.2:- version "11.8.6"- resolved "https://registry.yarnpkg.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a"- integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==- dependencies:- "@sindresorhus/is" "^4.0.0"- "@szmarczak/http-timer" "^4.0.5"- "@types/cacheable-request" "^6.0.1"- "@types/responselike" "^1.0.0"- cacheable-lookup "^5.0.3"- cacheable-request "^7.0.2"+got@^13.0.0:+ version "13.0.0"+ resolved "https://registry.yarnpkg.com/got/-/got-13.0.0.tgz#a2402862cef27a5d0d1b07c0fb25d12b58175422"+ integrity sha512-XfBk1CxOOScDcMr9O1yKkNaQyy865NbYs+F7dr4H0LZMVgCj2Le59k6PqbNHoL5ToeaEQUYh6c6yMfVcc6SJxA==+ dependencies:+ "@sindresorhus/is" "^5.2.0"+ "@szmarczak/http-timer" "^5.0.1"+ cacheable-lookup "^7.0.0"+ cacheable-request "^10.2.8"decompress-response "^6.0.0"- http2-wrapper "^1.0.0-beta.5.2"- lowercase-keys "^2.0.0"- p-cancelable "^2.0.0"- responselike "^2.0.0"+ form-data-encoder "^2.1.2"+ get-stream "^6.0.1"+ http2-wrapper "^2.1.10"+ lowercase-keys "^3.0.0"+ p-cancelable "^3.0.0"+ responselike "^3.0.0"graceful-fs@^4.1.6, graceful-fs@^4.2.0:version "4.2.11"@@ -5708,7 +6016,7 @@ htmlparser2@^8.0.0, htmlparser2@^8.0.1, htmlparser2@^8.0.2:domutils "^3.0.1"entities "^4.4.0"-http-cache-semantics@^4.0.0:+http-cache-semantics@^4.1.1:version "4.1.1"resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==@@ -5750,13 +6058,13 @@ http-problem-details@^0.1.5:resolved "https://registry.yarnpkg.com/http-problem-details/-/http-problem-details-0.1.5.tgz#f8f94f4ab9d4050749e9f8566fb85bb8caa2be56"integrity sha512-GHxfQZ0POP4FWbAM0guOyZyJNWwbLUXp+4XOJdmitS2tp3gHVSatrSX59Yyq/dCkhk4KiGtTWIlXZC83yCkBkA==-http2-wrapper@^1.0.0-beta.5.2:- version "1.0.3"- resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-1.0.3.tgz#b8f55e0c1f25d4ebd08b3b0c2c079f9590800b3d"- integrity sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==+http2-wrapper@^2.1.10:+ version "2.2.0"+ resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.0.tgz#b80ad199d216b7d3680195077bd7b9060fa9d7f3"+ integrity sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ==dependencies:quick-lru "^5.1.1"- resolve-alpn "^1.0.0"+ resolve-alpn "^1.2.0"https-proxy-agent@^5.0.0:version "5.0.1"@@ -5849,6 +6157,16 @@ import-fresh@^3.0.0, import-fresh@^3.2.1:parent-module "^1.0.0"resolve-from "^4.0.0"+ version "1.4.1"+ resolved "https://registry.yarnpkg.com/import-in-the-middle/-/import-in-the-middle-1.4.1.tgz#31b25123bc35d556986a172bb398a3e6c32af9be"+ integrity sha512-hGG0PcCsykVo8MBVH8l0uEWLWW6DXMgJA9jvC0yps6M3uIJ8L/tagTCbyF8Ud5TtqJ8/jmZL1YkyySyeVkVQrA==+ dependencies:+ acorn "^8.8.2"+ acorn-import-assertions "^1.9.0"+ cjs-module-lexer "^1.2.2"+ module-details-from-path "^1.0.3"+imurmurhash@^0.1.4:version "0.1.4"resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"@@ -6193,10 +6511,10 @@ isexe@^2.0.0:resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==- version "2.2.0"- resolved "https://registry.yarnpkg.com/iso-639-3/-/iso-639-3-2.2.0.tgz#eb01d7734d61396efec934979e8b0806550837f1"- integrity sha512-v9w/U4XDSfXCrXxf4E6ertGC/lTRX8MLLv7XC1j6N5oL3ympe38jp77zgeyMsn3MbufuAAoGeVzDJbOXnPTMhQ==+ version "3.0.1"+ resolved "https://registry.yarnpkg.com/iso-639-3/-/iso-639-3-3.0.1.tgz#4be56987c46fbda79da63a3d90d6552d7429dcea"+ integrity sha512-SdljCYXOexv/JmbQ0tvigHN43yECoscVpe2y2hlEqy/CStXQlroPhZLj7zKLRiGqLJfw8k7B973UAMDoQczVgQ==isomorphic-fetch@^3.0.0:version "3.0.0"@@ -6314,7 +6632,7 @@ json5@^1.0.2:dependencies:minimist "^1.2.0"-json5@^2.1.3, json5@^2.2.2, json5@^2.2.3:+json5@^2.1.3, json5@^2.2.3:version "2.2.3"resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==@@ -6408,10 +6726,10 @@ k-rpc@^5.1.0:k-rpc-socket "^1.7.2"randombytes "^2.0.5"-keyv@^4.0.0:- version "4.5.2"- resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.2.tgz#0e310ce73bf7851ec702f2eaf46ec4e3805cce56"- integrity sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==+keyv@^4.5.3:+ version "4.5.3"+ resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.3.tgz#00873d2b046df737963157bd04f294ca818c9c25"+ integrity sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==dependencies:json-buffer "3.0.1"@@ -6542,6 +6860,11 @@ locate-path@^6.0.0:dependencies:p-locate "^5.0.0"+lodash-es@^4.17.21:+ version "4.17.21"+ resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"+ integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==+lodash.chunk@^4.2.0:version "4.2.0"resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc"@@ -6567,7 +6890,7 @@ lodash.isarguments@^3.1.0:resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a"integrity sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==[email protected], lodash.merge@^4.6.2:+lodash.merge@^4.6.2:version "4.6.2"resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==@@ -6616,10 +6939,10 @@ loupe@^2.3.1:dependencies:get-func-name "^2.0.0"-lowercase-keys@^2.0.0:- version "2.0.0"- resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479"- integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==+lowercase-keys@^3.0.0:+ version "3.0.0"+ resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2"+ integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==version "4.1.5"@@ -6724,11 +7047,6 @@ make-dir@^3.1.0:dependencies:semver "^6.0.0"-make-error@^1.1.1:- version "1.3.6"- resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"- integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==-make-plural@^7.0.0:version "7.3.0"resolved "https://registry.yarnpkg.com/make-plural/-/make-plural-7.3.0.tgz#2889dbafca2fb097037c47967d3e3afa7e48a52c"@@ -6878,16 +7196,16 @@ mimic-fn@^2.1.0:resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==-mimic-response@^1.0.0:- version "1.0.1"- resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"- integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==-mimic-response@^3.1.0:version "3.1.0"resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9"integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==+mimic-response@^4.0.0:+ version "4.0.0"+ resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-4.0.0.tgz#35468b19e7c75d10f5165ea25e75a5ceea7cf70f"+ integrity sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==+min-document@^2.19.0:version "2.19.0"resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"@@ -7289,10 +7607,10 @@ normalize-path@^3.0.0, normalize-path@~3.0.0:resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==-normalize-url@^6.0.1:- version "6.1.0"- resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a"- integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==+normalize-url@^8.0.0:+ version "8.0.0"+ resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-8.0.0.tgz#593dbd284f743e8dcf6a5ddf8fadff149c82701a"+ integrity sha512-uVFpKhj5MheNBJRTiMZ9pE/7hD1QTeEvugSJW/OmLzAp78PB5O6adfMNTvmfKhXBkvCzC+rqifWcVYpGFwTjnw==npm-run-path@^2.0.0:version "2.0.2"@@ -7417,14 +7735,14 @@ open@7:is-docker "^2.0.0"is-wsl "^2.1.1"-opentelemetry-instrumentation-sequelize@^0.35.0:- version "0.35.0"- resolved "https://registry.yarnpkg.com/opentelemetry-instrumentation-sequelize/-/opentelemetry-instrumentation-sequelize-0.35.0.tgz#ac583d0a2283e251f71c35b983ffeb06305f8b2b"- integrity sha512-bYcw98dFTbAGcGzIwNa+09mnW7tRgew0qR9L09oo3X3+L6NtA3C6GxGVGBa9ExxHJeokSl5F5ytSMTYVUG4iBA==+opentelemetry-instrumentation-sequelize@^0.39.1:+ version "0.39.1"+ resolved "https://registry.yarnpkg.com/opentelemetry-instrumentation-sequelize/-/opentelemetry-instrumentation-sequelize-0.39.1.tgz#1fb3e1fa517ef776e749b0c5c5b043c4132c1659"+ integrity sha512-LMZ9UxMbD23JhAqrHdzwd6w0khEYNkBK7ic+aP2vTLI06RutfiOmk0OZkKvzCW5ZozAsO2vI4zihJCqJGN98gA==dependencies:- "@opentelemetry/core" "^1.8.0"- "@opentelemetry/instrumentation" "^0.35.1"- "@opentelemetry/semantic-conventions" "^1.8.0"+ "@opentelemetry/core" "^1.13.0"+ "@opentelemetry/instrumentation" "^0.41.0"+ "@opentelemetry/semantic-conventions" "^1.14.0"opentracing@^0.14.4:version "0.14.7"@@ -7455,10 +7773,10 @@ otpauth@^9.0.2:dependencies:jssha "~3.3.0"-p-cancelable@^2.0.0:- version "2.1.1"- resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz#aab7fbd416582fa32a3db49859c122487c5ed2cf"- integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==+p-cancelable@^3.0.0:+ version "3.0.0"+ resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050"+ integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==version "4.2.0"@@ -7500,21 +7818,26 @@ p-locate@^5.0.0:dependencies:p-limit "^3.0.2"-p-queue@^6:- version "6.6.2"- resolved "https://registry.yarnpkg.com/p-queue/-/p-queue-6.6.2.tgz#2068a9dcf8e67dd0ec3e7a2bcb76810faa85e426"- integrity sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==+p-queue@^7.3.4:+ version "7.3.4"+ resolved "https://registry.yarnpkg.com/p-queue/-/p-queue-7.3.4.tgz#7ef7d89b6c1a0563596d98adbc9dc404e9ed4a84"+ integrity sha512-esox8CWt0j9EZECFvkFl2WNPat8LN4t7WWeXq73D9ha0V96qPRufApZi4ZhPwXAln1uVVal429HVVKPa2X0yQg==dependencies:- eventemitter3 "^4.0.4"- p-timeout "^3.2.0"+ eventemitter3 "^4.0.7"+ p-timeout "^5.0.2"-p-timeout@^3.0.0, p-timeout@^3.1.0, p-timeout@^3.2.0:+p-timeout@^3.0.0, p-timeout@^3.1.0:version "3.2.0"resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-3.2.0.tgz#c7e17abc971d2a7962ef83626b35d635acf23dfe"integrity sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==dependencies:p-finally "^1.0.0"+p-timeout@^5.0.2:+ version "5.1.0"+ resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-5.1.0.tgz#b3c691cf4415138ce2d9cfe071dba11f0fee085b"+ integrity sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==+p-try@^2.0.0:version "2.2.0"resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"@@ -8383,19 +8706,10 @@ require-from-string@^2.0.2:resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==-require-in-the-middle@^5.0.3:- version "5.2.0"- resolved "https://registry.yarnpkg.com/require-in-the-middle/-/require-in-the-middle-5.2.0.tgz#4b71e3cc7f59977100af9beb76bf2d056a5a6de2"- integrity sha512-efCx3b+0Z69/LGJmm9Yvi4cqEdxnoGnxYxGxBghkkTTFeXRtTCmmhO0AnAfHz59k957uTSuy8WaHqOs8wbYUWg==- dependencies:- debug "^4.1.1"- module-details-from-path "^1.0.3"- resolve "^1.22.1"--require-in-the-middle@^7.1.0:- version "7.1.0"- resolved "https://registry.yarnpkg.com/require-in-the-middle/-/require-in-the-middle-7.1.0.tgz#8ab4089383e7b7879ed134d8e9d1887bd48195ec"- integrity sha512-6f86Mh0vWCxqKKatRPwgY6VzYmcVay3WUTIpJ1ILBCNh+dTWabMR1swKGKz3XcEZ5mgjndzRu7fQ+44G2H9Gew==+require-in-the-middle@^7.1.1:+ version "7.2.0"+ resolved "https://registry.yarnpkg.com/require-in-the-middle/-/require-in-the-middle-7.2.0.tgz#b539de8f00955444dc8aed95e17c69b0a4f10fcf"+ integrity sha512-3TLx5TGyAY6AOqLBoXmHkNql0HIf2RGbuMgCDT2WO/uGVAPJs6h7Kl+bN6TIZGd9bWhWPwnDnTHGtW8Iu77sdw==dependencies:debug "^4.1.1"module-details-from-path "^1.0.3"@@ -8411,7 +8725,7 @@ require-package-name@^2.0.1:resolved "https://registry.yarnpkg.com/require-package-name/-/require-package-name-2.0.1.tgz#c11e97276b65b8e2923f75dabf5fb2ef0c3841b9"integrity sha512-uuoJ1hU/k6M0779t3VMVIYpb2VMJk05cehCaABFhXaibcbvfgR8wKiozLjVFSzJPmQMRqIcO0HMyTFqfV09V6Q==-resolve-alpn@^1.0.0:+resolve-alpn@^1.2.0:version "1.2.1"resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9"integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==@@ -8421,14 +8735,10 @@ resolve-from@^4.0.0:resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==-resolve-tspaths@^0.8.8:- version "0.8.13"- resolved "https://registry.yarnpkg.com/resolve-tspaths/-/resolve-tspaths-0.8.13.tgz#83e37d7fb40b0ed241c40e91dbcd15c0fb82224c"- integrity sha512-eHlHinC2qt3jQLFiZyUE4HXZOTlT1abHO2fb+OI9Ybsn8wdhKiAtIFVy1+QVTaIQNphCLvm42EkqJt/+ZAA8Sw==- dependencies:- ansi-colors "4.1.3"- commander "10.0.0"- fast-glob "3.2.12"+resolve-pkg-maps@^1.0.0:+ version "1.0.0"+ resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f"+ integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==resolve@^1.10.1, resolve@^1.15.1, resolve@^1.18.1, resolve@^1.22.1, resolve@^1.22.2:version "1.22.2"@@ -8439,12 +8749,12 @@ resolve@^1.10.1, resolve@^1.15.1, resolve@^1.18.1, resolve@^1.22.1, resolve@^1.2path-parse "^1.0.7"supports-preserve-symlinks-flag "^1.0.0"-responselike@^2.0.0:- version "2.0.1"- resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc"- integrity sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==+responselike@^3.0.0:+ version "3.0.0"+ resolved "https://registry.yarnpkg.com/responselike/-/responselike-3.0.0.tgz#20decb6c298aff0dbee1c355ca95461d42823626"+ integrity sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==dependencies:- lowercase-keys "^2.0.0"+ lowercase-keys "^3.0.0"ret@~0.1.10:version "0.1.15"@@ -8620,6 +8930,13 @@ semver@^7.0.0, semver@^7.3.2, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semvedependencies:lru-cache "^6.0.0"+semver@^7.5.1:+ version "7.5.4"+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"+ integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==+ dependencies:+ lru-cache "^6.0.0"+version "0.18.0"resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be"@@ -8898,6 +9215,19 @@ socks@^2.0.0:resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==+source-map-support@^0.5.21:+ version "0.5.21"+ resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"+ integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==+ dependencies:+ buffer-from "^1.0.0"+ source-map "^0.6.0"++source-map@^0.6.0:+ version "0.6.1"+ resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"+ integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==+version "0.0.2-1"resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0"@@ -9460,25 +9790,6 @@ triple-beam@^1.3.0:resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9"integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==-ts-node@^10.8.1:- version "10.9.1"- resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"- integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==- dependencies:- "@cspotcode/source-map-support" "^0.8.0"- "@tsconfig/node10" "^1.0.7"- "@tsconfig/node12" "^1.0.7"- "@tsconfig/node14" "^1.0.0"- "@tsconfig/node16" "^1.0.2"- acorn "^8.4.1"- acorn-walk "^8.1.1"- arg "^4.1.0"- create-require "^1.1.0"- diff "^4.0.1"- make-error "^1.1.1"- v8-compile-cache-lib "^3.0.1"- yn "3.1.1"-tsc-watch@^6.0.0:version "6.0.4"resolved "https://registry.yarnpkg.com/tsc-watch/-/tsc-watch-6.0.4.tgz#af15229f03cd53086771a97b10653db063bc6c59"@@ -9499,15 +9810,6 @@ tsconfig-paths@^3.14.1:minimist "^1.2.6"strip-bom "^3.0.0"-tsconfig-paths@^4.0.0:- version "4.2.0"- resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz#ef78e19039133446d244beac0fd6a1632e2d107c"- integrity sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==- dependencies:- json5 "^2.2.2"- minimist "^1.2.6"- strip-bom "^3.0.0"-tslib@^1.11.1, tslib@^1.8.1:version "1.14.1"resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"@@ -9525,6 +9827,17 @@ tsutils@^3.21.0:dependencies:tslib "^1.8.1"+tsx@^3.12.7:+ version "3.12.7"+ resolved "https://registry.yarnpkg.com/tsx/-/tsx-3.12.7.tgz#b3b8b0fc79afc8260d1e14f9e995616c859a91e9"+ integrity sha512-C2Ip+jPmqKd1GWVQDvz/Eyc6QJbGfE7NrR3fx5BpEHMZsEHoIxHL1j+lKdGobr8ovEyqeNkPLSKp6SCSOt7gmw==+ dependencies:+ "@esbuild-kit/cjs-loader" "^2.4.2"+ "@esbuild-kit/core-utils" "^3.0.0"+ "@esbuild-kit/esm-loader" "^2.5.5"+ optionalDependencies:+ fsevents "~2.3.2"+tv4@^1.3.0:version "1.3.0"resolved "https://registry.yarnpkg.com/tv4/-/tv4-1.3.0.tgz#d020c846fadd50c855abb25ebaecc68fc10f7963"@@ -9608,6 +9921,13 @@ uint64be@^2.0.2:dependencies:buffer-alloc "^1.1.0"+uint8-util@^2.1.6:+ version "2.2.2"+ resolved "https://registry.yarnpkg.com/uint8-util/-/uint8-util-2.2.2.tgz#d1830e02957c7b5e1913c519174ff2c63fb7e2a3"+ integrity sha512-zqDacLmV6UPJguIUKezcW8V9NzWJQxF6KX0hHiJWq2YbgHcTS8RnsfcganIRI51Pla59OIq6MjjjEMDEBnEW0A==+ dependencies:+ base64-arraybuffer "^1.0.2"+unbox-primitive@^1.0.2:version "1.0.2"resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e"@@ -9747,11 +10067,6 @@ uuid@^9.0.0:resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==-v8-compile-cache-lib@^3.0.1:- version "3.0.1"- resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"- integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==-valid-data-url@^3.0.0:version "3.0.1"resolved "https://registry.yarnpkg.com/valid-data-url/-/valid-data-url-3.0.1.tgz#826c1744e71b5632e847dd15dbd45b9fb38aa34f"@@ -10208,11 +10523,6 @@ yargs@^17.7.1:y18n "^5.0.5"yargs-parser "^21.1.1"- version "3.1.1"- resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"- integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==-yocto-queue@^0.1.0:version "0.1.0"resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"