Skip to content

Commit b3e51f8

Browse files
committed
feat: add debug route to inspect ui files
1 parent 61880b0 commit b3e51f8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Elysia } from "elysia";
22
import { Database } from "bun:sqlite";
33
import { join } from "path";
4-
import { existsSync, readFileSync } from 'node:fs';
4+
import { existsSync, readFileSync, readdirSync } from 'node:fs';
55
import { writeFile } from 'node:fs/promises';
66
import { createSessionManager } from './core/session.js';
77
import { authenticator } from 'otplib';
@@ -190,6 +190,20 @@ export const sqliteAdmin = ({ dbPath, prefix = "/admin", configPath = "./sqlite-
190190
});
191191
})
192192

193+
// DEBUG: List files in UI path
194+
.get("/api/debug/files", () => {
195+
try {
196+
const files = readdirSync(uiPath);
197+
const assetsPath = join(uiPath, 'assets');
198+
const assets = existsSync(assetsPath)
199+
? readdirSync(assetsPath)
200+
: 'Assets folder missing';
201+
return { uiPath, files, assets };
202+
} catch (e) {
203+
return { error: e.message, stack: e.stack, uiPath };
204+
}
205+
})
206+
193207
// TOTP: Generate
194208
.post("/api/totp/generate", async ({ session, set }) => {
195209
if (!session) { set.status = 401; return; }

0 commit comments

Comments
 (0)