2021-04-09 11:07:42 +00:00
|
|
|
// TODO: import @types/peertube when available
|
|
|
|
|
|
|
|
interface RegisterClientHookOptions {
|
|
|
|
target: string // FIXME
|
|
|
|
handler: Function
|
|
|
|
priority?: number
|
|
|
|
}
|
|
|
|
|
|
|
|
interface RegisterClientHelpers {
|
|
|
|
getBaseStaticRoute: () => string
|
2021-06-02 13:18:09 +00:00
|
|
|
// NB: getBaseRouterRoute will come with Peertube > 3.2.1 (3.3.0?)
|
|
|
|
getBaseRouterRoute?: () => string
|
2021-04-09 11:07:42 +00:00
|
|
|
isLoggedIn: () => boolean
|
2021-06-11 23:16:57 +00:00
|
|
|
getAuthHeader: () => { 'Authorization': string } | undefined
|
2021-04-09 11:07:42 +00:00
|
|
|
getSettings: () => Promise<{ [ name: string ]: string }>
|
|
|
|
notifier: {
|
|
|
|
info: (text: string, title?: string, timeout?: number) => void
|
|
|
|
error: (text: string, title?: string, timeout?: number) => void
|
|
|
|
success: (text: string, title?: string, timeout?: number) => void
|
|
|
|
}
|
|
|
|
showModal: (input: {
|
|
|
|
title: string
|
|
|
|
content: string
|
|
|
|
close?: boolean
|
|
|
|
cancel?: { value: string, action?: () => void }
|
|
|
|
confirm?: { value: string, action?: () => void }
|
|
|
|
}) => void
|
|
|
|
markdownRenderer: {
|
|
|
|
textMarkdownToHTML: (textMarkdown: string) => Promise<string>
|
|
|
|
enhancedMarkdownToHTML: (enhancedMarkdown: string) => Promise<string>
|
|
|
|
}
|
|
|
|
translate: (toTranslate: string) => Promise<string>
|
|
|
|
}
|
|
|
|
|
2021-05-10 19:04:04 +00:00
|
|
|
interface RegisterClientFormFieldOptions {
|
|
|
|
name: string
|
|
|
|
label: string
|
|
|
|
type: 'input' | 'input-checkbox' | 'input-password' | 'input-textarea' | 'markdown-text' | 'markdown-enhanced'
|
|
|
|
descriptionHTML?: string
|
|
|
|
default?: string | boolean
|
2021-06-08 16:08:58 +00:00
|
|
|
hidden?: (options: any) => boolean
|
2021-05-10 19:04:04 +00:00
|
|
|
}
|
|
|
|
interface RegisterClientSettingsScript {
|
|
|
|
isSettingHidden: (options: {
|
|
|
|
setting: RegisterClientFormFieldOptions
|
|
|
|
formValues: { [name: string]: any }
|
|
|
|
}) => boolean
|
|
|
|
}
|
|
|
|
|
2021-06-08 16:08:58 +00:00
|
|
|
interface RegisterClientVideoFieldOptions {
|
|
|
|
type: 'update' | 'upload' | 'import-url' | 'import-torrent' | 'go-live'
|
|
|
|
}
|
|
|
|
|
2021-04-07 16:14:58 +00:00
|
|
|
interface RegisterOptions {
|
2021-04-09 11:07:42 +00:00
|
|
|
registerHook: (options: RegisterClientHookOptions) => void
|
|
|
|
peertubeHelpers: RegisterClientHelpers
|
2021-06-02 10:32:00 +00:00
|
|
|
registerSettingsScript: (options: RegisterClientSettingsScript) => void
|
2021-06-08 16:08:58 +00:00
|
|
|
registerVideoField: (
|
|
|
|
commonOptions: RegisterClientFormFieldOptions,
|
|
|
|
videoFormOptions: RegisterClientVideoFieldOptions
|
|
|
|
) => void
|
2021-04-07 16:14:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Video {
|
|
|
|
isLive: boolean
|
|
|
|
isLocal: boolean
|
|
|
|
originInstanceUrl: string
|
|
|
|
uuid: string
|
|
|
|
}
|