diff --git a/qryn_bun.mjs b/qryn_bun.mjs index 1de674f7..f20198b6 100644 --- a/qryn_bun.mjs +++ b/qryn_bun.mjs @@ -315,15 +315,17 @@ export default async() => { const serveView = fs.existsSync(path.join(__dirname, 'view/index.html')) if (serveView) { app.plug(group(path.join(__dirname, 'view'))); + for (const fakePath of ['/plugins', '/users', '/datasources', '/datasources/:ds']) { + app.get(fakePath, + (ctx) => + file(path.join(__dirname, 'view', 'index.html'))(ctx)) + } } app.use(404, (ctx) => { if (ctx.error && ctx.error.name === 'UnauthorizedError') { return new Response(ctx.error.message, {status: 401, headers: { 'www-authenticate': 'Basic' }}) } - if (serveView) { - return file(path.join(__dirname, 'view', 'index.html'))(ctx); - } return wrapper(handle404) }) app.port = process.env.PORT || 3100 diff --git a/qryn_node.js b/qryn_node.js index aa3cccad..3c0ba8be 100755 --- a/qryn_node.js +++ b/qryn_node.js @@ -438,6 +438,12 @@ let fastify = require('fastify')({ root: path.join(__dirname, 'view'), prefix: '/' }) + const idx = fs.readFileSync('view/index.html', 'utf8') + for (const fakePath of ['/plugins', '/users', '/datasources', '/datasources/:ds']) { + fastify.get(fakePath, + (req, reply) => + reply.code(200).header('Content-Type', 'text/html').send(idx)) + } } // Run API Service