mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: status: auto-remove after 24hr
This commit is contained in:
1 parent
9524e56d01
commit
4904b16fa5
3 files changed
+6
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.21.6",
|
||||
"version": "2.21.7",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -3,6 +3,7 @@ import RecordModel from '../model/record';
|
||||
import DomainModel from '../model/domain';
|
||||
import * as DocumentModel from '../model/document';
|
||||
import db from '../service/db';
|
||||
import * as bus from '../service/bus';
|
||||
import { Route, Handler } from '../service/server';
|
||||
import UserModel from '../model/user';
|
||||
|
||||
@@ -64,6 +65,7 @@ class StatusUpdateHandler extends Handler {
|
||||
async post(args) {
|
||||
this.checkPriv(PRIV.PRIV_JUDGE);
|
||||
args.type = 'judge';
|
||||
args.updateAt = new Date();
|
||||
return coll.updateOne(
|
||||
{ mid: args.mid, type: 'judge' },
|
||||
{ $set: args },
|
||||
@@ -72,6 +74,8 @@ class StatusUpdateHandler extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
bus.once('app/started', () => coll.createIndex('updateAt', { expireAfterSeconds: 24 * 3600 }));
|
||||
|
||||
export async function apply() {
|
||||
Route('status', '/status', StatusHandler);
|
||||
Route('status_admin', '/.status', AdminStatusHandler);
|
||||
|
||||
@@ -68,7 +68,7 @@ export default function (env = {}) {
|
||||
entry: {
|
||||
hydro: './entry.js',
|
||||
'theme.default': './theme/default.js',
|
||||
'theme.98': './theme/98.js',
|
||||
// 'theme.98': './theme/98.js',
|
||||
},
|
||||
output: {
|
||||
path: root('public'),
|
||||
|
||||
Reference in new issue
Block a user