mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
telemetry: sandbox version
This commit is contained in:
1 parent
84c7815ef6
commit
5bc8882738
6 files changed
+20
-4
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import crypto from 'crypto';
|
||||
import yaml from 'js-yaml';
|
||||
import * as bus from 'hydrooj/src/service/bus';
|
||||
import db from 'hydrooj/src/service/db';
|
||||
import {
|
||||
Handler, post, Route, Types,
|
||||
@@ -28,6 +29,7 @@ class DataReportHandler extends Handler {
|
||||
@post('payload', Types.String)
|
||||
async post(domainId: string, installId: string, _payload: string) {
|
||||
const payload: any = yaml.load(decrypt(_payload));
|
||||
const old = await coll.findOne({ _id: installId });
|
||||
await coll.updateOne({ _id: installId }, {
|
||||
$set: {
|
||||
version: payload.version,
|
||||
@@ -45,9 +47,11 @@ class DataReportHandler extends Handler {
|
||||
problemCount: payload.problemCount,
|
||||
discussionCount: payload.discussionCount,
|
||||
recordCount: payload.recordCount,
|
||||
sandbox: payload.sandbox,
|
||||
},
|
||||
}, { upsert: true });
|
||||
this.response.body = 'success';
|
||||
bus.emit('center/report', this, installId, old, payload);
|
||||
this.response.body = { code: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/center",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"main": "package.json",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
|
||||
Reference in new issue
Block a user