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

+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"
}
}