core: bug fix

This commit is contained in:
undefined committed 2024-10-25 06:30:27 +08:00
1 parent 751288e0fb
commit 0bc1729147
4 files changed
+6 -3

No files matched your search

+2 -1
View File
@@ -111,7 +111,7 @@ Hydro 用户群:1085853538
<details> <details>
<summary><h2>更新日志(点击展开)</h2></summary> <summary><h2>更新日志(点击展开)</h2></summary>
## Hydro 4.17.2 / UI 4.55.2 ## Hydro 4.17.3 / UI 4.55.2
- core: 限制显示名长度 - core: 限制显示名长度
- core: 支持调整代码长度限制 - core: 支持调整代码长度限制
@@ -124,6 +124,7 @@ Hydro 用户群:1085853538
- core: 支持 StorageModel.copy 和 StorageModel.exists - core: 支持 StorageModel.copy 和 StorageModel.exists
- core: 弃用 ProblemModel.list - core: 弃用 ProblemModel.list
- core: 添加 user/import/parse 和 user/import/create 钩子 - core: 添加 user/import/parse 和 user/import/create 钩子
- core: 优化题目列表查询性能
## Hydro 4.16.0 / UI 4.54.3 ## Hydro 4.16.0 / UI 4.54.3
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "4.17.2", "version": "4.17.3",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/plugin-api", "main": "src/plugin-api",
"module": "src/plugin-api", "module": "src/plugin-api",
+2
View File
@@ -368,12 +368,14 @@ function set(s: Setting, key: string, value: any) {
if (Number.isNaN(+value)) throw new ValidationError(key); if (Number.isNaN(+value)) throw new ValidationError(key);
return +value; return +value;
} }
if (value) {
if (['json', 'yaml', 'markdown', 'textarea'].includes(s.type)) { if (['json', 'yaml', 'markdown', 'textarea'].includes(s.type)) {
if (!Types.Content[1](value)) throw new ValidationError(key); if (!Types.Content[1](value)) throw new ValidationError(key);
} }
if (s.type === 'text') { if (s.type === 'text') {
if (!Types.ShortString[1](value)) throw new ValidationError(key); if (!Types.ShortString[1](value)) throw new ValidationError(key);
} }
}
if (s.subType === 'yaml') { if (s.subType === 'yaml') {
try { try {
yaml.load(value); yaml.load(value);
+1 -1
View File
@@ -128,7 +128,7 @@ class HomeworkDetailHandler extends Handler {
Object.assign(this.response.body, { pdict, psdict, rdict }); Object.assign(this.response.body, { pdict, psdict, rdict });
} }
async postAttend(domainId: string) { async postAttend({ domainId }) {
this.checkPerm(PERM.PERM_ATTEND_HOMEWORK); this.checkPerm(PERM.PERM_ATTEND_HOMEWORK);
if (contest.isDone(this.tdoc)) throw new HomeworkNotLiveError(this.tdoc.docId); if (contest.isDone(this.tdoc)) throw new HomeworkNotLiveError(this.tdoc.docId);
await contest.attend(domainId, this.tdoc.docId, this.user._id); await contest.attend(domainId, this.tdoc.docId, this.user._id);