core: add definePlugin syntax support

This commit is contained in:
undefined committed 2022-10-05 19:10:03 +08:00
1 parent 9971967fd1
commit bb288cb960
2 files changed
+13 -4

No files matched your search

+6 -4
View File
@@ -1,7 +1,7 @@
import assert from 'assert';
import crypto from 'crypto';
import {
Context, db, ForbiddenError, Handler, post, Types, yaml,
db, definePlugin, ForbiddenError, Handler, post, Types, yaml,
} from 'hydrooj';
function decrypt(encrypted: string) {
@@ -67,6 +67,8 @@ class DataReportHandler extends Handler {
}
}
export function apply(ctx: Context) {
ctx.Route('data_report', '/center/report', DataReportHandler);
}
export default definePlugin({
apply(ctx) {
ctx.Route('data_report', '/center/report', DataReportHandler);
},
});