✨ feat(config): 统一分片大小配置与续传校验

This commit is contained in:
orion committed 2026-09-18 17:51:42 +08:00
1 parent 1023292e71
commit c2d743ba51
8 files changed
+116 -14

No files matched your search

+11
View File
@@ -1709,6 +1709,7 @@ class ConfigService:
"adminSessionExpire",
"trashRetentionDays",
"enableChunk",
"chunkSizeMB",
"errorCount",
"errorMinute",
"loginCount",
@@ -1747,6 +1748,16 @@ class ConfigService:
if key in settings.default_config and key not in INTERNAL_CONFIG_KEYS
}
if "chunkSizeMB" in update_data:
raw_size = update_data["chunkSizeMB"]
if isinstance(raw_size, bool) or not (
isinstance(raw_size, int) or
isinstance(raw_size, str) and raw_size.strip().isdigit()
):
raise HTTPException(400, "分片大小必须是 1–100 MB 的整数")
if not 1 <= int(raw_size) <= 100:
raise HTTPException(400, "分片大小必须是 1–100 MB 的整数")
admin_token = update_data.get("admin_token")
admin_password_changed = False
if admin_token is None or admin_token == "":