aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/videos-command.ts
diff options
context:
space:
mode:
authorlutangar <johan.dufour@gmail.com>2021-11-02 19:11:20 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-12-16 10:08:43 +0100
commit06aad80165d09a8863ab8103149a8ff518b10641 (patch)
treea97fa31f3ade29ff807ca1b77704eb47085ab99d /shared/extra-utils/videos/videos-command.ts
parent854f533c12bd2b88c70f9d5aeab770059e9a6861 (diff)
downloadPeerTube-06aad80165d09a8863ab8103149a8ff518b10641.tar.gz
PeerTube-06aad80165d09a8863ab8103149a8ff518b10641.tar.zst
PeerTube-06aad80165d09a8863ab8103149a8ff518b10641.zip
chore(refactor): remove shared folder dependencies to the server
Many files from the `shared` folder were importing files from the `server` folder. When attempting to use Typescript project references to describe dependencies, it highlighted a circular dependency beetween `shared` <-> `server`. The Typescript project forbid such usages. Using project references greatly improve performance by rebuilding only the updated project and not all source files. > see https://www.typescriptlang.org/docs/handbook/project-references.html
Diffstat (limited to 'shared/extra-utils/videos/videos-command.ts')
-rw-r--r--shared/extra-utils/videos/videos-command.ts12
1 files changed, 2 insertions, 10 deletions
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts
index 7ec9c3647..8ea828b40 100644
--- a/shared/extra-utils/videos/videos-command.ts
+++ b/shared/extra-utils/videos/videos-command.ts
@@ -5,8 +5,7 @@ import { createReadStream, stat } from 'fs-extra'
5import got, { Response as GotResponse } from 'got' 5import got, { Response as GotResponse } from 'got'
6import { omit } from 'lodash' 6import { omit } from 'lodash'
7import validator from 'validator' 7import validator from 'validator'
8import { buildUUID } from '@server/helpers/uuid' 8import { buildUUID } from '@shared/core-utils/uuid'
9import { loadLanguages } from '@server/initializers/constants'
10import { pick } from '@shared/core-utils' 9import { pick } from '@shared/core-utils'
11import { 10import {
12 HttpStatusCode, 11 HttpStatusCode,
@@ -23,7 +22,7 @@ import {
23} from '@shared/models' 22} from '@shared/models'
24import { buildAbsoluteFixturePath, wait } from '../miscs' 23import { buildAbsoluteFixturePath, wait } from '../miscs'
25import { unwrapBody } from '../requests' 24import { unwrapBody } from '../requests'
26import { PeerTubeServer, waitJobs } from '../server' 25import { waitJobs } from '../server'
27import { AbstractCommand, OverrideCommandOptions } from '../shared' 26import { AbstractCommand, OverrideCommandOptions } from '../shared'
28 27
29export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { 28export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & {
@@ -33,13 +32,6 @@ export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile
33} 32}
34 33
35export class VideosCommand extends AbstractCommand { 34export class VideosCommand extends AbstractCommand {
36
37 constructor (server: PeerTubeServer) {
38 super(server)
39
40 loadLanguages()
41 }
42
43 getCategories (options: OverrideCommandOptions = {}) { 35 getCategories (options: OverrideCommandOptions = {}) {
44 const path = '/api/v1/videos/categories' 36 const path = '/api/v1/videos/categories'
45 37