Compare commits

..

5 Commits

Author SHA1 Message Date
2dfe735c78
Merge f39eef51e6 into 678889ba4f 2024-08-01 20:20:07 +08:00
678889ba4f
fix: update permissions
Some checks failed
Build & Push Docker Images / Build Image (., web/Dockerfile, web) (push) Failing after 18s
Build & Push Docker Images / Build Image (db, db/Dockerfile, db) (push) Failing after 12s
Build & Push Docker Images / Build Image (judger, judger/Dockerfile, judger) (push) Failing after 10s
Build & Push Docker Images / Build Image (remote_judger, remote_judger/Dockerfile, remote-judger) (push) Failing after 11s
2024-07-20 22:38:52 +08:00
e9ade3bf58
refactor: switch to gitea actions
Some checks failed
Build & Push Docker Images / Build Image (., web/Dockerfile, web) (push) Failing after 3m53s
Build & Push Docker Images / Build Image (db, db/Dockerfile, db) (push) Failing after 20s
Build & Push Docker Images / Build Image (judger, judger/Dockerfile, judger) (push) Failing after 2m55s
Build & Push Docker Images / Build Image (remote_judger, remote_judger/Dockerfile, remote-judger) (push) Failing after 32s
2024-07-20 22:10:31 +08:00
afda9290fa
fix(remote_judger/atcoder): add referer when submitting problem 2024-07-18 15:51:35 +08:00
70d5b541de
fix(remote_judger/atcoder): update LANGS_MAP 2024-07-18 10:01:26 +08:00
3 changed files with 25 additions and 142 deletions

View File

@ -1,123 +0,0 @@
---
kind: pipeline
type: docker
name: Build Docker Image (s2oj-db)
trigger:
branch:
- master
steps:
- name: tags
image: alpine
commands:
- echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:8}" > .tags
- name: docker
image: plugins/docker
settings:
registry: git.m.ac
repo: git.m.ac/baoshuo/s2oj-db
context: db
dockerfile: db/Dockerfile
username: baoshuo
password:
from_secret: GITMAC_SECRET
cache_from: git.m.ac/baoshuo/s2oj-db:latest
when:
event: push
branch: master
---
kind: pipeline
type: docker
name: Build Docker Image (s2oj-judger)
trigger:
branch:
- master
steps:
- name: tags
image: alpine
commands:
- echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:8}" > .tags
- name: docker
image: plugins/docker
settings:
registry: git.m.ac
repo: git.m.ac/baoshuo/s2oj-judger
context: judger
dockerfile: judger/Dockerfile
username: baoshuo
password:
from_secret: GITMAC_SECRET
cache_from: git.m.ac/baoshuo/s2oj-judger:latest
when:
event: push
branch: master
---
kind: pipeline
type: docker
name: Build Docker Image (s2oj-remote-judger)
trigger:
branch:
- master
steps:
- name: tags
image: alpine
commands:
- echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:8}" > .tags
- name: docker
image: plugins/docker
settings:
registry: git.m.ac
repo: git.m.ac/baoshuo/s2oj-remote-judger
context: remote_judger
dockerfile: remote_judger/Dockerfile
username: baoshuo
password:
from_secret: GITMAC_SECRET
cache_from: git.m.ac/baoshuo/s2oj-remote-judger:latest
when:
event: push
branch: master
---
kind: pipeline
type: docker
name: Build Docker Image (s2oj-web)
trigger:
branch:
- master
steps:
- name: tags
image: alpine
commands:
- echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:7}" > .tags
- name: version
image: alpine
commands:
- sed -i "s/'s2oj-version' => 'dev'/'s2oj-version' => '${DRONE_COMMIT_SHA:0:7}'/g" web/app/.default-config.php
- name: docker
image: plugins/docker
settings:
registry: git.m.ac
repo: git.m.ac/baoshuo/s2oj-web
dockerfile: web/Dockerfile
username: baoshuo
password:
from_secret: GITMAC_SECRET
cache_from: git.m.ac/baoshuo/s2oj-web:latest
when:
event: push
branch: master

View File

@ -10,9 +10,12 @@ on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
REGISTRY: ${{ startsWith(github.server_url, 'https://github.com') && 'ghcr.io' || 'git.m.ac' }}
IMAGE_BASENAME: ${{ github.repository }}
permissions:
packages: write
jobs:
build:
name: Build Image

View File

@ -10,23 +10,23 @@ const logger = new Logger('remote/atcoder');
const LANGS_MAP = {
C: {
name: 'C (GCC 9.2.1)',
id: 4001,
name: 'C (GCC 12.2.0)',
id: 5017,
comment: '//',
},
'C++': {
name: 'C++ (GCC 9.2.1)',
id: 4003,
name: 'C++ 20 (GCC 12.2.0)',
id: 5001,
comment: '//',
},
Pascal: {
name: 'Pascal (FPC 3.0.4)',
id: 4041,
name: 'Pascal (FPC 3.2.2)',
id: 5041,
comment: '//',
},
Python3: {
name: 'Python (3.8.2)',
id: 4006,
name: 'Python (CPython 3.11.4)',
id: 5055,
comment: '#',
},
};
@ -193,9 +193,8 @@ export default class AtcoderProvider implements IBasicProvider {
}
const [contestId, problemId] = parseProblemId(id);
const csrf = await this.getCsrfToken(
`/contests/${contestId}/tasks/${problemId}`
);
const referer = `/contests/${contestId}/tasks/${problemId}`;
const csrf = await this.getCsrfToken(referer);
logger.debug(
'Submitting',
@ -208,11 +207,13 @@ export default class AtcoderProvider implements IBasicProvider {
await next({ status: 'Submitting to AtCoder...' });
// TODO: check submit time to ensure submission
const res = await this.post(`/contests/${contestId}/submit`).send({
csrf_token: csrf,
const res = await this.post(`/contests/${contestId}/submit`)
.set('Referer', referer)
.send({
'data.TaskScreenName': problemId,
'data.LanguageId': programType.id,
sourceCode: code,
csrf_token: csrf,
});
if (res.error) {
@ -233,7 +234,9 @@ export default class AtcoderProvider implements IBasicProvider {
const { text: status, header: status_header } = await this.get(
`/contests/${contestId}/submissions/me`
).retry(3);
)
.set('Referer', referer)
.retry(3);
if (status_header['set-cookie']) {
this.cookie = status_header['set-cookie'];