]> BookStack Code Mirror - bookstack/blob - app/App/PwaManifestBuilder.php
Merge branch 'development' of github.com:BookStackApp/BookStack into development
[bookstack] / app / App / PwaManifestBuilder.php
1 <?php
2
3 namespace BookStack\App;
4
5 class PwaManifestBuilder
6 {
7     public function build(): array
8     {
9         // Note, while we attempt to use the user's preference here, the request to the manifest
10         // does not start a session, so we won't have current user context.
11         // This was attempted but removed since manifest calls could affect user session
12         // history tracking and back redirection.
13         // Context: https://github.com/BookStackApp/BookStack/issues/4649
14         $darkMode = (bool) setting()->getForCurrentUser('dark-mode-enabled');
15         $appName = setting('app-name');
16
17         return [
18             "name" => $appName,
19             "short_name" => $appName,
20             "start_url" => "./",
21             "scope" => "/",
22             "display" => "standalone",
23             "background_color" => $darkMode ? '#111111' : '#F2F2F2',
24             "description" => $appName,
25             "theme_color" => ($darkMode ? setting('app-color-dark') : setting('app-color')),
26             "launch_handler" => [
27                 "client_mode" => "focus-existing"
28             ],
29             "orientation" => "any",
30             "icons" => [
31                 [
32                     "src" => setting('app-icon-32') ?: url('/icon-32.png'),
33                     "sizes" => "32x32",
34                     "type" => "image/png"
35                 ],
36                 [
37                     "src" => setting('app-icon-64') ?: url('/icon-64.png'),
38                     "sizes" => "64x64",
39                     "type" => "image/png"
40                 ],
41                 [
42                     "src" => setting('app-icon-128') ?: url('/icon-128.png'),
43                     "sizes" => "128x128",
44                     "type" => "image/png"
45                 ],
46                 [
47                     "src" => setting('app-icon-180') ?: url('/icon-180.png'),
48                     "sizes" => "180x180",
49                     "type" => "image/png"
50                 ],
51                 [
52                     "src" => setting('app-icon') ?: url('/icon.png'),
53                     "sizes" => "256x256",
54                     "type" => "image/png"
55                 ],
56                 [
57                     "src" => url('favicon.ico'),
58                     "sizes" => "48x48",
59                     "type" => "image/vnd.microsoft.icon"
60                 ],
61             ],
62         ];
63     }
64 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.