From 2889b6df81943422930d11baccc1ec170c3a6063 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 20 Mar 2023 15:18:50 +0800 Subject: [PATCH] fix: disable custom test in remote problem --- web/app/libs/uoj-utility-lib.php | 29 ++++++++++++++++++++++++++ web/app/libs/uoj-utility-lib.php.patch | 13 ++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 web/app/libs/uoj-utility-lib.php create mode 100644 web/app/libs/uoj-utility-lib.php.patch diff --git a/web/app/libs/uoj-utility-lib.php b/web/app/libs/uoj-utility-lib.php new file mode 100644 index 0000000..faf6c2e --- /dev/null +++ b/web/app/libs/uoj-utility-lib.php @@ -0,0 +1,29 @@ + 'answer', + 'type' => 'source code', + 'file_name' => 'answer.code' + ); + foreach (getProblemSubmissionRequirement($problem) as $req) { + if ($req['name'] == 'answer' && $req['type'] == 'source code' && isset($req['languages'])) { + $answer['languages'] = $req['languages']; + } + } + return array( + $answer, + array( + 'name' => 'input', + 'type' => 'text', + 'file_name' => 'input.txt' + ) + ); + } +} diff --git a/web/app/libs/uoj-utility-lib.php.patch b/web/app/libs/uoj-utility-lib.php.patch new file mode 100644 index 0000000..d79df0f --- /dev/null +++ b/web/app/libs/uoj-utility-lib.php.patch @@ -0,0 +1,13 @@ +--- UOJ-System/web/app/libs/uoj-utility-lib.php 2022-12-30 09:54:05.452022649 +0800 ++++ UOJ-Luogu-RemoteJudge/web/app/libs/uoj-utility-lib.php 2023-03-20 15:17:40.943109445 +0800 +@@ -150,7 +150,9 @@ + } + function getProblemCustomTestRequirement($problem) { + $extra_config = json_decode($problem['extra_config'], true); +- if (isset($extra_config['custom_test_requirement'])) { ++ if ($problem['type'] != 'local') { ++ return array(); ++ } elseif (isset($extra_config['custom_test_requirement'])) { + return $extra_config['custom_test_requirement']; + } else { + $answer = array(