-
-
Notifications
You must be signed in to change notification settings - Fork 581
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
Support for push notifications in GotoSocial 0.18 #3150
Comments
Thanks for sharing the update. 😃 I'm still unfamiliar with how push notification works in Mastodon but I checked some related codes. MessageIn the current implementation, the second paragraph ( ref.
New notification type
Current Canary Elk won't show notifications with unknown types in Notification tab (https://main.elk.zone/notifications), and just print out warnings to the console: https://github.com/elk-zone/elk/blob/main/components/notification/NotificationCard.vue#L34 |
Do you happen to know where the VAPID key is coming from? VAPID public keys are per instance, but Mastodon used to also send them when app credentials were created; this was deprecated in Mastodon 4.3.0 and may stop working someday. Since Mastodon 4.3.0, it's now available from the v2 instance API. You can see that in the GtS version of my own push-notification-enabled GtS server here: https://princess.industries/api/v2/instance Finally, it's available on Web Push subscription objects, but that's probably not relevant to this case, since you'd need to create a subscription to get it that way, and this check happens before that. Let me confirm that we're providing it all three ways in GtS and get back to you. |
can you check the error in devtools? the server key is requested when the user signs-in: Line 106 in a7d64fd
Here the api: https://docs.joinmastodon.org/methods/push/#get And the vapid_key logic here: elk/composables/push-notifications/createPushSubscription.ts Lines 19 to 38 in a7d64fd
and the creation here: elk/composables/push-notifications/createPushSubscription.ts Lines 118 to 135 in a7d64fd
Do you have enabled another account with psuh notifications enabled? do you have permissions blocked (push notification requires you to enable browser push notifications when asked)? |
I don't have permissions blocked, and I don't have another account with push notifications enabled (I'm aware that a given site can only have one push subscription at a time). As far as errors, both Mastodon and GtS 404 when I think we're running into #2562 here: elk.zone has old OAuth app credentials for my production and test servers, and those credentials don't have an associated VAPID key. If you can delete your stored app credentials for |
I believe there are at least two possible fixes aside from directly addressing #2562; one is to do a one-time invalidation of the app token for every GtS instance, and the other is to use the VAPID key in |
Thanks for the suggestions. I'm going to take a closer look at this issue this week and try to understand how push notifications work. I was able to set up GoToSocial server on my Raspberry Pi with docker-compose (https://dev-000.gotosocial.shuuji3.xyz/@shuuji3) so that I can check how they interact with the local Elk dev server. Can I use I think the first step I can try is to implement the second option, using #2562 was also a long-standing issue and I understand we need to fix it at some point. After implementing that, I'll try TTL cache package (like https://www.npmjs.com/package/@isaacs/ttlcache) or something to prevent permanent lockout from Elk. |
Another idea for testing: maybe you can create a PR (with a trivial edit) against this repository just for testing. Elk repository will create a new deploy preview using Netlify similar to the production build, and it issues a new domain for each PR. For example, the creation of this PR #3183 triggered the new deploy preview with this URL: https://deploy-preview-3183--elk-zone.netlify.app/. It should have a clean database for each Elk server so the old OAuth app credentials don't exist there. If you think it works for you, please feel free to create any number of PR 🙂 |
@shuuji3 that's correct, the |
Probably #3193 will (partially) solve the app token issue. It prioritizes using vapid_key from I tested the
Note that although #3193 changed to use |
I'm the GotoSocial developer implementing Web Push notifications for the upcoming GtS 0.18 release and wanted to give you a heads up. Right now Elk properly displays that GtS doesn't support them yet:
But we'll be adding them with superseriousbusiness/gotosocial#3587 fairly soon. They work almost identically to Mastodon's, with the following caveats:
pending.favourite
,pending.reply
, andpending.reblog
policy
for controlling who you get PNs from is not yet implemented: you can set it to anything but GtS will ignore it and always returnpolicy: "all"
(this may change before we ship 0.18)Please let me know if you have questions.
The text was updated successfully, but these errors were encountered: