2.0.0(preview)

This commit is contained in:
masnn committed 2020-06-08 13:41:43 +08:00
1 parent d5929d78b1
commit 1c8b62a6d9
33 files changed
+307 -241

No files matched your search

+20 -7
View File
@@ -24,7 +24,11 @@ class StatusHandler extends Handler {
desc = desc || 'Online';
stats[i].status = desc;
}
this.response.body = { stats };
console.log(stats);
const path = [
['Hydro', '/'],
];
this.response.body = { stats, path };
this.response.template = 'status.html';
}
}
@@ -32,7 +36,12 @@ class StatusHandler extends Handler {
class StatusUpdateHandler extends Handler {
async post(args) {
this.checkPerm(PERM_JUDGE);
await coll.updateOne({ _id: args._id }, { $set: { ...args, type: 'judger' } }, { upsert: true });
args.type = 'judger';
return coll.updateOne(
{ mid: args.mid, type: 'judger' },
{ $set: args },
{ upsert: true },
);
}
}
@@ -50,9 +59,13 @@ async function apply() {
Route('/language/:lang', SwitchLanguageHandler);
}
global.Hydro.handler.misc = module.exports = {
FileDownloadHandler,
StatusHandler,
StatusUpdateHandler,
apply,
apply.updateStatus = function updateStatus(args) {
args.type = 'judger';
return coll.updateOne(
{ mid: args.mid, type: 'judger' },
{ $set: args },
{ upsert: true },
);
};
global.Hydro.handler.misc = module.exports = apply;