mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #762] Allow local attachments in "Publish as JSON" feature #549
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#549
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 @codebude on GitHub (Jun 1, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/762
💡 Idea
#133 brought us the wonderful "Send notification as JSON feature" (documented here: https://docs.ntfy.sh/publish/#publish-as-json)
But one thing is missing: Local attachments. Would it be possible to pass files/attachments via the JSON structure?
I think the whole point of implementing this feature, was to support sender systems that aren't able to set/modify headers, but rely totally on the body. To enable those systems to (directly) send files, it would be great, to add another/new field to the JSON structure, that could handle data. E.g.
An alternative idea that came to my mind (and one that would avoid introducing a new field) is allowing data-uris in the attach field. E.g.
(I'm not sure if Go supports this out of the box as web browsers do, but there's at least a package for it: https://github.com/vincent-petithory/dataurl)
💻 Target components
ntfy server
@binwiederhier commented on GitHub (Jun 2, 2023):
There is a proposal for multipart on the "POST ntfy.sh" endpoint, see use case 4 in https://github.com/binwiederhier/ntfy/issues/69#issuecomment-1183839284
I'd much rather do that than base64 encoded data in JSON. Would that work as well? I really don't want to allow giant JSON blobs in memory. Right now, I limit it to 16k, which is ok. If I allow attachments as part of the JSON, I'd have to read the entire thing first into memory before deciding whether it's allowed or not. It's really not feasible at scale.
@codebude commented on GitHub (Jun 2, 2023):
Ok, that's a valid point. I still think there's a use Case for blobs in JSON but I understand your argument from a design perspective.
@kk7ds commented on GitHub (Dec 27, 2024):
I'm fine with really any method of doing this (blob or multipart or whatever) but would definitely like to have it. I want to always publish as json instead of needing a different code path for "is there a picture in this one?".