35
common/Core/Manifest/BuildManifestFile.php
Executable file
35
common/Core/Manifest/BuildManifestFile.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Common\Core\Manifest;
|
||||
|
||||
use Common\Core\AppUrl;
|
||||
use Common\Settings\Settings;
|
||||
|
||||
class BuildManifestFile
|
||||
{
|
||||
public function __construct(protected Settings $settings)
|
||||
{
|
||||
}
|
||||
|
||||
public function execute(): void
|
||||
{
|
||||
$primaryColor = config('common.themes.light.--be-primary');
|
||||
$bgColor = config('common.themes.light.--be-background');
|
||||
$replacements = [
|
||||
'DUMMY_NAME' => config('app.name'),
|
||||
'DUMMY_SHORT_NAME' => config('app.name'),
|
||||
'DUMMY_THEME_COLOR' => "rgb($primaryColor)",
|
||||
'DUMMY_BACKGROUND_COLOR' => "rgb($bgColor)",
|
||||
'DUMMY_START_URL' => app(AppUrl::class)->htmlBaseUri,
|
||||
];
|
||||
|
||||
@file_put_contents(
|
||||
public_path('manifest.json'),
|
||||
str_replace(
|
||||
array_keys($replacements),
|
||||
$replacements,
|
||||
file_get_contents(__DIR__ . '/manifest-example.json'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
51
common/Core/Manifest/manifest-example.json
Executable file
51
common/Core/Manifest/manifest-example.json
Executable file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "DUMMY_NAME",
|
||||
"short_name": "DUMMY_SHORT_NAME",
|
||||
"theme_color": "DUMMY_THEME_COLOR",
|
||||
"background_color": "DUMMY_BACKGROUND_COLOR",
|
||||
"display": "standalone",
|
||||
"scope": "DUMMY_START_URL",
|
||||
"start_url": "DUMMY_START_URL",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon/icon-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon/icon-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon/icon-128x128.png",
|
||||
"sizes": "128x128",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon/icon-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon/icon-152x152.png",
|
||||
"sizes": "152x152",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon/icon-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon/icon-384x384.png",
|
||||
"sizes": "384x384",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "favicon/icon-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user