3 * @copyright Copyright (C) 2010-2022, the Friendica project
5 * @license GNU AGPL version 3 or any later version
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 namespace Friendica\Module;
24 use Friendica\BaseModule;
28 class Manifest extends BaseModule
30 protected function rawContent(array $request = [])
32 $config = DI::config();
34 $theme = DI::config()->get('system', 'theme');
37 'name' => $config->get('config', 'sitename', 'Friendica'),
38 'start_url' => DI::baseUrl()->get(),
39 'display' => 'standalone',
40 'description' => $config->get('config', 'info', DI::l10n()->t('A Decentralized Social Network')),
41 'short_name' => 'Friendica',
42 'lang' => $config->get('system', 'language'),
44 'categories' => ['social network', 'internet'],
47 'name' => 'Latest posts',
55 'name' => 'Notifications',
56 'url' => '/notifications/system'
69 /// @TODO If the admin provides their own touch icon, the manifest will regress
70 /// to a smaller set of icons that do not follow the web app manifest spec.
71 /// There should be a mechanism to allow the admin to provide all of the 6
72 /// different images that are required for a fully valid web app manifest.
73 $touch_icon = $config->get('system', 'touch_icon');
75 $manifest['icons'] = [
77 'src' => DI::baseUrl()->get() . '/' . $touch_icon,
79 'type' => 'image/png',
82 'src' => DI::baseUrl()->get() . '/' . $touch_icon,
84 'type' => 'image/png',
88 $manifest['icons'] = [
90 'src' => DI::baseUrl()->get() . '/images/friendica.svg',
92 'type' => 'image/svg+xml',
96 'src' => DI::baseUrl()->get() . '/images/friendica-192.png',
98 'type' => 'image/png',
102 'src' => DI::baseUrl()->get() . '/images/friendica-512.png',
103 'sizes' => '512x512',
104 'type' => 'image/png',
108 'src' => DI::baseUrl()->get() . '/images/friendica-maskable.svg',
110 'type' => 'image/svg+xml',
111 'purpose' => 'maskable',
114 'src' => DI::baseUrl()->get() . '/images/friendica-maskable-192.png',
115 'sizes' => '192x192',
116 'type' => 'image/png',
117 'purpose' => 'maskable',
120 'src' => DI::baseUrl()->get() . '/images/friendica-maskable-512.png',
121 'sizes' => '512x512',
122 'type' => 'image/png',
123 'purpose' => 'maskable',
128 if ($background_color = Core\Theme::getBackgroundColor($theme)) {
129 $manifest['background_color'] = $background_color;
132 if ($theme_color = Core\Theme::getThemeColor($theme)) {
133 $manifest['theme_color'] = $theme_color;
136 Core\System::jsonExit($manifest, 'application/manifest+json');