feat: add GitHub skin store and organize instance administration

Adopt the pinned published TeamSpeak SDK and direct relay routing.
Add optional TeamSpeak Query administration with encrypted credentials
and separate WebSpeak access, site, operations and skin management.
Distribute Discord Voice through the GitHub skin index, preserve skin
state during updates, and correct KAAK scaling and screen fullscreen.

Validation: 831 tests; backend and frontend builds; five-language UI
checks from narrow screens through 4K and local Query fixture actions.
This commit is contained in:
illusia committed 2026-10-24 12:52:59 +08:00
1 parent 180bfeb52f
commit 0af3236c30
95 files changed
+7678 -709

No files matched your search

+69 -78
View File
@@ -1,38 +1,16 @@
<template>
<section class="page-content operations-page">
<div class="page-heading"
><div
><h2>{{ tr("operations") }}</h2
><p>{{ tr("operationsLead") }}</p></div
><button
class="secondary-button"
:disabled="operationsLoading"
@click="loadOperations"
><span
v-if="operationsLoading"
class="spinner small"
></span
><Icon
v-else
name="refresh"
:size="17"
/>{{ tr("refresh") }}</button
></div
>
<div class="alert info system-notice"
><Icon
name="info"
:size="16"
/><span>{{
tr("updateNotice", { version: operations.diagnostics.version || "—" })
}}</span></div
>
<div class="operations-grid operations-primary">
<article class="operation-card operation-wide"
<section class="page-content operations-page" data-admin-scope="webspeak">
<div class="page-heading"><div><h2>{{ tr('adminInstanceOperations') }}</h2><p>{{ tr('adminInstanceOperationsLead') }}</p></div>
<button class="secondary-button" type="button" :disabled="operationsLoading" @click="loadOperations"><span v-if="operationsLoading" class="spinner small"></span><Icon v-else name="refresh" :size="17"/>{{ tr('refresh') }}</button>
</div>
<nav class="admin-section-nav" :aria-label="tr('adminInstanceOperations')">
<button v-for="section in sections" :key="section.id" type="button" :aria-current="activeSection === section.id ? 'page' : undefined" @click="activeSection = section.id">{{ section.label }}<span v-if="section.count !== undefined" class="admin-tab-count">{{ section.count }}</span></button>
</nav>
<div v-show="activeSection === 'sessions'" class="admin-operations-section" data-admin-section="sessions"><article class="operation-card operation-wide"
><header
><div
><h3>{{ tr("sessions") }}</h3
><p>{{ tr("sessionsLead") }}</p></div
><h3>{{ tr("adminBrowserSessions") }}</h3
><p>{{ tr("adminBrowserSessionsLead") }}</p></div
><strong>{{ operations.sessions.length }}</strong></header
><div
v-if="operations.sessions.length"
@@ -78,12 +56,12 @@
:size="22"
/><span>{{ tr("sessionEmpty") }}</span></div
></article
>
<article class="operation-card"
></div>
<div v-show="activeSection === 'invites'" class="admin-operations-section" data-admin-section="invites"><article class="operation-card"
><header
><div
><h3>{{ tr("invites") }}</h3
><p>{{ tr("invitesLead") }}</p></div
><p>{{ tr("adminInviteScope") }}</p></div
></header
><form
class="invite-form"
@@ -161,47 +139,8 @@
></div
></div
></article
>
</div>
<div class="operations-grid lower-operations">
<article class="operation-card diagnostics-card"
><header
><div
><h3>{{ tr("diagnostics") }}</h3
><p>{{ tr("diagnosticsLead") }}</p></div
><a
class="text-link"
href="/api/admin/diagnostics/report"
>{{ tr("downloadReport") }}</a
></header
><dl class="diagnostic-list"
><div
><dt>{{ tr("version") }}</dt
><dd>{{ operations.diagnostics.version || "—" }}</dd></div
><div
><dt>{{ tr("runtime") }}</dt
><dd>{{ operations.diagnostics.node || "—" }}</dd></div
><div
><dt>{{ tr("platform") }}</dt
><dd
>{{ operations.diagnostics.platform || "—" }} /
{{ operations.diagnostics.arch || "—" }}</dd
></div
><div
><dt>{{ tr("databaseSchema") }}</dt
><dd>v{{ operations.diagnostics.schemaVersion || "—" }}</dd></div
><div
><dt>{{ tr("createdSessions") }}</dt
><dd>{{ operations.diagnostics.createdSessions }}</dd></div
></dl
><button
class="secondary-button"
type="button"
@click="downloadBackup"
>{{ tr("exportBackup") }}</button
></article
>
<article class="operation-card logs-card"
></div>
<div v-show="activeSection === 'logs'" class="admin-operations-section" data-admin-section="logs"><article class="operation-card logs-card"
><header
><div
><h3>{{ tr("logViewer") }}</h3
@@ -271,8 +210,8 @@
:size="22"
/><span>{{ tr("noLogs") }}</span></div
></article
>
<article class="operation-card audit-card"
></div>
<div v-show="activeSection === 'audit'" class="admin-operations-section" data-admin-section="audit"><article class="operation-card audit-card"
><header
><div
><h3>{{ tr("audit") }}</h3
@@ -296,12 +235,51 @@
>{{ tr("auditEmpty") }}</li
></ul
></article
></div>
<div v-show="activeSection === 'maintenance'" class="admin-operations-section" data-admin-section="maintenance"><article class="operation-card diagnostics-card"
><header
><div
><h3>{{ tr("diagnostics") }}</h3
><p>{{ tr("diagnosticsLead") }}</p></div
><a
class="text-link"
href="/api/admin/diagnostics/report"
>{{ tr("downloadReport") }}</a
></header
><dl class="diagnostic-list"
><div
><dt>{{ tr("version") }}</dt
><dd>{{ operations.diagnostics.version || "—" }}</dd></div
><div
><dt>{{ tr("runtime") }}</dt
><dd>{{ operations.diagnostics.node || "—" }}</dd></div
><div
><dt>{{ tr("platform") }}</dt
><dd
>{{ operations.diagnostics.platform || "—" }} /
{{ operations.diagnostics.arch || "—" }}</dd
></div
><div
><dt>{{ tr("databaseSchema") }}</dt
><dd>v{{ operations.diagnostics.schemaVersion || "—" }}</dd></div
><div
><dt>{{ tr("createdSessions") }}</dt
><dd>{{ operations.diagnostics.createdSessions }}</dd></div
></dl
><button
class="secondary-button"
type="button"
@click="downloadBackup"
>{{ tr("exportBackup") }}</button
></article
>
<div class="alert info system-notice"><Icon name="info" :size="16"/><span>{{ tr('updateNotice', {version: operations.diagnostics.version || '—'}) }}</span></div>
</div>
</section>
</template>
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import Icon from "../Icon.vue";
import type { useAdminOperations } from "../../composables/useAdminOperations.js";
import type { useAdminI18n } from "../../composables/useAdminI18n.js";
@@ -309,12 +287,25 @@ import type { AdminConnectionRecord } from "../../../../src/shared/admin-respons
const props = defineProps<{
model: ReturnType<typeof useAdminOperations>;
initialSection?: string;
i18n: Pick<ReturnType<typeof useAdminI18n>, "tr" | "formatDate" | "formatAge" | "sessionStateLabel" | "connectionStatusLabel" | "inviteStatusLabel" | "eventName" | "connectionFailureText">;
}>();
// Request ownership, cancellation and drafts remain in the page's controller.
const { operations, operationsLoading, terminatingSession, inviteSubmitting, revokingInvites, inviteForm, createdInvite,
loadOperations, terminateSession, createInvite, revokeInvite, copyInviteLink, downloadBackup } = props.model;
const { tr, formatDate, formatAge, sessionStateLabel, connectionStatusLabel, inviteStatusLabel, eventName, connectionFailureText } = props.i18n;
type OperationsSection = 'sessions' | 'invites' | 'logs' | 'audit' | 'maintenance';
const normalizeSection = (value?: string): OperationsSection => value === 'invites' || value === 'logs' || value === 'audit' || value === 'maintenance' ? value : 'sessions';
const activeSection = ref<OperationsSection>(normalizeSection(props.initialSection));
watch(() => props.initialSection, value => { activeSection.value = normalizeSection(value); });
const sections = computed(() => [
{ id: 'sessions' as const, label: tr('adminBrowserSessions'), count: operations.sessions.length },
{ id: 'invites' as const, label: tr('invites'), count: operations.invites.length },
{ id: 'logs' as const, label: tr('adminLogsSection'), count: undefined },
{ id: 'audit' as const, label: tr('audit'), count: undefined },
{ id: 'maintenance' as const, label: tr('adminMaintenanceSection'), count: undefined },
]);
function connectionRoute(record: AdminConnectionRecord) {
const route = tr("connectionFromTo", { ip: record.clientIp || "—", target: record.target || "—" });
+65 -112
View File
@@ -1,33 +1,40 @@
<template>
<section class="page-content server-page">
<div class="page-heading"
><div
><h2>{{ tr("serverSettings") }}</h2
><p>{{ tr("serverSettingsLead") }}</p></div
><button
class="primary-button"
:disabled="serverSaving"
@click="saveServerSettings"
>{{ serverSaving ? tr("saving") : tr("saveChanges") }}</button
></div
>
<div class="settings-grid">
<details
class="settings-card settings-accordion target-accordion"
open
>
<summary class="settings-accordion-header">
<span class="settings-accordion-heading"
><strong>{{ tr("teamSpeakTarget") }}</strong
><small>{{ serverForm.address || "—" }} · {{ serverForm.port || "—" }}</small></span
>
<Icon
name="chevron-down"
:size="18"
/>
</summary>
<div class="settings-accordion-content">
<div class="target-settings-layout">
<section class="page-content server-page" data-admin-scope="webspeak">
<div class="page-heading"><div><h2>{{ tr('adminInstanceSettings') }}</h2><p>{{ tr('adminInstanceLead') }}</p></div>
<button class="primary-button" type="button" :disabled="serverSaving" @click="saveServerSettings">{{ serverSaving ? tr('saving') : tr('saveChanges') }}</button>
</div>
<div class="admin-scope-banner"><Icon name="waveform" :size="20"/><div><strong>{{ tr('adminWsGroup') }}</strong><p>{{ tr('adminWsScopeLead') }}</p></div></div>
<nav class="admin-section-nav" :aria-label="tr('adminInstanceSettings')">
<button v-for="section in sections" :key="section.id" type="button" :aria-current="activeSection === section.id ? 'page' : undefined" @click="activeSection = section.id">{{ section.label }}</button>
</nav>
<div v-show="activeSection === 'access'" class="settings-grid admin-settings-section" data-admin-section="access">
<article class="settings-card admin-setting-card"><header class="admin-card-heading"><h3>{{ tr('accessMode') }}</h3></header><div class="access-settings-layout"><fieldset class="access-mode-fieldset"
><legend>{{ tr("accessMode") }}</legend
><label
class="choice"
:class="{ selected: serverForm.accessMode === 'fixed' }"
><input
v-model="serverForm.accessMode"
type="radio"
value="fixed"
/><span
><strong>{{ tr("fixedMode") }}</strong
><small>{{ tr("fixedModeLead") }}</small></span
></label
><label
class="choice"
:class="{ selected: serverForm.accessMode === 'open' }"
><input
v-model="serverForm.accessMode"
type="radio"
value="open"
/><span
><strong>{{ tr("openMode") }}</strong
><small>{{ tr("openModeLead") }}</small></span
></label
></fieldset
></div></article>
<article class="settings-card admin-setting-card"><header class="admin-card-heading"><h3>{{ tr('teamSpeakTarget') }}</h3><p>{{ tr('adminTargetScope') }}</p></header><div class="target-settings-layout">
<div class="target-fields">
<label
><span>{{ tr("serverAddress") }}</span
@@ -117,53 +124,9 @@
></dl
></div
>
</div>
</div>
</details>
<details class="settings-card settings-accordion">
<summary class="settings-accordion-header">
<span class="settings-accordion-heading"
><strong>{{ tr("accessAndIdentity") }}</strong
><small
>{{ serverForm.accessMode === "fixed" ? tr("fixedMode") : tr("openMode") }} ·
{{ serverForm.siteName || "WebSpeak" }}</small
></span
>
<Icon
name="chevron-down"
:size="18"
/>
</summary>
<div class="settings-accordion-content">
<div class="access-settings-layout">
<fieldset class="access-mode-fieldset"
><legend>{{ tr("accessMode") }}</legend
><label
class="choice"
:class="{ selected: serverForm.accessMode === 'fixed' }"
><input
v-model="serverForm.accessMode"
type="radio"
value="fixed"
/><span
><strong>{{ tr("fixedMode") }}</strong
><small>{{ tr("fixedModeLead") }}</small></span
></label
><label
class="choice"
:class="{ selected: serverForm.accessMode === 'open' }"
><input
v-model="serverForm.accessMode"
type="radio"
value="open"
/><span
><strong>{{ tr("openMode") }}</strong
><small>{{ tr("openModeLead") }}</small></span
></label
></fieldset
>
<div class="site-identity-fields">
</div></article>
</div>
<article v-show="activeSection === 'site'" class="settings-card admin-setting-card admin-settings-section" data-admin-section="site"><header class="admin-card-heading"><h3>{{ tr('adminSiteSection') }}</h3><p>{{ tr('adminSiteScope') }}</p></header><div class="site-identity-fields">
<label
><span>{{ tr("siteName") }}</span
><input
@@ -173,7 +136,7 @@
<div class="welcome-editor"
><div class="welcome-editor-heading"
><label
><span>{{ tr("welcomeLanguage") }}</span
><span>{{ tr("adminAnnouncementLanguage") }}</span
><select v-model="welcomeLanguage"
><option
v-for="option in welcomeLanguageOptions"
@@ -184,43 +147,17 @@
></label
><small>{{ tr("welcomeLanguageHint") }}</small></div
><label
><span>{{ tr("welcomeText") }} · {{ selectedWelcomeLanguageLabel }}</span
><span>{{ tr("adminSiteAnnouncement") }} · {{ selectedWelcomeLanguageLabel }}</span
><textarea
v-model="selectedWelcomeText"
maxlength="500"
rows="4"
:placeholder="selectedWelcomeDefault"
></textarea></label
><small class="field-help">{{ tr("welcomeFallbackHint") }}</small></div
><small class="field-help">{{ tr("adminAnnouncementFallback") }}</small></div
>
</div>
</div>
</div>
</details>
<details class="settings-card settings-accordion advanced-card">
<summary class="settings-accordion-header">
<span class="settings-accordion-heading"
><strong>{{ tr("advancedSettings") }}</strong
><small>{{ tr("advancedSettingsLead") }}</small></span
>
<span class="settings-accordion-statuses"
><span class="settings-summary-chip"
><i :class="{ active: serverForm.webRtcEnabled }"></i>{{ tr("webrtcSettings") }} ·
{{ serverForm.webRtcEnabled ? tr("enabledStatus") : tr("disabledStatus") }}</span
><span class="settings-summary-chip"
><i :class="{ active: serverForm.relayNodes.some((relay) => relay.enabled) }"></i
>{{ tr("relaySettings") }} ·
{{ tr("relayNodeCount", { count: serverForm.relayNodes.length }) }}</span
></span
>
<Icon
name="chevron-down"
:size="18"
/>
</summary>
<div class="settings-accordion-content">
<div class="advanced-settings-grid">
</div></article>
<article v-show="activeSection === 'network'" class="settings-card admin-setting-card admin-settings-section" data-admin-section="network"><header class="admin-card-heading"><h3>{{ tr('adminNetworkSection') }}</h3><p>{{ tr('advancedSettingsLead') }}</p></header><div class="advanced-settings-grid">
<section class="settings-subsection webrtc-card"
><header class="settings-subsection-heading"
><div
@@ -317,6 +254,12 @@
v-model.trim="relay.target"
maxlength="300"
:placeholder="tr('relayTargetPlaceholder')" /></label
><label
><span>{{ tr("relayVoiceEndpoint") }}</span
><input
v-model.trim="relay.voiceEndpoint"
maxlength="300"
:placeholder="tr('relayVoiceEndpointPlaceholder')" /></label
><div class="password-row"
><label
><span>{{ tr("relayToken") }}</span
@@ -352,17 +295,16 @@
type="button"
@click="addRelayNode"
>{{ tr("relayAdd") }}</button
><small class="field-help">{{ tr("relayVoiceEndpointLead") }}</small
><small class="field-help">{{ tr("relayManagedHint") }}</small></section
>
</div>
</div>
</details>
</div>
</div></article>
<p class="admin-save-scope"><Icon name="info" :size="15"/>{{ tr('adminSaveScope') }}</p>
</section>
</template>
<script setup lang="ts">
import { computed } from "vue";
import { computed, ref, watch } from "vue";
import Icon from "../Icon.vue";
import type { useAdminServerSettings } from "../../composables/useAdminServerSettings.js";
import type { useAdminI18n } from "../../composables/useAdminI18n.js";
@@ -373,6 +315,7 @@ type WelcomeLanguage = SiteLanguage;
type WelcomeTextField = "welcomeText" | "welcomeTextEn" | "welcomeTextDe" | "welcomeTextRu" | "welcomeTextJa";
const props = defineProps<{
model: ReturnType<typeof useAdminServerSettings>;
initialSection?: string;
i18n: Pick<ReturnType<typeof useAdminI18n>, "tr" | "formatDate" | "connectionFailureText">;
}>();
const welcomeLanguage = defineModel<WelcomeLanguage>("welcomeLanguage", { required: true });
@@ -380,6 +323,16 @@ const emit = defineEmits<{ webrtcToggle: [] }>();
// The page owns one stable feature controller across route changes.
const { serverForm, serverSaving, testing, testResult, saveServerSettings, testServerConnection, addRelayNode, removeRelayNode } = props.model;
const { tr, formatDate, connectionFailureText } = props.i18n;
type SettingsSection = 'access' | 'site' | 'network';
const normalizeSection = (value?: string): SettingsSection => value === 'site' || value === 'network' ? value : 'access';
const activeSection = ref<SettingsSection>(normalizeSection(props.initialSection));
watch(() => props.initialSection, value => { activeSection.value = normalizeSection(value); });
const sections = computed(() => [
{ id: 'access' as const, label: tr('adminAccessSection') },
{ id: 'site' as const, label: tr('adminSiteSection') },
{ id: 'network' as const, label: tr('adminNetworkSection') },
]);
function handleWebRtcToggle() { emit("webrtcToggle"); }
const welcomeLanguageOptions: Array<{ value: WelcomeLanguage; label: string }> = [
@@ -0,0 +1,55 @@
<template>
<section class="skin-store" :aria-label="tr('skinStore')" :aria-busy="storeLoading">
<div class="skin-store-heading">
<div><h3>{{ tr('skinStore') }}</h3><p>{{ tr('skinStoreLead') }}</p></div>
<button class="secondary-button" type="button" :disabled="storeLoading || skinBusy" @click="loadSkinStore(true)">
{{ storeLoading ? tr('loading') : tr('skinStoreRefresh') }}
</button>
</div>
<p class="skin-store-source">{{ tr('skinStoreSource') }} · <a :href="SKIN_STORE_REPOSITORY" target="_blank" rel="noopener noreferrer">Huddle-Up-Forge/webspeak-skins</a></p>
<div class="alert info"><Icon name="info" :size="16"/><span>{{ tr('skinStorePermissionNote') }}</span></div>
<div v-if="storeError" class="alert error" role="alert">{{ storeError }}</div>
<div v-if="storeLoading" class="skin-library-loading" role="status"><span class="spinner"></span>{{ tr('loading') }}</div>
<div v-if="storeCatalog?.entries.length" class="skin-library-grid">
<article v-for="entry in storeCatalog.entries" :key="entry.id" class="skin-library-card skin-store-card">
<div class="skin-library-copy">
<div class="skin-library-title"><h3>{{ entry.metadata?.name || entry.id }}</h3><span>{{ entry.id }}</span></div>
<template v-if="entry.metadata">
<p>{{ entry.metadata.description }}</p>
<dl>
<div><dt>{{ tr('skinStoreAvailableVersion') }}</dt><dd>v{{ entry.metadata.version }}</dd></div>
<div v-if="installedStoreSkin(entry)"><dt>{{ tr('skinStoreCurrentVersion') }}</dt><dd>v{{ installedStoreSkin(entry)!.version }}</dd></div>
<div><dt>{{ tr('skinAuthor') }}</dt><dd>{{ entry.metadata.author }}</dd></div>
<div><dt>{{ tr('skinLicense') }}</dt><dd>{{ entry.metadata.license }}</dd></div>
<div><dt>{{ tr('skinMinVersion') }}</dt><dd>{{ entry.metadata.minAppVersion }}</dd></div>
</dl>
<p v-if="!entry.compatible" class="skin-store-warning">{{ tr('skinStoreIncompatible') }}</p>
</template>
<p v-else class="skin-store-warning">{{ tr(entry.error === 'SKIN_STORE_UNAVAILABLE' ? 'skinStoreUnavailable' : 'skinStoreInvalid') }}</p>
<div class="skin-library-actions">
<a :href="entry.repository" target="_blank" rel="noopener noreferrer" class="text-link">{{ tr('skinStoreRepository') }}</a>
<button v-if="entry.metadata" class="primary-button" type="button"
:disabled="skinBusy || skinLoading || storeLoading || !entry.compatible || storeVersionOrder(entry) <= 0"
@click="installStoreSkin(entry)">
<span v-if="storeInstallingId === entry.id" class="spinner small"></span>
{{ storeInstallingId === entry.id ? tr('skinStoreInstalling') : storeVersionOrder(entry) < 0 ? tr('skinStoreNewer') : storeVersionOrder(entry) === 0 ? tr('skinStoreInstalled') : installedStoreSkin(entry) ? tr('skinStoreUpdate') : tr('skinStoreInstall') }}
</button>
</div>
</div>
</article>
</div>
<p v-else-if="storeCatalog && !storeLoading" class="skin-library-empty">{{ tr('skinStoreEmpty') }}</p>
<p v-if="storeCatalog" class="skin-store-source">{{ tr('skinStoreLoadedAt') }} {{ new Date(storeCatalog.fetchedAt).toLocaleString() }} · WebSpeak {{ storeCatalog.appVersion }}</p>
</section>
</template>
<script setup lang="ts">
import Icon from "../Icon.vue";
import { SKIN_STORE_REPOSITORY } from "../../../../src/shared/skin-store.js";
import type { useAdminSkins } from "../../composables/useAdminSkins.js";
import type { useAdminI18n } from "../../composables/useAdminI18n.js";
const props = defineProps<{ model: ReturnType<typeof useAdminSkins>; i18n: Pick<ReturnType<typeof useAdminI18n>, "tr"> }>();
const { storeCatalog, storeLoading, storeInstallingId, storeError, skinBusy, skinLoading,
loadSkinStore, installStoreSkin, installedStoreSkin, storeVersionOrder } = props.model;
const { tr } = props.i18n;
</script>
+10 -1
View File
@@ -33,7 +33,11 @@
:size="16"
/><span>{{ tr("skinLibraryScope") }}</span></div
>
<section class="skin-default-control"
<nav class="skin-library-tabs" :aria-label="tr('skinLibrary')">
<button type="button" :aria-current="skinTab === 'installed' ? 'page' : undefined" @click="selectSkinTab('installed')">{{ tr('skinInstalledTab') }}</button>
<button type="button" :aria-current="skinTab === 'store' ? 'page' : undefined" @click="selectSkinTab('store')">{{ tr('skinStore') }}</button>
</nav>
<section v-if="skinTab === 'installed'" class="skin-default-control"
><div
><strong>{{ tr("skinDefault") }}</strong
><p>{{ tr("skinDefaultLead") }}</p></div
@@ -62,6 +66,8 @@
role="status"
>{{ skinManagerNotice }}</div
>
<AdminSkinStore v-if="skinTab === 'store'" :model="model" :i18n="i18n" />
<div v-else>
<div
v-if="skinLoading"
class="skin-library-loading"
@@ -153,12 +159,14 @@
><strong>{{ tr("skinEmpty") }}</strong
><p>{{ tr("skinEmptyLead") }}</p></div
>
</div>
</section>
</template>
<script setup lang="ts">
import { ref } from "vue";
import Icon from "../Icon.vue";
import AdminSkinStore from "./AdminSkinStore.vue";
import type { useAdminSkins } from "../../composables/useAdminSkins.js";
import type { useAdminI18n } from "../../composables/useAdminI18n.js";
import type { SkinCatalogEntry } from "../../services/skin-catalog.js";
@@ -169,6 +177,7 @@ const props = defineProps<{
}>();
const skinFileInput = ref<HTMLInputElement | null>(null);
const { skinEntries, skinLoading, skinUploading, removingSkinId, skinDefaultId, skinBusy,
skinTab, selectSkinTab,
enabledSkinEntries, skinManagerError, skinManagerNotice, saveSkinDefault, toggleSkinEnabled, onSkinFileChanged, removeSkin } = props.model;
const { tr } = props.i18n;
+134
View File
@@ -0,0 +1,134 @@
<template>
<section class="page-content ts-admin-page" data-admin-scope="teamspeak">
<div class="page-heading"><div><h2>{{ tr('tsAdminTitle') }}</h2><p>{{ tr('tsAdminLead') }}</p></div><span class="admin-optional">{{ tr('adminOptional') }}</span></div>
<div class="admin-scope-banner"><Icon name="shield" :size="20"/><div><strong>{{ tr('adminTsGroup') }}</strong><p>{{ tr('adminTsManageLead') }}</p></div></div>
<div v-if="!settings.fixedMode" class="alert info admin-fixed-notice"><Icon name="info" :size="18"/><div><p>{{ tr('tsAdminFixedOnly') }}</p><RouterLink to="/admin/server">{{ tr('adminInstanceSettings') }}</RouterLink></div></div>
<template v-else>
<div v-if="noticeMessage" class="alert success" role="status">{{ noticeMessage }}</div>
<article v-if="!settings.enabled && !loading" class="operation-card admin-ts-setup">
<Icon name="server" :size="26"/><div><h3>{{ tr('adminTsSetupTitle') }}</h3><p>{{ tr('adminTsSetupLead') }}</p></div>
<button class="secondary-button" type="button" @click="configureConnection">{{ tr('adminTsConfigure') }}</button>
</article>
<details ref="connectionPanel" class="operation-card ts-admin-credentials" :open="connectionOpen" @toggle="connectionOpen = ($event.target as HTMLDetailsElement).open">
<summary><Icon name="chevron-right" :size="18"/><div><strong>{{ tr('adminTsConnection') }}</strong><small>{{ settings.enabled ? tr('adminTsConfigured') : tr('adminTsNotEnabled') }}</small></div><span class="state-pill">{{ settings.enabled ? settings.transport === 'web' ? tr('tsAdminWeb') : settings.transport === 'ssh' ? tr('tsAdminSsh') : tr('tsAdminTcp') : tr('adminOptional') }}</span></summary>
<div class="admin-connection-body"><p class="field-help">{{ tr('adminTsConnectionScope') }}</p>
<form class="ts-admin-form" @submit.prevent="saveSettings">
<fieldset :disabled="loading || saving || acting || connecting">
<label class="choice ts-admin-enable" :class="{ selected: form.enabled }"><input v-model="form.enabled" type="checkbox" />
<span><strong>{{ tr('tsAdminEnable') }}</strong><small>{{ tr('tsAdminEnableLead') }}</small></span></label>
<div class="ts-admin-fields">
<label><span>{{ tr('adminTsSavedTarget') }}</span><input :value="`${targetAddress} · ${targetPort}`" readonly /></label>
<label><span>{{ tr('tsAdminTransport') }}</span><select v-model="form.transport"><option value="web">{{ tr('tsAdminWeb') }}</option><option value="ssh">{{ tr('tsAdminSsh') }}</option><option value="tcp">{{ tr('tsAdminTcp') }}</option></select></label>
<label v-if="form.transport === 'web'" class="ts-admin-wide"><span>{{ tr('tsAdminUrl') }}</span><input v-model.trim="form.webQueryUrl" type="url" maxlength="2048" placeholder="https://ts.example.com:10443" :required="form.enabled" /></label>
<template v-else>
<label><span>{{ tr('tsAdminHost') }}</span><input v-model.trim="form.queryHost" maxlength="253" :placeholder="targetAddress" /></label>
<label><span>{{ tr('tsAdminQueryPort') }}</span><input v-model.trim="form.queryPort" type="number" min="1" max="65535" required /></label>
<label><span>{{ tr('tsAdminUsername') }}</span><input v-model.trim="form.username" autocomplete="username" maxlength="128" :required="form.enabled" /></label>
<label v-if="form.transport === 'ssh'"><span>{{ tr('tsAdminHostKey') }}</span><input v-model.trim="form.hostKeyFingerprint" maxlength="128" placeholder="SHA256:…" :required="form.enabled" /></label>
</template>
<label><span>{{ tr('tsAdminServerId') }}</span><input v-model.number="form.serverId" type="number" min="0" max="4294967295" required /></label>
</div>
<p class="field-help">{{ tr('tsAdminServerIdHelp') }}</p>
<template v-if="form.transport === 'web'">
<div class="ts-admin-password-row"><label><span>{{ tr('tsAdminApiKey') }}</span><input v-model="form.apiKey" type="password" autocomplete="new-password" maxlength="4096" :disabled="form.apiKeyAction !== 'replace'" :placeholder="settings.hasApiKey ? tr('tsAdminApiKeyConfigured') : ''" :required="form.enabled && form.apiKeyAction === 'replace'" /></label>
<button type="button" :class="{active: form.apiKeyAction === 'replace'}" @click="form.apiKeyAction = 'replace'">{{ tr('tsAdminSetKey') }}</button>
<button v-if="settings.hasApiKey" type="button" :class="{danger: form.apiKeyAction === 'remove'}" @click="form.apiKeyAction = form.apiKeyAction === 'remove' ? 'keep' : 'remove'">{{ form.apiKeyAction === 'remove' ? tr('tsAdminKeepKey') : tr('tsAdminRemoveKey') }}</button></div>
<p class="field-help">{{ tr('tsAdminWebHelp') }}</p><p class="field-help">{{ tr('tsAdminKeyHelp') }}</p>
</template>
<template v-else>
<div class="ts-admin-password-row"><label><span>{{ tr('tsAdminPassword') }}</span><input v-model="form.password" type="password" autocomplete="new-password" maxlength="1024" :disabled="form.passwordAction !== 'replace'" :placeholder="settings.hasPassword ? tr('tsAdminPasswordConfigured') : tr('tsAdminPasswordPlaceholder')" /></label>
<button type="button" :class="{active: form.passwordAction === 'replace'}" @click="form.passwordAction = 'replace'">{{ settings.hasPassword ? tr('change') : tr('tsAdminSetPassword') }}</button>
<button v-if="settings.hasPassword" type="button" :class="{danger: form.passwordAction === 'remove'}" @click="form.passwordAction = form.passwordAction === 'remove' ? 'keep' : 'remove'">{{ form.passwordAction === 'remove' ? tr('tsAdminKeepPassword') : tr('remove') }}</button></div>
<p class="field-help">{{ tr('tsAdminHostHelp') }}</p><p v-if="form.transport === 'ssh'" class="field-help">{{ tr('tsAdminFingerprintHint') }}</p>
</template>
<div class="ts-admin-actions"><button class="primary-button" type="submit"><span v-if="saving" class="spinner small"></span>{{ saving ? tr('saving') : tr('saveChanges') }}</button></div>
</fieldset>
</form>
</div>
</details>
<div v-if="settingsDirty" class="alert info" role="status"><Icon name="info" :size="18"/><span>{{ tr('adminTsConfigPending') }}</span></div>
<article v-if="settings.enabled" class="operation-card ts-admin-live">
<header><div><h3>{{ tr('tsAdminLiveTitle') }}</h3><p>{{ overview ? tr('tsAdminUpdatedAt', {time: formatDate(overview.observedAt)}) : tr('adminTsConfigurationSaved') }}</p></div>
<button class="secondary-button" type="button" :disabled="loading || connecting || saving || acting || settingsDirty" @click="connectAndRefresh"><span v-if="connecting" class="spinner small"></span>{{ connecting ? tr('tsAdminConnecting') : overview ? tr('refresh') : tr('tsAdminConnect') }}</button></header>
<div v-if="!overview" class="operation-empty"><Icon name="server" :size="22"/><span>{{ tr('tsAdminEmpty') }}</span></div>
<template v-if="overview">
<nav class="admin-section-nav" :aria-label="tr('tsAdminTitle')"><button v-for="section in sections" :key="section.id" type="button" :aria-current="activeSection === section.id ? 'page' : undefined" @click="activeSection = section.id">{{ section.label }}<span v-if="section.count !== undefined" class="admin-tab-count">{{ section.count }}</span></button></nav>
<article v-if="editor.action" ref="editorPanel" class="operation-card ts-admin-editor" :aria-label="actionTitle">
<header><div><h3>{{ actionTitle }}</h3><p>{{ tr('tsAdminActionHelp') }}</p></div></header>
<form class="ts-admin-form" @submit.prevent="runAction"><fieldset :disabled="acting || saving || settingsDirty || loading">
<p v-if="editor.targetName" class="ts-admin-selected-target">{{ editor.targetName }} <small>#{{ editor.id }}</small></p>
<div class="ts-admin-fields">
<label v-if="['server.update','channel.create','channel.update'].includes(editor.action)"><span>{{ editor.action === 'server.update' ? tr('tsAdminServer') : tr('tsAdminChannelName') }}</span><input v-model="editor.name" :maxlength="editor.action === 'server.update' ? 64 : 40" required /></label>
<template v-if="editor.action === 'server.update'"><label><span>{{ tr('tsAdminSlots') }}</span><input v-model.number="editor.maxClients" type="number" min="1" max="65535" required /></label><label class="ts-admin-wide"><span>{{ tr('tsAdminWelcome') }}</span><textarea v-model="editor.welcomeMessage" maxlength="4096" rows="3"></textarea></label></template>
<template v-if="editor.action === 'channel.create'">
<label><span>{{ tr('tsAdminParent') }}</span><select v-model="editor.parentId"><option value="0">{{ tr('tsAdminRoot') }}</option><option v-for="channel in overview?.channels" :key="channel.id" :value="channel.id">{{ channel.name }}</option></select></label>
<label class="ts-admin-wide"><span>{{ tr('tsAdminDescription') }}</span><textarea v-model="editor.description" maxlength="8192" rows="3"></textarea></label>
<label><span>{{ tr('tsAdminPassword') }}</span><input v-model="editor.password" type="password" autocomplete="new-password" maxlength="512" /></label><label class="choice"><input v-model="editor.permanent" type="checkbox" /><span>{{ tr('tsAdminPermanent') }}</span></label>
</template>
<label v-if="editor.action === 'client.move'"><span>{{ tr('tsAdminChannel') }}</span><select v-model="editor.channelId" required><option v-for="channel in overview?.channels" :key="channel.id" :value="channel.id">{{ channel.name }}</option></select></label>
<template v-if="editor.action === 'client.group'"><label><span>{{ tr('tsAdminGroup') }}</span><select v-model="editor.groupId" required><option v-for="group in overview?.groups" :key="group.id" :value="group.id">{{ group.name }} (#{{ group.id }})</option></select></label><label class="choice"><input v-model="editor.remove" type="checkbox" /><span>{{ tr('tsAdminRemoveGroup') }}</span></label></template>
<label v-if="editor.action === 'client.kick' || editor.action === 'client.ban'"><span>{{ tr('tsAdminReason') }}</span><input v-model="editor.reason" maxlength="200" /></label>
<label v-if="editor.action === 'client.ban'"><span>{{ tr('tsAdminBanDuration') }}</span><input v-model.number="editor.durationSeconds" type="number" min="0" max="31536000" required /></label>
</div>
<p v-if="editor.action === 'channel.delete'" class="field-help">{{ tr('tsAdminDeleteHelp') }}</p><p v-if="editor.action === 'client.ban'" class="field-help">{{ tr('tsAdminBanHelp') }}</p>
<div class="ts-admin-toolbar"><button class="primary-button" type="submit"><span v-if="acting" class="spinner small"></span>{{ tr('tsAdminConfirm') }}</button><button class="secondary-button" type="button" @click="closeAction">{{ tr('tsAdminCancel') }}</button></div>
</fieldset></form>
</article>
<section v-show="activeSection === 'overview'" data-admin-section="overview" class="admin-ts-section">
<div class="metric-grid ts-admin-metrics"><article><small>{{ tr('tsAdminServer') }}</small><strong>{{ overview.serverName || '—' }}</strong><em>{{ overview.serverVersion || overview.serverFamily }}</em></article>
<article><small>{{ tr('tsAdminChannels') }}</small><strong>{{ overview.channelCount }}</strong></article><article><small>{{ tr('tsAdminClients') }}</small><strong>{{ overview.clientCount }} / {{ overview.maxClients || '—' }}</strong></article></div>
<div class="ts-admin-toolbar"><button type="button" class="secondary-button" :disabled="loading || saving || acting || settingsDirty" @click="beginAction('server.update')">{{ tr('tsAdminServerSettings') }}</button></div>
</section>
<div v-show="activeSection === 'channels'" data-admin-section="channels" class="admin-ts-section">
<div class="ts-admin-toolbar"><button type="button" class="primary-button" :disabled="loading || saving || acting || settingsDirty" @click="beginAction('channel.create')"><Icon name="plus" :size="16"/>{{ tr('tsAdminCreateChannel') }}</button></div>
<section class="operation-card"><header><h3>{{ tr('tsAdminChannels') }}</h3><strong>{{ overview.channels.length }}</strong></header><div class="table-wrap" role="region" tabindex="0" :aria-label="tr('tsAdminChannels')"><table><thead><tr><th>{{ tr('tsAdminChannelName') }}</th><th>{{ tr('tsAdminMembers') }}</th><th>{{ tr('tsAdminChannelType') }}</th><th>{{ tr('tsAdminTitle') }}</th></tr></thead><tbody>
<tr v-for="channel in overview.channels" :key="channel.id"><td><strong>{{ channel.name }}</strong><small>#{{ channel.id }}</small></td><td>{{ channel.totalClients }}</td><td>{{ channel.hasPassword ? tr('tsAdminProtected') : tr('tsAdminPublic') }}</td><td><div class="ts-admin-row-actions"><button type="button" :disabled="settingsDirty || loading || saving || acting" @click="beginAction('channel.update', channel)">{{ tr('tsAdminRenameChannel') }}</button><button class="danger" type="button" :disabled="settingsDirty || loading || saving || acting" @click="beginAction('channel.delete', channel)">{{ tr('tsAdminDeleteChannel') }}</button></div></td></tr>
<tr v-if="!overview.channels.length"><td colspan="4">{{ tr('tsAdminNoChannels') }}</td></tr></tbody></table></div></section>
</div>
<div v-show="activeSection === 'clients'" data-admin-section="clients" class="admin-ts-section">
<p v-if="!overview.groupsAvailable" class="field-help">{{ tr('tsAdminGroup') }}: {{ tr('tsAdminRestricted') }}</p>
<section class="operation-card"><header><h3>{{ tr('tsAdminClients') }}</h3><strong>{{ overview.clients.length }}</strong></header><div class="table-wrap" role="region" tabindex="0" :aria-label="tr('tsAdminClients')"><table><thead><tr><th>{{ tr('nickname') }}</th><th>{{ tr('tsAdminChannel') }}</th><th>{{ tr('tsAdminGroup') }}</th><th>{{ tr('tsAdminTitle') }}</th></tr></thead><tbody>
<tr v-for="client in overview.clients" :key="client.id"><td><strong>{{ client.nickname }}</strong><small>#{{ client.id }}</small></td><td>{{ channelNames.get(client.channelID) || client.channelID }}</td><td>{{ client.serverGroups.map(id => groupNames.get(id) || id).join(', ') || '—' }}</td><td><div class="ts-admin-row-actions"><button type="button" :disabled="settingsDirty || loading || saving || acting || !client.uid" @click="beginAction('client.move', client)">{{ tr('tsAdminMove') }}</button><button type="button" :disabled="settingsDirty || loading || saving || acting || !client.uid || !overview.groupsAvailable" @click="beginAction('client.group', client)">{{ tr('tsAdminGroupAction') }}</button><button class="danger" type="button" :disabled="settingsDirty || loading || saving || acting || !client.uid" @click="beginAction('client.kick', client)">{{ tr('tsAdminKick') }}</button><button class="danger" type="button" :disabled="settingsDirty || loading || saving || acting || !client.uid" @click="beginAction('client.ban', client)">{{ tr('tsAdminBan') }}</button></div></td></tr>
<tr v-if="!overview.clients.length"><td colspan="4">{{ tr('tsAdminNoClients') }}</td></tr></tbody></table></div></section>
</div>
<div v-show="activeSection === 'bans'" data-admin-section="bans" class="admin-ts-section"><section class="operation-card"><header><h3>{{ tr('tsAdminBans') }}</h3><strong>{{ overview.bans.length }}</strong></header><p v-if="!overview.bansAvailable" class="field-help">{{ tr('tsAdminRestricted') }}</p><div v-else class="table-wrap"><table><thead><tr><th>{{ tr('nickname') }} / UID</th><th>{{ tr('tsAdminReason') }}</th><th>{{ tr('tsAdminBanDuration') }}</th><th>{{ tr('tsAdminTitle') }}</th></tr></thead><tbody><tr v-for="ban in overview.bans" :key="ban.id"><td>{{ ban.name || ban.uid || `#${ban.id}` }}</td><td>{{ ban.reason || '—' }}</td><td>{{ ban.durationSeconds }}</td><td><button type="button" class="secondary-button" :disabled="settingsDirty || loading || saving || acting" @click="beginAction('ban.delete', ban)">{{ tr('remove') }}</button></td></tr><tr v-if="!overview.bans.length"><td colspan="4">{{ tr('tsAdminNoBans') }}</td></tr></tbody></table></div></section></div>
</template>
</article>
</template>
</section>
</template>
<script setup lang="ts">
import { computed, nextTick, ref, watch } from 'vue';
import { RouterLink } from 'vue-router';
import type { useAdminTsAdmin } from '../../composables/useAdminTsAdmin.js';
import type { useAdminI18n } from '../../composables/useAdminI18n.js';
import type { TsAdminAction } from '../../../../src/shared/admin-inputs.js';
import type { AdminTranslationKey } from '../../i18n/admin.js';
import Icon from '../Icon.vue';
const props = defineProps<{ model: ReturnType<typeof useAdminTsAdmin>; i18n: Pick<ReturnType<typeof useAdminI18n>, 'tr' | 'formatDate'>; targetAddress: string; targetPort: string }>();
const {tr, formatDate} = props.i18n;
const {settings, form, editor, overview, settingsDirty, noticeMessage, loading, saving, connecting, acting, saveSettings, connectAndRefresh, beginAction, closeAction, runAction} = props.model;
const connectionOpen = ref(false);
const connectionPanel = ref<HTMLDetailsElement | null>(null);
async function configureConnection() {
connectionOpen.value = true;
await nextTick();
connectionPanel.value?.querySelector<HTMLInputElement>('input[type="checkbox"]')?.focus();
}
type TsSection = 'overview' | 'channels' | 'clients' | 'bans';
const activeSection = ref<TsSection>('overview');
const sections = computed(() => [
{ id: 'overview' as const, label: tr('adminTsOverviewSection'), count: undefined },
{ id: 'channels' as const, label: tr('tsAdminChannels'), count: overview.value?.channelCount },
{ id: 'clients' as const, label: tr('tsAdminClients'), count: overview.value?.clientCount },
{ id: 'bans' as const, label: tr('tsAdminBans'), count: overview.value?.bansAvailable ? overview.value.bans.length : undefined },
]);
const channelNames = computed(() => new Map((overview.value?.channels ?? []).map(channel => [channel.id, channel.name])));
const groupNames = computed(() => new Map((overview.value?.groups ?? []).map(group => [group.id, group.name])));
const titles: Record<TsAdminAction['action'], AdminTranslationKey> = { 'server.update': 'tsAdminServerSettings', 'channel.create': 'tsAdminCreateChannel', 'channel.update': 'tsAdminRenameChannel', 'channel.delete': 'tsAdminDeleteChannel', 'client.move': 'tsAdminMove', 'client.kick': 'tsAdminKick', 'client.ban': 'tsAdminBan', 'client.group': 'tsAdminGroupAction', 'ban.delete': 'remove' };
const actionTitle = computed(() => editor.action ? tr(titles[editor.action]) : '');
const editorPanel = ref<HTMLElement | null>(null);
watch(() => editor.action, async action => { if (!action) return; await nextTick(); editorPanel.value?.scrollIntoView?.({block: 'nearest'}); editorPanel.value?.querySelector<HTMLElement>('input,select,textarea,button')?.focus(); });
</script>
@@ -138,18 +138,35 @@ function updateStageSize(): void {
const stage = stageElement.value;
const player = playerElement.value ?? stage?.parentElement ?? null;
if (!stage || !player) return;
if (screenShareFullscreen.value) {
// Read the browser's fullscreen element directly. The Vue state is updated
// by a separate fullscreenchange listener and can lag the layout transition.
if (typeof document !== "undefined" && document.fullscreenElement === player) {
const fullscreenHeight = typeof CSS !== "undefined" && CSS.supports("height", "100dvh") ? "100dvh" : "100vh";
setInlineStyle(player, "position", "fixed");
setInlineStyle(player, "inset", "0");
setInlineStyle(player, "width", "100vw");
setInlineStyle(player, "height", "100vh");
setInlineStyle(player, "height", fullscreenHeight);
setInlineStyle(player, "max-width", "none");
setInlineStyle(player, "max-height", "none");
setInlineStyle(player, "margin", "0");
setInlineStyle(stage, "width", "100%");
setInlineStyle(stage, "height", "100%");
setInlineStyle(stage, "min-height", "0");
setInlineStyle(stage, "max-height", "none");
setInlineStyle(stage, "aspect-ratio", "auto");
return;
}
setInlineStyle(player, "position", null);
setInlineStyle(player, "inset", null);
setInlineStyle(player, "width", null);
setInlineStyle(player, "height", null);
setInlineStyle(player, "max-width", null);
setInlineStyle(player, "max-height", null);
setInlineStyle(player, "margin", null);
setInlineStyle(stage, "width", null);
setInlineStyle(stage, "height", null);
setInlineStyle(stage, "min-height", null);
setInlineStyle(stage, "max-height", null);
setInlineStyle(stage, "aspect-ratio", "auto");
}
@@ -168,9 +185,13 @@ function setStageElement(element: unknown): void {
updateStageSize();
}
onMounted(() => window.addEventListener("resize", updateStageSize));
onMounted(() => {
window.addEventListener("resize", updateStageSize);
document.addEventListener("fullscreenchange", updateStageSize);
});
watch(screenShareFullscreen, updateStageSize);
onBeforeUnmount(() => {
window.removeEventListener("resize", updateStageSize);
document.removeEventListener("fullscreenchange", updateStageSize);
});
</script>