mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #248] Support relative paths for attachments #195
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#195
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 @Curid on GitHub (May 11, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/248
"base-url" is the root URL for the ntfy server; this is needed for the generated attachment URLsIf the client knows the URL of the server, why does the baseURL need to be configured manually?
@binwiederhier commented on GitHub (May 11, 2022):
There are many reasons, not all of them are rock solid. Here's the gist of it:
Hostheader and the protocol. The re-assembled URL doesn't always match the publicly available URL. For instance, the ntfy.sh server runs on an HTTP port, but is proxied through nginx on HTTPS, so for all that the ntfy server is concerned, it's on HTTP, though that is not true.Hostheader, so they absolutely need a base URL./file/abcdefg.jpginstead ofhttps://...), but then the clients would have to differentiate between relative and absolute URLs. Setting the base URL in the server config seems much easier than that.Makes sense? Why are you asking about this?
@Curid commented on GitHub (May 11, 2022):
Does the server need to know the base URL for messages to be published?
I want to embed ntfy in a web app and I've been careful to make all paths in the app relative so users wouldn't need to specify a baseURL.
How about putting
@in front of relative paths and have the clients replace it?@binwiederhier commented on GitHub (May 11, 2022):
If you check for where
config.BaseURLis used, you can see that it's in two places:The attachment URL is stored in the DB and returned to the client. So the base URL has to be known to the server at time of publishing. If you don't use either of these features, you don't need to specify it.
The web app will not work unless it's at the doc root. I've tried very hard to make it relative in React, but I couldn't make it work and eventually gave up.
@Curid commented on GitHub (Jun 6, 2022):
@binwiederhier I need some help to implement this.
In the WebUI I'm thinking of replacing the
@before they are saved in the database here Does there need to be 2 methods for adding notifications or can I combine them into one?For the Android side I have no idea.