core: use cordis to manage app lifecycle

This commit is contained in:
undefined committed 2022-09-23 17:52:27 +08:00
1 parent d7ec26b772
commit 5b7067d77d
19 files changed
+307 -375

No files matched your search

+1 -6
View File
@@ -4,9 +4,7 @@ import * as yaml from 'js-yaml';
import Schema from 'schemastery';
import * as check from '../check';
import { BadRequestError, ValidationError } from '../error';
import {
isEmail, isPassword, isUname, validate,
} from '../lib/validator';
import { isEmail, isPassword, isUname } from '../lib/validator';
import { Logger } from '../logger';
import { PRIV, STATUS } from '../model/builtin';
import domain from '../model/domain';
@@ -106,9 +104,6 @@ class SystemScriptHandler extends SystemHandler {
let args = JSON.parse(raw);
if (typeof global.Hydro.script[id].validate === 'function') {
args = global.Hydro.script[id].validate(args);
} else {
logger.warn('You are using the legacy script validation API, which will be dropped in the future.');
validate(global.Hydro.script[id].validate, args);
}
const rid = await record.add(domainId, -1, this.user._id, '-', id, false, { input: raw, type: 'pretest' });
const report = (data) => judge.next({ domainId, rid, ...data });