From 95438057c5dc7d2106cd26252a335c20c09ea744 Mon Sep 17 00:00:00 2001 From: Mart Pluijmaekers Date: Fri, 28 Nov 2025 10:37:58 +0100 Subject: [PATCH 1/2] Fixes judgehost down notification The route requires the judgehostid as route parameter, not the hostname. --- webapp/public/js/domjudge.js | 2 +- webapp/src/Service/DOMJudgeService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/public/js/domjudge.js b/webapp/public/js/domjudge.js index 6ba5118d97..81f8590afa 100644 --- a/webapp/public/js/domjudge.js +++ b/webapp/public/js/domjudge.js @@ -759,7 +759,7 @@ function updateMenuJudgehosts(data) sendNotification('Judgehost down.', {'tag': 'host_'+data[i].hostname+'@'+ Math.floor(data[i].polltime), - 'link': domjudge_base_url + '/jury/judgehosts/' + encodeURIComponent(data[i].hostname), + 'link': domjudge_base_url + '/jury/judgehosts/' + encodeURIComponent(data[i].judgehostid), 'body': data[i].hostname + ' is down'}); } } diff --git a/webapp/src/Service/DOMJudgeService.php b/webapp/src/Service/DOMJudgeService.php index 5101285bf8..ab5a9ce060 100644 --- a/webapp/src/Service/DOMJudgeService.php +++ b/webapp/src/Service/DOMJudgeService.php @@ -370,7 +370,7 @@ public function getUpdates(): array } $judgehosts = $this->em->createQueryBuilder() - ->select('j.hostname', 'j.polltime') + ->select('j.judgehostid', 'j.hostname', 'j.polltime') ->from(Judgehost::class, 'j') ->andWhere('j.enabled = 1') ->andWhere('j.hidden = 0') From 633d14b2b47895c3d80912909fd34318a5c814f5 Mon Sep 17 00:00:00 2001 From: Mart Pluijmaekers Date: Fri, 28 Nov 2025 10:50:53 +0100 Subject: [PATCH 2/2] Adds type requirements in JudgehostController This fixes issues with non-integer judgehostids throwing a 500 instead of a 404. --- webapp/src/Controller/Jury/JudgehostController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/src/Controller/Jury/JudgehostController.php b/webapp/src/Controller/Jury/JudgehostController.php index 58e9eb103a..3679c196b2 100644 --- a/webapp/src/Controller/Jury/JudgehostController.php +++ b/webapp/src/Controller/Jury/JudgehostController.php @@ -230,7 +230,7 @@ public function indexAction(Request $request): Response /** * @throws NonUniqueResultException */ - #[Route(path: '/{judgehostid}', methods: ['GET'], name: 'jury_judgehost')] + #[Route(path: '/{judgehostid<\d+>}', methods: ['GET'], name: 'jury_judgehost')] public function viewAction(Request $request, int $judgehostid): Response { /** @var Judgehost|null $judgehost */ @@ -302,7 +302,7 @@ public function viewAction(Request $request, int $judgehostid): Response * @throws NonUniqueResultException */ #[IsGranted('ROLE_ADMIN')] - #[Route(path: '/{judgehostid}/delete', name: 'jury_judgehost_delete')] + #[Route(path: '/{judgehostid<\d+>}/delete', name: 'jury_judgehost_delete')] public function deleteAction(Request $request, int $judgehostid): Response { /** @var Judgehost $judgehost */ @@ -318,7 +318,7 @@ public function deleteAction(Request $request, int $judgehostid): Response } #[IsGranted('ROLE_ADMIN')] - #[Route(path: '/{judgehostid}/enable', name: 'jury_judgehost_enable')] + #[Route(path: '/{judgehostid<\d+>}/enable', name: 'jury_judgehost_enable')] public function enableAction(RouterInterface $router, Request $request, int $judgehostid): RedirectResponse { /** @var Judgehost $judgehost */ @@ -330,7 +330,7 @@ public function enableAction(RouterInterface $router, Request $request, int $jud } #[IsGranted('ROLE_ADMIN')] - #[Route(path: '/{judgehostid}/disable', name: 'jury_judgehost_disable')] + #[Route(path: '/{judgehostid<\d+>}/disable', name: 'jury_judgehost_disable')] public function disableAction(RouterInterface $router, Request $request, int $judgehostid): RedirectResponse { /** @var Judgehost $judgehost */