mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Return a Cache-Control
header for files served via the API
This commit is contained in:
parent
50e829f270
commit
49b26bd375
@ -2,4 +2,5 @@
|
|||||||
- It's now possible to display a recipe directly from the meal plan (new "eye button") (thanks @kriddles)
|
- It's now possible to display a recipe directly from the meal plan (new "eye button") (thanks @kriddles)
|
||||||
- Improved the responsiveness of the meal plan and calendar page by automatically switching to a day calendar view on smaller screens (thanks for the idea @kriddles)
|
- Improved the responsiveness of the meal plan and calendar page by automatically switching to a day calendar view on smaller screens (thanks for the idea @kriddles)
|
||||||
- The calendar now also contains all planned recipes from the meal plan on the corresponding day
|
- The calendar now also contains all planned recipes from the meal plan on the corresponding day
|
||||||
|
- The API Endpoint `GET /files/{group}/{fileName}` now also returns a `Cache-Control` header (defaults fixed to 30 days) to further increase page load times
|
||||||
- Some style/CSS detail-refinements
|
- Some style/CSS detail-refinements
|
||||||
|
@ -81,6 +81,7 @@ class FilesApiController extends BaseApiController
|
|||||||
if (file_exists($filePath))
|
if (file_exists($filePath))
|
||||||
{
|
{
|
||||||
$response->write(file_get_contents($filePath));
|
$response->write(file_get_contents($filePath));
|
||||||
|
$response = $response->withHeader('Cache-Control', 'max-age=2592000');
|
||||||
$response = $response->withHeader('Content-Type', mime_content_type($filePath));
|
$response = $response->withHeader('Content-Type', mime_content_type($filePath));
|
||||||
return $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
|
return $response->withHeader('Content-Disposition', 'inline; filename="' . $fileName . '"');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user