From 73f52989115344e06c4dca99daa7d74c4f59df92 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 19 Jan 2023 11:49:15 +0800 Subject: [PATCH] feat(problem): display remote problem url --- web/app/models/UOJProblem.php | 6 +++++- web/app/models/UOJRemoteProblem.php | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/web/app/models/UOJProblem.php b/web/app/models/UOJProblem.php index 3bae2cf..463d623 100644 --- a/web/app/models/UOJProblem.php +++ b/web/app/models/UOJProblem.php @@ -392,6 +392,7 @@ class UOJProblem { } $remote_oj = $this->getExtraConfig('remote_online_judge'); + $remote_id = $this->getExtraConfig('remote_problem_id'); if (!$remote_oj || !array_key_exists($remote_oj, UOJRemoteProblem::$providers)) { return 'Error'; @@ -399,7 +400,10 @@ class UOJProblem { $provider = UOJRemoteProblem::$providers[$remote_oj]; - return HTML::tag('a', ['href' => $provider['url'], 'target' => '_blank'], $provider['name']); + return HTML::tag('a', [ + 'href' => UOJRemoteProblem::getProblemRemoteUrl($remote_oj, $remote_id), + 'target' => '_blank' + ], $provider['name']); } public function getDifficultyHTML() { diff --git a/web/app/models/UOJRemoteProblem.php b/web/app/models/UOJRemoteProblem.php index e4c69f4..6074faa 100644 --- a/web/app/models/UOJRemoteProblem.php +++ b/web/app/models/UOJRemoteProblem.php @@ -6,7 +6,6 @@ class UOJRemoteProblem { 'name' => 'Codeforces', 'short_name' => 'CF', 'url' => 'https://codeforces.com', - 'host' => 'https://codeforces.com', 'not_exists_texts' => [ '