core: use disposable handler

This commit is contained in:
undefined committed 2022-09-20 22:47:14 +08:00
1 parent fd7c9cbeb1
commit 3d4aa0ba21
18 files changed
+130 -168

No files matched your search

+3 -5
View File
@@ -10,7 +10,7 @@ import { buildContent } from 'hydrooj/src/lib/content';
import { ProblemAdd } from 'hydrooj/src/lib/ui';
import { PERM } from 'hydrooj/src/model/builtin';
import problem from 'hydrooj/src/model/problem';
import { Handler, Route } from 'hydrooj/src/service/server';
import { Handler } from 'hydrooj/src/service/server';
fs.ensureDirSync('/tmp/hydro/import-qduoj');
@@ -126,9 +126,7 @@ class ImportQduojHandler extends Handler {
}
}
export async function apply() {
Route('problem_import_qduoj', '/problem/import/qduoj', ImportQduojHandler, PERM.PERM_CREATE_PROBLEM);
export async function apply(ctx) {
ctx.Route('problem_import_qduoj', '/problem/import/qduoj', ImportQduojHandler, PERM.PERM_CREATE_PROBLEM);
ProblemAdd('problem_import_qduoj', {}, 'copy', 'From QDUOJ Export');
}
global.Hydro.handler.qduImport = apply;