-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add service worker for push notifications #5805
Conversation
wcfsetup/install/files/lib/action/RegisterServiceWorkerAction.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/action/RegisterServiceWorkerAction.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/data/service/worker/ServiceWorker.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/acp/dashboard/box/event/PHPExtensionCollecting.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Util.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Util.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/ServiceWorkerHandler.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/ServiceWorkerHandler.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
$payload = JSON::encode([ | ||
'aud' => $serviceWorker->getEndpoint(), | ||
'exp' => TIME_NOW + 43200, // 12h | ||
'sub' => "mailto:" . MAIL_ADMIN_ADDRESS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the email address be rawurlencode
d? Thinking about email addresses such as admin+myforum@example.com
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed. The value mailto:admin+myforum@example.com
works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also might make sense to drop the reverted dependency-related commits entirely, for two reasons:
- Less bloat for the repository, because they will not be part of
master
after being merged. - Less garbage for the fileDelete.xml generation script to work through. See 04f17cd. That script will add anything to fileDelete.xml that was previously part of the
master
branch, but no longer is part of it.
Update the register of new service worker Add objectID for ServiceWorker
Better exception handling
Add `notificationclick` event to open new window with the given url
4ef9fec
to
d0963eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more remarks regarding the cryptography. I did not test any of the code snippets, so please disregard the stuff that does not make sense to you / that you disagree with. It's already much better with the hex2bin
/bin2hex
gone.
wcfsetup/install/files/lib/system/service/worker/ServiceWorkerHandler.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/VAPID.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encryption.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Util.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't quite follow the entire cryptographic flow, but that might be because I didn't actually read the underlying specification. That said, it looks reasonable to me now.
You might want to consider running phpcbf
and php-cs-fixer
on lib/system/service/
. Some of the spacing (with regard to empty lines) doesn't match the code style that is generally used and made it a little jarring while attempting to grok the code.
wcfsetup/install/files/lib/system/background/job/ServiceWorkerDeliveryBackgroundJob.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Encoding.class.php
Outdated
Show resolved
Hide resolved
wcfsetup/install/files/lib/system/service/worker/Util.class.php
Outdated
Show resolved
Hide resolved
8ce4cc4
to
02f380a
Compare
# Conflicts: # wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.1.php
Waiting for composer packages
|
…fications # Conflicts: # ts/WoltLabSuite/Core/Notification/Handler.ts # wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js # wcfsetup/install/files/lib/system/api/composer.json # wcfsetup/install/files/lib/system/api/composer.lock # wcfsetup/install/files/lib/system/api/composer/installed.json # wcfsetup/install/files/lib/system/api/composer/installed.php
https://github.com/web-push-libs/web-push-php/releases has v9.0.0-rc2 out for a few days already and we can possibly expect a release to arrive in July.
The version 4.0 appears to be still under development as of now. However, its |
# Conflicts: # wcfsetup/install/files/acp/database/update_com.woltlab.wcf_6.1.php
# Conflicts: # wcfsetup/install/files/lib/system/api/composer.json # wcfsetup/install/files/lib/system/api/composer.lock # wcfsetup/install/files/lib/system/api/composer/installed.php
`web-token/jwt-library` to `3.3.50` `spomky-labs/pki-framework` to `1.2.1`
`web-token/jwt-library` to `3.3.50` `spomky-labs/pki-framework` to `1.2.1`
Closes #3960