From 8ed662321d9417b065c3cfc8b5685c6c8cc555c8 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 4 Mar 2023 20:59:39 -0600 Subject: [PATCH] Implement apps API (the stupid way) --- src/api/apps.ts | 21 +++++++++++++++++++++ src/app.ts | 4 ++++ 2 files changed, 25 insertions(+) create mode 100644 src/api/apps.ts diff --git a/src/api/apps.ts b/src/api/apps.ts new file mode 100644 index 00000000..899eb9b7 --- /dev/null +++ b/src/api/apps.ts @@ -0,0 +1,21 @@ +import type { Context } from '@/deps.ts'; + +const FAKE_APP = { + id: '1', + name: 'Nostrverse', + website: null, + redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', + client_id: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + client_secret: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + vapid_key: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=', +}; + +function createAppController(c: Context) { + return c.json(FAKE_APP); +} + +function appVerifyCredentials(c: Context) { + return c.json(FAKE_APP); +} + +export { appVerifyCredentials, createAppController }; diff --git a/src/app.ts b/src/app.ts index 2e2445ce..c183f555 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,4 +1,5 @@ import { Hono } from '@/deps.ts'; +import { appVerifyCredentials, createAppController } from './api/apps.ts'; import instanceController from './api/instance.ts'; @@ -6,4 +7,7 @@ const app = new Hono(); app.get('/api/v1/instance', instanceController); +app.get('/api/v1/apps/verify_credentials', appVerifyCredentials); +app.post('/api/v1/apps', createAppController); + export default app;