mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 09:49:20 +02:00
Migrate server to ESM
Sorry for the very big commit that may lead to git log issues and merge conflicts, but it's a major step forward: * Server can be faster at startup because imports() are async and we can easily lazy import big modules * Angular doesn't seem to support ES import (with .js extension), so we had to correctly organize peertube into a monorepo: * Use yarn workspace feature * Use typescript reference projects for dependencies * Shared projects have been moved into "packages", each one is now a node module (with a dedicated package.json/tsconfig.json) * server/tools have been moved into apps/ and is now a dedicated app bundled and published on NPM so users don't have to build peertube cli tools manually * server/tests have been moved into packages/ so we don't compile them every time we want to run the server * Use isolatedModule option: * Had to move from const enum to const (https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums) * Had to explictely specify "type" imports when used in decorators * Prefer tsx (that uses esbuild under the hood) instead of ts-node to load typescript files (tests with mocha or scripts): * To reduce test complexity as esbuild doesn't support decorator metadata, we only test server files that do not import server models * We still build tests files into js files for a faster CI * Remove unmaintained peertube CLI import script * Removed some barrels to speed up execution (less imports)
This commit is contained in:
parent
04d1da5621
commit
3a4992633e
2196 changed files with 12690 additions and 11574 deletions
259
packages/models/src/server/custom-config.model.ts
Normal file
259
packages/models/src/server/custom-config.model.ts
Normal file
|
@ -0,0 +1,259 @@
|
|||
import { NSFWPolicyType } from '../videos/nsfw-policy.type.js'
|
||||
import { BroadcastMessageLevel } from './broadcast-message-level.type.js'
|
||||
|
||||
export type ConfigResolutions = {
|
||||
'144p': boolean
|
||||
'240p': boolean
|
||||
'360p': boolean
|
||||
'480p': boolean
|
||||
'720p': boolean
|
||||
'1080p': boolean
|
||||
'1440p': boolean
|
||||
'2160p': boolean
|
||||
}
|
||||
|
||||
export interface CustomConfig {
|
||||
instance: {
|
||||
name: string
|
||||
shortDescription: string
|
||||
description: string
|
||||
terms: string
|
||||
codeOfConduct: string
|
||||
|
||||
creationReason: string
|
||||
moderationInformation: string
|
||||
administrator: string
|
||||
maintenanceLifetime: string
|
||||
businessModel: string
|
||||
hardwareInformation: string
|
||||
|
||||
languages: string[]
|
||||
categories: number[]
|
||||
|
||||
isNSFW: boolean
|
||||
defaultNSFWPolicy: NSFWPolicyType
|
||||
|
||||
defaultClientRoute: string
|
||||
|
||||
customizations: {
|
||||
javascript?: string
|
||||
css?: string
|
||||
}
|
||||
}
|
||||
|
||||
theme: {
|
||||
default: string
|
||||
}
|
||||
|
||||
services: {
|
||||
twitter: {
|
||||
username: string
|
||||
whitelisted: boolean
|
||||
}
|
||||
}
|
||||
|
||||
client: {
|
||||
videos: {
|
||||
miniature: {
|
||||
preferAuthorDisplayName: boolean
|
||||
}
|
||||
}
|
||||
|
||||
menu: {
|
||||
login: {
|
||||
redirectOnSingleExternalAuth: boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cache: {
|
||||
previews: {
|
||||
size: number
|
||||
}
|
||||
|
||||
captions: {
|
||||
size: number
|
||||
}
|
||||
|
||||
torrents: {
|
||||
size: number
|
||||
}
|
||||
|
||||
storyboards: {
|
||||
size: number
|
||||
}
|
||||
}
|
||||
|
||||
signup: {
|
||||
enabled: boolean
|
||||
limit: number
|
||||
requiresApproval: boolean
|
||||
requiresEmailVerification: boolean
|
||||
minimumAge: number
|
||||
}
|
||||
|
||||
admin: {
|
||||
email: string
|
||||
}
|
||||
|
||||
contactForm: {
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
user: {
|
||||
history: {
|
||||
videos: {
|
||||
enabled: boolean
|
||||
}
|
||||
}
|
||||
videoQuota: number
|
||||
videoQuotaDaily: number
|
||||
}
|
||||
|
||||
videoChannels: {
|
||||
maxPerUser: number
|
||||
}
|
||||
|
||||
transcoding: {
|
||||
enabled: boolean
|
||||
|
||||
allowAdditionalExtensions: boolean
|
||||
allowAudioFiles: boolean
|
||||
|
||||
remoteRunners: {
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
threads: number
|
||||
concurrency: number
|
||||
|
||||
profile: string
|
||||
|
||||
resolutions: ConfigResolutions & { '0p': boolean }
|
||||
|
||||
alwaysTranscodeOriginalResolution: boolean
|
||||
|
||||
webVideos: {
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
hls: {
|
||||
enabled: boolean
|
||||
}
|
||||
}
|
||||
|
||||
live: {
|
||||
enabled: boolean
|
||||
|
||||
allowReplay: boolean
|
||||
|
||||
latencySetting: {
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
maxDuration: number
|
||||
maxInstanceLives: number
|
||||
maxUserLives: number
|
||||
|
||||
transcoding: {
|
||||
enabled: boolean
|
||||
remoteRunners: {
|
||||
enabled: boolean
|
||||
}
|
||||
threads: number
|
||||
profile: string
|
||||
resolutions: ConfigResolutions
|
||||
alwaysTranscodeOriginalResolution: boolean
|
||||
}
|
||||
}
|
||||
|
||||
videoStudio: {
|
||||
enabled: boolean
|
||||
|
||||
remoteRunners: {
|
||||
enabled: boolean
|
||||
}
|
||||
}
|
||||
|
||||
videoFile: {
|
||||
update: {
|
||||
enabled: boolean
|
||||
}
|
||||
}
|
||||
|
||||
import: {
|
||||
videos: {
|
||||
concurrency: number
|
||||
|
||||
http: {
|
||||
enabled: boolean
|
||||
}
|
||||
torrent: {
|
||||
enabled: boolean
|
||||
}
|
||||
}
|
||||
videoChannelSynchronization: {
|
||||
enabled: boolean
|
||||
maxPerUser: number
|
||||
}
|
||||
}
|
||||
|
||||
trending: {
|
||||
videos: {
|
||||
algorithms: {
|
||||
enabled: string[]
|
||||
default: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
autoBlacklist: {
|
||||
videos: {
|
||||
ofUsers: {
|
||||
enabled: boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
followers: {
|
||||
instance: {
|
||||
enabled: boolean
|
||||
manualApproval: boolean
|
||||
}
|
||||
}
|
||||
|
||||
followings: {
|
||||
instance: {
|
||||
autoFollowBack: {
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
autoFollowIndex: {
|
||||
enabled: boolean
|
||||
indexUrl: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
broadcastMessage: {
|
||||
enabled: boolean
|
||||
message: string
|
||||
level: BroadcastMessageLevel
|
||||
dismissable: boolean
|
||||
}
|
||||
|
||||
search: {
|
||||
remoteUri: {
|
||||
users: boolean
|
||||
anonymous: boolean
|
||||
}
|
||||
|
||||
searchIndex: {
|
||||
enabled: boolean
|
||||
url: string
|
||||
disableLocalSearch: boolean
|
||||
isDefaultSearch: boolean
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue