Skip to content

Commit

Permalink
Upload WordPress-specific HTTPS service worker and manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Pang committed Dec 8, 2017
0 parents commit 12d2182
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions OneSignalSDKUpdaterWorker.js.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* Note: This file is intended to be publicly accessible.
* Reference: https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers
*/

header("Service-Worker-Allowed: /");
header("Content-Type: application/javascript");
header("X-Robots-Tag: none");
echo "importScripts('https://cdn.onesignal.com/sdks/OneSignalSDK.js');";
?>
11 changes: 11 additions & 0 deletions OneSignalSDKWorker.js.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* Note: This file is intended to be publicly accessible.
* Reference: https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers
*/

header("Service-Worker-Allowed: /");
header("Content-Type: application/javascript");
header("X-Robots-Tag: none");
echo "importScripts('https://cdn.onesignal.com/sdks/OneSignalSDK.js');";
?>
15 changes: 15 additions & 0 deletions manifest.json.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Note: This file is intended to be publicly accessible.
* Reference: https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web#add_a_web_app_manifest
*/

header("Content-Type: application/json");
header("X-Robots-Tag: none");
$gcm_sender_id = preg_replace('/[^0-9]/', '', $_GET["gcm_sender_id"]);
?>
{
"start_url": "/",
"gcm_sender_id": "<?php echo (empty($gcm_sender_id) ? '482941778795' : $gcm_sender_id); ?>",
"gcm_user_visible_only": true
}

0 comments on commit 12d2182

Please sign in to comment.