mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #20] Opening ntfy.sh link in a browser on Android opens the app and subscribes to the topic if the app is installed #16
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Copephobia on GitHub (Nov 24, 2021).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/20
A scenario may be:
If I click on the ntfy.sh link, it will attempt to open the app and subscribe to the topic, so that I can view it from there.
If I do not have the ntfy.sh link, it will display the web page for that topic.
@binwiederhier commented on GitHub (Nov 24, 2021):
I like this idea. And it should not be hard to implement.
@binwiederhier commented on GitHub (Dec 13, 2021):
Re-opening this, since I removed the feature in the latest commit. Android is not allowing me to register reg-ex patterns of URLs and the wildcard stuff seems incredibly buggy. I spent two+ hours with it yesterday and it's not worth it for now.
@gc-ss commented on GitHub (Dec 31, 2021):
Let's simplify it first?
ntfylinks and the app registers to handlentfylinksntfylink to send to people (instead of just http(s) link)Is this a possibility?
@binwiederhier commented on GitHub (Dec 31, 2021):
I wrote a whole long paragraph about why that's difficult and then I read your comment again. You just want a Share button that prints two links, one of which will open the app?
I don't know if Android will highlight and let you click ntfy:// links, probably not, but it's worth a try definitely.
And we'd still need a solution for the web UI.
@gc-ss commented on GitHub (Dec 31, 2021):
Philipp, then I did a poor job of conveying my intention. In case you happen to have that paragraph, I would really appreciate reading it. If it's gone, can you just type in the highlights so I can figure out what disconnect existed (before you read my comment again)?
Right. My thought is that the app can register itself with
ntfy://links and have greater controlI believe we can still use
ntfy://links or something similar (the client app can register itself withntfy://links)@12nick12 commented on GitHub (Jan 17, 2022):
I'm not a dev, but going from what has been spoken in the issue and my limited knowledge of stuff, you could just add a ntfy: link in the web page if you can get ntfy app to open ntfy: links. Kind of link how tel: opens the dialer and mailto: opens email.
@binwiederhier commented on GitHub (Jan 17, 2022):
That would be easy to do, but then it looks horribly broken for people that don't have the app installed.
@12nick12 commented on GitHub (Jan 17, 2022):
You could word something like "if you have the app installed hit THIS link"
@jhotmann commented on GitHub (Mar 31, 2022):
For me, having the app able to handle
ntfy://links would be enough as I mainly just want to be able to open the app to a specific topic via Tasker. But having antfy://link show up if you open a topic in a mobile browser could also be handy.I wrote a custom Owntracks server implementation and part of it includes device configuration generation. It creates an
owntracks://links with the configuration data base64 encoded and is clickable from the Android and iOS browsers. The links aren't highlighted/clickable in messaging and other apps, though.@binwiederhier commented on GitHub (Apr 7, 2022):
Sorry I never responded to this. This sounds easy enough. I should be able to whip that up at some point. There are just so many tickets :-D
@binwiederhier commented on GitHub (Apr 12, 2022):
(I'm starting work on this)
So if I implement
ntfy://ntfy.sh/mytopicthat opens the topic in the Android app and subscribes to it, that would be enough?I wonder if I should structure the link differently, so that other actions are supported in the future, like
ntfy://ntfy.sh/mytopic?action=subscribe, orntfy://subscribe/ntfy.sh/mytopic, ...I suppose I could iterate on it, so I think I'll just start with
ntfy://ntfy.sh/mytopic.@binwiederhier commented on GitHub (Apr 12, 2022):
https://github.com/binwiederhier/ntfy-android/pull/24/files implements this:
ntfy://myhost.lan/mytopic--> subscribes tohttps://myhost.lan/mytopic(if not already subscribed) and shows itntfy://myhost.lan/mytopic?secure=false--> subscribes tohttp://myhost.lan/mytopic(if not already subscribed) and shows itI think this is all there is to it. All that's missing is documentation for it.
To test:
@binwiederhier commented on GitHub (Apr 13, 2022):
Done. Will be in the next Android release. Added docs too, which will be in the next server release:
@adebisi-fa commented on GitHub (Nov 15, 2024):
Hi @binwiederhier,
Thanks for this great piece of work. ntfy is awesome!
Could we have the subscription's appearance setting (e.g. name and icon) configured via ntfy: // protocol, also?
Something like this:
ntfy://<hostname>/<topic>?name=<SubscriptionName>&icon=<IconUrl>&secure=<true|false>It would be a great addition!
Thanks once again for this great project.
@reslin commented on GitHub (Dec 1, 2024):
Hi @adebisi-fa!
Because this issue being over 2 years old, you maybe better open a new issue.
I have a similar request with deep links, but the issue (+PR, if I hopefully can provide some code) which I'll open soon will be on "mutating" topics rather than updating them.
(Meaning: add new topics and delete old ones, in one step... I thought "mutate" would be a fitting term.)
If you look at
https://github.com/binwiederhier/ntfy-android/blob/main/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt
line 99, you see this
.getBooleanQueryParameter(...)method, and surely there are other methods like.getStringQueryParameter(...)which can serve your purpose.In addition to the existing
ntfy://<host>/<topic>[?secure={true|false}]deep link I'm planning to introduce something likentfy://<host>/mutate?{sub|del|wipe}=<name|prefix>[&secure={true|false}](And that should allow even for something like this (
wipe= wildcard delete):ntfy://<host>/mutate?sub=new_topic_UUID&del=old_topic_UUID&wipe=topic_with_prefix_XYZ[&...].See? You could concatenate "endless" key-value pairs, like so:
ntfy://<host>/mutate?sub=new_topic_1&sub=new_topic_2&sub=new_topic_3.)Therefore your suggestion, or alternatively
ntfy://<host>/update?name=<name>&icon=<iconurl>[&secure={true|false}]seems to be possible.
Best regards, Uwe
PS: I used
<>denoting a mandatory input,{}denoting a set of possible values/commands and[]denoting a non-mandatory input. - Don't know if that's fully orthodox and correct, but you get the idea ;-)@e0548965 commented on GitHub (Jul 18, 2025):
Did you manage to do this @reslin ? We'd like to be able to set the subscription name to something more user friendly.
@reslin commented on GitHub (Jul 19, 2025):
Sorry, I did not pursue the topic further.