From c684d96d908eff0d156ee3e15e78476e4f7497b4 Mon Sep 17 00:00:00 2001 From: M1 Date: Tue, 17 Mar 2026 06:37:29 +0400 Subject: [PATCH] fix: rename API Keys -> Sub-Keys, show key inline on creation, no reload --- apps/web/src/routes/auth.ts | 4 ++-- apps/web/src/views/settings.ejs | 37 +++++++++++++++++---------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/apps/web/src/routes/auth.ts b/apps/web/src/routes/auth.ts index 444b8ca..e417ff9 100644 --- a/apps/web/src/routes/auth.ts +++ b/apps/web/src/routes/auth.ts @@ -192,8 +192,8 @@ export const account = new Elysia({ prefix: "/account" }) const keyLookup = sha256(norm); const keyHash = await Bun.password.hash(norm, { algorithm: "bcrypt", cost: 10 }); - await sql`INSERT INTO api_keys (key_lookup, key_hash, account_id, label) VALUES (${keyLookup}, ${keyHash}, ${accountId}, ${body.label})`; - return { key: rawKey, label: body.label }; + const [created] = await sql`INSERT INTO api_keys (key_lookup, key_hash, account_id, label) VALUES (${keyLookup}, ${keyHash}, ${accountId}, ${body.label}) RETURNING id`; + return { key: rawKey, id: created.id, label: body.label }; }, { body: t.Object({ label: t.String({ description: "A name for this key, e.g. 'ci-pipeline' or 'mobile-app'" }), diff --git a/apps/web/src/views/settings.ejs b/apps/web/src/views/settings.ejs index 395f313..39f3cdd 100644 --- a/apps/web/src/views/settings.ejs +++ b/apps/web/src/views/settings.ejs @@ -49,10 +49,10 @@
-

API Keys

+

Sub-Keys

Create separate keys for different apps, scripts, or teammates.

- +
@@ -66,19 +66,19 @@ - + - +
<% if (it.apiKeys.length === 0) { %> -

No API keys yet.

+

No sub-keys yet.

<% } else { %> <% it.apiKeys.forEach(function(k) { %>
@@ -97,15 +97,7 @@