surrealroad / wp-safari-push Goto Github PK
View Code? Open in Web Editor NEWSafari Push Plugin for Wordpress
License: MIT License
Safari Push Plugin for Wordpress
License: MIT License
it would be great if end users could have criteria to fine tune what type of posts they get push notifications for (i.e. per category, per tag, per keyword in headline, per keyword in message context).
http://wordpress.org/support/topic/thank-you-for-this-wonderful-plugin#post-
To speed up the display of pages, it would be nice to provide a compressed version of the javascript file.
jQuery(document).ready(function(){var a=window.navigator.userAgent,b=a.indexOf("Safari"),a=a.substring(0,b).substring(a.substring(0,b).lastIndexOf("/")+1);null===SafariPushParams.websitePushID?(console.log("Website Push ID is missing"),SafariPushParams.status="error"):null===SafariPushParams.webServiceURL?(console.log("Web Service URL is missing"),SafariPushParams.status="error"):0<b&&7<=parseInt(a,10)?surrealroad_safaripush_checkPermission():SafariPushParams.status="unsupported";surrealroad_safaripush_rendershortcode(SafariPushParams.status)}); function surrealroad_safaripush_checkPermission(){var a=window.safari.pushNotification.permission(SafariPushParams.websitePushID);SafariPushParams.status=a.permission;"default"===a.permission?surrealroad_safaripush_requestPermission():"granted"===a.permission&&(SafariPushParams.token=a.deviceToken)} function surrealroad_safaripush_requestPermission(){window.safari.pushNotification.requestPermission(SafariPushParams.webServiceURL,SafariPushParams.websitePushID,null,surrealroad_safaripush_requestPermissionCallback)}function surrealroad_safaripush_requestPermissionCallback(a){"granted"===a.permission&&(SafariPushParams.token=a.deviceToken);SafariPushParams.status=a.permission;surrealroad_safaripush_rendershortcode(SafariPushParams.status)} function surrealroad_safaripush_rendershortcode(a){var b="";switch(a){case "error":b=SafariPushParams.errorMsg;break;case "unsupported":b=SafariPushParams.unsupportedMsg;break;case "granted":b=SafariPushParams.grantedMsg;break;case "denied":b=SafariPushParams.deniedMsg;break;default:b=SafariPushParams.defaultMsg}jQuery(".safari-push-info").html(b)};
Support for the post excerpt being passed with the notification.
Support for Mutli-site WordPress installations by allowing the URL-Format variable to be passed from the site that is sending the push instead of a static setting for all sites using the server.
a widget or a short code with details on how many people have subscribed to the push notifications would be nice to have.
Hello. This is not and issue, but rather a request for detailed instructions on how to properly set up the plugin.
Although I've read all the plugin's documentation as also further instructions on https://github.com/surrealroad/Safari-Push-Notifications, I still can't get the plugin to work as intended. I run a seld-managed vps and I use a SSL (HTTPS) server, signed by a recognised authority (Comodo).
I'd really appreciate any help from the experts. P.S: As I'm not a developer I apologize for any noob terms I might be using here...Thanks in advance for your attention.
openssl x509 -in website_aps_production.cer -inform DER -out apns-cert.pem -outform PEM
- which resulted on a new file named apns-cert.pemFinally I created the folders /v1/push/ under my WordPress website root directory on my server and moved all the following files to the /push/ directory.
1 - config.php
2 - createPushPackage.php
3 - index.php
3 - desktop.php
4 - mysqli.inc.php
5 - And the /pushPackage.raw/ folder
My server's directory structure for my WordPress installation is a bit different as follows:
I have the WordPress installed under a directory named /site/ which lies on my website's root directory that is /www/, meaning my WP website runs on /www/site/ - This is an ordinary nginx server and I have no issues regarding the ssl certificate from Comodo or the WP website itself.
I confess I'm totally lost here, so after moving the aforementioned files to the server I placed the certificates mysite_webpush.p12 and apns-cert.pem right within the /v1/ directory while the rest of the files I uploaded to the /push/ directory.
Here's a example of the organization I've done.
/www/site/v1/ ---> Here I placed the certificates mysite_webpush.p12 and apns-cert.pem
/www/site/v1/push/ ---> Here I placed all the files config.php, createPushPackage.php, index.php, desktop.php, mysqli.inc.php and the /pushPackage.raw/ folder.
I've set up the config.php as follows:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for storing device ids */
define('DB_NAME', 'mydb_name');
/** MySQL database username */
define('DB_USER', 'mydb_user');
/** MySQL database password */
define('DB_PASSWORD', 'mydb_password');
/** MySQL hostname */
define('DB_HOST', 'localhost');
// ** Push server site settings ** //
/* Web Service Base URL */
define('WEBSERVICE_URL', 'https://pizzariameurancho.com.br/site/');
/* Website Push ID unique identifier */
define('WEBSITE_UID', 'web.com.br.pizzariameurancho_myapp');
/* Website Name */
define('WEBSITE_NAME', 'Pizzaria Meu Rancho');
/* Allowed Domains, must be comma-seperated and quoted */
define('ALLOWED_DOMAINS', '"https://pizzariameurancho.com.br", "https://www.pizzariameurancho.com.br"');
/* URL string format for links */
define('URL_FORMAT', 'https://pizzariameurancho.com.br/site/');
// ** Certificate settings - certificates provided by Apple ** //
define('CERTIFICATE_PATH', './mysite_webpush.p12'); // Change this to the path where your certificate is located
define('CERTIFICATE_PASSWORD', ''); // Change this to the certificate's import password
define('PRODUCTION_CERTIFICATE_PATH', './apns-cert.pem'); // Change this to the path to your Website Push ID Production Certificate
// ** Authorisation code for requesting push notifications to be sent ** //
define('AUTHORISATION_CODE', '');
// ** APNS Settings, probably don't need to be changed ** //
define('APNS_HOST', 'gateway.push.apple.com');
define('APNS_PORT', 2195);
Could anyone please point out what I'm missing. This has been a total puzzle to me.
Thanks a lot for your attention.
Regards,
Adriano.
An important message about apple push notifications.
There is a change to make.
Hello,
There is a problem with safaripush_authcode in the Plugin WP. The code is not encrypted in the database.
If someone hack the server, it may have associated with the certificate code push.
It is necessary to encrypt the password in the database
Thank you
allow sending to individual devices, specifically in the test push field, even if this means entering the device id for where to send manual.
hello, i have installed the plugin as from (a bit low) documentation but quen i watch web site from safari 7 the confitmation popup isnt displayed (watching your test site its show)
I have tryed to debug the page in safari and i see that the call to window.safari.pushNotification.requestPermission is done but when the Callback function is called the permission parameters contain 'denied' as if the user click NO but the popup never displayed...
Please any idea ?? are the certificate used/needed internally from this call ? may be i have not puy they in the right place ? (i have only one certificate reallly, in two format, p12 and pem)
Many thanks
Interface for reading the device list from the .push table to show current number of subscribers. If someone was logged in when they grant push notification permission, ass the user name to the table row to allow easier identification of who subscribers are.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.