feat(ui): implement public status endpoint and update UI components
CI / build-and-test (push) Failing after -30m49s
CI / build-and-test (push) Failing after -30m49s
* add public status handler and response types * modify status API to restrict access and update client tracking * adjust UI components to display public status information * update routing to include public status endpoint
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { StatusResponse } from "../../types";
|
||||
import type { PublicStatusResponse } from "../../types";
|
||||
type IntelligenceCard = {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -16,7 +16,7 @@
|
||||
error,
|
||||
}: {
|
||||
isOAuthCallback: boolean;
|
||||
data: StatusResponse | null;
|
||||
data: PublicStatusResponse | null;
|
||||
loading: boolean;
|
||||
error: string;
|
||||
} = $props();
|
||||
@@ -143,10 +143,24 @@
|
||||
<p class="mt-2 text-sm font-medium text-rose-300">Unavailable</p>
|
||||
<p class="mt-2 text-xs text-rose-200/80">{error}</p>
|
||||
{:else if data}
|
||||
<p class="mt-2 text-2xl font-semibold text-white">{data.version}</p>
|
||||
<p class="mt-2 text-sm text-slate-400">
|
||||
{data.connected_count} connected in {data.connected_window}
|
||||
<p class="mt-2 text-2xl font-semibold text-white">
|
||||
{data.connected_count}
|
||||
</p>
|
||||
<p class="mt-2 text-sm text-slate-400">
|
||||
connected in {data.connected_window}
|
||||
</p>
|
||||
{#if data.entries.length > 0}
|
||||
<p class="mt-2 text-xs text-slate-400">
|
||||
Clients:
|
||||
{#each data.entries.slice(0, 3) as client, idx}
|
||||
<code class="text-slate-200">{client.key_id}</code>{idx <
|
||||
Math.min(data.entries.length, 3) - 1
|
||||
? ", "
|
||||
: ""}
|
||||
{/each}
|
||||
{data.entries.length > 3 ? " …" : ""}
|
||||
</p>
|
||||
{/if}
|
||||
<a
|
||||
href="/status"
|
||||
class="mt-3 inline-flex items-center rounded-lg border border-emerald-300/30 bg-emerald-400/10 px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.12em] text-emerald-100 transition hover:border-emerald-300/50 hover:bg-emerald-400/20"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import LoginInfoPanel from './LoginInfoPanel.svelte';
|
||||
import LoginPanel from './LoginPanel.svelte';
|
||||
import type { StatusResponse } from '../../types';
|
||||
import type { PublicStatusResponse } from '../../types';
|
||||
|
||||
const {
|
||||
isOAuthCallback,
|
||||
@@ -19,7 +19,7 @@
|
||||
authBusy: boolean;
|
||||
authError: string;
|
||||
authMessage: string;
|
||||
statusData: StatusResponse | null;
|
||||
statusData: PublicStatusResponse | null;
|
||||
statusLoading: boolean;
|
||||
statusError: string;
|
||||
onlogin: (username: string, password: string) => void;
|
||||
|
||||
Reference in New Issue
Block a user