-
-
Notifications
You must be signed in to change notification settings - Fork 919
Handle anonymous read restrictions by sending a poll_request event #1287
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
Handle anonymous read restrictions by sending a poll_request event #1287
Conversation
If a topic does not allow anonymous reads, this change ensures that we send a "poll_request" event instead of relaying the message via Firebase. Additionally, we include generic text in the title and body/message. This way, if the client cannot retrieve the actual message, the user will still receive a notification, prompting them to update the client manually.
Holy shit, is this the issue why some users do not receive message on iOS if they have a Pro subscription? |
@binwiederhier Yes, I'm pretty sure this is the source of/fix for that bug! I think I worked through this with barart on Discord |
@binwiederhier I’m not sure what features Pro subscription users have, but this fix addresses the issue with the iOS app and APNS when the topic is private. Additionally, this other fix is also required in the iOS app: I host my own ntfy server, compiled my own version of the ntfy iOS app, and use my own APNS configuration via my Apple Developer account, so I’m not entirely sure what the Pro subscription includes or how this fix might impact it. But I’d be happy to help investigate if you can guide me on what issue your Pro users are facing. And yep, we worked on this with @wunter8 on Discord that day, he gave me the clue that led to the fix. |
That's exactly the issue binwiederhier is talking about: Pro subscriptions let people make a certain number of topics private on the public ntfy.sh instance. However, once they make the topic private, they don't receive push notifications through the iOS app anymore |
So yes, this will fix the problem 👌🏻 |
So I don't think I agree with the tags and such being part of the poll request. I'll merge your PR, but then later empty-out these fields. I don't want to leak data. |
Thank you. I hope this works! |
@binwiederhier It works, I've been using this fix ever since. 😉 The tags are necessary exactly to avoid data leaks and to show something generic to iOS in case the device can't retrieve the actual message from the server. |
My brain is not fully functioning anymore, so I'll have to re-read what you wrote tomorrow, but please look at what I did here and tell me if you think this would still work: 6d15b9f You could try it out 😬 Are you sure that ALL the fields are necessary, or only the |
@binwiederhier Nope, all fields are required iOS needs them (working on the fix i read that) is very strict specially on mute messages (this is the case), once you have time, read my previous post so you can understand, i already tried a lot of things to figure and protect the messages and that was my result of a lot of debug, what you did will leak the messages, not trigger the MutableContent function (that was my first try) and some notifications will be lost |
I wrote a big whole thing about how you are incorrect, and then I finally got it. My misunderstanding was that I was thinking that I'll update the code tonight to fix my fuckup. |
@barart Here you go, this should make the entire thing a little more elegant I think: #1353 It works like this:
Easiest to read like this: ntfy/server/server_firebase.go Lines 141 to 152 in f40023a
|
You say that all fields are required for it to work in iOS, though this code does not have all the fields: ntfy/server/server_firebase.go Lines 130 to 139 in f40023a
Can you explain why all the fields would be necessary? This^^ code would not work I think (this is for self-hosted folks), if all fields were necessary. |
@barart If you have some time, would you kindly look at the currently committed code ^ and let me know if you believe that it would work? I currently don't have a good testing setup, so I'll probably just release it to prod and roll back if it breaks anything. Here: https://github.com/binwiederhier/ntfy/blob/main/server/server_firebase.go |
If a topic does not allow anonymous reads, this change ensures that we send a "poll_request" event instead of relaying the message via Firebase. Additionally, we include generic text in the title and body/message. This way, if the client cannot retrieve the actual message, the user will still receive a notification, prompting them to update the client manually.