]> git.mxchange.org Git - friendica.git/commitdiff
Update manifest output with config/theme info
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 19 Feb 2020 15:29:13 +0000 (10:29 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 19 Feb 2020 15:29:13 +0000 (10:29 -0500)
src/Module/Manifest.php
view/templates/manifest.tpl

index c0af708fa8877e21749bf4aeb0ea7ee84484d1ab..d40624cf80f43e333cb9bffa045d054a8cb1723e 100644 (file)
@@ -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;
index 6f9294774da1ddcff48be642f035dcf2490b9481..f38c67db3d74ea0b9259851db3842c5b2d52fbdc 100644 (file)
@@ -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