2023-09-22 05:00:41 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\App;
|
|
|
|
|
|
|
|
use BookStack\Http\Controller;
|
|
|
|
|
|
|
|
class PwaManifestBuilder extends Controller
|
|
|
|
{
|
|
|
|
private function GenerateManifest()
|
|
|
|
{
|
2023-09-22 05:31:24 -04:00
|
|
|
dump(setting()->getForCurrentUser('dark-mode-enabled'));
|
|
|
|
dump(setting('app-color-dark'));
|
|
|
|
dump(setting('app-color'));
|
|
|
|
|
2023-09-22 05:00:41 -04:00
|
|
|
return [
|
2023-09-22 05:15:13 -04:00
|
|
|
"name" => setting('app-name'),
|
|
|
|
"short_name" => setting('app-name'),
|
2023-09-22 05:00:41 -04:00
|
|
|
"start_url" => "./",
|
2023-09-22 05:15:13 -04:00
|
|
|
"scope" => "/",
|
2023-09-22 05:00:41 -04:00
|
|
|
"display" => "standalone",
|
|
|
|
"background_color" => (setting()->getForCurrentUser('dark-mode-enabled') ? setting('app-color-dark') : setting('app-color')),
|
2023-09-22 05:15:13 -04:00
|
|
|
"description" => setting('app-name'),
|
2023-09-22 05:31:24 -04:00
|
|
|
"theme_color" => (setting()->getForCurrentUser('dark-mode-enabled') ? setting('app-color-dark') : setting('app-color')),
|
2023-09-22 05:00:41 -04:00
|
|
|
"launch_handler" => [
|
|
|
|
"client_mode" => "focus-existing"
|
|
|
|
],
|
|
|
|
"orientation" => "portrait",
|
|
|
|
"icons" => [
|
|
|
|
[
|
|
|
|
"src" => setting('app-icon-64') ?: url('/icon-64.png'),
|
|
|
|
"sizes" => "64x64",
|
|
|
|
"type" => "image/png"
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"src" => setting('app-icon-32') ?: url('/icon-32.png'),
|
|
|
|
"sizes" => "32x32",
|
|
|
|
"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-09-22 05:31:24 -04:00
|
|
|
"src" => public_path('icon.ico'),
|
2023-09-22 05:00:41 -04:00
|
|
|
"sizes" => "48x48",
|
|
|
|
"type" => "image/vnd.microsoft.icon"
|
|
|
|
],
|
|
|
|
[
|
2023-09-22 05:31:24 -04:00
|
|
|
"src" => public_path('favicon.ico'),
|
2023-09-22 05:00:41 -04:00
|
|
|
"sizes" => "48x48",
|
|
|
|
"type" => "image/vnd.microsoft.icon"
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Serve the application manifest.
|
|
|
|
* Ensures a 'manifest.json'
|
|
|
|
*/
|
|
|
|
public function manifest()
|
|
|
|
{
|
|
|
|
return response()->json($this->GenerateManifest());
|
|
|
|
}
|
|
|
|
}
|