Skip to content

Front/webpush#2663

Open
p1gp1g wants to merge 36 commits intonextcloud:masterfrom
p1gp1g:front/webpush
Open

Front/webpush#2663
p1gp1g wants to merge 36 commits intonextcloud:masterfrom
p1gp1g:front/webpush

Conversation

@p1gp1g
Copy link
Contributor

@p1gp1g p1gp1g commented Nov 28, 2025

This PR uses the new web push support (#2662) to get push notifications on the web application, even when nextcloud isn't opened in the browser.

It achieves 2 things:

  • it gives push notifications when nextcloud isn't opened: this is particularly useful for collaborative work, as nexcloud isn't always opened but we can expect to be notified anyway. (I won't miss call, polls, or events anymore)
  • it gives real time notifications, without the notify_push app (which adds a websocket support to nextcloud). It should reduce load on the server as the periodic fetch is reduce to once every 15min. When the server get a notification for a user, it sends it to the user through its push server (all modern browser are connected to a push server)

To work, this PR needs to add worker-src 'self' to the CSP by default:

https://github.com/nextcloud/server/blob/master/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php#L62

-	protected $allowedWorkerSrcDomains = null;
+	protected $allowedWorkerSrcDomains = ["'self'"];

@p1gp1g p1gp1g mentioned this pull request Nov 28, 2025
@wrenix

This comment was marked as resolved.

@nickvergessen

This comment was marked as resolved.

@github-actions
Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@p1gp1g p1gp1g marked this pull request as ready for review February 12, 2026 11:20
@p1gp1g
Copy link
Contributor Author

p1gp1g commented Feb 12, 2026

I've rebased the PR on the master branch, and updated following some changes we did: apptype (array) => appTypes (String)

@Elsensee
Copy link

I really love this PR and I wanted WebPush support in Nextcloud for some time already, so I am super sorry for all this!

But another thing I noticed was, that you don’t seem to handle delete notifications at all? I am not even sure, how this could be properly handled. You could call getNotifications() and then close() but on Android this might still appear in the notification history. Also, when the tab is closed you must show a notification on push.
Alternatively, you could replace the notification with some silent notification with title "This notification has been deleted" and then quickly close() it, but I don’t know if that will actually work.

I assume, integrating UnifiedPush for the mobile apps will be a lot more straight forward as most logic should already be in place there. It’s just a shame, that you have to do all this manual legwork for browsers. 😅

@p1gp1g
Copy link
Contributor Author

p1gp1g commented Feb 12, 2026

I suppose this is a typo and you're not sorry for this ?

BTW, your help is very welcome, thanks. I will show a generic notification if we don't have the right content. You can also suggest code directly or open PR on my repo if you want :)

Regarding UnifiedPush: the implementation is already done, I've a few things to do following changes on the backend Pr :D

@Elsensee
Copy link

I just didn't want to come across as rude and complaining about a lot, especially since I am not affiliated with Nextcloud. :)

And nice, I will see what my time allows me to do on contributing. :)

I’m looking forward to the UnifiedPush implementation!

@p1gp1g
Copy link
Contributor Author

p1gp1g commented Feb 12, 2026

No problem, code review is done for that ! At the end we have a better solution

p1gp1g and others added 21 commits February 24, 2026 10:40
Signed-off-by: sim <git@sgougeon.fr>
Signed-off-by: sim <git@sgougeon.fr>
Signed-off-by: sim <git@sgougeon.fr>
…n't supported

Signed-off-by: sim <git@sgougeon.fr>
Signed-off-by: sim <git@sgougeon.fr>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: S1m <31284753+p1gp1g@users.noreply.github.com>
Signed-off-by: sim <git@sgougeon.fr>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: sim <git@sgougeon.fr>
Signed-off-by: sim <git@sgougeon.fr>
Signed-off-by: sim <git@sgougeon.fr>
Signed-off-by: sim <git@sgougeon.fr>
Co-authored-by: Maksim Sukharev <antreesy.web@gmail.com>
Signed-off-by: S1m <31284753+p1gp1g@users.noreply.github.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
@p1gp1g
Copy link
Contributor Author

p1gp1g commented Feb 24, 2026

How do you do your tests ? I've tested on Firefox and Chromium - both on Linux, but all platforms should work

You still need your browser to be opened, else it isn't connected to their push server anymore. Except on mobile, where the browser can be waken by the device push service (APNS, FCM, UnifiedPush). But you don't have to have Nextcloud in one of the opened tab

@nickvergessen
Copy link
Member

How do you do your tests ?

  1. Open Nextcloud with this branch of notification app
  2. Grant notification permissions in browser
  3. Close the tab
  4. occ notification:generate --dummy userId 2

Expectation

See a notification

Actual

nothing

When 3 is skipped and you just navigate to another tab, it works.

@p1gp1g
Copy link
Contributor Author

p1gp1g commented Feb 24, 2026

I wonder if it isn't because the test notification isn't formatted the same way than actual notifications. Can you do the same thing but send a Talk message or comment a shared file for the 4th step - to fire a real notification ?

And, if something is wrong, then you may want to look at the Service : about:debugging on Firefox > This Firefox > And you will be able to inspect the service worker

@nickvergessen
Copy link
Member

And, if something is wrong, then you may want to look at the Service : about:debugging on Firefox > This Firefox > And you will be able to inspect the service worker

After going there is was missing the entry, it showed up after loading the page again, but it was disabled. After pressing "Start" it worked, and after a few moments it's off again, but now also starts again when receiving a notification:
grafik

@nickvergessen
Copy link
Member

I wonder if it isn't because the test notification isn't formatted the same way than actual notifications.

Well it is an accepted format. Any app can push notifications and it should the same for all of those. But lets see how the testing continues.

@p1gp1g
Copy link
Contributor Author

p1gp1g commented Feb 24, 2026

You shouldn't have to click "Start", it is done automatically on push. Maybe the service worker wasn't registered for any reason, a cache or something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants