workspace: upgrade deps

This commit is contained in:
undefined committed 2022-10-04 21:31:58 +08:00
1 parent 1c3dc161b6
commit 8cffe19609
17 files changed
+110 -98

No files matched your search

+9 -2
View File
@@ -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: {