From 06a9080a5c87efc741996afe58ac875a73a62975 Mon Sep 17 00:00:00 2001 From: undefined Date: Thu, 28 Dec 2023 07:32:11 +0800 Subject: [PATCH] core: only allow record lookup for up to 10 weeks when allDomain enabled --- packages/hydrooj/src/handler/record.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/hydrooj/src/handler/record.ts b/packages/hydrooj/src/handler/record.ts index d3692b5ba..ab11e14c9 100644 --- a/packages/hydrooj/src/handler/record.ts +++ b/packages/hydrooj/src/handler/record.ts @@ -20,7 +20,7 @@ import user from '../model/user'; import { ConnectionHandler, param, subscribe, Types, } from '../service/server'; -import { buildProjection } from '../utils'; +import { buildProjection, Time } from '../utils'; import { ContestDetailBaseHandler } from './contest'; import { postJudge } from './judge'; @@ -87,6 +87,7 @@ class RecordListHandler extends ContestDetailBaseHandler { if (allDomain) { this.checkPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN); delete q.contest; + q._id = { $gt: Time.getObjectID(new Date(Date.now() - 10 * Time.week)) }; } let cursor = record.getMulti(allDomain ? '' : domainId, q).sort('_id', -1); if (!full) cursor = cursor.project(buildProjection(record.PROJECTION_LIST));