mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
workspace: upgrade deps
This commit is contained in:
1 parent
1c3dc161b6
commit
8cffe19609
17 files changed
+110
-98
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import assert from 'assert';
|
||||
import crypto from 'crypto';
|
||||
import {
|
||||
Context, db, Handler, post, Types, yaml,
|
||||
Context, db, ForbiddenError, Handler, post, Types, yaml,
|
||||
} from 'hydrooj';
|
||||
|
||||
function decrypt(encrypted: string) {
|
||||
@@ -16,6 +16,9 @@ declare module 'hydrooj' {
|
||||
interface Collections {
|
||||
dataReport: any;
|
||||
}
|
||||
interface EventMap {
|
||||
'center/report': (thisArg: DataReportHandler, installId: string, old: any, payload: any) => void;
|
||||
}
|
||||
}
|
||||
|
||||
const coll = db.collection('dataReport');
|
||||
@@ -32,7 +35,11 @@ class DataReportHandler extends Handler {
|
||||
} catch (e) {
|
||||
payload = yaml.load(_payload);
|
||||
}
|
||||
assert(payload.url);
|
||||
try {
|
||||
assert(typeof payload.url === 'string');
|
||||
} catch (e) {
|
||||
throw new ForbiddenError();
|
||||
}
|
||||
const old = await coll.findOne({ _id: installId });
|
||||
await coll.updateOne({ _id: installId }, {
|
||||
$set: {
|
||||
|
||||
Reference in new issue
Block a user