+
Sessions
+
Devices currently signed in to your account.
+
+ {error &&
{error}
}
+ {loading ? (
+
Loading…
+ ) : (
+
+ {sessions.length === 0 &&
No active sessions.
}
+ {sessions.map(s => (
+
+
+
+ {s.user_agent || 'Unknown device'}
+ {s.current && This device}
+
+
Signed in {formatTimestamp(s.created_at)}
+
Last seen {formatTimestamp(s.last_seen_at)}
+
Expires {formatTimestamp(s.expires_at)}
+
+ {!s.current && (
+
+ )}
+
))}
)}
diff --git a/frontend/src/styles.css b/frontend/src/styles.css
index 785719f..dd95407 100644
--- a/frontend/src/styles.css
+++ b/frontend/src/styles.css
@@ -2262,6 +2262,36 @@ select {
.token-row-info strong { font-size: 14px; display: block; }
.token-row-info .muted { font-size: 12px; margin-top: 2px; }
.token-create-row { display: flex; gap: 8px; margin-bottom: 16px; }
+.token-row-title { display: flex; align-items: center; gap: 8px; }
+.token-badge,
+.session-badge {
+ display: inline-block;
+ padding: 1px 7px;
+ border-radius: var(--r);
+ font-size: 11px;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ border: 1px solid var(--line);
+ color: var(--muted);
+ background: var(--paper-2);
+}
+.session-badge { background: #d8eddf; color: #235c35; border-color: #b4d9be; }
+.token-expiry { font-size: 12px; color: var(--muted); margin-top: 2px; }
+.token-expiry--expired { color: var(--accent); }
+.session-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ border: 1px solid var(--line);
+ background: var(--paper-3);
+ padding: 10px 12px;
+ border-radius: var(--r);
+ margin-bottom: 6px;
+}
+.session-row .muted { font-size: 12px; margin-top: 2px; }
+.admin-action-btn--danger { color: var(--accent); border-color: var(--accent); }
+.admin-action-btn--danger:hover { background: #f5ddd8; }
/* ── Instance settings checkboxes ───────────────────────────────────────── */
.checkbox-row {
diff --git a/frontend/src/utils.js b/frontend/src/utils.js
index 6463665..f325dd5 100644
--- a/frontend/src/utils.js
+++ b/frontend/src/utils.js
@@ -33,6 +33,18 @@ export function formatTimestamp(value) {
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;
}
+// Describes a token's expiry for display. `expiresAt` is an RFC 3339 string or
+// null (never expires). Returns { expired, text } where text is the date-only
+// UTC form, e.g. "Expires 2026-11-01" or "Expired 2026-10-01".
+export function describeExpiry(expiresAt, now = new Date()) {
+ if (!expiresAt) return { expired: false, text: "Never expires" };
+ const d = new Date(expiresAt);
+ if (isNaN(d)) return { expired: false, text: `Expires ${expiresAt}` };
+ const date = d.toISOString().slice(0, 10);
+ const expired = d.getTime() <= now.getTime();
+ return { expired, text: `${expired ? "Expired" : "Expires"} ${date}` };
+}
+
export const SOURCE_ICONS = {
youtube: `
`,
youtube_music: `
`,
diff --git a/frontend/src/utils.test.js b/frontend/src/utils.test.js
new file mode 100644
index 0000000..f5623ce
--- /dev/null
+++ b/frontend/src/utils.test.js
@@ -0,0 +1,26 @@
+import { describe, expect, test } from 'bun:test'
+import { describeExpiry } from './utils.js'
+
+const now = new Date('2026-10-09T00:00:00Z')
+
+describe('describeExpiry', () => {
+ test('null expiry means the token never expires', () => {
+ expect(describeExpiry(null, now)).toEqual({ expired: false, text: 'Never expires' })
+ })
+
+ test('a future expiry shows the UTC date', () => {
+ expect(describeExpiry('2026-11-01T12:00:00Z', now)).toEqual({ expired: false, text: 'Expires 2026-11-01' })
+ })
+
+ test('a past expiry is marked expired', () => {
+ expect(describeExpiry('2026-10-01T12:00:00Z', now)).toEqual({ expired: true, text: 'Expired 2026-10-01' })
+ })
+
+ test('an expiry exactly at now counts as expired', () => {
+ expect(describeExpiry('2026-10-09T00:00:00Z', now).expired).toBe(true)
+ })
+
+ test('an unparseable value is shown verbatim and not marked expired', () => {
+ expect(describeExpiry('not-a-date', now)).toEqual({ expired: false, text: 'Expires not-a-date' })
+ })
+})