mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-06 07:53:11 -05:00
feat: bulk recipe settings update (#1557)
* extract switches from menu component * implement bulk updater for settings * fix browser cache api calls issue * add frontend for bulk settings modifications
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import contextlib
|
||||
import json
|
||||
from collections.abc import Callable
|
||||
from enum import Enum
|
||||
@@ -31,16 +32,15 @@ class MealieCrudRoute(APIRoute):
|
||||
original_route_handler = super().get_route_handler()
|
||||
|
||||
async def custom_route_handler(request: Request) -> Response:
|
||||
try:
|
||||
with contextlib.suppress(JSONDecodeError):
|
||||
response = await original_route_handler(request)
|
||||
response_body = json.loads(response.body)
|
||||
if type(response_body) == dict:
|
||||
if last_modified := response_body.get("updateAt"):
|
||||
response.headers["last-modified"] = last_modified
|
||||
|
||||
except JSONDecodeError:
|
||||
pass
|
||||
|
||||
# Force no-cache for all responses to prevent browser from caching API calls
|
||||
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
||||
return response
|
||||
|
||||
return custom_route_handler
|
||||
|
||||
Reference in New Issue
Block a user