GithubHelp home page GithubHelp logo

wp-safari-push's People

Contributors

surrealroad avatar tabrisrp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wp-safari-push's Issues

Minimize JS overhead

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 Mutli-site WordPress

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.

How to properly set up the plugin

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.

What I've done until now:

  • I installed and activated safari push plugin and filled up the main settings, here's a screenshot: https://cloudup.com/cfOcB5FzvmT - I've left some fields blank as I don't know what to put in there.

I've successfully created the certificates on Apple's Provisioning Portal following the steps:

  • I created a Certificate Signing Request on Mac;
  • I Created a Website Push ID with the reverse domain: web.com.br.mydomain.myappname
  • After choosing the Website Push ID I've created earlier, I uploaded the CSR file I've created on Mac on Apple's Provisioning Portal to generate Apple's website_aps_production.cer certificate file.

Back to the Mac:

  • I downloaded the website_aps_production.cer certificate file, then I added the file to the Mac's Keychain.app and I exported the certificate right from the Keychain.app as a .p12 certificate file and named it mysite_webpush.p12

On the server side:

  • I uploaded the certificates files (website_aps_production.cer and mysite_webpush.p12) to my server's root directory and then on Terminal I executed the following command to convert the website_aps_production.cer file to a .pem format: openssl x509 -in website_aps_production.cer -inform DER -out apns-cert.pem -outform PEM - which resulted on a new file named apns-cert.pem
  • I created a new database using the push.sql file
  • I successfully renamed the config-sample.php to config.php and set it up as per the database information
  • I replaced the images in pushPackage.raw/icon.iconset/

Directory structure and file organization

Finally 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.

The config.php set up

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.

safaripush_authcode and Security !

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

send test push to individual devices

allow sending to individual devices, specifically in the test push field, even if this means entering the device id for where to send manual.

Popup to accept notification is not displayed

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

Retrieve registered devices count

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.