|
8 | 8 | *
|
9 | 9 | */
|
10 | 10 |
|
11 |
| -use Symfony\Component\HttpFoundation\JsonResponse; |
12 |
| -use phpbb\webpushnotifications\ext; |
13 |
| - |
14 | 11 | /**
|
15 | 12 | * @ignore
|
16 | 13 | **/
|
|
19 | 16 | $phpEx = substr(strrchr(__FILE__, '.'), 1);
|
20 | 17 | include($phpbb_root_path . 'common.' . $phpEx);
|
21 | 18 |
|
| 19 | +require_once($phpbb_root_path . 'ext/phpbb/webpushnotifications/controller/manifest.' . $phpEx); |
| 20 | + |
22 | 21 | /** @var \phpbb\path_helper $path_helper */
|
23 | 22 | $path_helper = $phpbb_container->get('path_helper');
|
24 | 23 |
|
25 |
| -$board_path = $config['force_server_vars'] ? $config['script_path'] : $path_helper->get_web_root_path(); |
26 |
| -$board_url = generate_board_url(); |
27 |
| - |
28 |
| -// Emoji fixer-uppers |
29 |
| -$sitename = ext::decode_entities($config['sitename'], ENT_QUOTES); |
30 |
| -$pwa_short_name = ext::decode_entities($config['pwa_short_name'], ENT_QUOTES); |
31 |
| - |
32 |
| -$manifest = [ |
33 |
| - 'name' => $sitename, |
34 |
| - 'short_name' => $pwa_short_name ?: utf8_substr($sitename, 0, 12), |
35 |
| - 'display' => 'standalone', |
36 |
| - 'orientation' => 'portrait', |
37 |
| - 'dir' => $language->lang('DIRECTION'), |
38 |
| - 'start_url' => $board_path, |
39 |
| - 'scope' => $board_path, |
40 |
| -]; |
41 |
| - |
42 |
| -if (!empty($config['pwa_icon_small']) && !empty($config['pwa_icon_large'])) |
43 |
| -{ |
44 |
| - $manifest['icons'] = [ |
45 |
| - [ |
46 |
| - 'src' => $board_url . '/' . ext::PWA_ICON_DIR . '/' . $config['pwa_icon_small'], |
47 |
| - 'sizes' => '192x192', |
48 |
| - 'type' => 'image/png' |
49 |
| - ], |
50 |
| - [ |
51 |
| - 'src' => $board_url . '/' . ext::PWA_ICON_DIR . '/' . $config['pwa_icon_large'], |
52 |
| - 'sizes' => '512x512', |
53 |
| - 'type' => 'image/png' |
54 |
| - ] |
55 |
| - ]; |
56 |
| -} |
57 |
| - |
58 |
| -$response = new JsonResponse($manifest); |
59 |
| -$response->send(); |
| 24 | +echo (new \phpbb\webpushnotifications\controller\manifest($config, $language, $path_helper))->handle(); |
0 commit comments