diff options
| author | Adam Soltys <[email protected]> | 2025-02-13 10:35:23 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-02-13 10:35:23 -0800 |
| commit | 7f296fbb38c01e2aa39940280755d301962ee262 (patch) | |
| tree | c6f3288b03dd4fa1f9dd4508262bf04ae927dba6 | |
| parent | 1888e338f2ccef16ccdb738cfdd04ffe516e023a (diff) | |
| download | coinos-server-7f296fbb38c01e2aa39940280755d301962ee262.tar.gz coinos-server-7f296fbb38c01e2aa39940280755d301962ee262.zip | |
nwc app prefix
| -rw-r--r-- | lib/nwc.ts | 4 | ||||
| -rw-r--r-- | lib/register.ts | 2 | ||||
| -rw-r--r-- | routes/users.ts | 6 |
3 files changed, 6 insertions, 6 deletions
@@ -59,8 +59,8 @@ export default () => { if (!methods.includes(method)) return; try { - const app = await g(pubkey); - if (!app) fail(`pubkey not found`); + const app = await g(`app:${pubkey}`); + if (!app) fail("pubkey not found"); const user = await g(`user:${app.uid}`); const result = await handle(method, params, ev, app, user); diff --git a/lib/register.ts b/lib/register.ts index 1493211c..86a816a8 100644 --- a/lib/register.ts +++ b/lib/register.ts @@ -81,7 +81,7 @@ export default async (user, ip) => { name: username, }; - await s(app.pubkey, app); + await s(`app:${app.pubkey}`, app); await db.sAdd(`${id}:apps`, app.pubkey); db.multi() diff --git a/routes/users.ts b/routes/users.ts index 30bd6198..b3137ea8 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -819,7 +819,7 @@ export default { async app(req, res) { const { pubkey } = req.params; - const app = await g(pubkey); + const app = await g(`app:${pubkey}`); res.send(app); }, @@ -864,7 +864,7 @@ export default { if (app && uid !== app.uid) fail("Unauthorized"); if (secret) pubkey = getPublicKey(secret); app = { ...app, pubkey, max_amount, budget_renewal, name, uid, secret }; - await s(pubkey, app); + await s(`app:${pubkey}`, app); await db.sAdd(`${uid}:apps`, pubkey); res.send({}); } catch (e) { @@ -881,7 +881,7 @@ export default { const app = await g(pubkey); if (app && uid !== app.uid) fail("Unauthorized"); await db.sRem(`${uid}:apps`, pubkey); - await db.del(pubkey); + await db.del(`app:${pubkey}`); res.send({}); } catch (e) { console.log(e); |
