mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: fix lang select
This commit is contained in:
1 parent
ce8b77a6f7
commit
865f30fe42
9 files changed
+32
-34
No files matched your search
+3
-3
@@ -36,8 +36,8 @@
|
||||
"@types/node": "^18.11.3",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
||||
"@typescript-eslint/parser": "^5.41.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.42.0",
|
||||
"@typescript-eslint/parser": "^5.42.0",
|
||||
"autocannon": "^7.10.0",
|
||||
"cac": "^6.7.14",
|
||||
"cross-env": "^7.0.3",
|
||||
@@ -58,7 +58,7 @@
|
||||
"latest-version": "7.0.0",
|
||||
"mocha": "^10.1.0",
|
||||
"mongodb": "^3.7.3",
|
||||
"mongodb-memory-server": "^8.9.3",
|
||||
"mongodb-memory-server": "^8.9.5",
|
||||
"nyc": "^15.1.0",
|
||||
"ora": "^6.1.2",
|
||||
"semver": "^7.3.8",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"p-queue": "^7.3.0",
|
||||
"schemastery": "^3.5.4",
|
||||
"shell-quote": "^1.7.4",
|
||||
"superagent": "^8.0.2",
|
||||
"superagent": "^8.0.3",
|
||||
"ws": "^8.10.0"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
@@ -23,7 +23,7 @@
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/lodash": "^4.14.186",
|
||||
"@types/lodash": "^4.14.187",
|
||||
"@types/shell-quote": "^1.7.1",
|
||||
"@types/ws": "^8.5.3"
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.198.0",
|
||||
"@aws-sdk/lib-storage": "^3.198.0",
|
||||
"@aws-sdk/middleware-endpoint": "^3.198.0",
|
||||
"@aws-sdk/s3-presigned-post": "^3.198.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.198.0",
|
||||
"@aws-sdk/client-s3": "^3.202.0",
|
||||
"@aws-sdk/lib-storage": "^3.202.0",
|
||||
"@aws-sdk/middleware-endpoint": "^3.201.0",
|
||||
"@aws-sdk/s3-presigned-post": "^3.202.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.202.0",
|
||||
"@graphql-tools/schema": "^8.5.1",
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
"adm-zip": "0.5.5",
|
||||
@@ -51,7 +51,7 @@
|
||||
"schemastery": "^3.5.4",
|
||||
"semver": "^7.3.8",
|
||||
"serialize-javascript": "^6.0.0",
|
||||
"superagent": "^8.0.2",
|
||||
"superagent": "^8.0.3",
|
||||
"thirty-two": "^1.0.2",
|
||||
"ws": "^8.10.0"
|
||||
},
|
||||
@@ -63,7 +63,7 @@
|
||||
"@types/koa-compress": "^4.0.3",
|
||||
"@types/koa-router": "^7.4.4",
|
||||
"@types/koa-static-cache": "^5.1.1",
|
||||
"@types/lodash": "^4.14.186",
|
||||
"@types/lodash": "^4.14.187",
|
||||
"@types/mime-types": "^2.1.1",
|
||||
"@types/mongodb": "^3.6.20",
|
||||
"@types/nodemailer": "^6.4.6",
|
||||
|
||||
@@ -511,7 +511,11 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
@param('input', Types.String, true)
|
||||
@param('tid', Types.ObjectID, true)
|
||||
async post(domainId: string, lang: string, code: string, pretest = false, input = '', tid?: ObjectID) {
|
||||
if (this.response.body.pdoc.config?.langs && !this.response.body.pdoc.config.langs.includes(lang)) {
|
||||
const config = this.pdoc.config;
|
||||
if (typeof config === 'string' || config === null) throw new BadRequestError('Problem configuration incorrect');
|
||||
if (config.type === 'objective') {
|
||||
lang = '_';
|
||||
} else if (config.langs && !config.langs.includes(lang)) {
|
||||
throw new BadRequestError('Language not allowed.');
|
||||
}
|
||||
if (pretest) {
|
||||
@@ -527,8 +531,6 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
if (!code) {
|
||||
const file = this.request.files?.file;
|
||||
if (!file || file.size === 0) throw new ValidationError('code');
|
||||
const config = this.response.body.pdoc.config;
|
||||
if (typeof config !== 'object' || config === null) throw new BadRequestError('Incorrect problem config');
|
||||
const sizeLimit = config.type === 'submit_answer' ? 128 * 1024 * 1024 : 65535;
|
||||
if (file.size > sizeLimit) throw new ValidationError('file');
|
||||
if (file.size > 65535 || await isBinaryFile(file.filepath, file.size)) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"@types/turndown": "^5.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"mariadb": "^3.0.1",
|
||||
"mariadb": "^3.0.2",
|
||||
"mongodb": "^3.7.3",
|
||||
"mysql": "^2.18.1",
|
||||
"turndown": "^7.1.1"
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"sonic-channel": "^1.2.14"
|
||||
"sonic-channel": "^1.3.0"
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@
|
||||
"lint": "eslint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blueprintjs/core": "4.11.4",
|
||||
"@blueprintjs/select": "4.8.4",
|
||||
"@blueprintjs/core": "4.11.6",
|
||||
"@blueprintjs/select": "4.8.6",
|
||||
"@fontsource/dm-mono": "^4.5.10",
|
||||
"@fontsource/fira-code": "^4.5.12",
|
||||
"@fontsource/inconsolata": "^4.5.9",
|
||||
@@ -31,8 +31,8 @@
|
||||
"@types/qrcode": "^1.5.0",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
"@types/redux-logger": "^3.0.9",
|
||||
"@types/serviceworker": "^0.0.54",
|
||||
"@types/sharedworker": "^0.0.83",
|
||||
"@types/serviceworker": "^0.0.55",
|
||||
"@types/sharedworker": "^0.0.84",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@vscode/codicons": "^0.0.32",
|
||||
"autoprefixer": "^10.4.13",
|
||||
@@ -44,7 +44,7 @@
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"css-loader": "^6.7.1",
|
||||
"diff": "^5.1.0",
|
||||
"diff-dom": "^4.2.7",
|
||||
"diff-dom": "^4.2.8",
|
||||
"echarts": "^5.4.0",
|
||||
"emojis-keywords": "2.0.0",
|
||||
"emojis-list": "2.1.0",
|
||||
@@ -68,7 +68,7 @@
|
||||
"monaco-editor": "0.33.0",
|
||||
"monaco-editor-nls": "^2.0.0",
|
||||
"monaco-editor-webpack-plugin": "^7.0.1",
|
||||
"monaco-graphql": "^1.1.3",
|
||||
"monaco-graphql": "^1.1.4",
|
||||
"monaco-themes": "^0.4.2",
|
||||
"monaco-yaml": "^4.0.2",
|
||||
"nanoid": "^4.0.0",
|
||||
@@ -107,7 +107,7 @@
|
||||
"timeago-react": "^3.0.5",
|
||||
"timeago.js": "^4.0.2",
|
||||
"ts-loader": "^9.4.1",
|
||||
"vditor": "^3.8.17",
|
||||
"vditor": "^3.8.18",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"web-streams-polyfill": "^3.2.1",
|
||||
"webpack": "^5.74.0",
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
import CustomSelectAutoComplete from 'vj/components/autocomplete/CustomSelectAutoComplete';
|
||||
import { NamedPage } from 'vj/misc/Page';
|
||||
import i18n from 'vj/utils/i18n';
|
||||
|
||||
const page = new NamedPage('domain_edit', () => {
|
||||
const prefixes = new Set(Object.keys(window.LANGS).filter((i) => i.includes('.')).map((i) => i.split('.')[0]));
|
||||
const langs = [
|
||||
{ key: '_', name: i18n('objective') },
|
||||
...Object.keys(window.LANGS).filter((i) => !prefixes.has(i)).map((i) => (
|
||||
{ name: `${i.includes('.') ? `${window.LANGS[i.split('.')[0]].display}/` : ''}${window.LANGS[i].display}`, _id: i }
|
||||
)),
|
||||
];
|
||||
const langs = Object.keys(window.LANGS).filter((i) => !prefixes.has(i)).map((i) => (
|
||||
{ name: `${i.includes('.') ? `${window.LANGS[i.split('.')[0]].display}/` : ''}${window.LANGS[i].display}`, _id: i }
|
||||
));
|
||||
|
||||
const $langSelect = $('[name=langs]');
|
||||
$langSelect.val(($langSelect.val() as string).split(',').filter((i) => !prefixes.has(i)));
|
||||
@@ -17,7 +13,7 @@ const page = new NamedPage('domain_edit', () => {
|
||||
const select: CustomSelectAutoComplete<true> = CustomSelectAutoComplete.getOrConstruct($('[name=langs]'), { multi: true, data: langs });
|
||||
select.onChange((val) => {
|
||||
const value = val.split(',');
|
||||
value.push(...Array.from(new Set(value.filter((i) => i.includes('.')).map((i) => i.split('.')[0]))));
|
||||
value.push(...new Set(value.filter((i) => i.includes('.')).map((i) => i.split('.')[0])));
|
||||
$langSelect.val(value.join(','));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
"dependencies": {
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
"chrome-finder": "^1.0.7",
|
||||
"jsdom": "^20.0.1",
|
||||
"jsdom": "^20.0.2",
|
||||
"puppeteer-core": "^15.5.0",
|
||||
"puppeteer-extra": "3.3.0",
|
||||
"puppeteer-extra-plugin-portal": "3.1.0",
|
||||
"puppeteer-extra-plugin-stealth": "2.10.1",
|
||||
"superagent": "^8.0.2",
|
||||
"superagent": "^8.0.3",
|
||||
"superagent-proxy": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Reference in new issue
Block a user