mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&judge: add isTrusted option
This commit is contained in:
4 files changed
+12
-4
No files matched your search
@@ -41,6 +41,7 @@ interface Args {
|
||||
next: NextFunction;
|
||||
key: string;
|
||||
isSelfSubmission: boolean;
|
||||
trusted: boolean;
|
||||
lang: string;
|
||||
langConfig?: LangConfig;
|
||||
}
|
||||
@@ -85,6 +86,6 @@ export default async function readCases(folder: string, cfg: ProblemConfigFile =
|
||||
}
|
||||
result.subtasks = normalizeSubtasks(result.subtasks || [], checkFile, config.time, config.memory, false, timeRate, memoryRate);
|
||||
if (result.key && args.key !== result.key) throw new FormatError('Incorrect secret key');
|
||||
if (!result.key) isValidConfig(result);
|
||||
if (!result.key && !args.trusted) isValidConfig(result);
|
||||
return result;
|
||||
}
|
||||
@@ -112,6 +112,7 @@ export class JudgeTask {
|
||||
next: this.next,
|
||||
isSelfSubmission: this.meta.problemOwner === this.request.uid,
|
||||
key: md5(`${this.source}/${getConfig('secret')}`),
|
||||
trusted: this.request.trusted,
|
||||
lang: this.lang,
|
||||
langConfig: (this.request.type === 'generate' || ['objective', 'submit_answer'].includes(this.request.config.type))
|
||||
? null : this.session.getLang(this.lang),
|
||||
|
||||
Reference in new issue
Block a user