feat #14740: settings, keyring, tray and manual recording
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
|
||||
+34
-3
@@ -1,3 +1,34 @@
|
||||
<main>
|
||||
<h1>Gesprächsrekorder</h1>
|
||||
</main>
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte'
|
||||
import Recorder from './routes/Recorder.svelte'
|
||||
import Settings from './routes/Settings.svelte'
|
||||
|
||||
let route = $state(currentRoute())
|
||||
|
||||
function currentRoute(): string {
|
||||
return window.location.hash.replace(/^#/, '') || '/'
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const update = () => (route = currentRoute())
|
||||
window.addEventListener('hashchange', update)
|
||||
return () => window.removeEventListener('hashchange', update)
|
||||
})
|
||||
</script>
|
||||
|
||||
{#if route === '/recorder'}
|
||||
<Recorder />
|
||||
{:else if route === '/settings'}
|
||||
<Settings />
|
||||
{:else if route === '/prompt'}
|
||||
<main class="page">
|
||||
<p class="muted">Gespräch beendet.</p>
|
||||
</main>
|
||||
{:else}
|
||||
<main class="page">
|
||||
<header class="page-header">
|
||||
<h1>Gesprächsrekorder</h1>
|
||||
<a class="btn" href="#/settings" title="Einstellungen">⚙ Einstellungen</a>
|
||||
</header>
|
||||
</main>
|
||||
{/if}
|
||||
|
||||
+162
-23
@@ -1,40 +1,179 @@
|
||||
:root {
|
||||
--text: #6b6375;
|
||||
--text-h: #08060d;
|
||||
--bg: #fff;
|
||||
--text: #1d2330;
|
||||
--muted: #6b7280;
|
||||
--bg: #f5f6f9;
|
||||
--surface: #fff;
|
||||
--border: #e2e4ea;
|
||||
--control-border: #cfd3dc;
|
||||
--primary: #3b5bdb;
|
||||
--primary-soft: #eef2ff;
|
||||
--rec: #c62828;
|
||||
--rec-soft: #fde8e8;
|
||||
--ok: #1e7b34;
|
||||
--ok-soft: #e6f4ea;
|
||||
--meter-bg: #e8eaf0;
|
||||
|
||||
font: 18px/145% system-ui, 'Segoe UI', Roboto, sans-serif;
|
||||
color-scheme: light dark;
|
||||
font: 14px/1.45 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
color-scheme: light;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--text: #9ca3af;
|
||||
--text-h: #f3f4f6;
|
||||
--bg: #16171d;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: inherit;
|
||||
font-weight: 500;
|
||||
color: var(--text-h);
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
main {
|
||||
display: flex;
|
||||
min-height: 100svh;
|
||||
place-content: center;
|
||||
place-items: center;
|
||||
text-align: center;
|
||||
h2 {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.page {
|
||||
max-width: 760px;
|
||||
margin: 0 auto;
|
||||
padding: 20px 24px 32px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
padding: 16px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.muted {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--rec);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 6px 14px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--control-border);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn:hover:not(:disabled) {
|
||||
border-color: var(--primary);
|
||||
}
|
||||
|
||||
.btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.btn.primary {
|
||||
background: var(--primary);
|
||||
border-color: var(--primary);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn.danger {
|
||||
color: var(--rec);
|
||||
border-color: #f0b4b4;
|
||||
}
|
||||
|
||||
.btn.small {
|
||||
padding: 3px 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pill {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pill.rec {
|
||||
background: var(--rec-soft);
|
||||
color: var(--rec);
|
||||
}
|
||||
|
||||
.pill.ok {
|
||||
background: var(--ok-soft);
|
||||
color: var(--ok);
|
||||
}
|
||||
|
||||
.pill.missing {
|
||||
background: #eee;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.meter {
|
||||
height: 6px;
|
||||
border-radius: 3px;
|
||||
background: var(--meter-bg);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.meter > div {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #37b24d, #f59f00);
|
||||
transition: width 90ms linear;
|
||||
}
|
||||
|
||||
input,
|
||||
select {
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
color: var(--text);
|
||||
padding: 5px 8px;
|
||||
border: 1px solid var(--control-border);
|
||||
border-radius: 6px;
|
||||
background: var(--surface);
|
||||
}
|
||||
|
||||
input:focus,
|
||||
select:focus {
|
||||
outline: 2px solid var(--primary-soft);
|
||||
border-color: var(--primary);
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// Typed wrappers around the Tauri commands and events of the app shell.
|
||||
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { listen, type UnlistenFn } from '@tauri-apps/api/event'
|
||||
|
||||
export type CallId = number
|
||||
|
||||
export interface Settings {
|
||||
allowlist: string[]
|
||||
mic_device: string | null
|
||||
output_device: string | null
|
||||
language: string
|
||||
deepscript_model: string
|
||||
retention_days: number
|
||||
autostart: boolean
|
||||
start_after_secs: number
|
||||
end_after_secs: number
|
||||
}
|
||||
|
||||
export type Service = 'deepscript' | 'anthropic'
|
||||
|
||||
export interface DeviceInfo {
|
||||
id: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface Devices {
|
||||
inputs: DeviceInfo[]
|
||||
outputs: DeviceInfo[]
|
||||
}
|
||||
|
||||
export interface DeviceLevels {
|
||||
mic: number
|
||||
out: number
|
||||
}
|
||||
|
||||
export type Track = 'mic' | 'out'
|
||||
|
||||
export type RecordingState =
|
||||
| { state: 'idle' }
|
||||
| { state: 'recording'; call_id: CallId; app: string; started_at: string }
|
||||
|
||||
export interface Levels {
|
||||
mic: number
|
||||
out: number
|
||||
failed_tracks: Track[]
|
||||
}
|
||||
|
||||
export const getSettings = () => invoke<Settings>('get_settings')
|
||||
export const saveSettings = (settings: Settings) => invoke<void>('save_settings', { settings })
|
||||
export const setApiKey = (service: Service, key: string) =>
|
||||
invoke<void>('set_api_key', { service, key })
|
||||
export const hasApiKey = (service: Service) => invoke<boolean>('has_api_key', { service })
|
||||
export const listDevices = () => invoke<Devices>('list_devices')
|
||||
export const testDevices = () => invoke<DeviceLevels>('test_devices')
|
||||
export const getRecordingState = () => invoke<RecordingState>('get_recording_state')
|
||||
export const startManualRecording = () => invoke<CallId>('start_manual_recording')
|
||||
export const stopRecording = () => invoke<void>('stop_recording')
|
||||
export const discardCurrentRecording = () => invoke<void>('discard_current_recording')
|
||||
|
||||
export const onRecordingState = (handler: (state: RecordingState) => void): Promise<UnlistenFn> =>
|
||||
listen<RecordingState>('recording-state', (event) => handler(event.payload))
|
||||
export const onLevels = (handler: (levels: Levels) => void): Promise<UnlistenFn> =>
|
||||
listen<Levels>('levels', (event) => handler(event.payload))
|
||||
|
||||
/** Maps an rms level (0..1) to a meter fill (0..1) on a -60..0 dB scale. */
|
||||
export function meterFill(level: number): number {
|
||||
if (level <= 0) return 0
|
||||
const db = 20 * Math.log10(level)
|
||||
return Math.min(1, Math.max(0, (db + 60) / 60))
|
||||
}
|
||||
|
||||
/** Error text of a rejected command. */
|
||||
export function errorText(err: unknown): string {
|
||||
return typeof err === 'string' ? err : err instanceof Error ? err.message : String(err)
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte'
|
||||
import {
|
||||
discardCurrentRecording,
|
||||
errorText,
|
||||
getRecordingState,
|
||||
meterFill,
|
||||
onLevels,
|
||||
onRecordingState,
|
||||
stopRecording,
|
||||
type Levels,
|
||||
type RecordingState,
|
||||
type Track,
|
||||
} from '../lib/api'
|
||||
|
||||
let recording = $state<RecordingState>({ state: 'idle' })
|
||||
let levels = $state<Levels>({ mic: 0, out: 0, failed_tracks: [] })
|
||||
let now = $state(Date.now())
|
||||
let busy = $state(false)
|
||||
let error = $state('')
|
||||
|
||||
const tracks: { track: Track; label: string; failed: string }[] = [
|
||||
{ track: 'mic', label: 'Mikrofon (ich)', failed: '⚠ Mikrofonspur ausgefallen' },
|
||||
{ track: 'out', label: 'Lautsprecher (Gegenseite)', failed: '⚠ Lautsprecherspur ausgefallen' },
|
||||
]
|
||||
|
||||
let elapsed = $derived(
|
||||
recording.state === 'recording'
|
||||
? formatElapsed(now - new Date(recording.started_at).getTime())
|
||||
: '00:00',
|
||||
)
|
||||
|
||||
function formatElapsed(ms: number): string {
|
||||
const total = Math.max(0, Math.floor(ms / 1000))
|
||||
const mm = String(Math.floor(total / 60)).padStart(2, '0')
|
||||
const ss = String(total % 60).padStart(2, '0')
|
||||
return `${mm}:${ss}`
|
||||
}
|
||||
|
||||
function setRecording(state: RecordingState) {
|
||||
recording = state
|
||||
if (state.state === 'recording') {
|
||||
levels = { mic: 0, out: 0, failed_tracks: [] }
|
||||
error = ''
|
||||
busy = false
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const unlisten = [onRecordingState(setRecording), onLevels((l) => (levels = l))]
|
||||
getRecordingState().then(setRecording)
|
||||
const timer = setInterval(() => (now = Date.now()), 1000)
|
||||
return () => {
|
||||
clearInterval(timer)
|
||||
unlisten.forEach((p) => p.then((off) => off()))
|
||||
}
|
||||
})
|
||||
|
||||
async function run(action: () => Promise<void>) {
|
||||
busy = true
|
||||
error = ''
|
||||
try {
|
||||
await action()
|
||||
} catch (err) {
|
||||
error = errorText(err)
|
||||
} finally {
|
||||
busy = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<main class="recorder">
|
||||
<div class="status">
|
||||
<span class="pill rec">● Aufnahme läuft</span>
|
||||
<span class="muted">
|
||||
{recording.state === 'recording' ? recording.app : ''} · {elapsed}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{#each tracks as { track, label, failed } (track)}
|
||||
<div class="track">
|
||||
<div class="label">{label}</div>
|
||||
<div class="meter"><div style:width="{meterFill(levels[track]) * 100}%"></div></div>
|
||||
{#if levels.failed_tracks.includes(track)}
|
||||
<div class="failed">{failed}</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
<div class="actions">
|
||||
<button class="btn" disabled={busy} onclick={() => run(stopRecording)}>■ Stopp</button>
|
||||
<button class="btn danger" disabled={busy} onclick={() => run(discardCurrentRecording)}>
|
||||
Verwerfen
|
||||
</button>
|
||||
</div>
|
||||
{#if error}
|
||||
<div class="error">{error}</div>
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
<style>
|
||||
:global(body:has(.recorder)) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.recorder {
|
||||
min-height: 100vh;
|
||||
background: var(--surface);
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.status .muted {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.track {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.failed {
|
||||
font-size: 11px;
|
||||
color: var(--rec);
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-top: 9px;
|
||||
}
|
||||
|
||||
.error {
|
||||
margin-top: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,336 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte'
|
||||
import {
|
||||
errorText,
|
||||
getSettings,
|
||||
hasApiKey,
|
||||
listDevices,
|
||||
meterFill,
|
||||
saveSettings,
|
||||
setApiKey,
|
||||
testDevices,
|
||||
type DeviceInfo,
|
||||
type DeviceLevels,
|
||||
type Devices,
|
||||
type Service,
|
||||
type Settings,
|
||||
} from '../lib/api'
|
||||
|
||||
const services: { id: Service; name: string }[] = [
|
||||
{ id: 'deepscript', name: 'DeepScript' },
|
||||
{ id: 'anthropic', name: 'Anthropic (Claude)' },
|
||||
]
|
||||
|
||||
let settings = $state<Settings | null>(null)
|
||||
let devices = $state<Devices>({ inputs: [], outputs: [] })
|
||||
let keySaved = $state<Record<Service, boolean>>({ deepscript: false, anthropic: false })
|
||||
let keyInput = $state<Record<Service, string>>({ deepscript: '', anthropic: '' })
|
||||
let newApp = $state('')
|
||||
let testing = $state(false)
|
||||
let testResult = $state<DeviceLevels | null>(null)
|
||||
let message = $state('')
|
||||
let error = $state('')
|
||||
|
||||
onMount(load)
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
settings = await getSettings()
|
||||
for (const { id } of services) keySaved[id] = await hasApiKey(id)
|
||||
devices = await listDevices()
|
||||
} catch (err) {
|
||||
error = errorText(err)
|
||||
}
|
||||
}
|
||||
|
||||
/** The device list plus the saved device if it is currently unavailable. */
|
||||
function withSaved(list: DeviceInfo[], saved: string | null): DeviceInfo[] {
|
||||
if (saved === null || list.some((d) => d.id === saved)) return list
|
||||
return [...list, { id: saved, name: `${saved} (nicht verfügbar)` }]
|
||||
}
|
||||
|
||||
async function run(action: () => Promise<void>, done = '') {
|
||||
message = ''
|
||||
error = ''
|
||||
try {
|
||||
await action()
|
||||
message = done
|
||||
} catch (err) {
|
||||
error = errorText(err)
|
||||
}
|
||||
}
|
||||
|
||||
function storeKey(service: Service, key: string) {
|
||||
return run(async () => {
|
||||
await setApiKey(service, key)
|
||||
keySaved[service] = await hasApiKey(service)
|
||||
keyInput[service] = ''
|
||||
}, key ? 'Schlüssel gespeichert' : 'Schlüssel entfernt')
|
||||
}
|
||||
|
||||
function addApp() {
|
||||
const name = newApp.trim().toLowerCase()
|
||||
if (settings && name && !settings.allowlist.includes(name)) {
|
||||
settings.allowlist = [...settings.allowlist, name]
|
||||
}
|
||||
newApp = ''
|
||||
}
|
||||
|
||||
function removeApp(name: string) {
|
||||
if (settings) settings.allowlist = settings.allowlist.filter((a) => a !== name)
|
||||
}
|
||||
|
||||
async function persist() {
|
||||
if (!settings) return
|
||||
if (!Number.isInteger(settings.retention_days) || settings.retention_days < 1) {
|
||||
throw 'Aufbewahrung: bitte eine ganze Zahl ab 1 eingeben'
|
||||
}
|
||||
await saveSettings($state.snapshot(settings))
|
||||
}
|
||||
|
||||
async function runTest() {
|
||||
testing = true
|
||||
testResult = null
|
||||
await run(async () => {
|
||||
await persist()
|
||||
testResult = await testDevices()
|
||||
})
|
||||
testing = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<main class="page">
|
||||
<header class="page-header">
|
||||
<h1>Einstellungen</h1>
|
||||
<a class="btn" href="#/">← Zurück</a>
|
||||
</header>
|
||||
|
||||
{#if settings}
|
||||
<section class="card">
|
||||
<h2>API-Schlüssel</h2>
|
||||
{#each services as { id, name } (id)}
|
||||
<div class="key-row">
|
||||
<span class="key-name">{name}</span>
|
||||
{#if keySaved[id]}
|
||||
<span class="pill ok">gespeichert ✓</span>
|
||||
{:else}
|
||||
<span class="pill missing">fehlt</span>
|
||||
{/if}
|
||||
<input
|
||||
type="password"
|
||||
placeholder={keySaved[id] ? 'Neuen Schlüssel eingeben' : 'Schlüssel eingeben'}
|
||||
autocomplete="off"
|
||||
bind:value={keyInput[id]}
|
||||
/>
|
||||
<button
|
||||
class="btn small"
|
||||
disabled={!keyInput[id].trim()}
|
||||
onclick={() => storeKey(id, keyInput[id])}>Speichern</button
|
||||
>
|
||||
{#if keySaved[id]}
|
||||
<button class="btn small danger" onclick={() => storeKey(id, '')}>Entfernen</button>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Audio</h2>
|
||||
<div class="grid">
|
||||
<label for="mic">Mikrofon</label>
|
||||
<select id="mic" bind:value={settings.mic_device}>
|
||||
<option value={null}>Standardgerät</option>
|
||||
{#each withSaved(devices.inputs, settings.mic_device) as d (d.id)}
|
||||
<option value={d.id}>{d.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<label for="out">Lautsprecher</label>
|
||||
<select id="out" bind:value={settings.output_device}>
|
||||
<option value={null}>Standardgerät</option>
|
||||
{#each withSaved(devices.outputs, settings.output_device) as d (d.id)}
|
||||
<option value={d.id}>{d.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
<p class="hint">
|
||||
Bitte mit Headset telefonieren – sonst landet die Gegenseite auch auf der Mikrofonspur.
|
||||
</p>
|
||||
<div class="test">
|
||||
<button class="btn" disabled={testing} onclick={runTest}>
|
||||
{testing ? 'Test läuft …' : 'Test'}
|
||||
</button>
|
||||
<span class="muted">
|
||||
{testing
|
||||
? 'Bitte 5 Sekunden sprechen und etwas abspielen.'
|
||||
: 'Nimmt 5 Sekunden auf und zeigt den Pegel beider Spuren.'}
|
||||
</span>
|
||||
</div>
|
||||
{#if testResult}
|
||||
<div class="levels">
|
||||
<span>Mikrofon</span>
|
||||
<div class="meter"><div style:width="{meterFill(testResult.mic) * 100}%"></div></div>
|
||||
<span>Lautsprecher</span>
|
||||
<div class="meter"><div style:width="{meterFill(testResult.out) * 100}%"></div></div>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Gesprächserkennung</h2>
|
||||
<p class="muted">Programme, deren Mikrofonnutzung als Gespräch zählt:</p>
|
||||
<ul class="allowlist">
|
||||
{#each settings.allowlist as name (name)}
|
||||
<li>
|
||||
<span>{name}</span>
|
||||
<button class="remove" title="Entfernen" onclick={() => removeApp(name)}>✕</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
<form
|
||||
class="add"
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault()
|
||||
addApp()
|
||||
}}
|
||||
>
|
||||
<input placeholder="z. B. zoom.exe" bind:value={newApp} />
|
||||
<button class="btn small" type="submit" disabled={!newApp.trim()}>Hinzufügen</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Allgemein</h2>
|
||||
<div class="grid">
|
||||
<label for="language">Sprache der Gespräche</label>
|
||||
<select id="language" bind:value={settings.language}>
|
||||
<option value="de">Deutsch</option>
|
||||
<option value="en">Englisch</option>
|
||||
</select>
|
||||
<label for="retention">Aufbewahrung der Audiodateien</label>
|
||||
<span><input id="retention" type="number" min="1" bind:value={settings.retention_days} /> Tage</span>
|
||||
<label for="autostart">Beim Anmelden starten</label>
|
||||
<input id="autostart" type="checkbox" bind:checked={settings.autostart} />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="footer">
|
||||
<button class="btn primary" onclick={() => run(persist, 'Einstellungen gespeichert ✓')}>
|
||||
Speichern
|
||||
</button>
|
||||
{#if message}<span class="saved">{message}</span>{/if}
|
||||
{#if error}<span class="error">{error}</span>{/if}
|
||||
</div>
|
||||
{:else if error}
|
||||
<p class="error">{error}</p>
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
<style>
|
||||
.key-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.key-name {
|
||||
width: 150px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.key-row input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 220px 1fr;
|
||||
align-items: center;
|
||||
gap: 8px 12px;
|
||||
}
|
||||
|
||||
.grid select {
|
||||
max-width: 380px;
|
||||
}
|
||||
|
||||
.grid input[type='number'] {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.grid input[type='checkbox'] {
|
||||
justify-self: start;
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin: 12px 0;
|
||||
padding: 8px 10px;
|
||||
border-radius: 6px;
|
||||
background: #fff4d6;
|
||||
color: #8a6100;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.test {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.levels {
|
||||
display: grid;
|
||||
grid-template-columns: 100px 1fr;
|
||||
align-items: center;
|
||||
gap: 6px 10px;
|
||||
margin-top: 10px;
|
||||
max-width: 420px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.allowlist {
|
||||
list-style: none;
|
||||
margin: 8px 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.allowlist li {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 2px 4px 2px 10px;
|
||||
border-radius: 999px;
|
||||
background: var(--primary-soft);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.remove {
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.remove:hover {
|
||||
color: var(--rec);
|
||||
}
|
||||
|
||||
.add {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.saved {
|
||||
color: var(--ok);
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user