mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 12:18:42 +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,
|
id: string,
|
||||||
next: NextFunction,
|
next: NextFunction,
|
||||||
end: NextFunction,
|
end: NextFunction,
|
||||||
problem_id?: string
|
problem_id: string,
|
||||||
|
result_show_source?: boolean
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import superagent from 'superagent';
|
import superagent from 'superagent';
|
||||||
import proxy from 'superagent-proxy';
|
import proxy from 'superagent-proxy';
|
||||||
import { stripVTControlCharacters } from 'util';
|
import { stripVTControlCharacters } from 'util';
|
||||||
|
import { crlf, LF } from 'crlf-normalize';
|
||||||
import sleep from '../utils/sleep';
|
import sleep from '../utils/sleep';
|
||||||
import { IBasicProvider, RemoteAccount, USER_AGENT } from '../interface';
|
import { IBasicProvider, RemoteAccount, USER_AGENT } from '../interface';
|
||||||
import Logger from '../utils/logger';
|
import Logger from '../utils/logger';
|
||||||
import { normalize, VERDICT } from '../verdict';
|
import { normalize, VERDICT } from '../verdict';
|
||||||
import { crlf, LF } from 'crlf-normalize';
|
import htmlspecialchars from '../utils/htmlspecialchars';
|
||||||
|
|
||||||
proxy(superagent);
|
proxy(superagent);
|
||||||
const logger = new Logger('remote/loj');
|
const logger = new Logger('remote/loj');
|
||||||
@ -285,7 +286,13 @@ export default class LibreojProvider implements IBasicProvider {
|
|||||||
return user_id === submission_user_id;
|
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())) {
|
if (!(await this.ensureLogin())) {
|
||||||
await end({
|
await end({
|
||||||
error: true,
|
error: true,
|
||||||
@ -463,6 +470,16 @@ export default class LibreojProvider implements IBasicProvider {
|
|||||||
`<p class="mb-0"><b>Verdict:</b> ${status}</p>` +
|
`<p class="mb-0"><b>Verdict:</b> ${status}</p>` +
|
||||||
'</div>';
|
'</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
|
// Samples
|
||||||
if (body.progress.samples) {
|
if (body.progress.samples) {
|
||||||
details += `<subtask title="Samples" info="${getSubtaskStatusDisplayText(
|
details += `<subtask title="Samples" info="${getSubtaskStatusDisplayText(
|
||||||
|
@ -207,7 +207,8 @@ class VJudge {
|
|||||||
config.remote_submission_id,
|
config.remote_submission_id,
|
||||||
next,
|
next,
|
||||||
end,
|
end,
|
||||||
problem_id
|
problem_id,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return await end({
|
return await end({
|
||||||
|
Loading…
Reference in New Issue
Block a user