Differential D14011 Diff 33879 src/applications/webpush/controller/PhabricatorManifestController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/webpush/controller/PhabricatorManifestController.php
- This file was added.
| <?php | |||||
| final class PhabricatorManifestController extends PhabricatorController { | |||||
| public function shouldRequireLogin() { | |||||
| return false; | |||||
| } | |||||
| public function processRequest() { | |||||
| $out = array(); | |||||
| $gcm_sender_id = PhabricatorEnv::getEnvConfig('webpush.gcm-sender-id'); | |||||
| if (empty($gcm_sender_id)) { | |||||
| return new Aphront404Response(); | |||||
| } | |||||
| $out['name'] = 'Phabricator'; | |||||
| $out['short_name'] = 'Phabricator'; | |||||
| $out['icons'] = array( | |||||
| [ | |||||
| 'src' => '/favicon.ico', | |||||
| 'sizes' => '64x64', | |||||
| 'type' => 'image/x-icon', | |||||
| ], | |||||
| ); | |||||
| $out['start_url'] = '/'; | |||||
| $out['display'] = 'standalone'; | |||||
| $out['gcm_user_visible_only'] = true; | |||||
| $out['gcm_sender_id'] = $gcm_sender_id; | |||||
| return id(new AphrontJSONResponse()) | |||||
| ->setCacheDurationInSeconds(phutil_units('2 hours in seconds')) | |||||
| ->setAddJSONShield(false) | |||||
| ->setContent($out); | |||||
| } | |||||
| } |