This commit is contained in:
Philipp Heckel 2022-01-13 15:47:34 -05:00
parent 034c81288c
commit 6a7b20e4e3
2 changed files with 6 additions and 8 deletions

View File

@ -517,7 +517,7 @@ The format for a *size* is: `<number>(GMK)`, e.g. 1G, 200M or 4000k.
``` ```
$ ntfy serve --help $ ntfy serve --help
NAME: NAME:
main serve - Run the ntfy server ntfy serve - Run the ntfy server
USAGE: USAGE:
ntfy serve [OPTIONS..] ntfy serve [OPTIONS..]

View File

@ -660,7 +660,7 @@ Here's an example that will open Reddit when the notification is clicked:
``` ```
## Attachments ## Attachments
You can send images and other files to your phone as attachments to a notification. The attachments are then downloaded You can **send images and other files to your phone** as attachments to a notification. The attachments are then downloaded
onto your phone (depending on size and setting automatically), and can be used from the Downloads folder. onto your phone (depending on size and setting automatically), and can be used from the Downloads folder.
There are two different ways to send attachments: There are two different ways to send attachments:
@ -669,7 +669,7 @@ There are two different ways to send attachments:
* or by [passing an external URL](#attach-file-from-a-url) as an attachment, e.g. `https://f-droid.org/F-Droid.apk` * or by [passing an external URL](#attach-file-from-a-url) as an attachment, e.g. `https://f-droid.org/F-Droid.apk`
### Attach local file ### Attach local file
To send an attachment from your computer as a file, you can send it as the PUT request body. If a message is greater To **send a file from your computer** as an attachment, you can send it as the PUT request body. If a message is greater
than the maximum message size (4,096 bytes) or consists of non UTF-8 characters, the ntfy server will automatically than the maximum message size (4,096 bytes) or consists of non UTF-8 characters, the ntfy server will automatically
detect the mime type and size, and send the message as an attachment file. To send smaller text-only messages or files detect the mime type and size, and send the message as an attachment file. To send smaller text-only messages or files
as attachments, you must pass a filename by passing the `X-Filename` header or query parameter (or any of its aliases as attachments, you must pass a filename by passing the `X-Filename` header or query parameter (or any of its aliases
@ -701,6 +701,7 @@ Here's an example showing how to upload an image:
PUT /flowers HTTP/1.1 PUT /flowers HTTP/1.1
Host: ntfy.sh Host: ntfy.sh
Filename: flower.jpg Filename: flower.jpg
Content-Type: 52312
<binary JPEG data> <binary JPEG data>
``` ```
@ -750,15 +751,13 @@ Here's what that looks like on Android:
</figure> </figure>
### Attach file from a URL ### Attach file from a URL
Instead of sending a local file to your phone, you can use an external URL to specify where the attachment is hosted. Instead of sending a local file to your phone, you can use **an external URL** to specify where the attachment is hosted.
This could be a Google Drive or Dropbox link, or any other publicly available URL. The ntfy server will briefly probe This could be a Google Drive or Dropbox link, or any other publicly available URL. The ntfy server will briefly probe
the URL to retrieve type and size for you. Since the files are externally hosted, the expiration or size limits from the URL to retrieve type and size for you. Since the files are externally hosted, the expiration or size limits from
above do not apply here. above do not apply here.
To attach an external file, simple pass the `X-Attach` header or query parameter (or any of its aliases `Attach` or `a`) To attach an external file, simple pass the `X-Attach` header or query parameter (or any of its aliases `Attach` or `a`)
to specify the attachment URL. It can be any type of file. to specify the attachment URL. It can be any type of file. Here's an example showing how to upload an image:
Here's an example showing how to upload an image:
=== "Command line (curl)" === "Command line (curl)"
``` ```
@ -820,7 +819,6 @@ Here's an example showing how to upload an image:
<figcaption>File attachment sent from an external URL</figcaption> <figcaption>File attachment sent from an external URL</figcaption>
</figure> </figure>
## E-mail notifications ## E-mail notifications
You can forward messages to e-mail by specifying an address in the header. This can be useful for messages that You can forward messages to e-mail by specifying an address in the header. This can be useful for messages that
you'd like to persist longer, or to blast-notify yourself on all possible channels. you'd like to persist longer, or to blast-notify yourself on all possible channels.