This commit is contained in:
2024-10-01 19:19:13 -04:00
342 changed files with 45714 additions and 16642 deletions

View File

@ -1,41 +0,0 @@
{
"root": true,
"env": {
"browser": true,
"es6": true
},
"extends": [
"standard-with-typescript"
],
"globals": {},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"project": [
"./server/tsconfig.json",
"./client/tsconfig.json"
]
},
"plugins": [
"@typescript-eslint"
],
"ignorePatterns": [],
"rules": {
"@typescript-eslint/no-unused-vars": [2, {"argsIgnorePattern": "^_"}],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/return-await": [2, "in-try-catch"], // FIXME: correct?
"@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/triple-slash-reference": "off",
"max-len": [
"error",
{
"code": 120,
"comments": 120
}
],
"no-unused-vars": "off"
}
}

View File

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
SPDX-License-Identifier: AGPL-3.0-only

View File

@ -0,0 +1,12 @@
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
//
// SPDX-License-Identifier: AGPL-3.0-only
// Note: API request body size is limited to 100Kb (expressjs body-parser defaut limit, and Peertube nginx config).
// So we must be sure to never send more than 100Kb.
// All files are sent in one JSON object.
export const maxFirewallFileSize: number = 3 * 1024
export const maxFirewallFiles = 20
export const maxFirewallNameLength = 20
export const firewallNameRegexp = /^[a-zA-Z0-9_-]+$/

View File

@ -3,3 +3,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
export const channelTermsMaxLength = 400
export const forbidSpecialCharsDefaultTolerance = 0
export const forbidSpecialCharsMaxTolerance = 10
export const noDuplicateMaxDelay = 86400
export const noDuplicateDefaultDelay = 60

View File

@ -13,7 +13,7 @@ interface ActorImage {
updatedAt: Date | string
}
type ConverseJSTheme = 'peertube' | 'default' | 'concord'
type ConverseJSTheme = 'peertube' | 'default' | 'cyberpunk'
interface InitConverseJSParams {
peertubeVideoOriginalUrl?: string
@ -96,6 +96,8 @@ interface ChannelConfigurationOptions {
forbiddenWords: ChannelForbiddenWords[]
quotes: ChannelQuotes[]
commands: ChannelCommands[]
forbidSpecialChars: ChannelForbidSpecialChars
noDuplicate: ChannelNoDuplicate
// TODO: bannedJIDs: string[]
}
slowMode: {
@ -109,6 +111,7 @@ interface ChannelConfigurationOptions {
terms?: string // comes with Livechat 10.2.0
moderation: { // comes with Livechat 10.3.0
delay: number
anonymize: boolean // comes with Livechat 11.0.0
}
}
@ -131,6 +134,20 @@ interface ChannelCommands {
message: string
}
interface ChannelForbidSpecialChars {
enabled: boolean
tolerance: number
reason: string
applyToModerators: boolean
}
interface ChannelNoDuplicate {
enabled: boolean
reason: string
delay: number
applyToModerators: boolean
}
interface ChannelConfiguration {
channel: ChannelInfos
configuration: ChannelConfigurationOptions
@ -191,6 +208,17 @@ interface LivechatToken {
date: number
}
interface AdminFirewallConfigurationFile {
name: string
content: string
enabled: boolean
}
interface AdminFirewallConfiguration {
enabled: boolean
files: AdminFirewallConfigurationFile[]
}
export type {
ConverseJSTheme,
InitConverseJSParams,
@ -211,5 +239,7 @@ export type {
ChannelEmojis,
ChannelEmojisConfiguration,
ProsodyAuthentInfos,
LivechatToken
LivechatToken,
AdminFirewallConfiguration,
AdminFirewallConfigurationFile
}

View File

@ -44,7 +44,7 @@ function videoHasWebchat (settings: VideoHasWebchatSettings, video: SharedVideo)
if (video.remote) return false
}
if (settings['chat-per-live-video'] && video.isLive && video.pluginData && video.pluginData['livechat-active']) {
if (settings['chat-per-live-video'] && video.isLive && video.pluginData?.['livechat-active']) {
return true
}