2023-09-22 17:00:41 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\App;
|
|
|
|
|
2023-10-02 22:54:39 +08:00
|
|
|
class PwaManifestBuilder
|
2023-09-22 17:00:41 +08:00
|
|
|
{
|
2023-10-02 22:54:39 +08:00
|
|
|
public function build(): array
|
2023-09-22 17:00:41 +08:00
|
|
|
{
|
2023-10-02 22:54:39 +08:00
|
|
|
$darkMode = (bool) setting()->getForCurrentUser('dark-mode-enabled');
|
|
|
|
$appName = setting('app-name');
|
|
|
|
|
2023-09-22 17:00:41 +08:00
|
|
|
return [
|
2023-10-02 22:54:39 +08:00
|
|
|
"name" => $appName,
|
|
|
|
"short_name" => $appName,
|
2023-09-22 17:00:41 +08:00
|
|
|
"start_url" => "./",
|
2023-09-22 17:15:13 +08:00
|
|
|
"scope" => "/",
|
2023-09-22 17:00:41 +08:00
|
|
|
"display" => "standalone",
|
2023-10-02 22:54:39 +08:00
|
|
|
"background_color" => $darkMode ? '#111111' : '#F2F2F2',
|
|
|
|
"description" => $appName,
|
|
|
|
"theme_color" => ($darkMode ? setting('app-color-dark') : setting('app-color')),
|
2023-09-22 17:00:41 +08:00
|
|
|
"launch_handler" => [
|
|
|
|
"client_mode" => "focus-existing"
|
|
|
|
],
|
|
|
|
"orientation" => "portrait",
|
|
|
|
"icons" => [
|
|
|
|
[
|
2023-10-02 22:54:39 +08:00
|
|
|
"src" => setting('app-icon-32') ?: url('/icon-32.png'),
|
|
|
|
"sizes" => "32x32",
|
2023-09-22 17:00:41 +08:00
|
|
|
"type" => "image/png"
|
|
|
|
],
|
|
|
|
[
|
2023-10-02 22:54:39 +08:00
|
|
|
"src" => setting('app-icon-64') ?: url('/icon-64.png'),
|
|
|
|
"sizes" => "64x64",
|
2023-09-22 17:00:41 +08:00
|
|
|
"type" => "image/png"
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"src" => setting('app-icon-128') ?: url('/icon-128.png'),
|
|
|
|
"sizes" => "128x128",
|
|
|
|
"type" => "image/png"
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"src" => setting('app-icon-180') ?: url('/icon-180.png'),
|
|
|
|
"sizes" => "180x180",
|
|
|
|
"type" => "image/png"
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"src" => setting('app-icon') ?: url('/icon.png'),
|
|
|
|
"sizes" => "256x256",
|
|
|
|
"type" => "image/png"
|
|
|
|
],
|
|
|
|
[
|
2023-10-02 22:54:39 +08:00
|
|
|
"src" => url('favicon.ico'),
|
2023-09-22 17:00:41 +08:00
|
|
|
"sizes" => "48x48",
|
|
|
|
"type" => "image/vnd.microsoft.icon"
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|