feat: Integrations splits into Library, Acquisition, Metadata sources and Email & network, each a page on the admin rail; the Overview keeps only what needs you (M503 #5607)
release / govulncheck (push) Successful in 14s
release / web (push) Failing after 16s
release / go (push) Successful in 1m13s
release / integration (push) Successful in 4m54s
release / android (push) Successful in 5m5s
release / Build signed APK (releases and dev) (push) Successful in 5m18s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 14s
release / web (push) Failing after 16s
release / go (push) Successful in 1m13s
release / integration (push) Successful in 4m54s
release / android (push) Successful in 5m5s
release / Build signed APK (releases and dev) (push) Successful in 5m18s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
- Library: the folders, Run scan and a row per scan job, cover art, fingerprints and loudness (off the Overview and Duplicates) - Acquisition: indexers and clients, searching, re-acquisition (off Missing files), Lidarr - Metadata sources: AcoustID, and one provider block for cover art and tags in place of the pasted pair - Email & network: outgoing email, the notification schedule, public address, proxies - Lidarr, outgoing email and the provider block are rebuilt as SettingsGroup rows; failures read as sentences, not codes - Duplicates and Missing files say what their setting is and link to where it is set Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
import SettingsGroup from '#lib/components/settings/SettingsGroup.svelte';
|
||||
import SettingRow from '#lib/components/settings/SettingRow.svelte';
|
||||
import { errMessage } from '#lib/api/errors.js';
|
||||
import { pushToast } from '#lib/stores/toast.svelte.js';
|
||||
|
||||
// One block for a list of outside sources (#5607): cover art and tags had
|
||||
// the same panel pasted twice. Each source is a row: its name and what it
|
||||
// supplies, a switch, a key field when it takes one, Save and Test.
|
||||
|
||||
type Provider = {
|
||||
id: string;
|
||||
display_name: string;
|
||||
requires_api_key: boolean;
|
||||
supports: string[];
|
||||
enabled: boolean;
|
||||
api_key_set: boolean;
|
||||
testable: boolean;
|
||||
};
|
||||
type TestResult = { ok: boolean; duration_ms?: number; error?: string };
|
||||
type P = Provider;
|
||||
type Query = {
|
||||
data?: { providers: P[] };
|
||||
isPending: boolean;
|
||||
isError: boolean;
|
||||
refetch: () => unknown;
|
||||
};
|
||||
|
||||
let {
|
||||
title,
|
||||
hint,
|
||||
noun,
|
||||
query,
|
||||
save,
|
||||
test,
|
||||
keyPlaceholder = 'Paste an API key',
|
||||
note
|
||||
}: {
|
||||
title: string;
|
||||
hint?: string;
|
||||
// What the list is of, for the load error: "cover art sources".
|
||||
noun: string;
|
||||
query: Query;
|
||||
save: (id: string, patch: { enabled?: boolean; api_key?: string }) => Promise<unknown>;
|
||||
test: (id: string) => Promise<TestResult>;
|
||||
keyPlaceholder?: string;
|
||||
// A line under one source's name, when it needs one (where to get a key).
|
||||
note?: Snippet<[P]>;
|
||||
} = $props();
|
||||
|
||||
const button =
|
||||
'rounded-md border border-border px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-hover hover:text-text-primary disabled:opacity-50';
|
||||
|
||||
// What a source supplies, in words rather than its capability codes.
|
||||
const SUPPLIES: Record<string, string> = {
|
||||
album_cover: 'album covers',
|
||||
artist_thumb: 'artist photos',
|
||||
artist_fanart: 'artist backdrops',
|
||||
track_tags: 'track tags'
|
||||
};
|
||||
function supplies(p: P): string {
|
||||
const words = p.supports.map((c) => SUPPLIES[c] ?? c.replace(/_/g, ' '));
|
||||
return words.length ? words.join(', ').replace(/^./, (c) => c.toUpperCase()) : '';
|
||||
}
|
||||
|
||||
// The operator's edits, kept across refetches until saved.
|
||||
let local = $state<Record<string, { enabled: boolean; apiKey: string }>>({});
|
||||
let results = $state<Record<string, TestResult>>({});
|
||||
let saving = $state<Record<string, boolean>>({});
|
||||
let testing = $state<Record<string, boolean>>({});
|
||||
|
||||
$effect(() => {
|
||||
for (const p of query.data?.providers ?? []) {
|
||||
if (!local[p.id]) local[p.id] = { enabled: p.enabled, apiKey: '' };
|
||||
}
|
||||
});
|
||||
|
||||
function changed(p: P): boolean {
|
||||
const l = local[p.id];
|
||||
return !!l && (l.enabled !== p.enabled || l.apiKey !== '');
|
||||
}
|
||||
|
||||
async function onSave(p: P) {
|
||||
const l = local[p.id];
|
||||
if (!l || !changed(p)) return;
|
||||
const patch: { enabled?: boolean; api_key?: string } = {};
|
||||
if (l.enabled !== p.enabled) patch.enabled = l.enabled;
|
||||
if (l.apiKey !== '') patch.api_key = l.apiKey;
|
||||
saving[p.id] = true;
|
||||
try {
|
||||
await save(p.id, patch);
|
||||
local[p.id] = { enabled: l.enabled, apiKey: '' };
|
||||
} catch (e) {
|
||||
pushToast(`Couldn't save ${p.display_name}: ${errMessage(e)}`, 'error');
|
||||
} finally {
|
||||
saving[p.id] = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function onTest(p: P) {
|
||||
testing[p.id] = true;
|
||||
try {
|
||||
results[p.id] = await test(p.id);
|
||||
} catch (e) {
|
||||
results[p.id] = { ok: false, error: errMessage(e) };
|
||||
} finally {
|
||||
testing[p.id] = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<SettingsGroup {title} {hint}>
|
||||
{#if query.data}
|
||||
{#each query.data.providers as p (p.id)}
|
||||
{@const l = local[p.id]}
|
||||
{@const r = results[p.id]}
|
||||
<div data-testid="provider" data-provider={p.id}>
|
||||
<SettingRow label={p.display_name} for="src-{p.id}">
|
||||
{#snippet hint()}
|
||||
{supplies(p)}
|
||||
{#if note}{' · '}{@render note(p)}{/if}
|
||||
{/snippet}
|
||||
{#if l}
|
||||
<input
|
||||
id="src-{p.id}"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
aria-checked={l.enabled}
|
||||
bind:checked={l.enabled}
|
||||
class="h-4 w-4 cursor-pointer accent-accent"
|
||||
/>
|
||||
{/if}
|
||||
</SettingRow>
|
||||
{#if l}
|
||||
<div class="flex flex-wrap items-center gap-2 px-4 pb-3">
|
||||
{#if p.requires_api_key}
|
||||
<input
|
||||
type="password"
|
||||
aria-label="{p.display_name} API key"
|
||||
placeholder={p.api_key_set ? 'Key saved · leave empty to keep it' : keyPlaceholder}
|
||||
bind:value={l.apiKey}
|
||||
class="w-64 max-w-full rounded-md border border-border bg-background px-3 py-1.5 text-sm"
|
||||
/>
|
||||
{/if}
|
||||
<button
|
||||
type="button"
|
||||
disabled={!changed(p) || saving[p.id]}
|
||||
onclick={() => onSave(p)}
|
||||
class={button}>{saving[p.id] ? 'Saving…' : 'Save'}</button
|
||||
>
|
||||
{#if p.testable}
|
||||
<button type="button" disabled={testing[p.id]} onclick={() => onTest(p)} class={button}>
|
||||
{testing[p.id] ? 'Testing…' : 'Test'}
|
||||
</button>
|
||||
{/if}
|
||||
{#if r}
|
||||
<span class="text-xs {r.ok ? 'text-text-secondary' : 'text-error-fg'}" data-testid="provider-test">
|
||||
{#if r.ok}
|
||||
Works{r.duration_ms ? ` · answered in ${r.duration_ms} ms` : ''}
|
||||
{:else}
|
||||
Didn't work: {r.error}
|
||||
{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
{:else if query.isPending}
|
||||
<p class="px-4 py-3 text-sm text-text-secondary">Loading…</p>
|
||||
{:else if query.isError}
|
||||
<p class="px-4 py-3 text-sm text-error-fg" data-testid="providers-error">
|
||||
Couldn't load the {noun}.
|
||||
<button type="button" class="underline hover:no-underline" onclick={() => query.refetch()}>Try again</button>
|
||||
</p>
|
||||
{:else}
|
||||
<p class="px-4 py-3 text-sm text-text-secondary">None available.</p>
|
||||
{/if}
|
||||
</SettingsGroup>
|
||||
Reference in New Issue
Block a user