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 -3
View File
@@ -5,7 +5,7 @@ import AdmZip from 'adm-zip';
import fs from 'fs-extra';
import yaml from 'js-yaml';
import { ValidationError } from '../error';
import { ProblemAdd } from '../lib/ui';
import { PluginContext } from '../loader';
import { PERM, PRIV } from '../model/builtin';
import problem, { ProblemDoc } from '../model/problem';
import { Handler } from '../service/server';
@@ -93,7 +93,7 @@ class ProblemImportHydroHandler extends Handler {
}
}
export async function apply(ctx) {
ProblemAdd('problem_import_hydro', {}, 'copy', 'Import From Hydro');
export async function apply(ctx: PluginContext) {
ctx.Route('problem_import_hydro', '/problem/import/hydro', ProblemImportHydroHandler, PERM.PERM_CREATE_PROBLEM);
ctx.inject('ProblemAdd', 'problem_import_hydro', { icon: 'copy', text: 'Import From Hydro' });
}