This module will add a Service Worker & Web Manifest to your SilverStripe Project. You can change the manifestsettings in the site-settings section inside the CMS.
- Deploy a web-manifest from the CMS Working
- Service worker that displays offline-page when there is not connection Working
- Handle incomming push events Working
- Subscribe devices to push-service Working
- Send push-notifications from CMS Working
- Change notification-settings in CMS Working
- Different kinds of service workers (Offline-page, Cache-first, Pre-cache) In Development
- SilverStripe ^4.0
- silverware/colorpicker ^1.0
- silverstripe/vendor-plugin ^1.0
- minishlink/web-push ^5.2
composer require Anytech/silverstripe-pwa
- Run dev/build after the installation.
- Add this metadata to the header of the website
<meta name="theme-color" content="$SiteConfig.ManifestColor">
<link rel="manifest" href="{$BaseHref}manifest.json">
<script src="{$BaseHref}RegisterServiceWorker.js"></script>
- You have to generate your own private & public key and put them in the
/vendor/mdiederen/silverstripe-pwa/_config
directory for the VAPID authentication used by the push-manager. You can do this on unix (linux / MacOS) using the following commands:
$ openssl ecparam -genkey -name prime256v1 -out private_key.pem
$ openssl ec -in private_key.pem -pubout -outform DER|tail -c 65|base64|tr -d '=' |tr '/+' '_-' >> public_key.txt
$ openssl ec -in private_key.pem -outform DER|tail -c +8|head -c 32|base64|tr -d '=' |tr '/+' '_-' >> private_key.txt
Windows user can use online tools like Vapid Key Generator
- Add the extension to the pages on which you want to enable push-notifications in the
config.yml
inside thevendor/mdiederen/silverstripe-pwa/_config
directory.
See License
Michiel Diederen - [email protected]