Settings: per-user default for download_disabled
New pref download_disabled_default (stored in user_prefs + mirrored to _user_settings.json for the render pipeline). When true, apply_sidecar marks all activities as download_disabled unless the sidecar explicitly sets download_disabled: false (per-activity opt-in from the edit drawer). Settings page gets an "Activity defaults" card with the toggle.
This commit is contained in:
@@ -222,6 +222,18 @@ async def me_set_prefs(
|
||||
# Coerce all values to strings; ignore unknown keys silently
|
||||
prefs = {str(k): str(v) for k, v in body.items()}
|
||||
set_user_prefs(deps._get_db(), user.handle, prefs)
|
||||
|
||||
# Mirror download_disabled_default to a file so the render pipeline can read it
|
||||
if "download_disabled_default" in prefs:
|
||||
user_dir = deps._get_data_dir() / user.handle
|
||||
settings_path = user_dir / "_user_settings.json"
|
||||
try:
|
||||
current = json.loads(settings_path.read_text(encoding="utf-8")) if settings_path.exists() else {}
|
||||
except (OSError, json.JSONDecodeError):
|
||||
current = {}
|
||||
current["download_disabled_default"] = prefs["download_disabled_default"] == "true"
|
||||
settings_path.write_text(json.dumps(current, indent=2), encoding="utf-8")
|
||||
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user