mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix support for node18
This commit is contained in:
1 parent
f1436a366c
commit
1397f91f1e
4 files changed
+12
-13
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import assert from 'assert';
|
||||
import crypto from 'crypto';
|
||||
import yaml from 'js-yaml';
|
||||
import * as bus from 'hydrooj/src/service/bus';
|
||||
@@ -28,7 +29,13 @@ class DataReportHandler extends Handler {
|
||||
@post('installId', Types.String)
|
||||
@post('payload', Types.String)
|
||||
async post(domainId: string, installId: string, _payload: string) {
|
||||
const payload: any = yaml.load(decrypt(_payload));
|
||||
let payload: any;
|
||||
try {
|
||||
payload = yaml.load(decrypt(_payload));
|
||||
} catch (e) {
|
||||
payload = yaml.load(_payload);
|
||||
}
|
||||
assert(payload.url);
|
||||
const old = await coll.findOne({ _id: installId });
|
||||
await coll.updateOne({ _id: installId }, {
|
||||
$set: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/center",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
Reference in new issue
Block a user