fix: just show the login key on settings page

This commit is contained in:
M1 2026-03-17 06:33:13 +04:00
parent 2ec1915ef5
commit 0c65b5e3fa
2 changed files with 6 additions and 2 deletions

View File

@ -142,8 +142,9 @@ export const dashboard = new Elysia()
const [acc] = await sql`SELECT id, email_hash, created_at FROM accounts WHERE id = ${accountId}`;
const apiKeys = await sql`SELECT id, label, created_at, last_used_at FROM api_keys WHERE account_id = ${accountId} ORDER BY created_at DESC`;
const loginKey = cookie?.pingql_key?.value ?? null;
return html("settings", { nav: "settings", account: acc, apiKeys, accountId });
return html("settings", { nav: "settings", account: acc, apiKeys, accountId, loginKey });
})
// New monitor

View File

@ -16,7 +16,10 @@
<div class="space-y-3">
<div>
<label class="block text-xs text-gray-500 mb-1">Login Key</label>
<p class="text-sm text-gray-500 italic">Hidden for security. Use "Rotate Key" below to replace it — the new key will be shown immediately.</p>
<div class="flex gap-2">
<code class="flex-1 bg-gray-800 border border-gray-700 rounded-lg px-4 py-2.5 text-blue-400 text-sm font-mono select-all"><%= it.loginKey %></code>
<button onclick="navigator.clipboard.writeText('<%= it.loginKey %>'); this.textContent='Copied!'; setTimeout(()=>this.textContent='Copy',1500)" class="px-3 bg-gray-800 hover:bg-gray-700 border border-gray-700 rounded-lg text-gray-400 hover:text-white text-xs transition-colors">Copy</button>
</div>
</div>
<div>
<label class="block text-xs text-gray-500 mb-1">Member since</label>