core: langs: add validAs option

This commit is contained in:
undefined committed 2023-05-10 20:20:12 +08:00
1 parent d20c405da9
commit 1b1faa9ff9
4 files changed
+19 -28

No files matched your search

+3 -1
View File
@@ -42,7 +42,9 @@ class AccountService {
const end = (payload) => JudgeHandler.end({ ...payload, rid: task.rid });
await next({ status: STATUS.STATUS_FETCHED });
try {
const comment = SettingModel.langs[task.lang].comment;
const langConfig = SettingModel.langs[task.lang];
if (langConfig.validAs?.[this.account.type]) task.lang = langConfig.validAs[this.account.type];
const comment = langConfig.comment;
if (comment) {
const msg = `Hydro submission #${task.rid}@${new Date().getTime()}`;
if (typeof comment === 'string') task.code = `${comment} ${msg}\n${task.code}`;