core: fix 404 page display

This commit is contained in:
undefined committed 2025-05-07 21:37:52 +08:00
1 parent 83da1c8d66
commit cd56ffe55b
11 files changed
+48 -30

No files matched your search

+4 -2
View File
@@ -91,7 +91,8 @@ export async function apply(ctx: Context) {
xhost: system.get('server.xhost'),
});
if (process.env.HYDRO_CLI) return;
ctx.inject(['server', 'oauth'], ({ server, on, oauth }) => {
ctx.inject(['server', 'oauth', 'setting'], (childContext) => {
const { server, on, oauth } = childContext;
server.addHandlerLayer('init', async (c, next) => {
const init = Date.now();
try {
@@ -107,7 +108,8 @@ export async function apply(ctx: Context) {
}
});
applyApiHandler(ctx, 'api', '/api/:op');
applyApiHandler(childContext, 'api', '/api/:op');
server.setDefaultContext(childContext);
for (const addon of [...Object.values(global.addons)].reverse()) {
const dir = resolve(addon, 'public');