vjudge: fix csgoj (#673)

pull/654/head
guke1024 12 months ago committed by GitHub
parent 7e59fd0e02
commit 9901ffa62d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -81,7 +81,7 @@ Hydro 同时支持 VJudge这意味着你可以直接在系统内导入其他
- [UOJ](https://uoj.ac):国内知名 OJ国家集训队常用
- [SPOJ](https://www.spoj.com):国内连接很不稳定,不推荐;
- [洛谷](https://www.luogu.com.cn):使用此功能需要向洛谷购买授权;
- [CSGOJ](https://cpc.csgrandeur.cn)
- [CSGOJ](https://cpc.csgrandeur.cn):广东省赛与湖南省赛赛题评测平台
- [POJ](https://poj.org):较为古董,服务器稳定性差;
- HUSTOJ理论上支持所有 HUSTOJ 驱动的系统,但由于各个系统中 UI 有差异,通常需要手动适配。

@ -37,16 +37,19 @@ csgoj.1:
monaco: cpp
highlight: cpp astyle-c
comment: //
csgoj.2:
display: Pascal
monaco: pascal
highlight: pascal
comment: //
csgoj.3:
display: Java
monaco: java
highlight: java astyle-java
comment: //
csgoj.6:
display: Python3
highlight: python
comment: '#'
csgoj.17:
display: Go
highlight: go
comment: //
*/
const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0';
@ -107,8 +110,8 @@ export default class CSGOJProvider extends BasicFetcher implements IBasicProvide
const description = [...pDescription.children].map((i) => i.outerHTML).join('');
const input = [...document.querySelector('div[name="Input"]').children].map((i) => i.outerHTML).join('');
const output = [...document.querySelector('div[name="Output"]').children].map((i) => i.outerHTML).join('');
const sampleInput = `\`\`\`input1\n${document.querySelector('div[name="Sample Input"]>pre').innerHTML.trim()}\n\`\`\``;
const sampleOutput = `\`\`\`output1\n${document.querySelector('div[name="Sample Output"]>pre').innerHTML.trim()}\n\`\`\``;
const sampleInput = `\`\`\`input1\n${document.querySelector('pre.sample_input_area').innerHTML.trim()}\n\`\`\``;
const sampleOutput = `\`\`\`output1\n${document.querySelector('pre.sample_output_area').innerHTML.trim()}\n\`\`\``;
const contents = [description, input, output, sampleInput, sampleOutput];
const hint = document.querySelector('div[name="Hint"]');
if (hint.textContent.trim().length > 4) {
@ -160,9 +163,12 @@ export default class CSGOJProvider extends BasicFetcher implements IBasicProvide
while (count < 60) {
count++;
await sleep(3000);
const { body } = await this.get(`/csgoj/Status/status_ajax?solution_id=${id}`).set('X-Requested-With', 'XMLHttpRequest');
const { body } = await this
// eslint-disable-next-line max-len
.get(`/csgoj/status/status_ajax?sort=solution_id_show&order=desc&offset=0&limit=20&problem_id=&user_id=&solution_id=${id}&language=-1&result=-1`)
.set('X-Requested-With', 'XMLHttpRequest');
const status = statusDict[body.rows[0].result] || STATUS.STATUS_SYSTEM_ERROR;
if (status === STATUS.STATUS_JUDGING) continue;
if (status === STATUS.STATUS_JUDGING || status === STATUS.STATUS_COMPILING) continue;
await end({
status,
score: status === STATUS.STATUS_ACCEPTED ? 100 : 0,

Loading…
Cancel
Save