mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
vjudge: fix dep inject
This commit is contained in:
1 parent
54ae550586
commit
ebfa89c7ca
1 file changed
+7
-1
@@ -184,6 +184,8 @@ declare module 'cordis' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class VJudgeService extends Service {
|
class VJudgeService extends Service {
|
||||||
|
static inject = ['model:setting']; // Make sure langs are loaded before any consumer starts
|
||||||
|
|
||||||
constructor(ctx: Context) {
|
constructor(ctx: Context) {
|
||||||
super(ctx, 'vjudge');
|
super(ctx, 'vjudge');
|
||||||
}
|
}
|
||||||
@@ -297,9 +299,13 @@ export async function apply(ctx: Context) {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
ctx.inject(['vjudge', 'model:setting'], async (c) => {
|
ctx.inject(['vjudge'], async (c) => {
|
||||||
for (const [k, v] of Object.entries(providers)) {
|
for (const [k, v] of Object.entries(providers)) {
|
||||||
|
try {
|
||||||
if (!SystemModel.get(`vjudge.builtin-${k}-disable`)) c.vjudge.addProvider(k, v);
|
if (!SystemModel.get(`vjudge.builtin-${k}-disable`)) c.vjudge.addProvider(k, v);
|
||||||
|
} catch (e) {
|
||||||
|
logger.error(`Error adding provider ${k}: ${e}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
c.inject(['check'], ({ check }) => {
|
c.inject(['check'], ({ check }) => {
|
||||||
check.addChecker('Vjudge', async (_ctx, log, warn, error) => {
|
check.addChecker('Vjudge', async (_ctx, log, warn, error) => {
|
||||||
|
|||||||
Reference in new issue
Block a user