Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Flat shared module directory

Chocobozzz59c76ffa8f50
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index 98ce732579..2aabb5fe8e 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -24,7 +24,7 @@ import { ResultList, VideoDetails } from '../../../../shared'
import { addContextMenu, getVideojsOptions, loadLocale } from '../../assets/player/peertube-player'
import { PeerTubeResolution } from '../player/definitions'
import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings'
-import { VideoCaption } from '../../../../shared/models/videos/video-caption.model'
+import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
/**
* Embed API exposes control of the embed player to the outside world via
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index ff8e64330f..bce7971595 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -3,12 +3,11 @@ import { dirname, join } from 'path'
import { JobType, VideoRateType, VideoState } from '../../shared/models'
import { ActivityPubActorType } from '../../shared/models/activitypub'
import { FollowState } from '../../shared/models/actors'
-import { VideoPrivacy, VideoAbuseState } from '../../shared/models/videos'
+import { VideoPrivacy, VideoAbuseState, VideoImportState } from '../../shared/models/videos'
// Do not use barrels, remain constants as independent as possible
import { buildPath, isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
import { invert } from 'lodash'
-import { VideoImportState } from '../../shared/models/videos/video-import-state.enum'
// Use a variable to reload the configuration if we need
let config: IConfig = require('config')
diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts
index 4a25097f8a..3593646a2c 100644
--- a/server/models/video/video-caption.ts
+++ b/server/models/video/video-caption.ts
@@ -15,7 +15,7 @@ import {
import { throwIfNotValid } from '../utils'
import { VideoModel } from './video'
import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'
-import { VideoCaption } from '../../../shared/models/videos/video-caption.model'
+import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
import { CONFIG, STATIC_PATHS, VIDEO_LANGUAGES } from '../../initializers'
import { join } from 'path'
import { logger } from '../../helpers/logger'
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index b91cb75c2c..1cad8998cf 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -27,7 +27,7 @@ import {
import { rateVideo } from '../../utils/videos/videos'
import { waitJobs } from '../../utils/server/jobs'
import { createVideoCaption, listVideoCaptions, testCaptionFile } from '../../utils/videos/video-captions'
-import { VideoCaption } from '../../../../shared/models/videos/video-caption.model'
+import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
const expect = chai.expect
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index ba9ebbdd62..6e441410d3 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -6,7 +6,7 @@ import { checkVideoFilesWereRemoved, doubleFollow, flushAndRunMultipleServers, r
import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index'
import { waitJobs } from '../../utils/server/jobs'
import { createVideoCaption, deleteVideoCaption, listVideoCaptions, testCaptionFile } from '../../utils/videos/video-captions'
-import { VideoCaption } from '../../../../shared/models/videos/video-caption.model'
+import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
const expect = chai.expect
diff --git a/server/tests/utils/videos/video-abuses.ts b/server/tests/utils/videos/video-abuses.ts
index 5f138d6b3b..14907e6a09 100644
--- a/server/tests/utils/videos/video-abuses.ts
+++ b/server/tests/utils/videos/video-abuses.ts
@@ -1,5 +1,5 @@
import * as request from 'supertest'
-import { VideoAbuseUpdate } from '../../../../shared/models/videos/video-abuse-update.model'
+import { VideoAbuseUpdate } from '../../../../shared/models/videos/abuse/video-abuse-update.model'
import { makeDeleteRequest, makePutBodyRequest } from '..'
function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) {
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts
index d3085267f7..8eddaa4966 100644
--- a/shared/models/users/user.model.ts
+++ b/shared/models/users/user.model.ts
@@ -1,5 +1,5 @@
import { Account } from '../actors'
-import { VideoChannel } from '../videos/video-channel.model'
+import { VideoChannel } from '../videos/channel/video-channel.model'
import { UserRole } from './user-role'
import { NSFWPolicyType } from '../videos/nsfw-policy.type'
diff --git a/shared/models/videos/video-abuse-create.model.ts b/shared/models/videos/abuse/video-abuse-create.model.ts
similarity index 100%
rename from shared/models/videos/video-abuse-create.model.ts
rename to shared/models/videos/abuse/video-abuse-create.model.ts
diff --git a/shared/models/videos/video-abuse-state.model.ts b/shared/models/videos/abuse/video-abuse-state.model.ts
similarity index 100%
rename from shared/models/videos/video-abuse-state.model.ts
rename to shared/models/videos/abuse/video-abuse-state.model.ts
diff --git a/shared/models/videos/video-abuse-update.model.ts b/shared/models/videos/abuse/video-abuse-update.model.ts
similarity index 100%
rename from shared/models/videos/video-abuse-update.model.ts
rename to shared/models/videos/abuse/video-abuse-update.model.ts
diff --git a/shared/models/videos/video-abuse.model.ts b/shared/models/videos/abuse/video-abuse.model.ts
similarity index 75%
rename from shared/models/videos/video-abuse.model.ts
rename to shared/models/videos/abuse/video-abuse.model.ts
index b2319aa005..4f668795a8 100644
--- a/shared/models/videos/video-abuse.model.ts
+++ b/shared/models/videos/abuse/video-abuse.model.ts
@@ -1,5 +1,5 @@
-import { Account } from '../actors'
-import { VideoConstant } from './video-constant.model'
+import { Account } from '../../actors/index'
+import { VideoConstant } from '../video-constant.model'
import { VideoAbuseState } from './video-abuse-state.model'
export interface VideoAbuse {
diff --git a/shared/models/videos/video-blacklist-create.model.ts b/shared/models/videos/blacklist/video-blacklist-create.model.ts
similarity index 100%
rename from shared/models/videos/video-blacklist-create.model.ts
rename to shared/models/videos/blacklist/video-blacklist-create.model.ts
diff --git a/shared/models/videos/video-blacklist-update.model.ts b/shared/models/videos/blacklist/video-blacklist-update.model.ts
similarity index 100%
rename from shared/models/videos/video-blacklist-update.model.ts
rename to shared/models/videos/blacklist/video-blacklist-update.model.ts
diff --git a/shared/models/videos/video-blacklist.model.ts b/shared/models/videos/blacklist/video-blacklist.model.ts
similarity index 100%
rename from shared/models/videos/video-blacklist.model.ts
rename to shared/models/videos/blacklist/video-blacklist.model.ts
diff --git a/shared/models/videos/video-caption-update.model.ts b/shared/models/videos/caption/video-caption-update.model.ts
similarity index 100%
rename from shared/models/videos/video-caption-update.model.ts
rename to shared/models/videos/caption/video-caption-update.model.ts
diff --git a/shared/models/videos/video-caption.model.ts b/shared/models/videos/caption/video-caption.model.ts
similarity index 61%
rename from shared/models/videos/video-caption.model.ts
rename to shared/models/videos/caption/video-caption.model.ts
index 4695224ce5..d3c73e1a67 100644
--- a/shared/models/videos/video-caption.model.ts
+++ b/shared/models/videos/caption/video-caption.model.ts
@@ -1,4 +1,4 @@
-import { VideoConstant } from './video-constant.model'
+import { VideoConstant } from '../video-constant.model'
export interface VideoCaption {
language: VideoConstant<string>
diff --git a/shared/models/videos/video-channel-create.model.ts b/shared/models/videos/channel/video-channel-create.model.ts
similarity index 100%
rename from shared/models/videos/video-channel-create.model.ts
rename to shared/models/videos/channel/video-channel-create.model.ts
diff --git a/shared/models/videos/video-channel-update.model.ts b/shared/models/videos/channel/video-channel-update.model.ts
similarity index 100%
rename from shared/models/videos/video-channel-update.model.ts
rename to shared/models/videos/channel/video-channel-update.model.ts
diff --git a/shared/models/videos/video-channel.model.ts b/shared/models/videos/channel/video-channel.model.ts
similarity index 53%
rename from shared/models/videos/video-channel.model.ts
rename to shared/models/videos/channel/video-channel.model.ts
index 6e61183a72..92918f66ca 100644
--- a/shared/models/videos/video-channel.model.ts
+++ b/shared/models/videos/channel/video-channel.model.ts
@@ -1,6 +1,6 @@
-import { Actor } from '../actors/actor.model'
-import { Video } from './video.model'
-import { Account } from '../actors'
+import { Actor } from '../../actors/actor.model'
+import { Video } from '../video.model'
+import { Account } from '../../actors/index'
export interface VideoChannel extends Actor {
displayName: string
diff --git a/shared/models/videos/video-import-create.model.ts b/shared/models/videos/import/video-import-create.model.ts
similarity index 75%
rename from shared/models/videos/video-import-create.model.ts
rename to shared/models/videos/import/video-import-create.model.ts
index e76084e067..4254773899 100644
--- a/shared/models/videos/video-import-create.model.ts
+++ b/shared/models/videos/import/video-import-create.model.ts
@@ -1,4 +1,4 @@
-import { VideoUpdate } from './video-update.model'
+import { VideoUpdate } from '../video-update.model'
export interface VideoImportCreate extends VideoUpdate {
targetUrl?: string
diff --git a/shared/models/videos/video-import-state.enum.ts b/shared/models/videos/import/video-import-state.enum.ts
similarity index 100%
rename from shared/models/videos/video-import-state.enum.ts
rename to shared/models/videos/import/video-import-state.enum.ts
diff --git a/shared/models/videos/video-import.model.ts b/shared/models/videos/import/video-import.model.ts
similarity index 76%
rename from shared/models/videos/video-import.model.ts
rename to shared/models/videos/import/video-import.model.ts
index 2938540063..e2a56617d6 100644
--- a/shared/models/videos/video-import.model.ts
+++ b/shared/models/videos/import/video-import.model.ts
@@ -1,5 +1,5 @@
-import { Video } from './video.model'
-import { VideoConstant } from './video-constant.model'
+import { Video } from '../video.model'
+import { VideoConstant } from '../video-constant.model'
import { VideoImportState } from './video-import-state.enum'
export interface VideoImport {
diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts
index b99dd2d8fd..6b579cf3ed 100644
--- a/shared/models/videos/index.ts
+++ b/shared/models/videos/index.ts
@@ -1,16 +1,16 @@
-export * from './user-video-rate-update.model'
-export * from './user-video-rate.model'
-export * from './user-video-rate.type'
-export * from './video-abuse-state.model'
-export * from './video-abuse-create.model'
-export * from './video-abuse.model'
-export * from './video-abuse-update.model'
-export * from './video-blacklist.model'
-export * from './video-blacklist-create.model'
-export * from './video-blacklist-update.model'
-export * from './video-channel-create.model'
-export * from './video-channel-update.model'
-export * from './video-channel.model'
+export * from './rate/user-video-rate-update.model'
+export * from './rate/user-video-rate.model'
+export * from './rate/user-video-rate.type'
+export * from './abuse/video-abuse-state.model'
+export * from './abuse/video-abuse-create.model'
+export * from './abuse/video-abuse.model'
+export * from './abuse/video-abuse-update.model'
+export * from './blacklist/video-blacklist.model'
+export * from './blacklist/video-blacklist-create.model'
+export * from './blacklist/video-blacklist-update.model'
+export * from './channel/video-channel-create.model'
+export * from './channel/video-channel-update.model'
+export * from './channel/video-channel.model'
export * from './video-create.model'
export * from './video-privacy.enum'
export * from './video-rate.type'
@@ -18,8 +18,8 @@ export * from './video-resolution.enum'
export * from './video-update.model'
export * from './video.model'
export * from './video-state.enum'
-export * from './video-caption-update.model'
-export * from './video-import-create.model'
-export * from './video-import-state.enum'
-export * from './video-import.model'
+export * from './caption/video-caption-update.model'
+export * from './import/video-import-create.model'
+export * from './import/video-import-state.enum'
+export * from './import/video-import.model'
export { VideoConstant } from './video-constant.model'
diff --git a/shared/models/videos/user-video-rate-update.model.ts b/shared/models/videos/rate/user-video-rate-update.model.ts
similarity index 100%
rename from shared/models/videos/user-video-rate-update.model.ts
rename to shared/models/videos/rate/user-video-rate-update.model.ts
diff --git a/shared/models/videos/user-video-rate.model.ts b/shared/models/videos/rate/user-video-rate.model.ts
similarity index 100%
rename from shared/models/videos/user-video-rate.model.ts
rename to shared/models/videos/rate/user-video-rate.model.ts
diff --git a/shared/models/videos/user-video-rate.type.ts b/shared/models/videos/rate/user-video-rate.type.ts
similarity index 100%
rename from shared/models/videos/user-video-rate.type.ts
rename to shared/models/videos/rate/user-video-rate.type.ts
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts
index 8dfa960692..8e1fbe4442 100644
--- a/shared/models/videos/video.model.ts
+++ b/shared/models/videos/video.model.ts
@@ -1,7 +1,7 @@
import { VideoResolution, VideoState } from '../../index'
import { Account } from '../actors'
import { Avatar } from '../avatars/avatar.model'
-import { VideoChannel } from './video-channel.model'
+import { VideoChannel } from './channel/video-channel.model'
import { VideoPrivacy } from './video-privacy.enum'
import { VideoScheduleUpdate } from './video-schedule-update.model'
import { VideoConstant } from './video-constant.model'