From: Hypolite Petovan Date: Wed, 19 Feb 2020 15:29:13 +0000 (-0500) Subject: Update manifest output with config/theme info X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=930d395d7b69dab81c382a3e0fc725131c780667;p=friendica.git Update manifest output with config/theme info --- diff --git a/src/Module/Manifest.php b/src/Module/Manifest.php index c0af708fa8..d40624cf80 100644 --- a/src/Module/Manifest.php +++ b/src/Module/Manifest.php @@ -22,7 +22,7 @@ namespace Friendica\Module; use Friendica\BaseModule; -use Friendica\Core\Renderer; +use Friendica\Core; use Friendica\DI; class Manifest extends BaseModule @@ -31,18 +31,19 @@ class Manifest extends BaseModule { $config = DI::config(); - $tpl = Renderer::getMarkupTemplate('manifest.tpl'); - header('Content-type: application/manifest+json'); - $touch_icon = $config->get('system', 'touch_icon', 'images/friendica-128.png'); - if ($touch_icon == '') { - $touch_icon = 'images/friendica-128.png'; - } + $touch_icon = $config->get('system', 'touch_icon') ?: 'images/friendica-128.png'; + + $theme = DI::config()->get('system', 'theme'); - $output = Renderer::replaceMacros($tpl, [ - '$touch_icon' => $touch_icon, - '$title' => $config->get('config', 'sitename', 'Friendica'), + $tpl = Core\Renderer::getMarkupTemplate('manifest.tpl'); + $output = Core\Renderer::replaceMacros($tpl, [ + '$touch_icon' => $touch_icon, + '$title' => $config->get('config', 'sitename', 'Friendica'), + '$description' => $config->get('config', 'info', DI::l10n()->t('A Decentralized Social Network')), + '$background_color' => Core\Theme::getBackgroundColor($theme), + '$theme_color' => Core\Theme::getThemeColor($theme), ]); echo $output; diff --git a/view/templates/manifest.tpl b/view/templates/manifest.tpl index 6f9294774d..f38c67db3d 100644 --- a/view/templates/manifest.tpl +++ b/view/templates/manifest.tpl @@ -2,8 +2,17 @@ "name": "{{$title}}", "start_url": "{{$baseurl}}", "display": "standalone", - "description": "A Decentralized Social Network", + "description": "{{$description}}", +{{if $background_color}} + "theme_color": "{{$theme_color}}", +{{/if}} +{{if $background_color}} + "background_color": "{{$background_color}}", +{{/if}} + "short_name": "Friendica", "icons": [{ - "src": "{{$baseurl}}/{{$touch_icon}}" + "src": "{{$baseurl}}/{{$touch_icon}}", + "sizes": "128x128", + "type": "image/png" }] -} +} \ No newline at end of file