-
Notifications
You must be signed in to change notification settings - Fork 432
3.2.4 #989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.2.4 #989
Changes from 2 commits
a0bf878
b57d3c4
c7206a3
c261caa
ead16ba
fe1858f
ded24b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,11 +14,12 @@ | |
|
|
||
|
|
||
| def _sanitize_dict(d: dict) -> dict: | ||
| """Recursively mask string values whose keys contain sensitive keywords.""" | ||
| result = {} | ||
| for k, v in d.items(): | ||
| if isinstance(v, dict): | ||
| result[k] = _sanitize_dict(v) | ||
| elif any(s in k.lower() for s in _SENSITIVE_KEYS): | ||
| elif isinstance(v, str) and any(s in k.lower() for s in _SENSITIVE_KEYS): | ||
|
||
| result[k] = "********" | ||
| else: | ||
| result[k] = v | ||
|
|
@@ -27,13 +28,15 @@ def _sanitize_dict(d: dict) -> dict: | |
|
|
||
| @router.get("/get", dependencies=[Depends(get_current_user)]) | ||
| async def get_config(): | ||
| """Return the current configuration with sensitive fields masked.""" | ||
| return _sanitize_dict(settings.dict()) | ||
|
|
||
|
|
||
| @router.patch( | ||
| "/update", response_model=APIResponse, dependencies=[Depends(get_current_user)] | ||
| ) | ||
| async def update_config(config: Config): | ||
| """Persist and reload configuration from the supplied payload.""" | ||
| try: | ||
| settings.save(config_dict=config.dict()) | ||
| settings.load() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new set_weekday API endpoint (PATCH /bangumi/{id}/weekday) lacks automated test coverage. While 101 new tests were added to this PR, none specifically test this new endpoint's behavior including validation of weekday range (0-6), null handling, success/failure responses, and database state updates. Adding test coverage would help ensure this critical user-facing feature works correctly.