From 9f427076ba821ed25fc9566ce15cf93ee7e742a1 Mon Sep 17 00:00:00 2001 From: r1n04h Date: Thu, 11 Dec 2025 10:32:42 +0000 Subject: [PATCH 1/2] fix: openapi spec --- package.json | 2 +- src/index.ts | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 6a951ca..d56db4e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SparkHub", - "version": "1.0.0", + "version": "1.1.0", "scripts": { "test": "bun test", "dev": "bun run --watch src/index.ts", diff --git a/src/index.ts b/src/index.ts index e0eaf7e..a52125c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,11 +15,6 @@ initializeSparkWallet().catch(error => { }); const app = new Elysia(serverConfig.elysia) - .onAfterHandle(({ set }) => { - set.headers['Access-Control-Allow-Origin'] = '*'; - set.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS'; - set.headers['Access-Control-Allow-Headers'] = 'Content-Type, Authorization'; - }) .use( swagger({ documentation: { @@ -29,8 +24,14 @@ const app = new Elysia(serverConfig.elysia) description: 'SPA for self-custodial Lightning Address', }, }, + path: '/swagger', }) ) + .onAfterHandle(({ set }) => { + set.headers['Access-Control-Allow-Origin'] = '*'; + set.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS'; + set.headers['Access-Control-Allow-Headers'] = 'Content-Type, Authorization'; + }) .use( staticPlugin({ assets: 'dist', @@ -259,8 +260,10 @@ const app = new Elysia(serverConfig.elysia) } ) - // Lightning Address endpoint for direct username access - .get('/:username', () => Bun.file('public/index.html')) + // Catch-all for SPA - must be last + .get('/:username', () => { + return Bun.file('public/index.html'); + }) .listen(process.env.PORT ?? 3000); From 532b999a767944d36becc20ec4187c84b7e39c47 Mon Sep 17 00:00:00 2001 From: r1n04h Date: Thu, 11 Dec 2025 10:36:59 +0000 Subject: [PATCH 2/2] fix: openapi spec --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index a52125c..ae2dbd5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,6 +25,7 @@ const app = new Elysia(serverConfig.elysia) }, }, path: '/swagger', + excludeStaticFile: true, }) ) .onAfterHandle(({ set }) => {