dev: allow specifying runtime version
Docker Image CI / build-and-push-image (push) Waiting to run
Maintain Release Merge PR / update-release-pr (push) Waiting to run
release-please / release-please (push) Waiting to run
test / test (18.x) (push) Waiting to run
test / test (20.x) (push) Waiting to run
test / test (22.x) (push) Waiting to run

This commit is contained in:
KernelDeimos
2025-01-28 14:25:45 -05:00
parent c852a287e8
commit 1dad2e8716
@@ -35,6 +35,17 @@ class Judge0Service extends BaseService {
if ( runtime.startsWith('j0-') ) {
return runtime.slice(3);
}
if ( runtime.includes('-') ) {
const versionIndex = runtime.lastIndexOf('-');
const langPart = runtime.slice(0, versionIndex);
const versionPart = runtime.slice(versionIndex + 1);
const lang = this.languages.find((lang) =>
lang.language === langPart && lang.version === versionPart
);
if ( lang ) {
return lang.judge0_id;
}
}
let lang = this.languages.find((lang) => lang.language === runtime);
if ( lang ) {
return lang.judge0_id;