core: add provideModule and injectUI API

This commit is contained in:
undefined committed 2022-09-23 01:36:12 +08:00
1 parent 672c553f4c
commit 28f03dbcbd
18 files changed
+211 -97

No files matched your search

+3 -4
View File
@@ -4,10 +4,9 @@ import path from 'path';
import AdmZip from 'adm-zip';
import fs from 'fs-extra';
import yaml from 'js-yaml';
import type { ContentNode, ProblemConfigFile } from 'hydrooj';
import type { ContentNode, PluginContext, ProblemConfigFile } from 'hydrooj';
import { ValidationError } from 'hydrooj/src/error';
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 } from 'hydrooj/src/service/server';
@@ -126,7 +125,7 @@ class ImportQduojHandler extends Handler {
}
}
export async function apply(ctx) {
export async function apply(ctx: PluginContext) {
ctx.Route('problem_import_qduoj', '/problem/import/qduoj', ImportQduojHandler, PERM.PERM_CREATE_PROBLEM);
ProblemAdd('problem_import_qduoj', {}, 'copy', 'From QDUOJ Export');
ctx.inject('ProblemAdd', 'problem_import_qduoj', { icon: 'copy', text: 'From QDUOJ Export' });
}