2024-05-23 15:17:28 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 Mehdi Benadel <https://mehdibenadel.com>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-05-23 12:41:11 +00:00
|
|
|
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
2024-05-23 14:56:11 +00:00
|
|
|
import type { ChannelConfiguration } from 'shared/lib/types'
|
2024-05-26 03:06:28 +00:00
|
|
|
import { TemplateResult, html, nothing } from 'lit'
|
2024-05-23 00:26:38 +00:00
|
|
|
import { customElement, property, state } from 'lit/decorators.js'
|
2024-05-23 14:56:11 +00:00
|
|
|
import { ptTr } from '../../lib/directives/translation'
|
|
|
|
import { Task } from '@lit/task'
|
2024-05-23 12:41:11 +00:00
|
|
|
import { ChannelDetailsService } from '../services/channel-details'
|
|
|
|
import { provide } from '@lit/context'
|
2024-05-23 14:56:11 +00:00
|
|
|
import { channelConfigurationContext, channelDetailsServiceContext } from '../contexts/channel'
|
|
|
|
import { registerClientOptionsContext } from '../../lib/contexts/peertube'
|
2024-05-23 15:09:58 +00:00
|
|
|
import { LivechatElement } from '../../lib/elements/livechat'
|
2024-05-26 03:06:28 +00:00
|
|
|
import { ValidationError, ValidationErrorType } from '../../lib/models/validation'
|
|
|
|
import { classMap } from 'lit/directives/class-map.js'
|
2024-05-13 00:14:22 +00:00
|
|
|
|
2024-05-23 13:52:12 +00:00
|
|
|
@customElement('livechat-channel-configuration')
|
2024-05-23 15:09:58 +00:00
|
|
|
export class ChannelConfigurationElement extends LivechatElement {
|
2024-05-23 00:26:38 +00:00
|
|
|
@provide({ context: registerClientOptionsContext })
|
2024-05-13 14:40:36 +00:00
|
|
|
@property({ attribute: false })
|
2024-05-24 12:08:48 +00:00
|
|
|
public registerClientOptions?: RegisterClientOptions
|
2024-05-13 00:14:22 +00:00
|
|
|
|
2024-05-23 00:26:38 +00:00
|
|
|
@property({ attribute: false })
|
2024-05-24 12:08:48 +00:00
|
|
|
public channelId?: number
|
2024-05-23 00:26:38 +00:00
|
|
|
|
|
|
|
@provide({ context: channelConfigurationContext })
|
|
|
|
@state()
|
2024-05-24 12:08:48 +00:00
|
|
|
public _channelConfiguration?: ChannelConfiguration
|
2024-05-23 00:26:38 +00:00
|
|
|
|
2024-05-23 12:41:11 +00:00
|
|
|
@provide({ context: channelDetailsServiceContext })
|
2024-05-24 12:08:48 +00:00
|
|
|
private _channelDetailsService?: ChannelDetailsService
|
2024-05-23 00:26:38 +00:00
|
|
|
|
|
|
|
@state()
|
2024-05-26 03:06:28 +00:00
|
|
|
public _validationError?: ValidationError
|
2024-05-13 00:14:22 +00:00
|
|
|
|
2024-05-23 20:52:39 +00:00
|
|
|
private readonly _asyncTaskRender = new Task(this, {
|
|
|
|
task: async ([registerClientOptions]) => {
|
|
|
|
if (registerClientOptions) {
|
|
|
|
this._channelDetailsService = new ChannelDetailsService(registerClientOptions)
|
2024-05-23 12:41:11 +00:00
|
|
|
this._channelConfiguration = await this._channelDetailsService.fetchConfiguration(this.channelId ?? 0)
|
2024-05-13 14:40:36 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
args: () => [this.registerClientOptions]
|
2024-05-23 20:52:39 +00:00
|
|
|
})
|
2024-05-13 14:40:36 +00:00
|
|
|
|
2024-05-24 12:08:48 +00:00
|
|
|
private readonly _saveConfig = (event?: Event): void => {
|
|
|
|
event?.preventDefault()
|
2024-05-23 13:52:12 +00:00
|
|
|
if (this._channelDetailsService && this._channelConfiguration) {
|
2024-05-23 20:52:39 +00:00
|
|
|
this._channelDetailsService.saveOptions(this._channelConfiguration.channel.id,
|
|
|
|
this._channelConfiguration.configuration)
|
|
|
|
.then(() => {
|
2024-05-26 03:06:28 +00:00
|
|
|
this._validationError = undefined
|
2024-05-24 12:08:48 +00:00
|
|
|
this.registerClientOptions
|
|
|
|
?.peertubeHelpers.notifier.info('Livechat configuration has been properly updated.')
|
2024-05-26 03:06:28 +00:00
|
|
|
this.requestUpdate('_validationError')
|
2024-05-23 13:52:12 +00:00
|
|
|
})
|
2024-05-26 03:06:28 +00:00
|
|
|
.catch((error: ValidationError) => {
|
|
|
|
this._validationError = error
|
|
|
|
console.warn(`A validation error occurred in saving configuration. ${error.name}: ${error.message}`)
|
2024-05-24 12:08:48 +00:00
|
|
|
this.registerClientOptions
|
|
|
|
?.peertubeHelpers.notifier.error(
|
2024-05-26 03:06:28 +00:00
|
|
|
`An error occurred. ${(error.message) ? `${error.message}` : ''}`)
|
|
|
|
this.requestUpdate('_validationError')
|
2024-05-23 20:52:39 +00:00
|
|
|
})
|
2024-05-23 00:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-26 03:06:28 +00:00
|
|
|
private readonly _getInputValidationClass = (propertyName: string): { [key: string]: boolean } => {
|
|
|
|
const validationErrorTypes: ValidationErrorType[] | undefined =
|
|
|
|
this._validationError?.properties[`${propertyName}`]
|
|
|
|
return validationErrorTypes ? (validationErrorTypes.length ? { 'is-invalid': true } : { 'is-valid': true }) : {}
|
|
|
|
}
|
|
|
|
|
|
|
|
private readonly _renderFeedback = (feedbackId: string,
|
|
|
|
propertyName: string): TemplateResult | typeof nothing => {
|
|
|
|
const errorMessages: TemplateResult[] = []
|
|
|
|
const validationErrorTypes: ValidationErrorType[] | undefined =
|
|
|
|
this._validationError?.properties[`${propertyName}`] ?? undefined
|
|
|
|
|
|
|
|
if (validationErrorTypes && validationErrorTypes.length !== 0) {
|
|
|
|
if (validationErrorTypes.includes(ValidationErrorType.WrongType)) {
|
|
|
|
errorMessages.push(html`${ptTr(LOC_INVALID_VALUE_WRONG_TYPE)}`)
|
|
|
|
}
|
|
|
|
if (validationErrorTypes.includes(ValidationErrorType.WrongFormat)) {
|
|
|
|
errorMessages.push(html`${ptTr(LOC_INVALID_VALUE_WRONG_FORMAT)}`)
|
|
|
|
}
|
|
|
|
if (validationErrorTypes.includes(ValidationErrorType.NotInRange)) {
|
|
|
|
errorMessages.push(html`${ptTr(LOC_INVALID_VALUE_NOT_IN_RANGE)}`)
|
|
|
|
}
|
|
|
|
|
|
|
|
return html`<div id=${feedbackId} class="invalid-feedback">${errorMessages}</div>`
|
|
|
|
} else {
|
|
|
|
return nothing
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-23 20:52:39 +00:00
|
|
|
protected override render = (): unknown => {
|
|
|
|
const tableHeaderList = {
|
2024-05-23 00:26:38 +00:00
|
|
|
forbiddenWords: {
|
|
|
|
entries: {
|
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_LABEL),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_DESC2)
|
|
|
|
},
|
2024-05-28 10:45:35 +00:00
|
|
|
regexp: {
|
2024-05-23 00:26:38 +00:00
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_REGEXP_LABEL),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_REGEXP_DESC)
|
|
|
|
},
|
|
|
|
applyToModerators: {
|
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_APPLYTOMODERATORS_LABEL),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_APPLYTOMODERATORS_DESC)
|
|
|
|
},
|
|
|
|
label: {
|
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_LABEL_LABEL),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_LABEL_DESC)
|
|
|
|
},
|
|
|
|
reason: {
|
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_REASON_LABEL),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_REASON_DESC)
|
|
|
|
},
|
|
|
|
comments: {
|
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_COMMENTS_LABEL),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_COMMENTS_DESC)
|
|
|
|
}
|
2024-05-13 14:40:36 +00:00
|
|
|
},
|
2024-05-23 00:26:38 +00:00
|
|
|
quotes: {
|
|
|
|
messages: {
|
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_QUOTE_LABEL2),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_QUOTE_DESC2)
|
|
|
|
},
|
|
|
|
delay: {
|
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_QUOTE_DELAY_LABEL),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_QUOTE_DELAY_DESC)
|
|
|
|
}
|
2024-05-13 14:40:36 +00:00
|
|
|
},
|
2024-05-23 00:26:38 +00:00
|
|
|
commands: {
|
|
|
|
command: {
|
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_COMMAND_CMD_LABEL),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_COMMAND_CMD_DESC)
|
|
|
|
},
|
|
|
|
message: {
|
|
|
|
colName: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_COMMAND_MESSAGE_LABEL),
|
|
|
|
description: ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_COMMAND_MESSAGE_DESC)
|
|
|
|
}
|
2024-05-13 14:40:36 +00:00
|
|
|
}
|
2024-05-13 00:14:22 +00:00
|
|
|
}
|
2024-05-23 20:52:39 +00:00
|
|
|
const tableSchema = {
|
2024-05-23 00:26:38 +00:00
|
|
|
forbiddenWords: {
|
|
|
|
entries: {
|
2024-05-26 03:06:28 +00:00
|
|
|
inputType: 'tags',
|
|
|
|
default: [],
|
2024-05-27 22:36:49 +00:00
|
|
|
separators: ['\n', '\t', ';']
|
2024-05-23 00:26:38 +00:00
|
|
|
},
|
2024-05-28 10:45:35 +00:00
|
|
|
regexp: {
|
2024-05-23 19:51:25 +00:00
|
|
|
inputType: 'checkbox',
|
2024-05-23 20:52:39 +00:00
|
|
|
default: false
|
2024-05-23 00:26:38 +00:00
|
|
|
},
|
|
|
|
applyToModerators: {
|
|
|
|
inputType: 'checkbox',
|
2024-05-23 19:51:25 +00:00
|
|
|
default: false
|
2024-05-23 00:26:38 +00:00
|
|
|
},
|
|
|
|
label: {
|
|
|
|
inputType: 'text',
|
2024-05-23 19:51:25 +00:00
|
|
|
default: ''
|
2024-05-23 00:26:38 +00:00
|
|
|
},
|
|
|
|
reason: {
|
|
|
|
inputType: 'text',
|
2024-05-23 19:51:25 +00:00
|
|
|
default: '',
|
|
|
|
datalist: []
|
2024-05-23 00:26:38 +00:00
|
|
|
},
|
|
|
|
comments: {
|
|
|
|
inputType: 'textarea',
|
2024-05-23 19:51:25 +00:00
|
|
|
default: ''
|
2024-05-23 20:52:39 +00:00
|
|
|
}
|
2024-05-13 14:40:36 +00:00
|
|
|
},
|
2024-05-23 00:26:38 +00:00
|
|
|
quotes: {
|
|
|
|
messages: {
|
2024-05-26 03:06:28 +00:00
|
|
|
inputType: 'tags',
|
|
|
|
default: [],
|
|
|
|
separators: ['\n', '\t', ';']
|
2024-05-23 00:26:38 +00:00
|
|
|
},
|
|
|
|
delay: {
|
|
|
|
inputType: 'number',
|
2024-05-23 20:52:39 +00:00
|
|
|
default: 10
|
2024-05-23 00:26:38 +00:00
|
|
|
}
|
2024-05-13 14:40:36 +00:00
|
|
|
},
|
2024-05-23 00:26:38 +00:00
|
|
|
commands: {
|
|
|
|
command: {
|
|
|
|
inputType: 'text',
|
2024-05-23 20:52:39 +00:00
|
|
|
default: ''
|
2024-05-23 00:26:38 +00:00
|
|
|
},
|
|
|
|
message: {
|
|
|
|
inputType: 'text',
|
2024-05-23 20:52:39 +00:00
|
|
|
default: ''
|
2024-05-23 00:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
2024-05-13 14:40:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return this._asyncTaskRender.render({
|
2024-05-23 00:26:38 +00:00
|
|
|
complete: () => html`
|
2024-05-23 20:52:39 +00:00
|
|
|
<div class="margin-content peertube-plugin-livechat-configuration
|
|
|
|
peertube-plugin-livechat-configuration-channel">
|
2024-05-23 00:26:38 +00:00
|
|
|
<h1>
|
|
|
|
${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_TITLE)}:
|
|
|
|
<span class="peertube-plugin-livechat-configuration-channel-info">
|
|
|
|
<span>${this._channelConfiguration?.channel.displayName}</span>
|
|
|
|
<span>${this._channelConfiguration?.channel.name}</span>
|
|
|
|
</span>
|
2024-05-23 13:52:12 +00:00
|
|
|
<livechat-help-button .page="documentation/user/streamers/channel">
|
|
|
|
</livechat-help-button>
|
2024-05-23 00:26:38 +00:00
|
|
|
</h1>
|
|
|
|
<p>${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_DESC)}</p>
|
2024-05-23 16:35:23 +00:00
|
|
|
<form livechat-configuration-channel-options role="form" @submit=${this._saveConfig}>
|
2024-05-23 00:26:38 +00:00
|
|
|
<div class="row mt-3">
|
2024-05-23 13:52:12 +00:00
|
|
|
<div class="row mt-5">
|
|
|
|
<div class="col-12 col-lg-4 col-xl-3">
|
|
|
|
<livechat-configuration-row
|
|
|
|
.title=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_LABEL)}
|
|
|
|
.description=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_SLOW_MODE_DESC, true)}
|
2024-05-23 20:52:39 +00:00
|
|
|
.helpPage=${'documentation/user/streamers/slow_mode'}>
|
2024-05-23 13:52:12 +00:00
|
|
|
</livechat-configuration-row>
|
|
|
|
</div>
|
|
|
|
<div class="col-12 col-lg-8 col-xl-9">
|
|
|
|
<div class="form-group">
|
|
|
|
<label>
|
|
|
|
<input
|
|
|
|
type="number"
|
2024-05-26 03:06:28 +00:00
|
|
|
name="slowmode_duration"
|
|
|
|
class="form-control ${classMap(this._getInputValidationClass('slowMode.duration'))}"
|
2024-05-23 13:52:12 +00:00
|
|
|
min="0"
|
|
|
|
max="1000"
|
2024-05-26 03:06:28 +00:00
|
|
|
id="peertube-livechat-slowmode-duration"
|
|
|
|
aria-describedby="peertube-livechat-slowmode-duration-feedback"
|
2024-05-23 13:52:12 +00:00
|
|
|
@input=${(event: InputEvent) => {
|
2024-05-23 20:52:39 +00:00
|
|
|
if (event?.target && this._channelConfiguration) {
|
|
|
|
this._channelConfiguration.configuration.slowMode.duration =
|
|
|
|
Number((event.target as HTMLInputElement).value)
|
|
|
|
}
|
2024-05-23 13:52:12 +00:00
|
|
|
this.requestUpdate('_channelConfiguration')
|
|
|
|
}
|
2024-05-23 00:26:38 +00:00
|
|
|
}
|
2024-05-23 13:52:12 +00:00
|
|
|
value="${this._channelConfiguration?.configuration.slowMode.duration}"
|
|
|
|
/>
|
|
|
|
</label>
|
2024-05-26 03:06:28 +00:00
|
|
|
${this._renderFeedback('peertube-livechat-slowmode-duration-feedback', 'slowMode.duration')}
|
2024-05-23 13:52:12 +00:00
|
|
|
</div>
|
2024-05-23 00:26:38 +00:00
|
|
|
</div>
|
2024-05-23 13:52:12 +00:00
|
|
|
</div>
|
|
|
|
<div class="row mt-5">
|
|
|
|
<div class="col-12 col-lg-4 col-xl-3">
|
|
|
|
<livechat-configuration-row
|
|
|
|
.title=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_BOT_OPTIONS_TITLE)}
|
|
|
|
.description=${''}
|
2024-05-23 20:52:39 +00:00
|
|
|
.helpPage=${'documentation/user/streamers/channel'}>
|
2024-05-23 13:52:12 +00:00
|
|
|
</livechat-configuration-row>
|
|
|
|
</div>
|
|
|
|
<div class="col-12 col-lg-8 col-xl-9">
|
|
|
|
<div class="form-group">
|
|
|
|
<label>
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
name="bot"
|
|
|
|
id="peertube-livechat-bot"
|
|
|
|
@input=${(event: InputEvent) => {
|
2024-05-23 20:52:39 +00:00
|
|
|
if (event?.target && this._channelConfiguration) {
|
|
|
|
this._channelConfiguration.configuration.bot.enabled =
|
|
|
|
(event.target as HTMLInputElement).checked
|
|
|
|
}
|
2024-05-23 13:52:12 +00:00
|
|
|
this.requestUpdate('_channelConfiguration')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.value=${this._channelConfiguration?.configuration.bot.enabled}
|
|
|
|
?checked=${this._channelConfiguration?.configuration.bot.enabled}
|
|
|
|
/>
|
|
|
|
${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_ENABLE_BOT_LABEL)}
|
|
|
|
</label>
|
|
|
|
</div>
|
2024-05-23 20:52:39 +00:00
|
|
|
${this._channelConfiguration?.configuration.bot.enabled
|
|
|
|
? html`<div class="form-group">
|
2024-05-26 03:06:28 +00:00
|
|
|
<label for="peertube-livechat-bot-nickname">
|
2024-05-23 20:52:39 +00:00
|
|
|
${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_BOT_NICKNAME)}
|
|
|
|
</label>
|
2024-05-23 00:26:38 +00:00
|
|
|
<input
|
2024-05-23 13:52:12 +00:00
|
|
|
type="text"
|
|
|
|
name="bot_nickname"
|
2024-05-26 03:06:28 +00:00
|
|
|
class="form-control ${classMap(this._getInputValidationClass('bot.nickname'))}"
|
2024-05-23 13:52:12 +00:00
|
|
|
id="peertube-livechat-bot-nickname"
|
2024-05-26 03:06:28 +00:00
|
|
|
aria-describedby="peertube-livechat-bot-nickname-feedback"
|
2024-05-23 00:26:38 +00:00
|
|
|
@input=${(event: InputEvent) => {
|
2024-05-23 20:52:39 +00:00
|
|
|
if (event?.target && this._channelConfiguration) {
|
|
|
|
this._channelConfiguration.configuration.bot.nickname =
|
|
|
|
(event.target as HTMLInputElement).value
|
|
|
|
}
|
2024-05-23 00:26:38 +00:00
|
|
|
this.requestUpdate('_channelConfiguration')
|
|
|
|
}
|
|
|
|
}
|
2024-05-23 13:52:12 +00:00
|
|
|
value="${this._channelConfiguration?.configuration.bot.nickname}"
|
2024-05-23 00:26:38 +00:00
|
|
|
/>
|
2024-05-26 03:06:28 +00:00
|
|
|
${this._renderFeedback('peertube-livechat-bot-nickname-feedback', 'bot.nickname')}
|
2024-05-23 13:52:12 +00:00
|
|
|
</div>`
|
2024-05-23 00:26:38 +00:00
|
|
|
: ''
|
|
|
|
}
|
2024-05-23 13:52:12 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-05-23 20:52:39 +00:00
|
|
|
${this._channelConfiguration?.configuration.bot.enabled
|
|
|
|
? html`<div class="row mt-5">
|
2024-05-23 13:52:12 +00:00
|
|
|
<div class="col-12 col-lg-4 col-xl-3">
|
|
|
|
<livechat-configuration-row
|
|
|
|
.title=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_LABEL)}
|
|
|
|
.description=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_FORBIDDEN_WORDS_DESC)}
|
2024-05-23 20:52:39 +00:00
|
|
|
.helpPage=${'documentation/user/streamers/bot/forbidden_words'}>
|
2024-05-23 13:52:12 +00:00
|
|
|
</livechat-configuration-row>
|
|
|
|
</div>
|
|
|
|
<div class="col-12 col-lg-8 col-xl-9">
|
|
|
|
<livechat-dynamic-table-form
|
2024-05-26 03:06:28 +00:00
|
|
|
.header=${tableHeaderList.forbiddenWords}
|
|
|
|
.schema=${tableSchema.forbiddenWords}
|
|
|
|
.validation=${this._validationError?.properties}
|
|
|
|
.validationPrefix=${'bot.forbiddenWords'}
|
|
|
|
.rows=${this._channelConfiguration?.configuration.bot.forbiddenWords}
|
|
|
|
@update=${(e: CustomEvent) => {
|
|
|
|
if (this._channelConfiguration) {
|
|
|
|
this._channelConfiguration.configuration.bot.forbiddenWords = e.detail
|
|
|
|
this.requestUpdate('_channelConfiguration')
|
2024-05-23 13:52:12 +00:00
|
|
|
}
|
2024-05-23 00:26:38 +00:00
|
|
|
}
|
2024-05-26 03:06:28 +00:00
|
|
|
}
|
|
|
|
.formName=${'forbidden-words'}>
|
|
|
|
</livechat-dynamic-table-form>
|
2024-05-23 13:52:12 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row mt-5">
|
|
|
|
<div class="col-12 col-lg-4 col-xl-3">
|
|
|
|
<livechat-configuration-row
|
|
|
|
.title=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_QUOTE_LABEL)}
|
|
|
|
.description=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_QUOTE_DESC)}
|
2024-05-23 20:52:39 +00:00
|
|
|
.helpPage=${'documentation/user/streamers/bot/quotes'}>
|
2024-05-23 13:52:12 +00:00
|
|
|
</livechat-configuration-row>
|
|
|
|
</div>
|
|
|
|
<div class="col-12 col-lg-8 col-xl-9">
|
|
|
|
<livechat-dynamic-table-form
|
2024-05-23 00:26:38 +00:00
|
|
|
.header=${tableHeaderList.quotes}
|
|
|
|
.schema=${tableSchema.quotes}
|
2024-05-26 03:06:28 +00:00
|
|
|
.validation=${this._validationError?.properties}
|
|
|
|
.validationPrefix=${'bot.quotes'}
|
2024-05-23 00:26:38 +00:00
|
|
|
.rows=${this._channelConfiguration?.configuration.bot.quotes}
|
|
|
|
@update=${(e: CustomEvent) => {
|
2024-05-23 13:52:12 +00:00
|
|
|
if (this._channelConfiguration) {
|
|
|
|
this._channelConfiguration.configuration.bot.quotes = e.detail
|
|
|
|
this.requestUpdate('_channelConfiguration')
|
|
|
|
}
|
2024-05-23 00:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.formName=${'quote'}>
|
2024-05-23 13:52:12 +00:00
|
|
|
</livechat-dynamic-table-form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row mt-5">
|
|
|
|
<div class="col-12 col-lg-4 col-xl-3">
|
|
|
|
<livechat-configuration-row
|
|
|
|
.title=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_COMMAND_LABEL)}
|
|
|
|
.description=${ptTr(LOC_LIVECHAT_CONFIGURATION_CHANNEL_COMMAND_DESC)}
|
2024-05-23 20:52:39 +00:00
|
|
|
.helpPage=${'documentation/user/streamers/bot/commands'}>
|
2024-05-23 13:52:12 +00:00
|
|
|
</livechat-configuration-row>
|
|
|
|
</div>
|
|
|
|
<div class="col-12 col-lg-8 col-xl-9">
|
|
|
|
<livechat-dynamic-table-form
|
2024-05-23 00:26:38 +00:00
|
|
|
.header=${tableHeaderList.commands}
|
|
|
|
.schema=${tableSchema.commands}
|
2024-05-26 03:06:28 +00:00
|
|
|
.validation=${this._validationError?.properties}
|
|
|
|
.validationPrefix=${'bot.commands'}
|
2024-05-23 00:26:38 +00:00
|
|
|
.rows=${this._channelConfiguration?.configuration.bot.commands}
|
|
|
|
@update=${(e: CustomEvent) => {
|
2024-05-23 13:52:12 +00:00
|
|
|
if (this._channelConfiguration) {
|
|
|
|
this._channelConfiguration.configuration.bot.commands = e.detail
|
|
|
|
this.requestUpdate('_channelConfiguration')
|
|
|
|
}
|
2024-05-23 00:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.formName=${'command'}>
|
2024-05-23 13:52:12 +00:00
|
|
|
</livechat-dynamic-table-form>
|
|
|
|
</div>
|
|
|
|
</div>`
|
2024-05-23 00:26:38 +00:00
|
|
|
: ''
|
|
|
|
}
|
|
|
|
<div class="form-group mt-5">
|
2024-05-23 16:35:23 +00:00
|
|
|
<input type="submit" class="peertube-button-link orange-button" value=${ptTr(LOC_SAVE)} />
|
2024-05-23 00:26:38 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
2024-05-23 12:41:11 +00:00
|
|
|
</div>`
|
2024-05-13 14:40:36 +00:00
|
|
|
})
|
2024-05-13 00:14:22 +00:00
|
|
|
}
|
|
|
|
}
|