Code Monkey home page Code Monkey logo

perfecty-push-wp's People

Contributors

almaz avatar mociof avatar rwngallego avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

perfecty-push-wp's Issues

Make user information searchable

It would be nice to be able to search through records in user table (UUID, IP address) at /wp-admin/admin.php?page=perfecty-push-users

Prefill customizable text in Settings

Customizable text should be prefilled with current phrases, instead of being empty.

text

Also there should be screenshots of use, to be able to identify how and where the text is being displayed.

Anonymize IP

Related to https://wordpress.org/support/topic/anonymize-ip-7/

You know in some cases for collect the user’s IP you need a permission and besides that, we don’t want to do it. (Collect the user’s IP for privacy reasons).

We could maybe add a checkbox that enables/disables the collection of the IP address.

Add icon to prompt

It would be nice to display icon within the prompt and alter the buttons to look more like OneSignal’s:

94b280b-Slidedown_PrePermission_Message

Deleting users and re-subscribing

If I delete all the users from Perfectly Push > Users, it should delete all of them and users should be asked to allow notifications on their next visit, right? But is not happening. Deleting all users only deletes them from the admin interface. When visiting the website (cache cleared), deleted users are not prompted to allow notifications and if you click on the bottom bell icon, the checkbox is already checked. Unchecking that box returns an error "Could not change the preference, try again" (btw, the plugin should allow us to change this text from the settings because not everybody speaks English).

Notifications not running. Am I doing something wrong?

Hi,

I'm not sure if I need to do something extra?

  • Plugin is active
  • VAPID keys are showing.
  • PHP is 7.4
  • Latest WP
  • SSL is enabled
  • Plugin is 'Enabled'
  • Remove conflicting workers is disabled (also tried with enabled)
  • Box on front end is checked 'I want to receive notifications'
  • All other plugins are disabled
  • CDN & Cache are disabled
  • Tested on Chrome (incognito)
  • Tested on Chrome (logged out of WP)
  • Tested on Firefox

Here's the latest results:

2021-03-02 21:56:03

Status:
completed

Stats:
Total: 2
Succeeded: 2
Failed: 0

Execution details:
Finished
Batch size: 30
Duration: 00h:01m:11s

Endpoint is registered and active. But I see no notifications ☹️

Display execution logs

To make the troubleshooting easier, we could add a displaying mechanism for Logs. For security reasons, the log folder needs to have a special name, needs an index.php file and a .htaccess file like: https://github.com/inpsyde/backwpup/blob/bdb72dd8d51076d7e11bf9ce52e0f94e1246ca33/inc/class-file.php#L184-L189

We need to consider log rotation also. We could either use a Logging library like Monolog or simply create a custom and lighter one to avoid potential collisions with conflicting composer versions from other plugins.

firefox for android issue

i"m facing a problem with firefox for android i don't get the subscribe pop up or the subscribe bell at all but it works on the desktop and chrome for android

Problem creating users tables (index key is too long for MySql 5.6 using MyISAM tables and utf8)

Hi, just installed the plugin on a new wp instance, where the database is set with utf8_general_ci as charset collate.
After configuring the plugin, I tried to subscribe notification, but I received from the front js the following message: "Could not change the preference, try again" (in English, but this is my fault, next days I will post a patch to translate messages in public/js/perfecty-push-public.js).
Then looking at apache error log, I have seen the error that is _"[...] perfecty_push_users' doesn't exist for query SELECT id,uuid,endpoint,key_auth,key_p256dh,remote_ip,is_active [...]".
So, perfecty_push users table is missing.
I checked via phpmyadmin and there is no perfecty_push_users table in my db.
So:

  1. the activation procedure should check if something is wrong in creating db tables and notify this to the user.
  2. why there is no user table?

I tried to manually execute the query in lib/class-perfecty-push-lib-db.php to create the table and mysql answered:
Query SQL:

CREATE TABLE IF NOT EXISTS [my_prefix]_perfecty_push_users (
id int(11) NOT NULL AUTO_INCREMENT,
uuid char(36) NOT NULL,
remote_ip varchar(46) DEFAULT '',
endpoint varchar(500) NOT NULL UNIQUE,
key_auth varchar(100) NOT NULL UNIQUE,
key_p256dh varchar(100) NOT NULL UNIQUE,
is_active tinyint(1) DEFAULT 1 NOT NULL,
disabled tinyint(1) DEFAULT 0 NOT NULL,
created_at datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY users_uuid_uk (uuid),
UNIQUE KEY users_endpoint_uk (endpoint)
)

Messaggio di MySQL: Documentazione
#1071 - Specified key was too long; max key length is 1000 bytes

MySQL server is 5.6.47 version and I am using MyISAM tables, so the problem is in using endpoint for index because MySQL 5.6 has a limit of 1000 bytes of index and endpoint varchar(500) uses 500 x 4 = 2000 bytes in utf8.
In this topic, I found useful info about the issue: https://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes

Improve push notifications delivery speed

Sending 10.000 notifications takes 20 minutes on DigitalOcean Basic Droplet / 2 GB RAM / 1 Shared vCPU. That's extremely slow.

The goal is to send 10.000 notifications in 1-2 minutes without significantly raising the CPU load.

https://github.com/web-push-libs/web-push-php#how-do-i-scale mentions couple of things to do:

  • Make sure MultiCurl is available on your server - We should add this check and recommendation on Settings page
  • Find the right balance for your needs between security and performance - Payload is encrypted according to the Message Encryption for Web Push standard, using the user public key and authentication secret that you can get by following the Web Push API specification. - We could add option to enable/disable message encryption. It should be disabled by default, because notifications about post updates on public website do not need to be encrypted.
  • Find the right batch size (set it in defaultOptions or as parameter to flush())

Other ideas:

  • Using HTTP/2 allowing multiple concurrent exchanges on the same connection instead of HTTP/1 which needs to use multiple connections to achieve concurrency
  • Support for a script with no execution limit:

Another thing to note is that WP Crons are activated usually per page visit, so if the WP Cron that executes a single batch has finished, there’s a dead spot in which we lose some seconds. For 10.000 notifications in batches of 100, it’s 100 cycles, it means that if we wait 1 second between cycle, we lose 1,6 min, for 2 seconds we lose 3.3 min, etc… As we said, there’s definitively room for improvement, e.g. one alternative would be to have a script with no execution limit and we can send everything in one single cycle.

Based on: https://wordpress.org/support/topic/onesignal-6/

can't send notification in arabic

i get this error when i try to send a notification in arabic "Could not schedule the notification, check the logs", but i can in english also if i create a post in arabic i don't get notification when i publish the post but if i create a post in english i get the notification
Screenshot_20210511_195125

Deleting plugin doesn't clear db

Deleting the plugin and reinstalling it keeps the same settings, texts, vapid key, everything.
Shouldn't all these be deleted when the plugin is deleted?

Configure fields in the meta box

It would be nice to be able to remove "Send featured image or first image found in content" and "Custom title (default: website name)" fields from the meta box in Settings.

Conflicts with Guzzle version when using plugins that use composer

Some users have reported that even though the users can subscribe, no notifications are being sent. They get stale in a "Running" status and in the PHP error logs, we can notice something like:

Backend fatal error: PHP Fatal error:  Uncaught Error: Call to undefined method GuzzleHttp\\Utils::chooseHandler() in wp-content/plugins/perfecty-push-notifications/vendor/guzzlehttp/guzzle/src/functions.php:61\nStack 

How not to use the bell

Hi @rwngallego

This plugin is awesome! But what if I want to show alerts directly on all pages without using the bell?

I also looked at perfecty-push-js-sdk, but it looks like I need to change the Plugin after all, so please let me know.

Sorry for the text in translation.

Scheduling notifications

What about creating a scheduler to send notifications starting at a certain date/time in the future?

Cannot subscribe on MacOS

Many users are reporting to me that the subscribe alert keeps showing even if they click on "nope", but only on MacOS (both chrome and safari).
If they try to subscribe the alert disappears but subscription doesn't work and they got an error.

Not working

Even if on the Dashboard and in the Notification section the notifications appear as sent successfully (Succedeed:4, Failed:0), there were no notifications received in the browsers of the subscribers.

The hosting provider said "it is also not possible to integrate ngx_http_dav_module with Runcloud Nginx. Because it may break the default Nginx configuration badly"

Any solution for this?

Bug in the Perfecty Push Service Worker detection

Relates to:
https://wordpress.org/support/topic/update-issue-with-the-plugin-progressive-wordpress/

There's a third party Service Worker in the root scope, when the registration is triggered, the Perfecty SDK detects it as a conflict but skips the Service Worker installation:

Starting Perfecty Push SDK
perfecty-push-sdk.min.js?ver=1.1.3:1 Drawing controls
perfecty-push-sdk.min.js?ver=1.1.3:1 Showing the bell and settings controls
perfecty-push-sdk.min.js?ver=1.1.3:1 The site has not permissions granted
perfecty-push-sdk.min.js?ver=1.1.3:1 Perfecty Push SDK was started
perfecty-push-sdk.min.js?ver=1.1.3:1 User is accepting the subscription
perfecty-push-sdk.min.js?ver=1.1.3:1 Requesting Notification permission
perfecty-push-sdk.min.js?ver=1.1.3:1 Notification permission
perfecty-push-sdk.min.js?ver=1.1.3:1 granted
perfecty-push-sdk.min.js?ver=1.1.3:1 User has granted permissions
perfecty-push-sdk.min.js?ver=1.1.3:1 Service Worker found
perfecty-push-sdk.min.js?ver=1.1.3:1 Registering user
perfecty-push-sdk.min.js?ver=1.1.3:1 Subscribing to Push Notifications
perfecty-push-sdk.min.js?ver=1.1.3:1 Sending user registration
perfecty-push-sdk.min.js?ver=1.1.3:1 Registering user in the server
perfecty-push-sdk.min.js?ver=1.1.3:1 The user was registered successfully
perfecty-push-sdk.min.js?ver=1.1.3:1 Hiding the bell and settings control

Subscription blocked by Cloudflare - invalid method PUT

Hello, I just installed your WP plugin to test it out and looks like there's an issue with Cloudflare, the world's most used CDN.
The PUT http method is blocked so the subscription never gets to the server, the call to the endpoint returns a 405. error.

These are de response headers for the request:

allow: GET,POST,OPTIONS,HEAD,TRACE
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
cf-cache-status: DYNAMIC
cf-railgun: direct (starting new WAN connection)
cf-ray: 62dfbc72391fc769-AMS
cf-request-id: 08bfb41b660000c7697f875000000001
content-type: text/html; charset=iso-8859-1
date: Wed, 10 Mar 2021 21:46:30 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
nel: {"max_age":604800,"report_to":"cf-nel"}
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report?s=%2BDRLA2DRPHKzBo7GJlzfpNTi6tKqH3zgBj9UBRPQS3Ah58knua7oGdcLVknT%2FsN4n0V3K0286e76F9y50EBgepk%2BVMNuZWv6FnLTMA%3D%3D"}],"group":"cf-nel","max_age":604800}
server: cloudflare

and this is the response got in browser from the API endpoint:

image

Do you think you could change the way the subscription is passed from browser to server, from PUT to POST?
Thanks!


Edit: found a better explanation here: https://gridpane.com/kb/making-nginx-accept-put-delete-and-patch-verbs/
Cloudflare uses NGINX server.

Display prompt after X pageviews

Instead of displaying prompt right away to the new visitor, would like to display it after X pageviews, to be less intrusive.

Using the following for OneSignal:

jQuery(document).ready(function($) {

	window.OneSignal = window.OneSignal || [];
	var numVisitsTrigger = 3; /* Number of page visits before prompting user */

	window.OneSignal.push(function() {
		var numVisits = new Number(localStorage['numVisitsTrigger'] || 0);
		numVisits += 1;
		localStorage['numVisitsTrigger'] = numVisits;
		if (numVisits >= numVisitsTrigger) {
			promptAndSubscribeUser();
		}
	});

	function promptAndSubscribeUser() {
		window.OneSignal.isPushNotificationsEnabled(function(isEnabled) {
			if (!isEnabled) {
				// Show Slide Prompt
				window.OneSignal.showSlidedownPrompt();
			}
		});
	}

});

Add PWA support

Related to issue: https://wordpress.org/support/topic/integrating-with-pwa/

How do we handle conflicting service workers?

I have reviewed the code on GitHub and I believe we can edit the plugin service worker to include any other service works. The importStripts('exampleURL.com/js-serviceworker.js'); technique will merge service workers and allow them to work together.

notification job fail sometimes

sometimes the notification job fail and the status of the failed notification is :

scheduled
at 1970-01-01 00:00:00

this is the log from the admin panel :

2021-07-06 17:02:22 | INFO | Next ticker scheduled at: 2021-07-06 18:03:22

2021-07-06 17:02:17 | INFO | Next ticker scheduled at: 2021-07-06 18:03:16
2021-07-06 17:01:30 | INFO | Cron check ticked
2021-07-06 16:59:51 | INFO | Next ticker scheduled at: 2021-07-06 18:00:51
2021-07-06 16:59:37 | INFO | Cron check ticked
2021-07-06 16:58:37 | INFO | Next ticker scheduled at: 2021-07-06 17:59:37
2021-07-06 16:58:29 | INFO | Cron check ticked
2021-07-06 16:57:24 | INFO | Next ticker scheduled at: 2021-07-06 17:58:24
2021-07-06 16:57:23 | INFO | Next ticker scheduled at: 2021-07-06 17:58:23
2021-07-06 16:57:20 | INFO | Cron check ticked
2021-07-06 16:56:21 | INFO | Scheduling a broadcast notification
2021-07-06 16:56:21 | DEBUG | Array ( [title] => MJB Tech Tips [body] => كشفت ASRock عن قائمة اللوحات الأم التي ستدعم ويندوز 11 [icon] => https://mjbtechtips.com/wp-content/uploads/2021/06/cropped-icone.png [image] => https://mjbtechtips.com/wp-content/uploads/2021/06/2021-06-25-image-23-j.webp [require_interaction] => 1 [extra] => Array ( [url_to_open] => https://mjbtechtips.com/2021/07/%d9%83%d8%b4%d9%81%d8%aa-asrock-%d8%b9%d9%86-%d9%82%d8%a7%d8%a6%d9%85%d8%a9-%d8%a7%d9%84%d9%84%d9%88%d8%ad%d8%a7%d8%aa-%d8%a7%d9%84%d8%a3%d9%85-%d8%a7%d9%84%d8%aa%d9%8a-%d8%b3%d8%aa%d8%af%d8%b9%d9%85/ ) )
2021-07-06 16:56:21 | INFO | Scheduling job id=61, result: 1

and this is from /var/log/php7.4-fpm.log

[06-Jul-2021 16:56:21] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

there was nothing on the /var/log/nginx/error.log related to this event

Delete users that have opted-out

Related to: https://wordpress.org/support/topic/delete-user-from-database-on-unsubscribe/

We need to remove the users that have opted out, instead of marking them as inactive in the DB. There's no gain in having them in the DB, as usually they will not receive any push messages, and the subscription could expire in between opting out/in again.

In the JS side, the SDK should not check the user registration from the server if the status is marked as inactive in the LocalStorage.

White list for "Remove conflicting workers" option

As discussed at https://wordpress.org/support/topic/onesignal-6/

Isn’t it better to target specific workers such as OneSignalSDKWorker.js instead of removing all of them?

This is difficult because we would have to have a DB of the possible existing Push Providers (OneSignal is just one of tens of them).

To resolve "Don’t use it with PWA/AMP" issue when migrating from the other push provider, there should be a list of service workers that should be ignored, i.e. won't be automatically unregistered when "Remove conflicting workers" is enabled.

That we should explain webmasters in documentation how to find names of PWA/AMP service workers in browser console and put them in such list?

Notifications should not auto disappear

Notifications should not disappear after 10 seconds, but should be displayed on screen until user clicks it or closes it using Close button, just like OneSignal's notifications do.

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.