judge: allow unlimited access & fix file corruption when errored (#726)

Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
Yang Gaoandundefined authored and GitHub committed 2024-02-20 07:39:56 +08:00
1 parent 1f2100b9d1
commit 7ea3c91f5f
6 files changed
+42 -37

No files matched your search

+5 -1
View File
@@ -154,11 +154,13 @@ export async function end(body: Partial<JudgeResultBody>) {
}
export class JudgeFilesDownloadHandler extends Handler {
noCheckPermView = true;
notUsage = true;
async get() {
this.response.body = 'ok';
}
noCheckPermView = true;
@post('id', Types.String, true)
@post('files', Types.Set, true)
@post('pid', Types.UnsignedInt, true)
@@ -207,6 +209,8 @@ export async function processJudgeFileCallback(rid: ObjectId, filename: string,
}
export class JudgeFileUpdateHandler extends Handler {
notUsage = true;
@post('rid', Types.ObjectId)
@post('name', Types.Filename)
async post(domainId: string, rid: ObjectId, filename: string) {
+1
View File
@@ -104,6 +104,7 @@ export class FSDownloadHandler extends Handler {
export class StorageHandler extends Handler {
noCheckPermView = true;
notUsage = true;
@param('target', Types.Name)
@param('filename', Types.Filename, true)
+2 -1
View File
@@ -178,6 +178,7 @@ export class HandlerCommon {
export class Handler extends HandlerCommon {
loginMethods: any;
noCheckPermView = false;
notUsage = false;
allowCors = false;
__param: Record<string, decorators.ParamOption<any>[]>;
@@ -207,7 +208,7 @@ export class Handler extends HandlerCommon {
this.context.pendingError = new CsrfTokenError();
}
}
if (!argv.options.benchmark) await this.limitRate('global', 5, 100);
if (!argv.options.benchmark && !this.notUsage) await this.limitRate('global', 5, 100);
if (!this.noCheckPermView && !this.user.hasPriv(PRIV.PRIV_VIEW_ALL_DOMAIN)) this.checkPerm(PERM.PERM_VIEW);
this.loginMethods = Object.keys(global.Hydro.module.oauth)
.map((key) => ({