mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
2.0.0(preview)
This commit is contained in:
1 parent
d5929d78b1
commit
1c8b62a6d9
33 files changed
+307
-241
No files matched your search
+20
-7
@@ -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;
|
||||
Reference in new issue
Block a user