mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: problem hackable check (#427)
This commit is contained in:
1 parent
b34ed2d5a2
commit
25444f69f0
4 files changed
+4
-2
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.1",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -28,6 +28,7 @@ export default class Hydro {
|
||||
this.config.cookie = this.config.cookie || '';
|
||||
this.config.last_update_at = this.config.last_update_at || 0;
|
||||
if (!this.config.server_url.startsWith('http')) this.config.server_url = `http://${this.config.server_url}`;
|
||||
if (!this.config.server_url.endsWith('/')) this.config.server_url = `${this.config.server_url}/`;
|
||||
this.getLang = this.getLang.bind(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.17.1",
|
||||
"version": "3.17.2",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -550,6 +550,7 @@ export class ProblemHackHandler extends ProblemDetailHandler {
|
||||
@param('rid', Types.ObjectID)
|
||||
@param('tid', Types.ObjectID, true)
|
||||
async prepare(domainId: string, rid: ObjectID, tid?: ObjectID) {
|
||||
if (typeof this.pdoc.config !== 'object' || !this.pdoc.config.hackable) throw new ForbiddenError('This problem is not hackable.');
|
||||
this.rdoc = await record.get(domainId, rid);
|
||||
if (!this.rdoc || this.rdoc.pid !== this.pdoc.docId
|
||||
|| this.rdoc.contest?.toString() !== tid?.toString()) throw new RecordNotFoundError(domainId, rid);
|
||||
|
||||
Reference in new issue
Block a user