core&ui: fix contest_edit file upload

This commit is contained in:
undefined committed 2026-02-28 02:22:07 +08:00
1 parent 3a5586cc5a
commit 2bad9d330d
11 files changed
+39 -22

No files matched your search

@@ -0,0 +1,13 @@
diff --git a/lib/picker.js b/lib/picker.js
index 88fef537f38b4cc45d10cec3774363e2c5a007c9..79a097cc0b2d5bcc1eaf108c16430b5950034fe6 100644
--- a/lib/picker.js
+++ b/lib/picker.js
@@ -1079,7 +1079,7 @@ PickerConstructor._ = {
if ( !item ) return ''
// If the item is an array, do a join
- item = $.isArray( item ) ? item.join( '' ) : item
+ item = Array.isArray( item ) ? item.join( '' ) : item
// Check for the class
klass = klass ? ' class="' + klass + '"' : ''
+4 -4
View File
@@ -5,14 +5,14 @@
"main": "base.mjs",
"repository": "https://github.com/hydro-dev/Hydro",
"dependencies": {
"@antfu/eslint-config": "^7.4.3",
"@antfu/eslint-config": "^7.6.1",
"@eslint-react/eslint-plugin": "^2.13.0",
"@typescript-eslint/eslint-plugin": "^8.56.0",
"@typescript-eslint/parser": "^8.56.0",
"@typescript-eslint/eslint-plugin": "^8.56.1",
"@typescript-eslint/parser": "^8.56.1",
"eslint-plugin-de-morgan": "^2.0.0",
"eslint-plugin-github": "^6.0.0",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.5.0",
"eslint-plugin-react-refresh": "^0.5.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"globals": "^17.3.0"
},
+1 -1
View File
@@ -13,7 +13,7 @@
"@mongodb-js/saslprep": "^1.4.6",
"emoji-regex": "^10.6.0",
"fs-extra": "^11.3.3",
"koa": "^3.1.1",
"koa": "^3.1.2",
"koa-body": "^7.0.1",
"koa-compress": "5.1.1",
"path-to-regexp": "^8.3.0",
+3 -3
View File
@@ -43,7 +43,7 @@
"cross-env": "^10.1.0",
"cross-spawn": "^7.0.6",
"esbuild": "0.25.2",
"eslint": "^9.39.2",
"eslint": "^9.39.3",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-import-resolver-webpack": "^0.13.10",
"fs-extra": "^11.3.3",
@@ -53,10 +53,10 @@
"mongodb-memory-server": "11.0.1",
"nyc": "^17.1.0",
"ora": "^9.3.0",
"oxlint": "^1.48.0",
"oxlint": "^1.50.0",
"package-json": "^10.0.1",
"semver": "^7.7.4",
"simple-git": "^3.31.1",
"simple-git": "^3.32.3",
"supertest": "^7.2.2",
"supports-hyperlinks": "^4.4.0",
"typescript": "5.8.3",
+1 -1
View File
@@ -20,7 +20,7 @@
"devDependencies": {
"@types/diff": "^8.0.0",
"@types/js-yaml": "^4.0.9",
"@types/lodash": "^4.17.23",
"@types/lodash": "^4.17.24",
"sass": "^1.97.3"
},
"peerDependencies": {
+2 -2
View File
@@ -60,10 +60,10 @@
"@types/fs-extra": "^11.0.4",
"@types/js-yaml": "^4.0.9",
"@types/koa-static-cache": "^5.1.4",
"@types/lodash": "^4.17.23",
"@types/lodash": "^4.17.24",
"@types/mime-types": "^3.0.1",
"@types/mongodb-uri": "^0.9.4",
"@types/nodemailer": "^7.0.10",
"@types/nodemailer": "^7.0.11",
"@types/notp": "^2.0.5",
"@types/semver": "^7.7.1",
"@types/superagent": "^8.1.9",
+7 -4
View File
@@ -538,7 +538,9 @@ export class ContestCodeHandler extends Handler {
export class ContestManagementHandler extends ContestManagementBaseHandler {
@param('tid', Types.ObjectId)
async get(domainId: string, tid: ObjectId) {
@param('d', Types.Range(['public', 'private']), true)
@param('sidebar', Types.Boolean)
async get(domainId: string, tid: ObjectId, d?: string, sidebar?: boolean) {
this.response.body = {
tdoc: this.tdoc,
tsdoc: this.tsdoc,
@@ -549,11 +551,12 @@ export class ContestManagementHandler extends ContestManagementBaseHandler {
urlForFile: (filename: string, type: string) => this.url('contest_file_download', { tid, filename, type }),
};
this.response.pjax = [
['partials/files.html', { filetype: 'public' }],
['partials/files.html', {
...((!d || d === 'public') ? [['partials/files.html', { filetype: 'public', sidebar }] as const] : []),
...((!d || d === 'private') ? [['partials/files.html', {
files: this.response.body.privateFiles,
filetype: 'private',
}],
sidebar,
}] as const] : []),
];
this.response.template = 'contest_manage.html';
}
+5 -5
View File
@@ -23,12 +23,12 @@
"@mantine/core": "^8.3.15",
"@mantine/hooks": "^8.3.15",
"@mantine/notifications": "^8.3.15",
"@sentry/browser": "^10.39.0",
"@sentry/browser": "^10.40.0",
"@sentry/webpack-plugin": "^4.9.1",
"@simplewebauthn/browser": "13.2.2",
"@svgr/webpack": "^8.1.0",
"@types/html-to-text": "^9.0.4",
"@types/jquery": "^3.5.33",
"@types/jquery": "^3.5.34",
"@types/jquery.transit": "^0.9.33",
"@types/json-schema": "^7.0.15",
"@types/katex": "^0.16.8",
@@ -80,7 +80,7 @@
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"p-queue": "^9.1.0",
"pickadate": "^3.6.4",
"pickadate": "patch:pickadate@npm%3A3.6.4#~/.yarn/patches/pickadate-npm-3.6.4-5795acb19d.patch",
"postcss-loader": "7.3.4",
"postcss-preset-mantine": "^1.18.0",
"prism-themes": "^1.9.0",
@@ -116,7 +116,7 @@
"timeago.js": "^4.0.2",
"ts-loader": "^9.5.4",
"web-streams-polyfill": "^4.2.0",
"webpack": "^5.105.2",
"webpack": "^5.105.3",
"webpack-bundle-analyzer": "^5.2.0",
"webpack-dev-server": "^5.2.3",
"webpack-manifest-plugin": "^6.0.1",
@@ -131,7 +131,7 @@
"html-to-text": "^9.0.5",
"js-yaml": "^4.1.1",
"jsesc": "^3.1.0",
"katex": "^0.16.28",
"katex": "^0.16.33",
"lodash": "^4.17.23",
"markdown-it": "^14.1.1",
"markdown-it-anchor": "^9.2.0",
+1
View File
@@ -336,6 +336,7 @@ const page = new NamedPage([
'home_files', 'training_files', 'homework_files',
], (pageName) => {
if (pageName === 'problem_config' || pageName === 'problem_edit') endpoint = './files';
if (pageName === 'contest_edit') endpoint = './management';
$(document).on('click', '[name="file_rename"]', (ev) => handleClickRename(ev));
$(document).on('click', '[name="file_remove"]', (ev) => handleClickRemove(ev));
$(document).on('click', '[name="upload_file"]', (ev) => handleClickUpload(ev));
@@ -233,7 +233,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('Files') }}</h1>
<div class="section__tools">
<button class="primary rounded button" name="upload_file">{{ _('Upload') }}</button>
<button class="primary rounded button" name="upload_file" data-type="public" data-sidebar="true">{{ _('Upload') }}</button>
</div>
</div>
{% set sidebar = true %}
+1 -1
View File
@@ -16,6 +16,6 @@
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react-swc": "^4.2.3",
"vite": "^8.0.0-beta.15"
"vite": "^8.0.0-beta.16"
}
}