feat(fc3c): expose download_rate_limit_seconds + download_validate_files in /api/settings/import
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,8 @@ _EDITABLE_FIELDS = (
|
||||
"single_color_threshold",
|
||||
"single_color_tolerance",
|
||||
"phash_threshold",
|
||||
"download_rate_limit_seconds",
|
||||
"download_validate_files",
|
||||
)
|
||||
|
||||
|
||||
@@ -38,6 +40,8 @@ async def get_import_settings():
|
||||
"single_color_threshold": row.single_color_threshold,
|
||||
"single_color_tolerance": row.single_color_tolerance,
|
||||
"phash_threshold": row.phash_threshold,
|
||||
"download_rate_limit_seconds": row.download_rate_limit_seconds,
|
||||
"download_validate_files": row.download_validate_files,
|
||||
})
|
||||
|
||||
|
||||
@@ -56,6 +60,19 @@ async def update_import_settings():
|
||||
{"error": "phash_threshold must be a non-negative integer"}
|
||||
), 400
|
||||
|
||||
if "download_rate_limit_seconds" in body:
|
||||
val = body["download_rate_limit_seconds"]
|
||||
if not isinstance(val, (int, float)) or isinstance(val, bool) or val < 0:
|
||||
return jsonify(
|
||||
{"error": "download_rate_limit_seconds must be a non-negative number"}
|
||||
), 400
|
||||
if "download_validate_files" in body and not isinstance(
|
||||
body["download_validate_files"], bool
|
||||
):
|
||||
return jsonify(
|
||||
{"error": "download_validate_files must be a boolean"}
|
||||
), 400
|
||||
|
||||
async with get_session() as session:
|
||||
row = (
|
||||
await session.execute(select(ImportSettings).where(ImportSettings.id == 1))
|
||||
|
||||
Reference in New Issue
Block a user