mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
vjudge: fix csgoj (#673)
This commit is contained in:
1 parent
7e59fd0e02
commit
9901ffa62d
2 files changed
+16
-10
No files matched your search
@@ -81,7 +81,7 @@ Hydro 同时支持 VJudge,这意味着你可以直接在系统内导入其他
|
|||||||
- [UOJ](https://uoj.ac):国内知名 OJ,国家集训队常用;
|
- [UOJ](https://uoj.ac):国内知名 OJ,国家集训队常用;
|
||||||
- [SPOJ](https://www.spoj.com):国内连接很不稳定,不推荐;
|
- [SPOJ](https://www.spoj.com):国内连接很不稳定,不推荐;
|
||||||
- [洛谷](https://www.luogu.com.cn):使用此功能需要向洛谷购买授权;
|
- [洛谷](https://www.luogu.com.cn):使用此功能需要向洛谷购买授权;
|
||||||
- [CSGOJ](https://cpc.csgrandeur.cn);
|
- [CSGOJ](https://cpc.csgrandeur.cn):广东省赛与湖南省赛赛题评测平台;
|
||||||
- [POJ](https://poj.org):较为古董,服务器稳定性差;
|
- [POJ](https://poj.org):较为古董,服务器稳定性差;
|
||||||
- HUSTOJ:理论上支持所有 HUSTOJ 驱动的系统,但由于各个系统中 UI 有差异,通常需要手动适配。
|
- HUSTOJ:理论上支持所有 HUSTOJ 驱动的系统,但由于各个系统中 UI 有差异,通常需要手动适配。
|
||||||
|
|
||||||
|
|||||||
@@ -37,16 +37,19 @@ csgoj.1:
|
|||||||
monaco: cpp
|
monaco: cpp
|
||||||
highlight: cpp astyle-c
|
highlight: cpp astyle-c
|
||||||
comment: //
|
comment: //
|
||||||
csgoj.2:
|
|
||||||
display: Pascal
|
|
||||||
monaco: pascal
|
|
||||||
highlight: pascal
|
|
||||||
comment: //
|
|
||||||
csgoj.3:
|
csgoj.3:
|
||||||
display: Java
|
display: Java
|
||||||
monaco: java
|
monaco: java
|
||||||
highlight: java astyle-java
|
highlight: java astyle-java
|
||||||
comment: //
|
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';
|
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 description = [...pDescription.children].map((i) => i.outerHTML).join('');
|
||||||
const input = [...document.querySelector('div[name="Input"]').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 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 sampleInput = `\`\`\`input1\n${document.querySelector('pre.sample_input_area').innerHTML.trim()}\n\`\`\``;
|
||||||
const sampleOutput = `\`\`\`output1\n${document.querySelector('div[name="Sample Output"]>pre').innerHTML.trim()}\n\`\`\``;
|
const sampleOutput = `\`\`\`output1\n${document.querySelector('pre.sample_output_area').innerHTML.trim()}\n\`\`\``;
|
||||||
const contents = [description, input, output, sampleInput, sampleOutput];
|
const contents = [description, input, output, sampleInput, sampleOutput];
|
||||||
const hint = document.querySelector('div[name="Hint"]');
|
const hint = document.querySelector('div[name="Hint"]');
|
||||||
if (hint.textContent.trim().length > 4) {
|
if (hint.textContent.trim().length > 4) {
|
||||||
@@ -160,9 +163,12 @@ export default class CSGOJProvider extends BasicFetcher implements IBasicProvide
|
|||||||
while (count < 60) {
|
while (count < 60) {
|
||||||
count++;
|
count++;
|
||||||
await sleep(3000);
|
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;
|
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({
|
await end({
|
||||||
status,
|
status,
|
||||||
score: status === STATUS.STATUS_ACCEPTED ? 100 : 0,
|
score: status === STATUS.STATUS_ACCEPTED ? 100 : 0,
|
||||||
|
|||||||
Reference in new issue
Block a user