2024-05-23 09:42:14 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-05-23 12:41:11 +00:00
|
|
|
// Not working for some reason
|
|
|
|
// import type { ActorImage } from '@peertube/peertube-types'
|
|
|
|
|
|
|
|
interface ActorImage {
|
|
|
|
width: number
|
|
|
|
path: string
|
|
|
|
url?: string
|
|
|
|
createdAt: Date | string
|
|
|
|
updatedAt: Date | string
|
|
|
|
}
|
|
|
|
|
2021-11-18 10:08:12 +00:00
|
|
|
type ConverseJSTheme = 'peertube' | 'default' | 'concord'
|
2021-06-02 17:54:04 +00:00
|
|
|
|
2023-08-01 15:01:09 +00:00
|
|
|
interface InitConverseJSParams {
|
2024-04-08 17:02:56 +00:00
|
|
|
peertubeVideoOriginalUrl?: string
|
|
|
|
peertubeVideoUUID?: string
|
2023-08-01 15:01:09 +00:00
|
|
|
isRemoteChat: boolean
|
2024-04-04 14:48:19 +00:00
|
|
|
localAnonymousJID: string | null
|
2023-08-01 15:01:09 +00:00
|
|
|
remoteAnonymousJID: string | null
|
|
|
|
remoteAnonymousXMPPServer: boolean
|
|
|
|
remoteAuthenticatedXMPPServer: boolean
|
2023-08-01 16:42:24 +00:00
|
|
|
staticBaseUrl: string
|
2023-08-01 15:01:09 +00:00
|
|
|
assetsPath: string
|
|
|
|
room: string
|
|
|
|
localBoshServiceUrl: string | null
|
|
|
|
localWebsocketServiceUrl: string | null
|
|
|
|
remoteBoshServiceUrl: string | null
|
|
|
|
remoteWebsocketServiceUrl: string | null
|
|
|
|
authenticationUrl: string
|
|
|
|
autoViewerMode: boolean
|
|
|
|
forceReadonly: boolean | 'noscroll'
|
|
|
|
theme: ConverseJSTheme
|
|
|
|
transparent: boolean
|
2024-01-31 17:12:53 +00:00
|
|
|
forceDefaultHideMucParticipants?: boolean
|
2024-04-02 15:40:43 +00:00
|
|
|
autofocus?: boolean
|
2024-04-22 12:28:55 +00:00
|
|
|
externalAuthOIDC?: Array<{
|
|
|
|
type: ExternalAuthOIDCType
|
2024-04-15 16:29:09 +00:00
|
|
|
buttonLabel: string
|
2024-04-16 15:18:14 +00:00
|
|
|
url: string
|
2024-04-22 12:28:55 +00:00
|
|
|
}>
|
2024-05-28 15:56:24 +00:00
|
|
|
customEmojisUrl?: string | null
|
2023-08-01 15:01:09 +00:00
|
|
|
}
|
|
|
|
|
2023-12-27 11:48:45 +00:00
|
|
|
interface InitConverseJSParamsError {
|
|
|
|
isError: true
|
|
|
|
code: 404 | 403 | 500
|
|
|
|
message: string
|
|
|
|
}
|
|
|
|
|
2021-06-11 23:16:57 +00:00
|
|
|
interface ProsodyListRoomsResultError {
|
|
|
|
ok: false
|
|
|
|
error: string
|
|
|
|
}
|
|
|
|
|
2021-08-05 16:25:27 +00:00
|
|
|
interface ProsodyListRoomsResultRoom {
|
|
|
|
jid: string
|
|
|
|
localpart: string
|
|
|
|
name: string
|
|
|
|
lang: string
|
|
|
|
description: string
|
|
|
|
lasttimestamp?: number
|
|
|
|
channel?: {
|
|
|
|
id: number
|
|
|
|
name: string
|
|
|
|
displayName: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-11 23:16:57 +00:00
|
|
|
interface ProsodyListRoomsResultSuccess {
|
|
|
|
ok: true
|
2021-08-05 16:25:27 +00:00
|
|
|
rooms: ProsodyListRoomsResultRoom[]
|
2021-06-11 23:16:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ProsodyListRoomsResult = ProsodyListRoomsResultError | ProsodyListRoomsResultSuccess
|
|
|
|
|
2023-08-09 14:16:02 +00:00
|
|
|
interface ChannelInfos {
|
|
|
|
id: number
|
|
|
|
name: string
|
|
|
|
displayName: string
|
|
|
|
}
|
|
|
|
|
2024-05-23 12:41:11 +00:00
|
|
|
interface ChannelLiveChatInfos extends ChannelInfos {
|
|
|
|
avatar: ActorImage
|
|
|
|
avatars: ActorImage[]
|
|
|
|
livechatConfigurationUri: string
|
|
|
|
}
|
|
|
|
|
2023-09-06 13:23:39 +00:00
|
|
|
interface ChannelConfigurationOptions {
|
2023-09-21 17:32:47 +00:00
|
|
|
bot: {
|
|
|
|
enabled: boolean
|
|
|
|
nickname?: string
|
2024-05-26 03:06:28 +00:00
|
|
|
forbiddenWords: ChannelForbiddenWords[]
|
|
|
|
quotes: ChannelQuotes[]
|
|
|
|
commands: ChannelCommands[]
|
2023-09-21 17:32:47 +00:00
|
|
|
// TODO: bannedJIDs: string[]
|
|
|
|
}
|
2024-02-13 11:49:22 +00:00
|
|
|
slowMode: {
|
2024-03-07 16:56:27 +00:00
|
|
|
duration: number
|
2024-02-13 11:49:22 +00:00
|
|
|
}
|
2024-06-21 16:18:11 +00:00
|
|
|
mute: { // comes with Livechat 10.2.0
|
2024-06-20 14:46:14 +00:00
|
|
|
anonymous: boolean
|
|
|
|
// TODO: https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/127
|
|
|
|
// nonFollowers: boolean (or a number of seconds?)
|
|
|
|
}
|
2024-06-21 16:18:11 +00:00
|
|
|
terms?: string // comes with Livechat 10.2.0
|
2024-07-09 14:15:07 +00:00
|
|
|
moderation: { // comes with Livechat 10.3.0
|
|
|
|
delay: number
|
2024-07-26 15:04:14 +00:00
|
|
|
anonymize: boolean // comes with Livechat 11.0.0
|
2024-07-09 14:15:07 +00:00
|
|
|
}
|
2023-08-08 16:26:40 +00:00
|
|
|
}
|
|
|
|
|
2024-05-26 03:06:28 +00:00
|
|
|
interface ChannelForbiddenWords {
|
|
|
|
entries: string[]
|
|
|
|
regexp?: boolean
|
|
|
|
applyToModerators?: boolean
|
|
|
|
label?: string
|
|
|
|
reason?: string
|
|
|
|
comments?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ChannelQuotes {
|
|
|
|
messages: string[]
|
|
|
|
delay: number
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ChannelCommands {
|
|
|
|
command: string
|
|
|
|
message: string
|
|
|
|
}
|
|
|
|
|
2023-09-06 13:23:39 +00:00
|
|
|
interface ChannelConfiguration {
|
2023-08-09 14:16:02 +00:00
|
|
|
channel: ChannelInfos
|
2023-09-06 13:23:39 +00:00
|
|
|
configuration: ChannelConfigurationOptions
|
2023-08-09 14:16:02 +00:00
|
|
|
}
|
|
|
|
|
2024-03-28 14:06:15 +00:00
|
|
|
type ChatPeertubeIncludeMode = 'peertube-fullpage' | 'peertube-video'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ChatIncludeMode:
|
|
|
|
* - chat-only: the chat is on a full page, without Peertube
|
|
|
|
* - peertube-fullpage: the chat is embedded in Peertube, in a full custom page
|
|
|
|
* - peertube-video: the chat is embedded in Peertube, beside a video
|
|
|
|
*/
|
|
|
|
type ChatIncludeMode = 'chat-only' | ChatPeertubeIncludeMode
|
|
|
|
|
2024-04-19 07:53:23 +00:00
|
|
|
interface ExternalAuthResultOk {
|
2024-04-17 10:09:25 +00:00
|
|
|
ok: true
|
2024-04-17 16:30:39 +00:00
|
|
|
token: string
|
2024-04-17 10:09:25 +00:00
|
|
|
}
|
|
|
|
|
2024-04-19 07:53:23 +00:00
|
|
|
interface ExternalAuthResultError {
|
2024-04-17 10:09:25 +00:00
|
|
|
ok: false
|
|
|
|
message?: string
|
|
|
|
}
|
|
|
|
|
2024-04-19 07:53:23 +00:00
|
|
|
type ExternalAuthResult = ExternalAuthResultError | ExternalAuthResultOk
|
2024-04-17 10:09:25 +00:00
|
|
|
|
2024-04-22 12:28:55 +00:00
|
|
|
type ExternalAuthOIDCType = 'custom' | 'google' | 'facebook'
|
|
|
|
|
2024-05-28 15:56:24 +00:00
|
|
|
interface CustomEmojiDefinition {
|
|
|
|
sn: string
|
|
|
|
url: string
|
|
|
|
isCategoryEmoji?: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ChannelEmojis {
|
|
|
|
customEmojis: CustomEmojiDefinition[]
|
|
|
|
}
|
|
|
|
|
2024-06-04 14:39:25 +00:00
|
|
|
interface ChannelEmojisConfiguration {
|
|
|
|
channel: ChannelInfos
|
|
|
|
emojis: ChannelEmojis
|
|
|
|
}
|
|
|
|
|
2024-06-16 17:48:02 +00:00
|
|
|
interface ProsodyAuthentInfos {
|
|
|
|
type: 'peertube' | 'oidc' | 'livechat-token'
|
|
|
|
jid: string
|
|
|
|
password: string
|
|
|
|
nickname?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LivechatToken {
|
|
|
|
id: number
|
|
|
|
label: string
|
|
|
|
jid: string
|
|
|
|
password: string
|
|
|
|
nickname?: string
|
|
|
|
date: number
|
|
|
|
}
|
|
|
|
|
2024-08-12 16:17:31 +00:00
|
|
|
interface AdminFirewallConfigurationFile {
|
|
|
|
name: string
|
|
|
|
content: string
|
|
|
|
enabled: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
interface AdminFirewallConfiguration {
|
|
|
|
enabled: boolean
|
|
|
|
files: AdminFirewallConfigurationFile[]
|
|
|
|
}
|
|
|
|
|
2022-12-07 17:36:16 +00:00
|
|
|
export type {
|
2021-11-18 10:08:12 +00:00
|
|
|
ConverseJSTheme,
|
2023-08-01 15:01:09 +00:00
|
|
|
InitConverseJSParams,
|
2023-12-27 11:48:45 +00:00
|
|
|
InitConverseJSParamsError,
|
2021-08-05 16:25:27 +00:00
|
|
|
ProsodyListRoomsResult,
|
2023-08-08 16:26:40 +00:00
|
|
|
ProsodyListRoomsResultRoom,
|
2023-08-09 14:16:02 +00:00
|
|
|
ChannelInfos,
|
2024-05-23 12:41:11 +00:00
|
|
|
ChannelLiveChatInfos,
|
2023-09-06 13:23:39 +00:00
|
|
|
ChannelConfigurationOptions,
|
2024-03-28 14:06:15 +00:00
|
|
|
ChannelConfiguration,
|
|
|
|
ChatIncludeMode,
|
2024-04-17 10:09:25 +00:00
|
|
|
ChatPeertubeIncludeMode,
|
2024-04-19 07:53:23 +00:00
|
|
|
ExternalAuthResultError,
|
|
|
|
ExternalAuthResultOk,
|
2024-04-22 12:28:55 +00:00
|
|
|
ExternalAuthResult,
|
2024-05-28 15:56:24 +00:00
|
|
|
ExternalAuthOIDCType,
|
|
|
|
CustomEmojiDefinition,
|
2024-06-04 14:39:25 +00:00
|
|
|
ChannelEmojis,
|
2024-06-16 17:48:02 +00:00
|
|
|
ChannelEmojisConfiguration,
|
|
|
|
ProsodyAuthentInfos,
|
2024-08-12 16:17:31 +00:00
|
|
|
LivechatToken,
|
|
|
|
AdminFirewallConfiguration,
|
|
|
|
AdminFirewallConfigurationFile
|
2021-06-02 17:54:04 +00:00
|
|
|
}
|