forked from bai/curriculum-project-hub
12628c9233
- scaffold hub/database-admin as SvelteKit 2 + Svelte 5 static SPA
with aurora/glass visual style (paths.base='/database')
- add lib/{api,session,org}.ts + Aurora.svelte component
- add routes: root redirect, /admin login page, /dashboard (OWNER/ADMIN only)
- backend: replace server-rendered HTML routes with /database/config JSON endpoint
- add hub/src/database/static.ts to serve SPA under /database/*
- wire registerDatabaseSpa into plugin.ts
- exempt /database/* from silo rate-limit (same treatment as /admin/*)
- add database:dev + database:build npm scripts; update deploy scripts
- update hub/src/database/README.md
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
1005 B
Svelte
31 lines
1005 B
Svelte
<script lang="ts">
|
|
import { onMount } from 'svelte';
|
|
import { goto } from '$app/navigation';
|
|
import { base } from '$app/paths';
|
|
import { api } from '$lib/api';
|
|
|
|
onMount(async () => {
|
|
// /database entry — route to dashboard if signed in, else the login page.
|
|
try {
|
|
await api.me();
|
|
await goto(`${base}/dashboard`, { replaceState: true });
|
|
} catch {
|
|
await goto(`${base}/admin`, { replaceState: true });
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<div class="flex min-h-screen items-center justify-center">
|
|
<div class="flex flex-col items-center gap-3 text-slate-400">
|
|
<svg class="h-7 w-7 animate-spin text-violet-500" viewBox="0 0 24 24" fill="none">
|
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
<path
|
|
class="opacity-90"
|
|
fill="currentColor"
|
|
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
></path>
|
|
</svg>
|
|
<p class="text-sm">正在进入…</p>
|
|
</div>
|
|
</div>
|