Problem: Kattis login used `/login/email` without a CSRF token (always failed), the homepage login check used GET requests that Kattis blocks from httpx, the C++ language ID was `"C++17"` (rejected by the API), and `submit.lua` passed a relative source file path to Python whose cwd is the plugin directory. Solution: Switch login to `POST /login` with `script=true` (200 = success, 403 = bad credentials), remove the broken `_check_kattis_login` entirely, add a submit retry on `"Request validation failed"`, correct the Kattis cpp language ID to `"C++"`, and absolutize the source file path in `submit.lua` via `fnamemodify(..., ':p')` before spawning.
30 lines
588 B
Python
30 lines
588 B
Python
LANGUAGE_IDS = {
|
|
"atcoder": {
|
|
"cpp": "6017",
|
|
"python": "6082",
|
|
},
|
|
"codeforces": {
|
|
"cpp": "89",
|
|
"python": "70",
|
|
},
|
|
"cses": {
|
|
"cpp": "C++17",
|
|
"python": "Python3",
|
|
},
|
|
"usaco": {
|
|
"cpp": "cpp",
|
|
"python": "python",
|
|
},
|
|
"kattis": {
|
|
"cpp": "C++",
|
|
"python": "Python 3",
|
|
},
|
|
"codechef": {
|
|
"cpp": "C++ 17",
|
|
"python": "Python 3",
|
|
},
|
|
}
|
|
|
|
|
|
def get_language_id(platform: str, language: str) -> str | None:
|
|
return LANGUAGE_IDS.get(platform, {}).get(language)
|