fix #14740: fixed backend url per build, key bound to its server
- the backend URL is no longer a setting: one constant per build (release/dev) in src-tauri/src/backend.rs; Settings shows the server read-only; an old backend_url in settings.json is ignored - the stored key records the backend it was created for; a key of another backend is discarded before any use and never stored - a refused key is discarded only if it still is the stored one - the keyring is never called while the settings are locked - one upload per call at a time, also visible after a view switch - opener plugin without its link-click script (it also ran in the remote login page); a login error says to reload the login page Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+12
-4
@@ -15,12 +15,19 @@ export interface Settings {
|
||||
autostart: boolean
|
||||
start_after_secs: number
|
||||
end_after_secs: number
|
||||
/** The euvino admin backend, e.g. "https://test.euvinopro.eu". */
|
||||
backend_url: string
|
||||
/** Whose backend key is stored; set by the app at login. */
|
||||
backend_username: string | null
|
||||
/** When the stored backend key expires (RFC 3339); set by the app. */
|
||||
backend_key_expires_at: string | null
|
||||
/** The backend the stored key belongs to; set by the app. */
|
||||
backend_key_base_url: string | null
|
||||
}
|
||||
|
||||
/** The backend this build talks to (fixed per build, not a setting). */
|
||||
export interface BackendServer {
|
||||
base_url: string
|
||||
/** Where the admin manages their keys. */
|
||||
keys_url: string
|
||||
}
|
||||
|
||||
/** Login status for the settings, checked with the backend. */
|
||||
@@ -31,8 +38,6 @@ export interface BackendStatus {
|
||||
expires_at: string | null
|
||||
/** `false` if the key could not be checked; username and expiry are then the stored ones. */
|
||||
reachable: boolean
|
||||
/** Where the admin manages their keys. */
|
||||
keys_url: string
|
||||
}
|
||||
|
||||
export type Service = 'deepscript'
|
||||
@@ -115,6 +120,8 @@ export interface CallDetail {
|
||||
/** Renamed speakers by key. */
|
||||
speaker_names: Record<string, string>
|
||||
merges: SpeakerMerge[]
|
||||
/** The transcript is being uploaded right now. */
|
||||
uploading: boolean
|
||||
}
|
||||
|
||||
/** A newer version the release feed offers. */
|
||||
@@ -166,6 +173,7 @@ export const unmergeSpeaker = (id: CallId, fromKey: string) =>
|
||||
/** `null` or an empty title restores the default heading. */
|
||||
export const renameCall = (id: CallId, title: string | null) =>
|
||||
invoke<void>('rename_call', { id, title })
|
||||
export const backendServer = () => invoke<BackendServer>('backend_server')
|
||||
export const backendStatus = () => invoke<BackendStatus>('backend_status')
|
||||
/** Resolves once the login window created a key; rejects if it was closed or failed. */
|
||||
export const backendLogin = () => invoke<void>('backend_login')
|
||||
|
||||
@@ -273,6 +273,12 @@
|
||||
return parts.join(' · ')
|
||||
}
|
||||
|
||||
// Also while an upload started elsewhere (e.g. before switching views)
|
||||
// still runs in the app.
|
||||
let isUploading = $derived(
|
||||
detail !== null && (uploading.includes(detail.call.id) || detail.uploading),
|
||||
)
|
||||
|
||||
// A failed start (e.g. missing key) also marks the call failed; its
|
||||
// error is then shown once, in the failure box.
|
||||
let shownActionError = $derived(actionError !== detail?.call.error ? actionError : '')
|
||||
@@ -361,11 +367,11 @@
|
||||
{:else if call.status === 'done'}
|
||||
<button
|
||||
class="btn primary"
|
||||
disabled={!call.transcribed_at || uploading.includes(call.id)}
|
||||
disabled={!call.transcribed_at || isUploading}
|
||||
title={call.transcribed_at ? 'Transkript ins CRM hochladen' : 'Noch kein Transkript'}
|
||||
onclick={uploadClick}
|
||||
>
|
||||
{uploading.includes(call.id)
|
||||
{isUploading
|
||||
? 'wird hochgeladen…'
|
||||
: call.uploaded_at
|
||||
? 'Erneut hochladen'
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import {
|
||||
backendLogin,
|
||||
backendLogout,
|
||||
backendServer,
|
||||
backendStatus,
|
||||
errorText,
|
||||
getSettings,
|
||||
@@ -16,6 +17,7 @@
|
||||
saveSettings,
|
||||
setApiKey,
|
||||
testDevices,
|
||||
type BackendServer,
|
||||
type BackendStatus,
|
||||
type DeviceInfo,
|
||||
type DeviceLevels,
|
||||
@@ -38,6 +40,7 @@
|
||||
let message = $state('')
|
||||
let error = $state('')
|
||||
|
||||
let server = $state<BackendServer | null>(null)
|
||||
let backend = $state<BackendStatus | null>(null)
|
||||
let backendBusy = $state(false)
|
||||
let backendError = $state('')
|
||||
@@ -47,6 +50,9 @@
|
||||
|
||||
onMount(() => {
|
||||
load()
|
||||
backendServer()
|
||||
.then((s) => (server = s))
|
||||
.catch((err) => (backendError = errorText(err)))
|
||||
refreshBackend()
|
||||
const unlisten = [
|
||||
onBackendChanged(refreshBackend),
|
||||
@@ -66,12 +72,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** Saves the settings (the login goes to the saved backend URL), then logs in. */
|
||||
async function login() {
|
||||
backendBusy = true
|
||||
backendError = ''
|
||||
try {
|
||||
await persist()
|
||||
await backendLogin()
|
||||
} catch (err) {
|
||||
backendError = errorText(err)
|
||||
@@ -219,13 +223,8 @@
|
||||
<section class="card">
|
||||
<h2>Backend</h2>
|
||||
<div class="grid">
|
||||
<label for="backend-url">Backend-URL</label>
|
||||
<input
|
||||
id="backend-url"
|
||||
type="url"
|
||||
placeholder="https://test.euvinopro.eu"
|
||||
bind:value={settings.backend_url}
|
||||
/>
|
||||
<span>Server</span>
|
||||
<span>{server ? new URL(server.base_url).host : '…'}</span>
|
||||
<span>Status</span>
|
||||
<span class="backend-status">
|
||||
{#if backend === null}
|
||||
@@ -253,10 +252,10 @@
|
||||
{#if backendError}
|
||||
<p class="error">{backendError}</p>
|
||||
{/if}
|
||||
{#if backend}
|
||||
{#if server}
|
||||
<p class="muted keys-hint">
|
||||
Schlüssel auf dem Server verwalten:
|
||||
<a href={backend.keys_url} onclick={openKeysPage}>{backend.keys_url}</a>
|
||||
<a href={server.keys_url} onclick={openKeysPage}>{server.keys_url}</a>
|
||||
</p>
|
||||
{/if}
|
||||
</section>
|
||||
@@ -492,10 +491,6 @@
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.grid input[type='url'] {
|
||||
max-width: 380px;
|
||||
}
|
||||
|
||||
.backend-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
|
||||
Reference in New Issue
Block a user