mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 优化比赛模块鉴权(比赛结束时可自由查看题目)
This commit is contained in:
1 parent
99e0d2fb14
commit
c1da60a37e
4 files changed
+5
-4
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.13.50",
|
"version": "2.13.51",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export async function load(call: Entry) {
|
|||||||
for (const i of builtinModel) require(`../model/${i}`);
|
for (const i of builtinModel) require(`../model/${i}`);
|
||||||
const modelSystem = require('../model/system');
|
const modelSystem = require('../model/system');
|
||||||
const scripts = require('../upgrade');
|
const scripts = require('../upgrade');
|
||||||
let dbVer = (await modelSystem.get('db.ver')) || 0;
|
let dbVer = (await modelSystem.get('db.ver')) ?? 0;
|
||||||
const expected = scripts.length;
|
const expected = scripts.length;
|
||||||
while (dbVer < expected) {
|
while (dbVer < expected) {
|
||||||
logger.info('Upgrading database: from %d to %d', dbVer, expected);
|
logger.info('Upgrading database: from %d to %d', dbVer, expected);
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ class ContestProblemHandler extends ContestHandler {
|
|||||||
]);
|
]);
|
||||||
this.attended = this.tsdoc && this.tsdoc.attend === 1;
|
this.attended = this.tsdoc && this.tsdoc.attend === 1;
|
||||||
this.response.template = 'problem_detail.html';
|
this.response.template = 'problem_detail.html';
|
||||||
if (contest.isDone(this.tdoc)) {
|
if (!contest.isDone(this.tdoc)) {
|
||||||
if (!this.attended) throw new ContestNotAttendedError(this.tdoc.docId);
|
if (!this.attended) throw new ContestNotAttendedError(this.tdoc.docId);
|
||||||
if (contest.isNotStarted(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
|
if (contest.isNotStarted(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
|
||||||
}
|
}
|
||||||
@@ -272,6 +272,7 @@ class ContestProblemSubmitHandler extends ContestProblemHandler {
|
|||||||
@param('tid', Types.ObjectID)
|
@param('tid', Types.ObjectID)
|
||||||
@param('pid', Types.UnsignedInt)
|
@param('pid', Types.UnsignedInt)
|
||||||
async prepare(domainId: string, tid: ObjectID, pid: number) {
|
async prepare(domainId: string, tid: ObjectID, pid: number) {
|
||||||
|
if (contest.isOngoing(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
|
||||||
let rdocs = [];
|
let rdocs = [];
|
||||||
if (this.canShowRecord(this.tdoc)) {
|
if (this.canShowRecord(this.tdoc)) {
|
||||||
rdocs = await record.getUserInProblemMulti(
|
rdocs = await record.getUserInProblemMulti(
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ SystemSetting(
|
|||||||
Setting('setting_session', 'session.secure', null, false, 'boolean', 'session.secure'),
|
Setting('setting_session', 'session.secure', null, false, 'boolean', 'session.secure'),
|
||||||
Setting('setting_session', 'session.saved_expire_seconds', null, 3600 * 24 * 30, 'number', 'Saved session expire seconds'),
|
Setting('setting_session', 'session.saved_expire_seconds', null, 3600 * 24 * 30, 'number', 'Saved session expire seconds'),
|
||||||
Setting('setting_session', 'session.unsaved_expire_seconds', null, 3600 * 3, 'number', 'Unsaved session expire seconds'),
|
Setting('setting_session', 'session.unsaved_expire_seconds', null, 3600 * 3, 'number', 'Unsaved session expire seconds'),
|
||||||
Setting('setting_storage', 'db.ver', null, 1, 'number', 'Database version', null, FLAG_DISABLED | FLAG_HIDDEN),
|
Setting('setting_storage', 'db.ver', null, 0, 'number', 'Database version', null, FLAG_DISABLED | FLAG_HIDDEN),
|
||||||
Setting('setting_storage', 'user', null, 1, 'number', 'User Counter', null, FLAG_DISABLED | FLAG_HIDDEN),
|
Setting('setting_storage', 'user', null, 1, 'number', 'User Counter', null, FLAG_DISABLED | FLAG_HIDDEN),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user