core&ui: langs load fix

This commit is contained in:
undefined committed 2022-10-06 00:22:36 +08:00
1 parent 50cb3eaab5
commit 49693c27d4
8 files changed
+30 -46

No files matched your search

+3 -2
View File
@@ -59,9 +59,10 @@ export const service = getLoader('service', 'service');
export async function builtinModel(ctx: Context) {
const modelDir = path.resolve(__dirname, '..', 'model');
const models = ['task', 'blacklist', 'discussion', 'document'];
const models = await fs.readdir(modelDir);
for (const t of models) {
ctx.loader.reloadPlugin(ctx, path.resolve(modelDir, t), {}, `hydrooj/model/${t}`);
const q = path.resolve(modelDir, t);
if ('apply' in require(q)) ctx.loader.reloadPlugin(ctx, q, {}, `hydrooj/model/${t.split('.')[0]}`);
}
}