// SPDX-FileCopyrightText: 2024 John Livingston // // SPDX-License-Identifier: AGPL-3.0-only import type { AdminFirewallElement } from '../elements/admin-firewall' import type { TemplateResult } from 'lit' import type { DynamicFormHeader, DynamicFormSchema } from '../../../lib/elements/dynamic-table-form' import { maxFirewallFiles, maxFirewallNameLength, maxFirewallFileSize } from 'shared/lib/admin-firewall' import { ptTr } from '../../../lib/directives/translation' import { html } from 'lit' export function tplAdminFirewall (el: AdminFirewallElement): TemplateResult { const tableHeaderList: DynamicFormHeader = { enabled: { colName: ptTr(LOC_PROSODY_FIREWALL_FILE_ENABLED) }, name: { colName: ptTr(LOC_PROSODY_FIREWALL_NAME), description: ptTr(LOC_PROSODY_FIREWALL_NAME_DESC), headerClassList: ['peertube-livechat-admin-firewall-col-name'] }, content: { colName: ptTr(LOC_PROSODY_FIREWALL_CONTENT), headerClassList: ['peertube-livechat-admin-firewall-col-content'] } } const tableSchema: DynamicFormSchema = { enabled: { inputType: 'checkbox', default: true }, name: { inputType: 'text', default: '', maxlength: maxFirewallNameLength }, content: { inputType: 'textarea', default: '', maxlength: maxFirewallFileSize } } return html`

${ptTr(LOC_PROSODY_FIREWALL_CONFIGURATION)}

${ptTr(LOC_PROSODY_FIREWALL_CONFIGURATION_HELP, true)}

${ el.firewallConfiguration?.enabled ? '' : html`

${ptTr(LOC_PROSODY_FIREWALL_DISABLED_WARNING, true)}

` }
{ el.resetValidation(e) if (el.firewallConfiguration) { el.firewallConfiguration.files = e.detail el.requestUpdate('firewallConfiguration') } } } >
` }