mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
feat(plugins): add GitHub store and scoped collaborative panels
This commit is contained in:
1 parent
b9fccb8757
commit
ce681f749d
40 files changed
+1370
-5
No files matched your search
@@ -18,6 +18,9 @@
|
||||
<rect x="4" y="14" width="16" height="7" rx="1.5" />
|
||||
<path d="M8 6.5h.01M8 17.5h.01M11 6.5h5M11 17.5h5" />
|
||||
</template>
|
||||
<template v-else-if="name === 'grid'">
|
||||
<rect x="3" y="3" width="7" height="7" rx="1.5" /><rect x="14" y="3" width="7" height="7" rx="1.5" /><rect x="3" y="14" width="7" height="7" rx="1.5" /><rect x="14" y="14" width="7" height="7" rx="1.5" />
|
||||
</template>
|
||||
<template v-else-if="name === 'compass'">
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<path d="m15.5 8.5-2.2 4.8-4.8 2.2 2.2-4.8z" />
|
||||
@@ -69,6 +72,7 @@
|
||||
<path v-else-if="name === 'paperclip'" d="m20 11-7.5 7.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-7.5 7.5a2 2 0 0 1-3-3L14 7" />
|
||||
<path v-else-if="name === 'share'" d="M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7M16 6l-4-4-4 4m4-4v13" />
|
||||
<path v-else-if="name === 'copy'" d="M8 8V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-3M6 8h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2Z" />
|
||||
<path v-else-if="name === 'trash'" d="M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7M14 10v7" />
|
||||
<path v-else-if="name === 'close'" d="m6 6 12 12M18 6 6 18" />
|
||||
<path v-else-if="name === 'more'" d="M5 12h.01M12 12h.01M19 12h.01" stroke-width="3" />
|
||||
<path v-else-if="name === 'menu'" d="M4 6h16M4 12h16M4 18h16" />
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<button v-if="connected" class="ws-plugin-launcher" type="button" @click="show">◈ {{ tr('title') }}</button>
|
||||
<dialog ref="dialog" class="ws-plugin-dialog" :data-plugin-theme="theme" @close="closed" @cancel="closed">
|
||||
<header><strong>{{ current?.manifest.name ?? tr('title') }}</strong><button type="button" @click="dialog?.close()">{{ tr('close') }}</button></header>
|
||||
<p v-if="error" role="alert" class="ws-plugin-error">{{ error }}</p>
|
||||
<template v-if="!current">
|
||||
<div class="ws-plugin-toolbar"><button type="button" :disabled="busy" @click="refresh">{{ busy ? tr('loading') : tr('refresh') }}</button></div>
|
||||
<p>{{ tr('enableNote') }}</p><p v-if="!busy && !available.length">{{ tr('empty') }}</p>
|
||||
<section v-for="entry in available" :key="entry.manifest.id" class="ws-plugin-entry">
|
||||
<div><strong>{{ entry.manifest.name }}</strong><small>{{ entry.scope === 'server' ? tr('server') : tr('instance') }} · {{ entry.manifest.version }}</small><p>{{ entry.manifest.description }}</p></div>
|
||||
<button type="button" :disabled="busy" @click="launch(entry.manifest.id)">{{ tr('open') }}</button>
|
||||
</section>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="ws-plugin-toolbar"><button type="button" @click="stop">← {{ tr('back') }}</button><small>{{ tr('permission') }}: {{ current.manifest.permissions.join(', ') }}</small></div>
|
||||
<iframe ref="frame" :key="channel" :title="current.manifest.name" :srcdoc="documentSource" sandbox="allow-scripts" allow="fullscreen" referrerpolicy="no-referrer" @load="sendContext"></iframe>
|
||||
</template>
|
||||
</dialog>
|
||||
</Teleport>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue';
|
||||
import { parsePluginPackage, pluginRecord, parsePluginJson, type PluginManifest, type PluginScope, type PluginRoomSnapshot } from '../../../src/shared/plugins.js';
|
||||
import { pluginFrameDocument } from '../services/plugin-frame.js';
|
||||
import type { PluginTransport } from '../services/plugin-transport.js';
|
||||
import { pluginTranslations, type PluginTextKey } from '../i18n/plugins.js';
|
||||
import type { SiteLanguage } from '../../../src/site-copy.js';
|
||||
const props = defineProps<{ transport: PluginTransport; connected: boolean; language: SiteLanguage }>();
|
||||
const tr = (key: PluginTextKey) => pluginTranslations[props.language][key];
|
||||
const dialog = ref<HTMLDialogElement | null>(null), frame = ref<HTMLIFrameElement | null>(null);
|
||||
const available = shallowRef<{ manifest: PluginManifest; scope: PluginScope }[]>([]);
|
||||
const current = shallowRef<ReturnType<typeof parsePluginPackage> | null>(null);
|
||||
const documentSource = ref(''), channel = ref(''), theme = ref<'light'|'dark'>('light');
|
||||
const busy = ref(false), error = ref(''); let epoch = 0, openingId: string | undefined, context: Record<string,unknown> = {}, observer: MutationObserver | undefined;
|
||||
const inFlight = new Set<number>();
|
||||
const pluginId = computed(() => current.value?.manifest.id);
|
||||
function detectTheme() {
|
||||
const root = document.querySelector('.ws-skin-root');
|
||||
const color = root ? getComputedStyle(root).color.match(/[\d.]+/g)?.map(Number) : null;
|
||||
theme.value = color && color.length >= 3 ? (color[0]*.2126+color[1]*.7152+color[2]*.0722 > 140 ? 'dark':'light') : matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';
|
||||
}
|
||||
function send(value: object) { frame.value?.contentWindow?.postMessage({ channel: channel.value, ...value }, '*'); }
|
||||
function sendContext() { send({ type: 'context', context: { ...context, language: props.language, theme: theme.value } }); }
|
||||
async function refresh() {
|
||||
const owner = ++epoch; busy.value = true; error.value = '';
|
||||
try {
|
||||
const result = await props.transport.request('list');
|
||||
if (owner !== epoch) return;
|
||||
if (!Array.isArray(result) || result.length > 50) throw new Error('PLUGIN_INVALID_RESPONSE');
|
||||
available.value = result.map(v => { if (!pluginRecord(v)) throw new Error('PLUGIN_INVALID_RESPONSE');
|
||||
const manifest = v.manifest; if (!pluginRecord(manifest) || typeof manifest.id !== 'string' || typeof manifest.name !== 'string' || (v.scope !== 'server' && v.scope !== 'instance')) throw new Error('PLUGIN_INVALID_RESPONSE');
|
||||
return { manifest: manifest as unknown as PluginManifest, scope: v.scope }; });
|
||||
} catch (e) { if (owner === epoch) error.value = `${tr('error')}: ${e instanceof Error ? e.message : ''}`; }
|
||||
finally { if (owner === epoch) busy.value = false; }
|
||||
}
|
||||
function show() { detectTheme(); dialog.value?.showModal(); void refresh(); }
|
||||
function stop() {
|
||||
const id = pluginId.value ?? openingId; ++epoch; openingId = undefined; inFlight.clear(); current.value = null; documentSource.value = ''; context = {}; channel.value = ''; busy.value = false;
|
||||
if (id) void props.transport.request('close', { pluginId: id }).catch(() => undefined);
|
||||
}
|
||||
function closed() { stop(); error.value = ''; available.value = []; }
|
||||
async function launch(id: string) {
|
||||
const owner = ++epoch; openingId = id; busy.value = true; error.value = '';
|
||||
try {
|
||||
const result = await props.transport.request('open', { pluginId: id });
|
||||
// stop() queues the close after this open on the same ordered socket.
|
||||
// A late response must never close a newer opening of the same plugin.
|
||||
if (owner !== epoch) return;
|
||||
if (!pluginRecord(result) || !pluginRecord(result.snapshot)) throw new Error('PLUGIN_INVALID_RESPONSE');
|
||||
const pack = parsePluginPackage(result.package);
|
||||
if (pack.manifest.id !== id) throw new Error('PLUGIN_INVALID_RESPONSE');
|
||||
current.value = pack; context = { config: result.config, self: result.self, scope: result.scope, snapshot: result.snapshot };
|
||||
channel.value = crypto.randomUUID(); documentSource.value = pluginFrameDocument(pack, channel.value);
|
||||
} catch (e) { if (owner === epoch) error.value = `${tr('error')}: ${e instanceof Error ? e.message : ''}`; }
|
||||
finally { if (owner === epoch) { openingId = undefined; busy.value = false; } }
|
||||
}
|
||||
async function receive(event: MessageEvent) {
|
||||
if (!frame.value || event.source !== frame.value.contentWindow || !pluginRecord(event.data) || event.data.channel !== channel.value || !current.value) return;
|
||||
const value = event.data;
|
||||
if (value.type === 'ready') { sendContext(); return; }
|
||||
if (value.type !== 'request' || !Number.isSafeInteger(value.id) || inFlight.has(value.id as number) || inFlight.size >= 8) return;
|
||||
const id = value.id as number, owner = epoch, plugin = pluginId.value!; inFlight.add(id);
|
||||
try {
|
||||
let result: unknown;
|
||||
if (value.method === 'room.snapshot') result = await props.transport.request('snapshot', { pluginId: plugin });
|
||||
else if (value.method === 'room.update' && pluginRecord(value.args) && Number.isSafeInteger(value.args.revision)) {
|
||||
result = await props.transport.request('update', { pluginId: plugin, revision: value.args.revision as number, state: parsePluginJson(value.args.state) });
|
||||
} else throw new Error('PLUGIN_PERMISSION_DENIED');
|
||||
if (owner === epoch) send({ type: 'reply', id, result });
|
||||
} catch (e) { if (owner === epoch) send({ type: 'reply', id, error: e instanceof Error ? e.message : 'PLUGIN_FAILED' }); }
|
||||
finally { if (owner === epoch) inFlight.delete(id); }
|
||||
}
|
||||
const unsubscribe = props.transport.subscribe(message => {
|
||||
if (message.type === 'pluginReset') { stop(); available.value = []; dialog.value?.close(); return; }
|
||||
if (message.type !== 'pluginEvent' || message.pluginId !== pluginId.value) return;
|
||||
if (!message.snapshot) { stop(); error.value = tr('context'); return; }
|
||||
context.snapshot = message.snapshot as PluginRoomSnapshot; send({ type: 'snapshot', snapshot: message.snapshot });
|
||||
});
|
||||
watch(() => props.language, sendContext);
|
||||
watch(theme, sendContext);
|
||||
watch(() => props.connected, connected => { if (!connected) { closed(); dialog.value?.close(); } });
|
||||
onMounted(() => { window.addEventListener('message', receive); observer = new MutationObserver(detectTheme); observer.observe(document.documentElement, { attributes: true, subtree: true, attributeFilter:['data-ws-skin','data-theme'] }); });
|
||||
onBeforeUnmount(() => { unsubscribe(); stop(); observer?.disconnect(); window.removeEventListener('message', receive); dialog.value?.close(); });
|
||||
</script>
|
||||
<style>
|
||||
.ws-plugin-launcher{all:initial;position:fixed;right:16px;top:88px;z-index:10000;font:600 14px system-ui;cursor:pointer;background:#184b48;color:white;border:1px solid #4d827e;border-radius:24px;padding:10px 16px;box-shadow:0 4px 20px #0003}
|
||||
.ws-plugin-dialog{box-sizing:border-box;width:min(960px,calc(100vw - 24px));max-height:calc(100dvh - 32px);padding:20px;border:1px solid #b6c9c7;border-radius:16px;background:#fff;color:#182e2d;font:15px/1.5 system-ui;overflow:auto}
|
||||
.ws-plugin-dialog[data-plugin-theme="dark"]{background:#20242b;color:#ecf2f1;border-color:#4a525d}.ws-plugin-dialog::backdrop{background:#0009}.ws-plugin-dialog header,.ws-plugin-toolbar,.ws-plugin-entry{display:flex;align-items:center;gap:12px;justify-content:space-between}.ws-plugin-dialog header strong{font-size:20px}.ws-plugin-dialog button{font:inherit;cursor:pointer;border:1px solid #779c98;border-radius:8px;padding:8px 12px;background:#e5f3f0;color:#153f3b}.ws-plugin-dialog button:disabled{opacity:.5;cursor:wait}.ws-plugin-dialog iframe{display:block;width:100%;height:min(620px,68dvh);border:1px solid #779c98;border-radius:8px;background:transparent}.ws-plugin-toolbar{margin:14px 0;flex-wrap:wrap}.ws-plugin-entry{border-top:1px solid #779c9866;padding:16px 0}.ws-plugin-entry small{display:block;opacity:.7}.ws-plugin-entry p{margin:6px 0}.ws-plugin-error{color:#c73131;overflow-wrap:anywhere}
|
||||
@media(max-width:600px){.ws-plugin-launcher{top:72px;right:8px;padding:8px 12px}.ws-plugin-dialog{padding:14px}.ws-plugin-entry{align-items:start}.ws-plugin-dialog iframe{height:65dvh}}
|
||||
</style>
|
||||
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<section class="page-content plugin-admin">
|
||||
<header class="plugin-hero">
|
||||
<div><span class="plugin-eyebrow"><Icon name="grid" :size="14" /> EXTENSIONS</span><h2>{{ tr('store') }}</h2><p>{{ tr('lead') }}</p><div class="plugin-metrics"><span><b>{{ model.catalog.value?.entries.length ?? '—' }}</b>{{ text('available') }}</span><i></i><span><b>{{ model.installed.value.length }}</b>{{ tr('installed') }}</span><i></i><span><b>{{ enabledCount }}</b>{{ text('active') }}</span></div></div>
|
||||
<div class="plugin-hero-art" aria-hidden="true"><i></i><i></i><i></i><i></i><b>+</b></div>
|
||||
</header>
|
||||
<div class="plugin-toolbar">
|
||||
<nav class="plugin-tabs" :aria-label="tr('store')"><button type="button" :aria-current="tab==='store'?'page':undefined" @click="tab='store'"><Icon name="compass" :size="16" />{{ text('discover') }}</button><button type="button" :aria-current="tab==='installed'?'page':undefined" @click="tab='installed'"><Icon name="grid" :size="16" />{{ tr('installed') }}<span>{{ model.installed.value.length }}</span></button></nav>
|
||||
<div class="plugin-tools"><label class="plugin-search"><Icon name="search" :size="16" /><input v-model="search" type="search" :aria-label="text('search')" :placeholder="text('search')" /></label><button class="plugin-refresh" type="button" :disabled="model.busy.value" :title="tr('refresh')" :aria-label="tr('refresh')" @click="model.load"><Icon name="refresh" :size="17" /></button></div>
|
||||
</div>
|
||||
<p v-if="model.error.value" class="plugin-feedback is-error" role="alert"><Icon name="info" :size="17" />{{ tr('error') }}: {{ model.error.value }}</p>
|
||||
<p v-if="notice" class="plugin-feedback" role="status"><Icon name="check" :size="17" />{{ notice }}</p>
|
||||
<div class="plugin-section-heading"><div><h3>{{ tab==='store'?text('discover'):tr('installed') }}</h3><span v-if="tab==='store'" class="plugin-source"><i></i>{{ text('source') }}</span></div><a v-if="tab==='store'" :href="PLUGIN_STORE_REPOSITORY" target="_blank" rel="noopener noreferrer"><Icon name="github" :size="16" />GitHub ↗</a><button v-else class="plugin-button" type="button" :disabled="model.busy.value" @click="fileInput?.click()"><Icon name="share" :size="15" />{{ tr('upload') }}</button></div>
|
||||
<input ref="fileInput" class="plugin-file-input" type="file" accept=".wplugin,application/json" @change="upload" />
|
||||
<p v-if="model.busy.value" class="plugin-loading" role="status"><span class="spinner small"></span>{{ tr('loading') }}</p>
|
||||
<div v-if="tab==='store'" class="plugin-store-grid">
|
||||
<article v-for="entry in catalogEntries" :key="entry.id" class="plugin-market-card">
|
||||
<div class="plugin-card-visual"><div class="plugin-card-symbol"><Icon name="grid" :size="38" /></div><span>API {{ entry.manifest?.apiVersion ?? '—' }}</span><i aria-hidden="true"></i></div>
|
||||
<div class="plugin-card-body"><div class="plugin-card-title"><h4>{{ entry.manifest?.name ?? entry.id }}</h4><small>v{{ entry.manifest?.version ?? '—' }}</small></div><p class="plugin-author">{{ entry.manifest?.author }} · {{ entry.manifest?.license }}</p><p class="plugin-description">{{ entry.manifest?.description }}</p><div class="plugin-tags"><span v-for="scope in entry.manifest?.scopes" :key="scope"><Icon name="server" :size="12" />{{ tr(scope) }}</span></div><div class="plugin-permissions"><span v-for="permission in entry.manifest?.permissions" :key="permission"><Icon name="check" :size="12" />{{ text(permission==='room.read'?'read':'write') }}</span></div><p v-if="entry.error" class="is-error">{{ entry.error }}</p></div>
|
||||
<footer><a :href="entry.repository" target="_blank" rel="noopener noreferrer" :aria-label="`${entry.manifest?.name ?? entry.id} · GitHub`"><Icon name="github" :size="16" />GitHub ↗</a><button class="plugin-button primary" type="button" :disabled="model.busy.value || !entry.manifest || !!entry.error" @click="install(entry)"><Icon name="download" :size="15" />{{ installLabel(entry) }}</button></footer>
|
||||
</article>
|
||||
</div>
|
||||
<div v-else class="plugin-installed-list">
|
||||
<article v-for="plugin in installedEntries" :key="plugin.manifest.id" class="plugin-installed-card">
|
||||
<header><div class="plugin-installed-icon"><Icon name="grid" :size="23" /></div><div class="plugin-installed-name"><h4>{{ plugin.manifest.name }}</h4><p>v{{ plugin.manifest.version }} · {{ plugin.manifest.author }}</p></div><span class="plugin-status" :class="{active:plugin.settings.enabled}"><i></i>{{ text(plugin.settings.enabled?'active':'inactive') }}</span></header>
|
||||
<p class="plugin-description">{{ plugin.manifest.description }}</p><div class="plugin-installed-meta"><span><Icon name="server" :size="13" />{{ tr(plugin.settings.scope) }}</span><span>{{ plugin.manifest.license }}</span><span>API {{ plugin.manifest.apiVersion }}</span></div>
|
||||
<details :open="expanded===plugin.manifest.id" @toggle="onToggle($event,plugin.manifest.id)"><summary><Icon name="settings" :size="16" />{{ text('configure') }}<Icon class="plugin-chevron" name="chevron-down" :size="15" /></summary><fieldset :disabled="model.busy.value">
|
||||
<div class="plugin-enable-row"><div><strong>{{ tr('enabled') }}</strong><p>{{ text('review') }}</p></div><label class="plugin-switch"><input v-model="model.drafts[plugin.manifest.id].enabled" type="checkbox" :aria-label="tr('enabled')" /><span></span></label></div>
|
||||
<div class="plugin-permissions"><span v-for="permission in plugin.manifest.permissions" :key="permission"><Icon name="shield" :size="13" />{{ text(permission==='room.read'?'read':'write') }}</span></div>
|
||||
<label>{{ tr('scope') }}<select v-model="model.drafts[plugin.manifest.id].scope"><option v-for="scope in plugin.manifest.scopes" :key="scope" :value="scope">{{ tr(scope) }}</option></select></label>
|
||||
<label v-if="model.drafts[plugin.manifest.id].scope==='server'">{{ tr('targets') }}<textarea v-model="model.drafts[plugin.manifest.id].targets" rows="3" maxlength="15000" placeholder="voice.example.com:9987"></textarea></label>
|
||||
<details class="plugin-advanced"><summary>{{ text('advanced') }}<Icon name="chevron-down" :size="14" /></summary><label>{{ tr('config') }}<textarea v-model="model.drafts[plugin.manifest.id].config" rows="5" maxlength="8192" spellcheck="false"></textarea></label></details>
|
||||
<div class="plugin-settings-actions"><button class="plugin-button danger" type="button" @click="remove(plugin)"><Icon name="trash" :size="14" />{{ tr('remove') }}</button><button class="plugin-button primary" type="button" @click="save(plugin)"><Icon name="check" :size="15" />{{ tr('save') }}</button></div>
|
||||
</fieldset></details>
|
||||
</article>
|
||||
</div>
|
||||
<div v-if="!model.busy.value && !(tab==='store'?catalogEntries.length:installedEntries.length)" class="plugin-empty"><Icon name="grid" :size="32" /><h4>{{ search?text('empty'):tr('empty') }}</h4></div>
|
||||
<details class="plugin-scope-help"><summary><Icon name="info" :size="16" />{{ text('scopeHelp') }}<Icon name="chevron-down" :size="14" /></summary><p>{{ tr('note') }}</p><p>{{ tr('enableNote') }}</p></details>
|
||||
</section>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import Icon from '../Icon.vue';
|
||||
import type { SiteLanguage } from '../../../../src/site-copy.js';
|
||||
import { PLUGIN_STORE_REPOSITORY, type InstalledPlugin, type PluginStoreEntry, type PluginManifest } from '../../../../src/shared/plugins.js';
|
||||
import type { useAdminPlugins } from '../../composables/useAdminPlugins.js';
|
||||
import { pluginTranslations, type PluginTextKey } from '../../i18n/plugins.js';
|
||||
import { pluginStoreTranslations, type PluginStoreTextKey } from '../../i18n/plugin-store.js';
|
||||
const props=defineProps<{model:ReturnType<typeof useAdminPlugins>;language:SiteLanguage}>();
|
||||
const tr=(key:PluginTextKey)=>pluginTranslations[props.language][key],text=(key:PluginStoreTextKey)=>pluginStoreTranslations[props.language][key];
|
||||
const tab=ref<'store'|'installed'>('store'),search=ref(''),expanded=ref(''),notice=ref(''),fileInput=ref<HTMLInputElement|null>(null);
|
||||
const enabledCount=computed(()=>props.model.installed.value.filter(p=>p.settings.enabled).length);
|
||||
const matches=(manifest:PluginManifest|null,id:string)=>[manifest?.name,manifest?.author,manifest?.description,id].join(' ').toLocaleLowerCase().includes(search.value.trim().toLocaleLowerCase());
|
||||
const catalogEntries=computed(()=>(props.model.catalog.value?.entries??[]).filter(e=>matches(e.manifest,e.id)));
|
||||
const installedEntries=computed(()=>props.model.installed.value.filter(p=>matches(p.manifest,p.manifest.id)));
|
||||
function installLabel(entry:PluginStoreEntry){const local=props.model.installed.value.find(p=>p.manifest.id===entry.id);return !local?text('add'):local.manifest.version===entry.manifest?.version?text('reinstall'):text('update');}
|
||||
async function install(entry:PluginStoreEntry){notice.value='';await props.model.install(entry);if(!props.model.error.value){tab.value='installed';expanded.value=entry.id;notice.value=text('installedNotice');}}
|
||||
async function upload(event:Event){const input=event.target as HTMLInputElement,file=input.files?.[0];if(file){notice.value='';await props.model.upload(file);if(!props.model.error.value){tab.value='installed';notice.value=text('installedNotice');}}input.value='';}
|
||||
async function save(plugin:InstalledPlugin){notice.value='';await props.model.save(plugin);}
|
||||
function remove(plugin:InstalledPlugin){if(window.confirm(tr('removed'))){notice.value='';void props.model.remove(plugin);}}
|
||||
function onToggle(event:Event,id:string){if((event.target as HTMLDetailsElement).open)expanded.value=id;else if(expanded.value===id)expanded.value='';}
|
||||
</script>
|
||||
<style scoped>
|
||||
section.page-content.plugin-admin{display:grid;grid-template-columns:minmax(0,1fr);grid-auto-rows:max-content;align-content:start;gap:24px;color:var(--admin-text);min-width:0}
|
||||
.plugin-admin :is(h2,h3,h4,p){margin:0}.plugin-admin :is(button,input,select,textarea){font:inherit}.plugin-admin button{cursor:pointer}.plugin-admin button:disabled{opacity:.5;cursor:wait}
|
||||
.plugin-hero{position:relative;display:flex;align-items:center;justify-content:space-between;gap:28px;overflow:hidden;padding:32px;border:1px solid var(--admin-border);border-radius:20px;background:radial-gradient(ellipse at 100% 0,color-mix(in srgb,var(--admin-accent) 12%,transparent),transparent 65%),var(--admin-surface)}
|
||||
.plugin-hero>div:first-child{z-index:1;max-width:640px}.plugin-eyebrow{display:flex;align-items:center;gap:8px;font-size:10px;font-weight:800;letter-spacing:.16em;color:var(--admin-accent);margin-bottom:14px}.plugin-hero h2{font-size:30px;letter-spacing:-.04em}.plugin-hero p{font-size:13px;line-height:1.8;color:var(--admin-muted);max-width:560px;margin-top:12px}
|
||||
.plugin-metrics{display:flex;align-items:center;gap:20px;margin-top:24px;flex-wrap:wrap}.plugin-metrics>span{display:flex;align-items:center;gap:9px;font-size:11px;color:var(--admin-muted)}.plugin-metrics b{font-size:20px;color:var(--admin-text);font-variant-numeric:tabular-nums}.plugin-metrics>i{height:17px;width:1px;background:var(--admin-border)}
|
||||
.plugin-hero-art{position:relative;display:grid;grid-template-columns:1fr 1fr;gap:10px;width:130px;flex:0 0 130px;transform:rotate(-8deg);margin:8px 12px}.plugin-hero-art i{aspect-ratio:1;border-radius:15px;border:1px solid color-mix(in srgb,var(--admin-accent) 22%,var(--admin-border));background:var(--admin-accent-soft);box-shadow:0 8px 18px #0001}.plugin-hero-art i:nth-child(2){transform:translate(10px,-10px);background:var(--admin-accent);opacity:.8}.plugin-hero-art i:nth-child(3){opacity:.5}.plugin-hero-art b{position:absolute;right:-15px;bottom:-12px;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;font-size:25px;background:var(--admin-surface);color:var(--admin-accent)}
|
||||
.plugin-toolbar,.plugin-tools,.plugin-tabs{display:flex;align-items:center;gap:12px;min-width:0}.plugin-toolbar{justify-content:space-between;flex-wrap:wrap}.plugin-tabs{gap:4px;padding:4px;background:var(--admin-raised);border:1px solid var(--admin-border);border-radius:12px}.plugin-tabs button{display:flex;align-items:center;gap:8px;min-height:40px;border:0;border-radius:8px;padding:9px 15px;background:transparent;color:var(--admin-muted);font-size:12px;font-weight:650}.plugin-tabs button[aria-current]{color:var(--admin-accent);background:var(--admin-surface);box-shadow:0 1px 5px #0001}.plugin-tabs button>span{min-width:18px;border-radius:5px;padding:0 5px;background:var(--admin-accent-soft);font-size:10px}
|
||||
.plugin-search{display:flex;gap:8px;align-items:center;padding:0 12px;border:1px solid var(--admin-border);border-radius:10px;background:var(--admin-surface);color:var(--admin-muted)}.plugin-search input{width:200px;min-width:0;border:0!important;outline:none;background:transparent!important;color:var(--admin-text);height:42px;font-size:12px;padding:0!important;box-shadow:none!important}.plugin-search:focus-within{outline:2px solid color-mix(in srgb,var(--admin-accent) 35%,transparent)}.plugin-refresh{display:grid;place-items:center;width:44px;height:44px;padding:0;border:1px solid var(--admin-border);border-radius:10px;background:var(--admin-surface);color:var(--admin-muted)}
|
||||
.plugin-section-heading,.plugin-section-heading>div{display:flex;align-items:center;gap:14px;justify-content:space-between;flex-wrap:wrap}.plugin-section-heading h3{font-size:15px}.plugin-section-heading a,.plugin-market-card footer a{display:flex;gap:7px;align-items:center;font-size:11px;color:var(--admin-muted);text-decoration:none}.plugin-source{display:flex;align-items:center;gap:6px;font-size:10px;color:var(--admin-muted)}.plugin-source i,.plugin-status i{height:6px;width:6px;flex:none;border-radius:50%;background:#7c9790}.plugin-source i{background:var(--admin-accent)}
|
||||
.plugin-store-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr));gap:20px;align-items:start}.plugin-market-card{display:flex;flex-direction:column;max-width:460px;min-width:0;border:1px solid var(--admin-border);border-radius:16px;background:var(--admin-surface);overflow:hidden;transition:border-color .2s,transform .2s}.plugin-market-card:hover{transform:translateY(-3px);border-color:color-mix(in srgb,var(--admin-accent) 50%,var(--admin-border))}
|
||||
.plugin-card-visual{position:relative;display:grid;place-items:center;height:142px;overflow:hidden;background:linear-gradient(130deg,var(--admin-accent-soft),var(--admin-raised))}.plugin-card-symbol{display:grid;place-items:center;width:76px;height:76px;border:1px solid color-mix(in srgb,var(--admin-accent) 20%,var(--admin-border));background:var(--admin-surface);border-radius:21px;color:var(--admin-accent);transform:rotate(-8deg);box-shadow:0 8px 20px #0001;z-index:1}.plugin-card-visual>span{position:absolute;top:14px;right:14px;padding:4px 7px;border:1px solid var(--admin-border);border-radius:6px;font-size:9px;font-weight:700;background:var(--admin-surface);color:var(--admin-muted)}.plugin-card-visual>i{position:absolute;border:1px solid color-mix(in srgb,var(--admin-accent) 15%,transparent);border-radius:50%;width:260px;height:260px;left:-65px;top:-95px}.plugin-card-visual>i:after{content:'';position:absolute;inset:24px;border:inherit;border-radius:inherit}
|
||||
.plugin-card-body{padding:22px;display:grid;gap:12px}.plugin-card-title{display:flex;align-items:start;justify-content:space-between;gap:10px}.plugin-card-title h4{font-size:16px;line-height:1.4;letter-spacing:-.025em;overflow-wrap:anywhere}.plugin-card-title small{flex:none;font-size:10px;color:var(--admin-muted);padding-top:3px}.plugin-author{color:var(--admin-muted);font-size:10px}.plugin-description{font-size:12px;line-height:1.75;color:var(--admin-muted);overflow-wrap:anywhere}.plugin-tags,.plugin-permissions{display:flex;gap:7px;flex-wrap:wrap}.plugin-tags>span{display:inline-flex;align-items:center;gap:5px;padding:5px 7px;font-size:9px;border:1px solid var(--admin-border);border-radius:6px;color:var(--admin-muted)}.plugin-permissions>span{display:inline-flex;align-items:center;gap:5px;font-size:10px;color:var(--admin-accent)}.plugin-market-card footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:15px 22px;border-top:1px solid var(--admin-border);background:var(--admin-raised)}
|
||||
.plugin-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;border:1px solid var(--admin-border);border-radius:8px;padding:9px 13px;font-size:11px;font-weight:650;color:var(--admin-text);background:var(--admin-surface)}.plugin-button.primary{border-color:transparent;color:var(--admin-surface);background:var(--admin-accent)}.plugin-button.danger{color:#c95c5c;background:transparent;border-color:transparent}.plugin-file-input{display:none}.plugin-feedback{display:flex;gap:10px;align-items:center;border:1px solid var(--admin-border);border-radius:10px;padding:12px 16px;color:var(--admin-accent);background:var(--admin-accent-soft);font-size:12px;overflow-wrap:anywhere}.plugin-admin .is-error{color:#cf6565}.plugin-loading{display:flex;gap:10px;align-items:center;color:var(--admin-muted);font-size:12px}
|
||||
.plugin-installed-list{display:grid;gap:16px}.plugin-installed-card{background:var(--admin-surface);border:1px solid var(--admin-border);border-radius:16px;overflow:hidden;min-width:0}.plugin-installed-card>header{display:flex;align-items:center;gap:13px;padding:22px 24px 12px}.plugin-installed-icon{display:grid;place-items:center;flex:none;width:48px;height:48px;background:var(--admin-accent-soft);color:var(--admin-accent);border:1px solid var(--admin-border);border-radius:13px}.plugin-installed-name{flex:1;min-width:0}.plugin-installed-name h4{font-size:15px;overflow-wrap:anywhere}.plugin-installed-name p{color:var(--admin-muted);font-size:10px;margin-top:5px}.plugin-status{display:flex;align-items:center;gap:6px;padding:5px 8px;font-size:10px;border:1px solid var(--admin-border);border-radius:20px;color:var(--admin-muted);flex:none}.plugin-status.active{background:var(--admin-accent-soft);color:var(--admin-accent)}.plugin-status.active i{background:var(--admin-accent)}.plugin-installed-card>.plugin-description{padding:0 24px}.plugin-installed-meta{display:flex;gap:14px;flex-wrap:wrap;padding:14px 24px 20px;font-size:10px;color:var(--admin-muted)}.plugin-installed-meta>span{display:flex;align-items:center;gap:6px}
|
||||
.plugin-installed-card>details{border-top:1px solid var(--admin-border)}.plugin-installed-card>details>summary{display:flex;gap:8px;align-items:center;padding:15px 24px;list-style:none;cursor:pointer;color:var(--admin-muted);font-size:12px}.plugin-chevron{margin-left:auto;transition:transform .2s}details[open]>summary .plugin-chevron{transform:rotate(180deg)}summary::-webkit-details-marker{display:none}.plugin-installed-card fieldset{display:grid;gap:18px;min-width:0;margin:0;padding:6px 24px 24px;border:0}.plugin-enable-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px;background:var(--admin-raised);border:1px solid var(--admin-border);border-radius:10px}.plugin-enable-row strong{font-size:12px}.plugin-enable-row p{font-size:10px;color:var(--admin-muted);margin-top:4px}
|
||||
.plugin-switch{position:relative;flex:none;display:block;width:36px;height:21px}.plugin-switch input{position:absolute;inset:0;opacity:0;margin:0;z-index:1;cursor:pointer;width:100%;height:100%}.plugin-switch>span{display:block;height:21px;border-radius:20px;background:var(--admin-border);transition:background .2s}.plugin-switch>span:after{content:'';display:block;position:absolute;left:3px;top:3px;width:15px;height:15px;border-radius:50%;background:white;transition:transform .2s}.plugin-switch input:checked+span{background:var(--admin-accent)}.plugin-switch input:checked+span:after{transform:translateX(15px)}.plugin-switch input:focus-visible+span{outline:3px solid color-mix(in srgb,var(--admin-accent) 35%,transparent);outline-offset:3px}
|
||||
.plugin-installed-card fieldset>label,.plugin-advanced label{display:grid;gap:8px;color:var(--admin-muted);font-size:11px}.plugin-installed-card textarea,.plugin-installed-card select{width:100%;min-width:0;max-width:100%;border:1px solid var(--admin-border);padding:10px 12px;border-radius:8px;background:var(--admin-field);color:var(--admin-text);font-size:12px}.plugin-installed-card textarea{resize:vertical;line-height:1.7}.plugin-advanced{border:1px solid var(--admin-border);border-radius:9px;padding:0 12px}.plugin-advanced summary{display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--admin-muted);padding:12px 0;cursor:pointer}.plugin-advanced label{padding-bottom:12px}.plugin-advanced textarea{font-family:ui-monospace,monospace}.plugin-settings-actions{display:flex;justify-content:space-between;gap:12px;padding-top:4px}.plugin-scope-help{margin-top:8px;border-top:1px solid var(--admin-border);padding-top:20px;color:var(--admin-muted);font-size:11px}.plugin-scope-help summary{display:flex;gap:8px;align-items:center;cursor:pointer;width:fit-content}.plugin-scope-help p{line-height:1.8;margin-top:12px;max-width:850px}.plugin-empty{display:grid;justify-items:center;gap:16px;padding:60px 20px;color:var(--admin-muted);text-align:center;border:1px dashed var(--admin-border);border-radius:16px}.plugin-empty h4{font-size:14px}.plugin-admin :is(button,a,input,textarea,select,summary):focus-visible{outline:3px solid color-mix(in srgb,var(--admin-accent) 35%,transparent);outline-offset:3px}
|
||||
@media(max-width:1100px){.plugin-hero-art{width:100px;flex-basis:100px;margin-right:0}.plugin-hero{padding:26px}.plugin-tools{flex:1;justify-content:end}.plugin-search{flex:1;max-width:320px}.plugin-search input{width:100%}}
|
||||
@media(max-width:600px){.plugin-admin{gap:18px}.plugin-hero{padding:24px 20px;border-radius:16px}.plugin-hero h2{font-size:25px}.plugin-hero p{font-size:12px}.plugin-hero-art{position:absolute;width:110px;right:-28px;top:-35px;opacity:.12}.plugin-metrics{gap:12px}.plugin-metrics>span{gap:6px;font-size:10px}.plugin-metrics b{font-size:18px}.plugin-tabs,.plugin-tools{width:100%}.plugin-tabs button{flex:1;justify-content:center;padding:8px 10px}.plugin-search{max-width:none}.plugin-section-heading>div{gap:8px}.plugin-section-heading h3{font-size:14px}.plugin-source{font-size:9px}.plugin-card-body{padding:18px}.plugin-market-card{max-width:none}.plugin-installed-card>header{padding:18px 16px 12px;flex-wrap:wrap;gap:10px}.plugin-installed-icon{width:40px;height:40px}.plugin-installed-name h4{font-size:13px}.plugin-status{font-size:9px}.plugin-installed-card>.plugin-description,.plugin-installed-meta{padding-left:16px;padding-right:16px}.plugin-installed-card>details>summary{padding:14px 16px}.plugin-installed-card fieldset{padding:4px 16px 16px}.plugin-enable-row{padding:12px}}
|
||||
</style>
|
||||
@@ -0,0 +1,54 @@
|
||||
import { reactive, ref, shallowRef } from "vue";
|
||||
import { createAdminRequests } from "../services/admin-requests.js";
|
||||
import { isAdminRequestCancelled, type AdminApi } from "../services/admin-api.js";
|
||||
import { parsePluginPackage, PLUGIN_LIMIT_BYTES, type InstalledPlugin, type PluginCatalog, type PluginStoreEntry } from "../../../src/shared/plugins.js";
|
||||
|
||||
export function useAdminPlugins(api: AdminApi) {
|
||||
const installed = shallowRef<InstalledPlugin[]>([]), catalog = shallowRef<PluginCatalog | null>(null);
|
||||
const busy = ref(false), error = ref(''), requests = createAdminRequests();
|
||||
const drafts = reactive<Record<string, { enabled: boolean; scope: 'server'|'instance'; targets: string; config: string }>>({});
|
||||
function apply(records: InstalledPlugin[]) {
|
||||
installed.value = records;
|
||||
for (const record of records) if (!drafts[record.manifest.id]) drafts[record.manifest.id] = {
|
||||
enabled: record.settings.enabled, scope: record.settings.scope, targets: record.settings.targets.join('\n'), config: JSON.stringify(record.settings.config, null, 2),
|
||||
};
|
||||
for (const id of Object.keys(drafts)) if (!records.some(r => r.manifest.id === id)) delete drafts[id];
|
||||
}
|
||||
async function work(run: (signal: AbortSignal, current: () => boolean) => Promise<void>) {
|
||||
if (busy.value) return;
|
||||
const request = requests.begin('plugins'); busy.value = true; error.value = '';
|
||||
const timer = setTimeout(() => { if (request.isCurrent()) { error.value='PLUGIN_TIMEOUT'; requests.cancel('plugins'); busy.value=false; } }, 90_000);
|
||||
try { await run(request.signal, request.isCurrent); }
|
||||
catch (e) { if (request.isCurrent() && !isAdminRequestCancelled(e)) error.value = e instanceof Error ? e.message : 'PLUGIN_FAILED'; }
|
||||
finally { clearTimeout(timer); if (request.isCurrent()) busy.value = false; request.finish(); }
|
||||
}
|
||||
function load() { return work(async (signal, current) => {
|
||||
const result = await api.plugins(signal); if (current()) apply(result.plugins);
|
||||
// Installed packages remain manageable even when GitHub is unavailable.
|
||||
const store = await api.pluginStore(signal); if (current()) catalog.value = store;
|
||||
}); }
|
||||
async function install(entry: PluginStoreEntry) {
|
||||
return work(async (signal, current) => {
|
||||
const result = await api.installPlugin({ id: entry.id, revision: entry.revision, installedRevision: installed.value.find(p => p.manifest.id === entry.id)?.revision ?? null }, signal);
|
||||
if (current()) { delete drafts[entry.id]; apply([...installed.value.filter(p => p.manifest.id !== entry.id), result.plugin]); }
|
||||
});
|
||||
}
|
||||
function save(record: InstalledPlugin) {
|
||||
return work(async (signal, current) => {
|
||||
const draft = drafts[record.manifest.id], captured = JSON.stringify(draft);
|
||||
const settings = { enabled: draft.enabled, scope: draft.scope, targets: draft.targets.split(/\r?\n/).map(t => t.trim()).filter(Boolean), config: JSON.parse(draft.config) };
|
||||
const result = await api.configurePlugin(record.manifest.id, record.revision, settings, signal);
|
||||
if (current()) { if (JSON.stringify(drafts[record.manifest.id]) === captured) delete drafts[record.manifest.id]; apply(installed.value.map(p => p.manifest.id === record.manifest.id ? result.plugin : p)); }
|
||||
});
|
||||
}
|
||||
function remove(record: InstalledPlugin) { return work(async (signal, current) => { await api.removePlugin(record.manifest.id, record.revision, signal); if (current()) apply(installed.value.filter(p => p.manifest.id !== record.manifest.id)); }); }
|
||||
function upload(file: File) { return work(async (signal, current) => {
|
||||
if (file.size > PLUGIN_LIMIT_BYTES) throw new Error('PLUGIN_TOO_LARGE');
|
||||
const pack = parsePluginPackage(JSON.parse(await file.text())); if (!current()) return;
|
||||
const result = await api.uploadPlugin(pack, installed.value.find(p => p.manifest.id === pack.manifest.id)?.revision ?? null, signal);
|
||||
if (current()) { delete drafts[pack.manifest.id]; apply([...installed.value.filter(p => p.manifest.id !== pack.manifest.id), result.plugin]); }
|
||||
}); }
|
||||
function cancelRequests() { requests.reset(); busy.value = false; }
|
||||
function reset() { cancelRequests(); installed.value = []; catalog.value = null; error.value = ''; for (const id of Object.keys(drafts)) delete drafts[id]; }
|
||||
return { installed, catalog, busy, error, drafts, load, install, save, remove, upload, cancelRequests, reset };
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { createAccompaniment, type AccompanimentErrorCode } from "../voice/accom
|
||||
import { createWebRtcTransport } from "../voice/webrtc-transport.js";
|
||||
import { createVoiceConnection } from "../voice/connection.js";
|
||||
import { createVoiceCommands } from "../voice/commands.js";
|
||||
import { createPluginTransport } from "../services/plugin-transport.js";
|
||||
import { createVoiceSessionState } from "../voice/session-state.js";
|
||||
import { applySavedMemberVolumes } from "../voice/member-volume-preferences.js";
|
||||
import { createAudioDiagnostics, type AudioPermission, type VoiceAudioStatusSample } from "../voice/audio-diagnostics.js";
|
||||
@@ -200,6 +201,7 @@ export function useVoiceWebSocket() {
|
||||
const ws = shallowRef<WebSocket | null>(null);
|
||||
const serverInfo = shallowRef<VoiceServerInfo | null>(null);
|
||||
const state = reactive<VoiceState>({ connected: false, connecting: false, reconnecting: false, reconnectAttempt: 0, reconnectFailed: false, tsClientId: 0, error: "", errorCode: "", microphoneError: "", microphoneErrorCode: "", audioNotice: "", audioNoticeCode: "", channelSwitchedChannelId: "" });
|
||||
const plugins = createPluginTransport(() => ws.value, () => state.connected);
|
||||
const sessionState = createVoiceSessionState({
|
||||
selfId: () => state.tsClientId,
|
||||
onMemberRemoved(id) {
|
||||
@@ -1023,6 +1025,7 @@ export function useVoiceWebSocket() {
|
||||
|
||||
/** All ways a session ends release the same owned media and pending work. */
|
||||
function releaseSessionResources(sendScreenStop = false): void {
|
||||
plugins.reset();
|
||||
chatGeneration++;
|
||||
inputDeviceGeneration++;
|
||||
outputDeviceGeneration++;
|
||||
@@ -1043,6 +1046,7 @@ export function useVoiceWebSocket() {
|
||||
}
|
||||
|
||||
function handleMessage(raw: unknown): void {
|
||||
if (plugins.receive(raw)) return;
|
||||
const msg = parseServerMessage(raw);
|
||||
if (!msg || screenShare.handleMessage(msg) || sessionState.receive(msg)) return;
|
||||
switch (msg.type) {
|
||||
@@ -1416,6 +1420,7 @@ export function useVoiceWebSocket() {
|
||||
}
|
||||
|
||||
return {
|
||||
plugins,
|
||||
...screenShare.api,
|
||||
ws,
|
||||
state,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { SiteLanguage } from '../../../src/site-copy.js';
|
||||
const en={available:'Available plugins',discover:'Discover',search:'Search plugins or authors',active:'Enabled',inactive:'Disabled',configure:'Configure plugin',advanced:'Advanced configuration',add:'Install plugin',update:'Update',reinstall:'Reinstall',empty:'No matching plugins',read:'Read shared room',write:'Update shared room',review:'Review permissions before enabling',installedNotice:'Installed. Review settings and enable the plugin.',source:'Distributed through GitHub',scopeHelp:'About plugin scopes'};
|
||||
export type PluginStoreTextKey=keyof typeof en;
|
||||
export const pluginStoreTranslations:Record<SiteLanguage,Record<PluginStoreTextKey,string>>={
|
||||
en,
|
||||
zh:{available:'可用插件',discover:'发现插件',search:'搜索插件名称或作者',active:'已启用',inactive:'未启用',configure:'配置插件',advanced:'高级配置',add:'安装插件',update:'更新插件',reinstall:'重新安装',empty:'没有找到匹配的插件',read:'读取共享房间',write:'更新共享房间',review:'启用前请检查插件权限',installedNotice:'安装成功,请检查设置后启用插件。',source:'通过 GitHub 分发',scopeHelp:'了解插件作用域'},
|
||||
de:{available:'Verfügbare Plugins',discover:'Entdecken',search:'Plugins oder Autoren suchen',active:'Aktiviert',inactive:'Deaktiviert',configure:'Plugin konfigurieren',advanced:'Erweiterte Konfiguration',add:'Plugin installieren',update:'Aktualisieren',reinstall:'Neu installieren',empty:'Keine passenden Plugins',read:'Gemeinsamen Raum lesen',write:'Gemeinsamen Raum ändern',review:'Berechtigungen vor dem Aktivieren prüfen',installedNotice:'Installiert. Einstellungen prüfen und Plugin aktivieren.',source:'Verteilung über GitHub',scopeHelp:'Geltungsbereiche verstehen'},
|
||||
ru:{available:'Доступные плагины',discover:'Обзор',search:'Поиск плагинов или авторов',active:'Включён',inactive:'Выключен',configure:'Настроить плагин',advanced:'Дополнительные настройки',add:'Установить плагин',update:'Обновить',reinstall:'Переустановить',empty:'Подходящих плагинов нет',read:'Чтение общей комнаты',write:'Изменение общей комнаты',review:'Проверьте разрешения перед включением',installedNotice:'Установлено. Проверьте настройки и включите плагин.',source:'Распространение через GitHub',scopeHelp:'Области действия плагинов'},
|
||||
ja:{available:'利用可能',discover:'見つける',search:'プラグイン名・作者を検索',active:'有効',inactive:'無効',configure:'プラグイン設定',advanced:'詳細設定',add:'インストール',update:'更新',reinstall:'再インストール',empty:'一致するプラグインがありません',read:'共有ルームの読み取り',write:'共有ルームの更新',review:'有効化する前に権限を確認してください',installedNotice:'インストールしました。設定を確認して有効にしてください。',source:'GitHub で配布',scopeHelp:'スコープについて'},
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { SiteLanguage } from "../../../src/site-copy.js";
|
||||
const en = {
|
||||
title: "Plugins", store: "Plugin store", installed: "Installed plugins", refresh: "Refresh", install: "Install / update", upload: "Import .wplugin", remove: "Remove", save: "Save settings",
|
||||
server: "Server plugin", instance: "WebSpeak instance plugin", targets: "TS server targets (one host:port per line)", config: "Public configuration (JSON; never enter secrets)", enabled: "Enable plugin",
|
||||
lead: "Install from GitHub, review permissions, then enable. Updates are disabled until reviewed again.", empty: "No plugins available", open: "Open", close: "Close", back: "Back to plugins", permission: "Permissions", scope: "Scope", source: "Distribution repository",
|
||||
loading: "Loading…", error: "Plugin operation failed", removed: "Remove this plugin? Its active rooms will close.", context: "The connection, channel or plugin changed. Open the plugin again.",
|
||||
note: "Server plugins share a room within each channel of the configured TS server. Instance plugins share a room across all connected users on this WebSpeak gateway.",
|
||||
enableNote: "Opening a plugin runs third-party browser code in an isolated panel. Public configuration and room state are visible to participants.",
|
||||
};
|
||||
export type PluginTextKey = keyof typeof en;
|
||||
export const pluginTranslations: Record<SiteLanguage, Record<PluginTextKey,string>> = {
|
||||
en,
|
||||
zh: { title:"插件功能",store:"插件商店",installed:"已安装插件",refresh:"刷新",install:"安装 / 更新",upload:"导入 .wplugin",remove:"移除",save:"保存设置",server:"服务器插件",instance:"WebSpeak 实例插件",targets:"TS 服务器地址(每行一个 host:port)",config:"公开配置(JSON;请勿填入任何密钥)",enabled:"启用插件",lead:"从 GitHub 安装,审查权限后启用。更新后须重新审查并启用。",empty:"暂无可用插件",open:"打开",close:"关闭",back:"返回插件列表",permission:"权限",scope:"作用域",source:"分发仓库",loading:"加载中…",error:"插件操作失败",removed:"移除此插件?正在使用的插件房间将关闭。",context:"连接、频道或插件发生变化,请重新打开插件。",note:"服务器插件在指定 TS 服务器的每个频道内共享房间;实例插件在当前 WebSpeak 网关的所有已连接用户间共享房间。",enableNote:"打开插件会在隔离面板中执行第三方浏览器代码。公开配置和房间状态对参与者可见。" },
|
||||
de: {title:"Plugins",store:"Plugin-Store",installed:"Installierte Plugins",refresh:"Aktualisieren",install:"Installieren / aktualisieren",upload:".wplugin importieren",remove:"Entfernen",save:"Einstellungen speichern",server:"Server-Plugin",instance:"WebSpeak-Instanz-Plugin",targets:"TS-Server (host:port, eine Adresse pro Zeile)",config:"Öffentliche Konfiguration (JSON; keine Geheimnisse)",enabled:"Plugin aktivieren",lead:"Von GitHub installieren, Berechtigungen prüfen und aktivieren. Updates erfordern erneute Aktivierung.",empty:"Keine Plugins verfügbar",open:"Öffnen",close:"Schließen",back:"Zur Plugin-Liste",permission:"Berechtigungen",scope:"Geltungsbereich",source:"Verteilungsrepository",loading:"Wird geladen…",error:"Plugin-Vorgang fehlgeschlagen",removed:"Plugin entfernen? Aktive Räume werden geschlossen.",context:"Verbindung, Kanal oder Plugin geändert. Plugin erneut öffnen.",note:"Server-Plugins teilen Räume pro Kanal des konfigurierten TS-Servers. Instanz-Plugins teilen einen Raum mit allen verbundenen Nutzern dieses Gateways.",enableNote:"Plugins führen fremden Browsercode in einem isolierten Bereich aus. Öffentliche Konfiguration und Raumzustand sind für Teilnehmer sichtbar."},
|
||||
ru: {title:"Плагины",store:"Магазин плагинов",installed:"Установленные плагины",refresh:"Обновить",install:"Установить / обновить",upload:"Импорт .wplugin",remove:"Удалить",save:"Сохранить настройки",server:"Плагин сервера",instance:"Плагин экземпляра WebSpeak",targets:"Адреса TS (host:port, по одному в строке)",config:"Публичные настройки (JSON; без секретов)",enabled:"Включить плагин",lead:"Установите из GitHub, проверьте разрешения и включите. После обновления требуется повторное включение.",empty:"Нет доступных плагинов",open:"Открыть",close:"Закрыть",back:"К списку плагинов",permission:"Разрешения",scope:"Область действия",source:"Репозиторий распространения",loading:"Загрузка…",error:"Ошибка операции плагина",removed:"Удалить плагин? Активные комнаты закроются.",context:"Соединение, канал или плагин изменились. Откройте плагин снова.",note:"Плагины сервера создают общую комнату в каждом канале указанного TS-сервера. Плагины экземпляра объединяют всех подключённых пользователей шлюза.",enableNote:"Плагин выполняет сторонний код в изолированной панели. Публичные настройки и состояние комнаты видны участникам."},
|
||||
ja: {title:"プラグイン",store:"プラグインストア",installed:"インストール済み",refresh:"更新",install:"インストール / 更新",upload:".wplugin を読み込む",remove:"削除",save:"設定を保存",server:"サーバープラグイン",instance:"WebSpeak インスタンスプラグイン",targets:"TS サーバー(1行に host:port を1つ)",config:"公開設定(JSON、秘密情報を入力しないでください)",enabled:"有効にする",lead:"GitHub からインストールし、権限を確認して有効にします。更新後は再度有効化してください。",empty:"利用できるプラグインがありません",open:"開く",close:"閉じる",back:"一覧に戻る",permission:"権限",scope:"スコープ",source:"配布リポジトリ",loading:"読み込み中…",error:"プラグイン操作に失敗しました",removed:"削除しますか?使用中のルームは閉じられます。",context:"接続、チャンネルまたはプラグインが変更されました。開き直してください。",note:"サーバープラグインは指定 TS サーバーのチャンネルごとに共有します。インスタンスプラグインは同じゲートウェイの接続ユーザー全員で共有します。",enableNote:"隔離パネルでサードパーティーコードを実行します。公開設定とルーム状態は参加者に見えます。"},
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
import { adminResponses, type AdminResponseReader } from "../../../src/shared/admin-responses.js";
|
||||
import type { AdminSettingsInput, ManagedInviteInput, TsAdminSettingsInput, TsAdminActionRequest } from "../../../src/shared/admin-inputs.js";
|
||||
import type { SkinStoreInstallInput } from "../../../src/shared/skin-store.js";
|
||||
import { pluginResponses, type PluginPackage, type PluginSettings } from "../../../src/shared/plugins.js";
|
||||
|
||||
export class AdminApiError extends Error {
|
||||
constructor(readonly code: string, readonly status = 0, message = code) {
|
||||
@@ -100,6 +101,12 @@ export function createAdminApi(options: AdminApiOptions) {
|
||||
|
||||
return {
|
||||
invalidate() { generation++; for (const controller of pending) controller.abort(); },
|
||||
plugins: (signal?: AbortSignal) => request("/plugins", pluginResponses.installed, "GET", undefined, true, signal),
|
||||
pluginStore: (signal?: AbortSignal) => request("/plugins/store", pluginResponses.catalog, "GET", undefined, true, signal),
|
||||
installPlugin: (body: { id: string; revision: string; installedRevision: string | null }, signal?: AbortSignal) => request("/plugins/store/install", pluginResponses.saved, "POST", body, true, signal),
|
||||
uploadPlugin: (pack: PluginPackage, installedRevision: string | null, signal?: AbortSignal) => request("/plugins/upload", pluginResponses.saved, "POST", { package: pack, installedRevision }, true, signal),
|
||||
configurePlugin: (id: string, revision: string, settings: PluginSettings, signal?: AbortSignal) => request(`/plugins/${encodeURIComponent(id)}/settings`, pluginResponses.saved, "PUT", { revision, settings }, true, signal),
|
||||
removePlugin: (id: string, revision: string, signal?: AbortSignal) => request(`/plugins/${encodeURIComponent(id)}`, adminResponses.ok, "DELETE", { revision }, true, signal),
|
||||
session: (signal?: AbortSignal) => request("/session", adminResponses.session, "GET", undefined, true, signal),
|
||||
login: (username: string, password: string, signal?: AbortSignal) => request("/login", adminResponses.login, "POST", { username, password }, false, signal),
|
||||
changePassword: (newPassword: string, signal?: AbortSignal) => request("/change-password", adminResponses.ok, "POST", { newPassword }, true, signal),
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { type PluginPackage } from "../../../src/shared/plugins.js";
|
||||
|
||||
/** The SDK never receives a voice socket, TS identity, cookie, or admin API. */
|
||||
export function pluginFrameDocument(pack: PluginPackage, channel: string): string {
|
||||
const escape = (source: string, tag: string) => source.replace(new RegExp(`</${tag}`, "gi"), `<\\/${tag}`);
|
||||
const bootstrap = `(() => {
|
||||
const channel = ${JSON.stringify(channel)};
|
||||
const pending = new Map(), listeners = new Set(); let sequence = 0, context;
|
||||
const send = value => parent.postMessage({channel,...value}, '*');
|
||||
const ready = new Promise(resolve => window.addEventListener('message', function receive(event) {
|
||||
if(event.source !== parent || event.data?.channel !== channel) return;
|
||||
const m = event.data;
|
||||
if(m.type === 'context') { context=m.context; document.documentElement.dataset.theme=context.theme;
|
||||
document.getElementById('plugin-light').media=context.theme==='dark'?'not all':'all';
|
||||
document.getElementById('plugin-dark').media=context.theme==='dark'?'all':'not all'; resolve(context); }
|
||||
if(m.type === 'snapshot') for(const fn of listeners) { try {fn(m.snapshot);} catch {} }
|
||||
if(m.type === 'reply') { const task=pending.get(m.id); if(task) {pending.delete(m.id); clearTimeout(task.timer); m.error?task.reject(new Error(m.error)):task.resolve(m.result);} }
|
||||
}));
|
||||
const request = (method,args) => new Promise((resolve,reject) => {
|
||||
if(pending.size>=16) return reject(new Error('PLUGIN_RATE_LIMITED'));
|
||||
const id=++sequence, timer=setTimeout(()=>{pending.delete(id);reject(new Error('PLUGIN_TIMEOUT'));},12000);
|
||||
pending.set(id,{resolve,reject,timer}); send({type:'request',id,method,args});
|
||||
});
|
||||
window.webspeak = Object.freeze({apiVersion:1,ready,
|
||||
room:Object.freeze({snapshot:()=>request('room.snapshot'),update:(revision,state)=>request('room.update',{revision,state}),
|
||||
subscribe(fn){listeners.add(fn); return ()=>listeners.delete(fn);}})});
|
||||
send({type:'ready'});
|
||||
})();`;
|
||||
// Opaque origin + no same-origin, popups, forms, navigation, fetch, or nested frames.
|
||||
const csp = "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src https: data:; media-src https: http: blob:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'";
|
||||
return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="Content-Security-Policy" content="${csp}"><script>${escape(bootstrap,"script")}</script><style>html,body{margin:0;min-height:100%;font:15px system-ui}*{box-sizing:border-box}body{padding:20px}html[data-theme="dark"]{color-scheme:dark}</style><style id="plugin-light">${escape(pack.styles.light,"style")}</style><style id="plugin-dark" media="not all">${escape(pack.styles.dark,"style")}</style></head><body>${pack.html}<script>${escape(pack.script,"script")}</script></body></html>`;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { createPluginTransport } from './plugin-transport.js';
|
||||
|
||||
test('plugin requests correlate replies, reset pending work and release subscribers independently',async () => {
|
||||
const sent:any[]=[];const socket={readyState:1,send:(v:string)=>sent.push(JSON.parse(v))} as unknown as WebSocket;
|
||||
const transport=createPluginTransport(()=>socket,()=>true);
|
||||
const result=transport.request('list');assert.equal(sent[0].type,'pluginRequest');
|
||||
transport.receive({type:'pluginReply',requestId:sent[0].requestId,ok:true,result:[{id:'a'}]});
|
||||
assert.deepEqual(await result,[{id:'a'}]);
|
||||
const events:any[]=[];const off=transport.subscribe(m=>events.push(m));
|
||||
transport.receive({type:'pluginEvent',pluginId:'a',snapshot:null});assert.equal(events.length,1);
|
||||
const pending=transport.request('open',{pluginId:'a'});transport.reset();await assert.rejects(pending,/PLUGIN_NOT_CONNECTED/);
|
||||
transport.receive({type:'pluginReply',requestId:sent[1].requestId,ok:true,result:{old:true}});assert.equal(events.at(-1).type,'pluginReset');
|
||||
off();transport.reset();assert.equal(events.length,2);
|
||||
});
|
||||
test('server errors, disconnected sockets and request quotas do not leak promises',async () => {
|
||||
const sent:any[]=[];let connected=false;const socket={readyState:1,send:(v:string)=>sent.push(JSON.parse(v))} as unknown as WebSocket;
|
||||
const transport=createPluginTransport(()=>socket,()=>connected);
|
||||
await assert.rejects(transport.request('list'),/PLUGIN_NOT_CONNECTED/);connected=true;
|
||||
const failed=transport.request('snapshot',{pluginId:'a'});
|
||||
transport.receive({type:'pluginReply',requestId:sent[0].requestId,ok:false,code:'PLUGIN_NOT_OPEN'});await assert.rejects(failed,/PLUGIN_NOT_OPEN/);
|
||||
const pending=Array.from({length:16},()=>transport.request('list').catch(e=>e.message));
|
||||
await assert.rejects(transport.request('list'),/PLUGIN_RATE_LIMITED/);transport.reset();
|
||||
assert.ok((await Promise.all(pending)).every(v=>v==='PLUGIN_NOT_CONNECTED'));
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import { pluginRecord, type PluginRequest, type PluginMessage } from "../../../src/shared/plugins.js";
|
||||
|
||||
/** Owns requests and event subscribers for one voice connection. */
|
||||
export function createPluginTransport(socket: () => WebSocket | null, connected: () => boolean) {
|
||||
let sequence = 0;
|
||||
const pending = new Map<string, { finish(value?: unknown, error?: Error): void }>();
|
||||
const listeners = new Set<(message: PluginMessage | { type: "pluginReset" }) => void>();
|
||||
function emit(message: PluginMessage | { type: "pluginReset" }): void { for (const listener of [...listeners]) { try { listener(message); } catch { /* isolate presentation */ } } }
|
||||
return {
|
||||
request(action: PluginRequest["action"], fields: { pluginId?: string; revision?: number; state?: unknown } = {}): Promise<unknown> {
|
||||
const ws = socket();
|
||||
if (!connected() || ws?.readyState !== 1) return Promise.reject(new Error("PLUGIN_NOT_CONNECTED"));
|
||||
if (pending.size >= 16) return Promise.reject(new Error("PLUGIN_RATE_LIMITED"));
|
||||
const requestId = `plugin-${Date.now().toString(36)}-${++sequence}`;
|
||||
return new Promise((resolve, reject) => {
|
||||
const timer = setTimeout(() => finish(undefined, new Error("PLUGIN_TIMEOUT")), 15_000);
|
||||
const finish = (value?: unknown, error?: Error) => { if (!pending.delete(requestId)) return; clearTimeout(timer); error ? reject(error) : resolve(value); };
|
||||
pending.set(requestId, { finish });
|
||||
try { ws.send(JSON.stringify({ type: "pluginRequest", requestId, action, ...fields })); }
|
||||
catch { finish(undefined, new Error("PLUGIN_NOT_CONNECTED")); }
|
||||
});
|
||||
},
|
||||
receive(value: unknown): boolean {
|
||||
if (!pluginRecord(value)) return false;
|
||||
if (value.type === "pluginReply") {
|
||||
if (typeof value.requestId === "string" && typeof value.ok === "boolean") pending.get(value.requestId)?.finish(value.result,
|
||||
value.ok ? undefined : new Error(typeof value.code === "string" ? value.code.slice(0, 80) : "PLUGIN_FAILED"));
|
||||
return true;
|
||||
}
|
||||
if (value.type === "pluginEvent" && typeof value.pluginId === "string" && (value.snapshot === null || pluginRecord(value.snapshot))) {
|
||||
emit(value as unknown as PluginMessage); return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
subscribe(listener: (message: PluginMessage | { type: "pluginReset" }) => void): () => void { listeners.add(listener); return () => listeners.delete(listener); },
|
||||
reset(): void { for (const item of [...pending.values()]) item.finish(undefined, new Error("PLUGIN_NOT_CONNECTED")); emit({ type: "pluginReset" }); },
|
||||
};
|
||||
}
|
||||
export type PluginTransport = ReturnType<typeof createPluginTransport>;
|
||||
@@ -151,6 +151,7 @@
|
||||
<RouterLink to="/admin/server" active-class="active"><Icon name="server" :size="18" />{{ tr('adminInstanceSettings') }}</RouterLink>
|
||||
<RouterLink to="/admin/operations" active-class="active"><Icon name="users" :size="18" />{{ tr('adminInstanceOperations') }}</RouterLink>
|
||||
<RouterLink to="/admin/skins" active-class="active"><Icon name="compass" :size="18" />{{ tr('skinLibrary') }}</RouterLink>
|
||||
<RouterLink to="/admin/plugins" active-class="active"><Icon name="grid" :size="18" />{{ pluginTranslations[language].store }}</RouterLink>
|
||||
</div>
|
||||
<div class="admin-nav-group">
|
||||
<span class="admin-nav-heading">{{ tr('adminTsGroup') }}<span class="admin-optional">{{ tr('adminOptional') }}</span></span>
|
||||
@@ -241,6 +242,7 @@
|
||||
:model="adminSkins"
|
||||
:i18n="i18n"
|
||||
/>
|
||||
<AdminPlugins v-else-if="route.path === '/admin/plugins'" :model="adminPlugins" :language="language" />
|
||||
<AdminTsAdmin
|
||||
v-else-if="route.path === '/admin/ts-admin'"
|
||||
:model="adminTsAdmin"
|
||||
@@ -399,6 +401,9 @@ import Icon from "../components/Icon.vue";
|
||||
import AdminServerSettings from "../components/admin/AdminServerSettings.vue";
|
||||
import AdminOperations from "../components/admin/AdminOperations.vue";
|
||||
import AdminSkins from "../components/admin/AdminSkins.vue";
|
||||
import AdminPlugins from "../components/admin/AdminPlugins.vue";
|
||||
import { useAdminPlugins } from "../composables/useAdminPlugins.js";
|
||||
import { pluginTranslations } from "../i18n/plugins.js";
|
||||
import AdminTsAdmin from "../components/admin/AdminTsAdmin.vue";
|
||||
import LanguageSwitcher from "../components/LanguageSwitcher.vue";
|
||||
import { createAdminRequests } from "../services/admin-requests.js";
|
||||
@@ -454,12 +459,13 @@ const currentScope = computed(() => route.path === "/admin/ts-admin" ? tr("admin
|
||||
const adminOperations = useAdminOperations({ api: adminApi, errorMessage, errorText, tr, refreshOverview: loadOverview });
|
||||
const { loadOperations } = adminOperations;
|
||||
const adminSkins = useAdminSkins({ api: adminApi, tr });
|
||||
const adminPlugins = useAdminPlugins(adminApi);
|
||||
const { loadSkinCatalog } = adminSkins;
|
||||
const adminTsAdmin = useAdminTsAdmin({ api: adminApi, errorMessage, errorText, tr });
|
||||
const { loadSettings: loadTsAdminSettings } = adminTsAdmin;
|
||||
|
||||
const passwordStrength = computed(() => Math.min(100, Math.max(8, newPassword.value.length * 5 + (/[\s\W]/.test(newPassword.value) ? 15 : 0))));
|
||||
const currentPageTitle = computed(() => route.path === "/admin/server" ? tr('adminInstanceSettings') : route.path === "/admin/operations" ? tr('adminInstanceOperations') : route.path === "/admin/skins" ? tr('skinLibrary') : route.path === "/admin/ts-admin" ? tr('tsAdminTitle') : tr('overview'));
|
||||
const currentPageTitle = computed(() => route.path === "/admin/plugins" ? pluginTranslations[language.value].store : route.path === "/admin/server" ? tr('adminInstanceSettings') : route.path === "/admin/operations" ? tr('adminInstanceOperations') : route.path === "/admin/skins" ? tr('skinLibrary') : route.path === "/admin/ts-admin" ? tr('tsAdminTitle') : tr('overview'));
|
||||
const targetStatusText = computed(() => overview.teamSpeak.status === "reachable" ? tr('reachable') : overview.teamSpeak.status === "unreachable" ? tr('unreachable') : tr('notTested'));
|
||||
const webrtcPortRangeText = computed(() => `${serverForm.webRtcUdpStart}–${serverForm.webRtcUdpEnd}`);
|
||||
|
||||
@@ -471,10 +477,12 @@ watch(() => route.path, (path, previous) => {
|
||||
if (previous === "/admin/server") serverSettings.cancelRequests();
|
||||
if (previous === "/admin/operations") adminOperations.cancelRequests();
|
||||
if (previous === "/admin/skins") adminSkins.cancelRequests();
|
||||
if (previous === "/admin/plugins") adminPlugins.cancelRequests();
|
||||
if (previous === "/admin/ts-admin") adminTsAdmin.cancelRequests();
|
||||
if (screen.value !== "admin" || loading.value || submitting.value || loggingOut.value) return;
|
||||
if (path === "/admin/operations") void loadOperations();
|
||||
else if (path === "/admin/skins") void loadSkinCatalog();
|
||||
else if (path === "/admin/plugins") void adminPlugins.load();
|
||||
else if (path === "/admin/ts-admin") void loadTsAdminSettings();
|
||||
else if (path === "/admin") void loadOverview();
|
||||
});
|
||||
@@ -485,6 +493,7 @@ function cancelPendingWork() {
|
||||
serverSettings.cancelRequests();
|
||||
adminOperations.cancelRequests();
|
||||
adminSkins.cancelRequests();
|
||||
adminPlugins.cancelRequests();
|
||||
adminTsAdmin.cancelRequests();
|
||||
loading.value = false;
|
||||
submitting.value = false;
|
||||
@@ -492,6 +501,7 @@ function cancelPendingWork() {
|
||||
}
|
||||
function resetPrivateState() {
|
||||
serverSettings.reset(); adminOperations.reset(); adminSkins.reset(); adminTsAdmin.reset();
|
||||
adminPlugins.reset();
|
||||
Object.assign(overview, emptyOverview());
|
||||
loginPassword.value = ""; newPassword.value = ""; confirmNewPassword.value = "";
|
||||
errorMessage.value = "";
|
||||
@@ -505,6 +515,7 @@ async function loadAdminData(request: { isCurrent(): boolean }) {
|
||||
if (!request.isCurrent()) return;
|
||||
if (route.path === "/admin/operations") await loadOperations();
|
||||
else if (route.path === "/admin/skins") await loadSkinCatalog();
|
||||
else if (route.path === "/admin/plugins") await adminPlugins.load();
|
||||
else if (route.path === "/admin/ts-admin") await loadTsAdminSettings();
|
||||
}
|
||||
async function loadAdminView() {
|
||||
|
||||
@@ -870,6 +870,7 @@
|
||||
<div class="ws-skin-mount-slot" data-ws-skin-mount="voice.workspace.overlay"></div>
|
||||
</div>
|
||||
|
||||
<PluginPanel :transport="plugins" :connected="voiceState.connected" :language="language" />
|
||||
<IdentityImportDialog
|
||||
v-if="identityImportOpen"
|
||||
v-model="identityImportText"
|
||||
@@ -1001,6 +1002,7 @@ import { useWebClientAudioControls } from "../composables/useWebClientAudioContr
|
||||
import { useWebClientChannels, type TreeChannel } from "../composables/useWebClientChannels.js";
|
||||
import { useWebClientConnection } from "../composables/useWebClientConnection.js";
|
||||
import { useWebClientMembers } from "../composables/useWebClientMembers.js";
|
||||
import PluginPanel from "../components/PluginPanel.vue";
|
||||
import { useVoiceWebSocket, type ChannelMember, type ChatMessage } from "../composables/useVoiceWebSocket.js";
|
||||
import { useWebClientScreenShare } from "../composables/useWebClientScreenShare.js";
|
||||
import { useWebClientPerformance } from "../composables/useWebClientPerformance.js";
|
||||
@@ -1102,6 +1104,7 @@ const {
|
||||
leaveScreenShare,
|
||||
checkSupport,
|
||||
clearError,
|
||||
plugins,
|
||||
measureVoiceAudioStatus,
|
||||
} = useVoiceWebSocket();
|
||||
const performance = useWebClientPerformance(computed(() => voiceState.connected), measureVoiceAudioStatus);
|
||||
|
||||
Reference in new issue
Block a user