From e2fc3602792d3d18c6a6af91e7f7ecf4a4cb28c0 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 6 Feb 2023 14:18:53 +0800 Subject: [PATCH] feat(remote_judger): make details more beautiful --- remote_judger/src/providers/codeforces.ts | 23 +++++++++++++------ remote_judger/src/providers/loj.ts | 28 +++++++++++++++++------ remote_judger/src/providers/luogu.ts | 27 ++++++++++++++++------ web/app/libs/uoj-html-lib.php | 2 +- 4 files changed, 58 insertions(+), 22 deletions(-) diff --git a/remote_judger/src/providers/codeforces.ts b/remote_judger/src/providers/codeforces.ts index e2c5c0e..cfd3f50 100644 --- a/remote_judger/src/providers/codeforces.ts +++ b/remote_judger/src/providers/codeforces.ts @@ -420,13 +420,22 @@ export default class CodeforcesProvider implements IBasicProvider { const details = '
' + '
' + - `

Contest: ${stripHtml(body.contestName).result}

` + - `

Problem: ${stripHtml(body.problemName).result}

` + - `

Remote submission: ${id}

` + - `

Remote account: ${remote_handle}

` + - `

Verdict: ${ - stripHtml(body.verdict).result - }

` + + '' + + '' + + '' + + Object.entries({ + 比赛: stripHtml(body.contestName).result, + 题目: stripHtml(body.problemName).result, + 提交记录: `${id}`, + 账号: `${remote_handle}`, + 状态: stripHtml(body.verdict).result, + }) + .map( + o => `` + ) + .join('') + + '' + + '
远端信息
${o[0]}${o[1]}
' + '
' + `${tests.join('\n')}` + '
'; diff --git a/remote_judger/src/providers/loj.ts b/remote_judger/src/providers/loj.ts index f8b9ca4..e4bb753 100644 --- a/remote_judger/src/providers/loj.ts +++ b/remote_judger/src/providers/loj.ts @@ -7,6 +7,7 @@ import { IBasicProvider, RemoteAccount, USER_AGENT } from '../interface'; import Logger from '../utils/logger'; import { normalize, VERDICT } from '../verdict'; import htmlspecialchars from '../utils/htmlspecialchars'; +import { stripHtml } from 'string-strip-html'; proxy(superagent); const logger = new Logger('remote/loj'); @@ -461,13 +462,26 @@ export default class LibreojProvider implements IBasicProvider { details += '
' + - `

Problem: #${body.meta.problem.displayId}. ${body.meta.problemTitle}

` + - `

Remote submission: ${id}

` + - `

Remote submit time: ${new Date( - body.meta.submitTime - ).toLocaleString('zh-CN')}

` + - `

Remote account: ${body.meta.submitter.username}

` + - `

Verdict: ${status}

` + + '' + + '' + + '' + + Object.entries({ + 题目: `#${ + body.meta.problem.displayId + }. ${htmlspecialchars(body.meta.problemTitle)}`, + 提交记录: `${id}`, + 提交时间: new Date(body.meta.submitTime).toLocaleString('zh-CN'), + 账号: `${body.meta.submitter.username}`, + 状态: status, + }) + .map( + o => `` + ) + .join('') + + '' + + '
远端信息
${o[0]}${o[1]}
' + '
'; if (result_show_source) { diff --git a/remote_judger/src/providers/luogu.ts b/remote_judger/src/providers/luogu.ts index 770053b..34824de 100644 --- a/remote_judger/src/providers/luogu.ts +++ b/remote_judger/src/providers/luogu.ts @@ -296,13 +296,26 @@ export default class LuoguProvider implements IBasicProvider { details += '
' + - `

Problem: ${data.problem.pid} ${data.problem.title}

` + - `

Remote submission: R${id}

` + - `

Remote submit time: ${new Date( - data.submitTime * 1000 - ).toLocaleString('zh-CN')}

` + - `

Remote account: ${data.user.name}

` + - `

Verdict: ${status}

` + + '' + + '' + + '' + + Object.entries({ + 题目: `${data.problem.pid} ${htmlspecialchars( + data.problem.title + )}`, + 提交记录: `R${id}`, + 提交时间: new Date(data.submitTime * 1000).toLocaleString('zh-CN'), + 账号: `${data.user.name}`, + 状态: status, + }) + .map( + o => `` + ) + .join('') + + '' + + '
远端信息
${o[0]}${o[1]}
' + '
'; if (data.detail.judgeResult.subtasks.length === 1) { diff --git a/web/app/libs/uoj-html-lib.php b/web/app/libs/uoj-html-lib.php index f6f8abf..152819c 100644 --- a/web/app/libs/uoj-html-lib.php +++ b/web/app/libs/uoj-html-lib.php @@ -543,7 +543,7 @@ class JudgmentDetailsPrinter { if ($test_memory >= 0) { echo '
'; - echo ' ', $test_memory, 'kB'; + echo ' ', $test_memory, ' kB'; echo '
'; }