mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Introduce generic video constant manager for plugins
Allow a plugin developer to get back constants values, and reset constants deletions or additions.
This commit is contained in:
parent
de15b052c5
commit
dc3d902234
12 changed files with 470 additions and 232 deletions
|
@ -1,8 +1,12 @@
|
|||
import { VideoPlaylistPrivacy } from '../../../videos/playlist/video-playlist-privacy.model'
|
||||
import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model'
|
||||
|
||||
export interface PluginPlaylistPrivacyManager {
|
||||
// PUBLIC = 1,
|
||||
// UNLISTED = 2,
|
||||
// PRIVATE = 3
|
||||
export interface PluginPlaylistPrivacyManager extends ConstantManager<VideoPlaylistPrivacy> {
|
||||
/**
|
||||
* PUBLIC = 1,
|
||||
* UNLISTED = 2,
|
||||
* PRIVATE = 3
|
||||
* @deprecated use `deleteConstant` instead
|
||||
*/
|
||||
deletePlaylistPrivacy: (privacyKey: VideoPlaylistPrivacy) => boolean
|
||||
}
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
export interface PluginVideoCategoryManager {
|
||||
import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model'
|
||||
|
||||
export interface PluginVideoCategoryManager extends ConstantManager<number> {
|
||||
/**
|
||||
* @deprecated use `addConstant` instead
|
||||
*/
|
||||
addCategory: (categoryKey: number, categoryLabel: string) => boolean
|
||||
|
||||
/**
|
||||
* @deprecated use `deleteConstant` instead
|
||||
*/
|
||||
deleteCategory: (categoryKey: number) => boolean
|
||||
}
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
export interface PluginVideoLanguageManager {
|
||||
import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model'
|
||||
|
||||
export interface PluginVideoLanguageManager extends ConstantManager<string> {
|
||||
/**
|
||||
* @deprecated use `addConstant` instead
|
||||
*/
|
||||
addLanguage: (languageKey: string, languageLabel: string) => boolean
|
||||
|
||||
/**
|
||||
* @deprecated use `deleteConstant` instead
|
||||
*/
|
||||
deleteLanguage: (languageKey: string) => boolean
|
||||
}
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
export interface PluginVideoLicenceManager {
|
||||
import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model'
|
||||
|
||||
export interface PluginVideoLicenceManager extends ConstantManager<number> {
|
||||
/**
|
||||
* @deprecated use `addLicence` instead
|
||||
*/
|
||||
addLicence: (licenceKey: number, licenceLabel: string) => boolean
|
||||
|
||||
/**
|
||||
* @deprecated use `deleteLicence` instead
|
||||
*/
|
||||
deleteLicence: (licenceKey: number) => boolean
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
import { VideoPrivacy } from '../../../videos/video-privacy.enum'
|
||||
import { ConstantManager } from '@shared/models/plugins/server/plugin-constant-manager.model'
|
||||
|
||||
export interface PluginVideoPrivacyManager {
|
||||
// PUBLIC = 1
|
||||
// UNLISTED = 2
|
||||
// PRIVATE = 3
|
||||
// INTERNAL = 4
|
||||
export interface PluginVideoPrivacyManager extends ConstantManager<VideoPrivacy> {
|
||||
/**
|
||||
* PUBLIC = 1,
|
||||
* UNLISTED = 2,
|
||||
* PRIVATE = 3
|
||||
* INTERNAL = 4
|
||||
* @deprecated use `deleteConstant` instead
|
||||
*/
|
||||
deletePrivacy: (privacyKey: VideoPrivacy) => boolean
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
export interface ConstantManager <K extends string | number> {
|
||||
addConstant: (key: K, label: string) => boolean
|
||||
deleteConstant: (key: K) => boolean
|
||||
getConstantValue: (key: K) => string
|
||||
getConstants: () => Record<K, string>
|
||||
resetConstants: () => void
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue