You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.7 KiB
50 lines
1.7 KiB
<?php
|
|
namespace kuzik\meta;
|
|
|
|
require 'lib/config.php';
|
|
|
|
header('Content-Type: application/manifest+json');
|
|
|
|
# See https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/How_to/Create_a_standalone_app
|
|
|
|
$mf=[
|
|
'name' =>$config['APP_NAME']??'App',
|
|
'short_name' =>$config['APP_SHORT_NAME']??str_replace(' ','',$config['APP_NAME'])??'App',
|
|
'start_url' =>$config['APP_START_URL']??'/',
|
|
];
|
|
|
|
|
|
# "display": browser (default), standalone, minimal-ui, and fullscreen
|
|
# fallback for each given mode: fullscreen → standalone → minimal-ui → browser
|
|
|
|
$options=[
|
|
'display',
|
|
'description',
|
|
'background_color',
|
|
'theme_color',
|
|
];
|
|
|
|
foreach($options as $option) {
|
|
$config_name='APP_'.strtoupper($option);
|
|
isset($config[$config_name]) && $mf[$option] = $config[$config_name];
|
|
}
|
|
|
|
# Ensure override is set
|
|
if (isset($mf['display']) && !isset($mf['display_override'])) {
|
|
$mf['display_override']= [
|
|
'window-controls-overlay',
|
|
$mf['display'],
|
|
'browser',
|
|
];
|
|
}
|
|
|
|
$mf['icons'] = [
|
|
['src' => __ICO__.'/android-icon-36x36.png', 'sizes' => '36x36', 'type' => 'image/png', 'density' => '0.75' ],
|
|
['src' => __ICO__.'/android-icon-48x48.png', 'sizes' => '48x48', 'type' => 'image/png', 'density' => '1.0' ],
|
|
['src' => __ICO__.'/android-icon-72x72.png', 'sizes' => '72x72', 'type' => 'image/png', 'density' => '1.5' ],
|
|
['src' => __ICO__.'/android-icon-96x96.png', 'sizes' => '96x96', 'type' => 'image/png', 'density' => '2.0' ],
|
|
['src' => __ICO__.'/android-icon-144x144.png', 'sizes' => '144x144', 'type' => 'image/png', 'density' => '3.0' ],
|
|
['src' => __ICO__.'/android-icon-192x192.png', 'sizes' => '192x192', 'type' => 'image/png', 'density' => '4.0' ]
|
|
];
|
|
|
|
echo json_encode($mf,JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
|
|