mirror of
https://github.com/grocy/grocy.git
synced 2025-08-16 02:34:44 +00:00
Use a dynamic (title / URL) manifest
This commit is contained in:
@@ -38,6 +38,28 @@ class SystemController extends BaseController
|
|||||||
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl($this->GetEntryPageRelative()));
|
return $response->withRedirect($this->AppContainer->get('UrlManager')->ConstructUrl($this->GetEntryPageRelative()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function Manifest(Request $request, Response $response, array $args)
|
||||||
|
{
|
||||||
|
$data = explode('#', base64_decode($request->getQueryParams()['data']));
|
||||||
|
|
||||||
|
$manifest = [
|
||||||
|
'name' => $data[0] . ' | Grocy',
|
||||||
|
'short_name' => $data[0] . ' | Grocy',
|
||||||
|
'icons' => [[
|
||||||
|
'src' => './img/icon-1024.png',
|
||||||
|
'sizes'=> '1024x1024',
|
||||||
|
'type' => 'image/png'
|
||||||
|
]],
|
||||||
|
'start_url' => $data[1],
|
||||||
|
'background_color' => '#333131',
|
||||||
|
'theme_color' => '#333131',
|
||||||
|
'display' => 'standalone'
|
||||||
|
];
|
||||||
|
|
||||||
|
$response->getBody()->write(json_encode($manifest));
|
||||||
|
return $response->withHeader('Content-Type', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
private function GetEntryPageRelative()
|
private function GetEntryPageRelative()
|
||||||
{
|
{
|
||||||
if (defined('GROCY_ENTRY_PAGE'))
|
if (defined('GROCY_ENTRY_PAGE'))
|
||||||
|
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Grocy",
|
|
||||||
"short_name": "Grocy",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "./img/icon-1024.png",
|
|
||||||
"sizes": "1024x1024",
|
|
||||||
"type": "image/png"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"start_url": "../",
|
|
||||||
"background_color": "#333131",
|
|
||||||
"theme_color": "#333131",
|
|
||||||
"display": "standalone"
|
|
||||||
}
|
|
@@ -9,6 +9,7 @@ $app->group('', function (RouteCollectorProxy $group) {
|
|||||||
// System routes
|
// System routes
|
||||||
$group->get('/', '\Grocy\Controllers\SystemController:Root')->setName('root');
|
$group->get('/', '\Grocy\Controllers\SystemController:Root')->setName('root');
|
||||||
$group->get('/about', '\Grocy\Controllers\SystemController:About');
|
$group->get('/about', '\Grocy\Controllers\SystemController:About');
|
||||||
|
$group->get('/manifest', '\Grocy\Controllers\SystemController:Manifest');
|
||||||
$group->get('/barcodescannertesting', '\Grocy\Controllers\SystemController:BarcodeScannerTesting');
|
$group->get('/barcodescannertesting', '\Grocy\Controllers\SystemController:BarcodeScannerTesting');
|
||||||
|
|
||||||
// Login routes
|
// Login routes
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
sizes="32x32"
|
sizes="32x32"
|
||||||
href="{{ $U('/img/icon-32.png?v=', true) }}{{ $version }}">
|
href="{{ $U('/img/icon-32.png?v=', true) }}{{ $version }}">
|
||||||
<link rel="manifest"
|
<link rel="manifest"
|
||||||
href="{{ $U('/manifest.json?v=', true) }}{{ $version }}">
|
href="{{ $U('/manifest') . '?data=' . base64_encode($__env->yieldContent('title') . '#' . $U($_SERVER['REQUEST_URI'])) }}">
|
||||||
|
|
||||||
<title>@yield('title') | Grocy</title>
|
<title>@yield('title') | Grocy</title>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user