Merges Renovate's kit 3 (PR #149) and adapter-static 4 (PR #148) bumps, plus the migration they need. The mechanical part is `sv migrate sveltekit-3`, run one task at a time and reviewed: - svelte.config.js is gone. Its options move into sveltekit() in vite.config.ts, exported as kitOptions so vitest.config.ts runs the same kit setup, including the $test-utils alias the tests import. - $lib becomes #lib through package.json "imports". There is no src/lib/index, so only the "#lib/*" entry is kept. - tsconfig extends $app/tsconfig. - Peer floors raised to kit 3's requirements: svelte ^5.57.1, vite ^8.0.12, svelte-check ^4.7.5. By hand, from the codemod's list of non-automated tasks: - goto's replaceState option is now replace; keepFocus becomes reset: false. For the search typeahead, reset: false also stops the scroll-to-top, which is wanted while typing. - The test setup mocks drop pushState/replaceState and $app/paths base/assets, which kit 3 removed, and mock refreshAll in place of invalidateAll. - The other flagged files only read page.url or goto internal routes, so they needed no change. TypeScript goes to ^6, not the ^7 Renovate offers: kit 3 declares typescript ^6 as a peer and svelte-check 4.7 accepts ^5 || ^6. Move to 7 once both accept it. With Tailwind 4 and kit 3 in, `npm audit` on the whole tree reports 0, so the web lane now audits every dependency rather than only what ships to browsers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
108 lines
3.6 KiB
Svelte
108 lines
3.6 KiB
Svelte
<script lang="ts">
|
|
import { onMount } from 'svelte';
|
|
import { Save, TriangleAlert } from 'lucide-svelte';
|
|
import { getNetworkSettings, updatePublicUrl } from '#lib/api/admin.js';
|
|
import { errMessage } from '#lib/api/errors.js';
|
|
import { pushToast } from '#lib/stores/toast.svelte.js';
|
|
|
|
let saved = $state<string | null>(null);
|
|
let value = $state('');
|
|
let saving = $state(false);
|
|
let loadError = $state(false);
|
|
|
|
const dirty = $derived(saved !== null && value.trim() !== saved);
|
|
// The address this page was loaded from is almost always the right answer,
|
|
// so offer it rather than making the operator type it.
|
|
const here = typeof window !== 'undefined' ? window.location.origin : '';
|
|
|
|
async function load() {
|
|
try {
|
|
const s = await getNetworkSettings();
|
|
saved = s.public_url;
|
|
value = s.public_url;
|
|
loadError = false;
|
|
} catch {
|
|
loadError = true;
|
|
}
|
|
}
|
|
|
|
onMount(load);
|
|
|
|
async function save() {
|
|
saving = true;
|
|
try {
|
|
const s = await updatePublicUrl(value.trim());
|
|
saved = s.public_url;
|
|
value = s.public_url;
|
|
pushToast(saved ? 'Public address saved.' : 'Public address cleared.');
|
|
} catch (e) {
|
|
pushToast(errMessage(e, "Couldn't save the public address."), 'error');
|
|
} finally {
|
|
saving = false;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<section class="space-y-4 rounded-xl border border-border bg-surface p-5">
|
|
<div>
|
|
<h3 class="font-display text-lg font-medium text-text-primary">Public address</h3>
|
|
<p class="mt-1 text-sm text-text-secondary">
|
|
The address people use to reach Minstrel. Password-reset emails link here.
|
|
</p>
|
|
</div>
|
|
|
|
{#if loadError}
|
|
<p class="text-sm text-action-destructive">
|
|
Couldn't load network settings.
|
|
<button type="button" class="underline hover:no-underline" onclick={load}>Try again</button>
|
|
</p>
|
|
{:else if saved === null}
|
|
<p class="text-sm text-text-secondary">Loading…</p>
|
|
{:else}
|
|
<div class="flex flex-wrap items-end gap-3">
|
|
<label class="flex min-w-0 flex-1 flex-col gap-1">
|
|
<span class="text-sm text-text-secondary">Address</span>
|
|
<input
|
|
type="url"
|
|
inputmode="url"
|
|
placeholder="https://music.example.com"
|
|
bind:value
|
|
class="w-full rounded border border-border bg-background px-2 py-1 font-mono
|
|
focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-accent"
|
|
/>
|
|
</label>
|
|
{#if here && value.trim() !== here}
|
|
<button
|
|
type="button"
|
|
class="rounded-md border border-border px-3 py-1.5 text-sm hover:bg-surface-hover
|
|
focus-visible:ring-2 focus-visible:ring-accent"
|
|
onclick={() => (value = here)}
|
|
>
|
|
Use {here}
|
|
</button>
|
|
{/if}
|
|
<button
|
|
type="button"
|
|
class="inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5
|
|
text-sm hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent
|
|
disabled:opacity-50"
|
|
disabled={saving || !dirty}
|
|
onclick={save}
|
|
>
|
|
<Save size={14} aria-hidden="true" />
|
|
{saving ? 'Saving…' : 'Save'}
|
|
</button>
|
|
</div>
|
|
|
|
{#if !saved}
|
|
<p class="flex items-start gap-2 text-sm text-text-secondary" role="status">
|
|
<TriangleAlert size={14} class="mt-0.5 shrink-0 text-action-destructive" aria-hidden="true" />
|
|
<span>
|
|
Not set, so password-reset emails are not being sent. Minstrel won't build the link from
|
|
whatever address a request claims, because anyone can claim any address.
|
|
</span>
|
|
</p>
|
|
{/if}
|
|
{/if}
|
|
</section>
|