Use a dynamic (title / URL) manifest

This commit is contained in:
Bernd Bestel
2023-08-01 17:12:35 +02:00
parent 8b444a03e5
commit b74fbddd94
4 changed files with 24 additions and 16 deletions

View File

@@ -38,6 +38,28 @@ class SystemController extends BaseController
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()
{
if (defined('GROCY_ENTRY_PAGE'))