mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-12-22 17:41:53 +00:00
feat(remote_judger/loj): include source code in result when fetching from archive
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
46592477c5
commit
050b4995ee
@ -23,7 +23,8 @@ export interface IBasicProvider {
|
||||
id: string,
|
||||
next: NextFunction,
|
||||
end: NextFunction,
|
||||
problem_id?: string
|
||||
problem_id: string,
|
||||
result_show_source?: boolean
|
||||
): Promise<void>;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
import superagent from 'superagent';
|
||||
import proxy from 'superagent-proxy';
|
||||
import { stripVTControlCharacters } from 'util';
|
||||
import { crlf, LF } from 'crlf-normalize';
|
||||
import sleep from '../utils/sleep';
|
||||
import { IBasicProvider, RemoteAccount, USER_AGENT } from '../interface';
|
||||
import Logger from '../utils/logger';
|
||||
import { normalize, VERDICT } from '../verdict';
|
||||
import { crlf, LF } from 'crlf-normalize';
|
||||
import htmlspecialchars from '../utils/htmlspecialchars';
|
||||
|
||||
proxy(superagent);
|
||||
const logger = new Logger('remote/loj');
|
||||
@ -285,7 +286,13 @@ export default class LibreojProvider implements IBasicProvider {
|
||||
return user_id === submission_user_id;
|
||||
}
|
||||
|
||||
async waitForSubmission(id: string, next, end, problem_id: string) {
|
||||
async waitForSubmission(
|
||||
id: string,
|
||||
next,
|
||||
end,
|
||||
problem_id: string,
|
||||
result_show_source = false
|
||||
) {
|
||||
if (!(await this.ensureLogin())) {
|
||||
await end({
|
||||
error: true,
|
||||
@ -463,6 +470,16 @@ export default class LibreojProvider implements IBasicProvider {
|
||||
`<p class="mb-0"><b>Verdict:</b> ${status}</p>` +
|
||||
'</div>';
|
||||
|
||||
if (result_show_source) {
|
||||
details +=
|
||||
'<div class="border-bottom p-3">' +
|
||||
'<div class="fw-bold mb-2">源代码</div>' +
|
||||
`<pre><code class="language-${body.content.language} bg-light rounded p-3">` +
|
||||
htmlspecialchars(parse(body.content.code)) +
|
||||
'</code></pre>' +
|
||||
'</div>';
|
||||
}
|
||||
|
||||
// Samples
|
||||
if (body.progress.samples) {
|
||||
details += `<subtask title="Samples" info="${getSubtaskStatusDisplayText(
|
||||
|
@ -207,7 +207,8 @@ class VJudge {
|
||||
config.remote_submission_id,
|
||||
next,
|
||||
end,
|
||||
problem_id
|
||||
problem_id,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
return await end({
|
||||
|
Loading…
Reference in New Issue
Block a user