ui: add service worker to cache resources (#445)

This commit is contained in:
undefined authored and GitHub committed 2022-10-20 01:34:30 +08:00
1 parent aa5df5346a
commit fcc4eedd9f
10 files changed
+112 -54

No files matched your search

+9
View File
@@ -161,6 +161,14 @@ class LanguageHandler extends ResourceHandler {
}
}
class SWConfigHandler extends ResourceHandler {
async get() {
this.response.body = {
preload: SystemModel.get('ui-default.preload'),
};
}
}
class SystemConfigSchemaHandler extends Handler {
async get() {
const schema = convert(Schema.intersect(SystemSettings) as any, true);
@@ -227,6 +235,7 @@ export function apply(ctx: Context) {
ctx.Route('markdown', '/markdown', MarkdownHandler);
ctx.Route('config_schema', '/manage/config/schema.json', SystemConfigSchemaHandler, PRIV.PRIV_EDIT_SYSTEM);
ctx.Route('lang', '/l/:lang', LanguageHandler);
ctx.Route('sw_config', '/sw-config', SWConfigHandler);
ctx.Route('media', '/media', RichMediaHandler);
ctx.on('app/started', buildUI);
ctx.on('app/started', updateLogo);