mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
patches from chongqing site
This commit is contained in:
16 files changed
+146
-85
No files matched your search
@@ -36,13 +36,13 @@
|
||||
"koa-proxies": "^0.12.4",
|
||||
"koa-static-cache": "^5.1.4",
|
||||
"lodash": "^4.17.21",
|
||||
"lru-cache": "^11.2.2",
|
||||
"lru-cache": "^11.2.4",
|
||||
"mime-types": "^3.0.2",
|
||||
"moment-timezone": "^0.6.0",
|
||||
"mongodb": "^7.0.0",
|
||||
"mongodb-uri": "^0.9.7",
|
||||
"nanoid": "^5.1.6",
|
||||
"nodemailer": "^7.0.10",
|
||||
"nodemailer": "^7.0.11",
|
||||
"notp": "^2.0.3",
|
||||
"p-queue": "^9.0.1",
|
||||
"sanitize-filename": "^1.6.3",
|
||||
|
||||
@@ -485,8 +485,11 @@ export class ContestCodeHandler extends Handler {
|
||||
async get(domainId: string, tid: ObjectId, all: boolean) {
|
||||
await this.limitRate('contest_code', 60, 10);
|
||||
const [tdoc, tsdocs] = await contest.getAndListStatus(domainId, tid);
|
||||
if (!this.user.own(tdoc) && !this.user.hasPriv(PRIV.PRIV_READ_RECORD_CODE)) {
|
||||
this.checkPerm(PERM.PERM_READ_RECORD_CODE);
|
||||
if (!this.user.own(tdoc)) {
|
||||
if (!this.user.hasPriv(PRIV.PRIV_READ_RECORD_CODE)) {
|
||||
this.checkPerm(PERM.PERM_READ_RECORD_CODE);
|
||||
}
|
||||
if (!contest.isDone(tdoc)) throw new ContestNotEndedError(domainId, tid);
|
||||
}
|
||||
if (!contest.canShowRecord.call(this, tdoc as any, true)) {
|
||||
throw new PermissionError(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD);
|
||||
@@ -754,7 +757,7 @@ export class ContestBalloonHandler extends ContestManagementBaseHandler {
|
||||
async postDone(domainId: string, tid: ObjectId, bid: ObjectId) {
|
||||
const balloon = await contest.getBalloon(domainId, tid, bid);
|
||||
if (!balloon) throw new ValidationError('balloon');
|
||||
if (balloon.sent) throw new ValidationError('balloon', null, 'Balloon already sent');
|
||||
if (balloon.sent) throw new ValidationError('Balloon already sent');
|
||||
await contest.updateBalloon(domainId, tid, bid, { sent: this.user._id, sentAt: new Date() });
|
||||
this.back();
|
||||
}
|
||||
|
||||
@@ -124,15 +124,13 @@ class HomeworkDetailHandler extends Handler {
|
||||
await contest.setStatus(domainId, tid, this.user._id, { startAt: new Date() });
|
||||
tsdoc.startAt = new Date();
|
||||
}
|
||||
for (const pdetail of tsdoc.journal || []) {
|
||||
const valid = (tsdoc.journal || []).filter((p) => this.tdoc.pids.includes(p.pid));
|
||||
for (const pdetail of valid) {
|
||||
psdict[pdetail.pid] = pdetail;
|
||||
rdict[pdetail.rid] = { _id: pdetail.rid };
|
||||
}
|
||||
if (contest.canShowSelfRecord.call(this, this.tdoc) && tsdoc.journal) {
|
||||
rdict = await record.getList(
|
||||
domainId,
|
||||
tsdoc.journal.map((pdetail) => pdetail.rid),
|
||||
);
|
||||
if (contest.canShowSelfRecord.call(this, this.tdoc) && valid.length) {
|
||||
rdict = await record.getList(domainId, valid.map((pdetail) => pdetail.rid));
|
||||
}
|
||||
}
|
||||
Object.assign(this.response.body, { pdict, psdict, rdict });
|
||||
|
||||
@@ -331,6 +331,7 @@ class RecordMainConnectionHandler extends ConnectionHandler {
|
||||
if (rdoc.domainId !== this.args.domainId) return;
|
||||
if (!this.pretest && typeof rdoc.input === 'string') return;
|
||||
if (!this.all) {
|
||||
if (!rdoc.contest && this.tid) return;
|
||||
if (rdoc.contest && ![this.tid, '000000000000000000000000'].includes(rdoc.contest.toString())) return;
|
||||
if (this.tid && rdoc.contest?.toString() !== '0'.repeat(24)) {
|
||||
if (rdoc.uid !== this.user._id && !contest.canShowRecord.call(this, this.tdoc, true)) return;
|
||||
|
||||
Reference in new issue
Block a user