Skip to content

Commit 25d3a66

Browse files
committedMay 18, 2023
Upstream access token
1 parent f13a654 commit 25d3a66

9 files changed

+144
-50
lines changed
 

‎cmd/serve.go

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ var flagsServe = append(
6464
altsrc.NewBoolFlag(&cli.BoolFlag{Name: "enable-login", Aliases: []string{"enable_login"}, EnvVars: []string{"NTFY_ENABLE_LOGIN"}, Value: false, Usage: "allows users to log in via the web app, or API"}),
6565
altsrc.NewBoolFlag(&cli.BoolFlag{Name: "enable-reservations", Aliases: []string{"enable_reservations"}, EnvVars: []string{"NTFY_ENABLE_RESERVATIONS"}, Value: false, Usage: "allows users to reserve topics (if their tier allows it)"}),
6666
altsrc.NewStringFlag(&cli.StringFlag{Name: "upstream-base-url", Aliases: []string{"upstream_base_url"}, EnvVars: []string{"NTFY_UPSTREAM_BASE_URL"}, Value: "", Usage: "forward poll request to an upstream server, this is needed for iOS push notifications for self-hosted servers"}),
67+
altsrc.NewStringFlag(&cli.StringFlag{Name: "upstream-access-token", Aliases: []string{"upstream_access_token"}, EnvVars: []string{"NTFY_UPSTREAM_ACCESS_TOKEN"}, Value: "", Usage: "access token to use for the upstream server; needed only if upstream rate limits are exceeded or upstream server requires auth"}),
6768
altsrc.NewStringFlag(&cli.StringFlag{Name: "smtp-sender-addr", Aliases: []string{"smtp_sender_addr"}, EnvVars: []string{"NTFY_SMTP_SENDER_ADDR"}, Usage: "SMTP server address (host:port) for outgoing emails"}),
6869
altsrc.NewStringFlag(&cli.StringFlag{Name: "smtp-sender-user", Aliases: []string{"smtp_sender_user"}, EnvVars: []string{"NTFY_SMTP_SENDER_USER"}, Usage: "SMTP user (if e-mail sending is enabled)"}),
6970
altsrc.NewStringFlag(&cli.StringFlag{Name: "smtp-sender-pass", Aliases: []string{"smtp_sender_pass"}, EnvVars: []string{"NTFY_SMTP_SENDER_PASS"}, Usage: "SMTP password (if e-mail sending is enabled)"}),
@@ -148,6 +149,7 @@ func execServe(c *cli.Context) error {
148149
enableLogin := c.Bool("enable-login")
149150
enableReservations := c.Bool("enable-reservations")
150151
upstreamBaseURL := c.String("upstream-base-url")
152+
upstreamAccessToken := c.String("upstream-access-token")
151153
smtpSenderAddr := c.String("smtp-sender-addr")
152154
smtpSenderUser := c.String("smtp-sender-user")
153155
smtpSenderPass := c.String("smtp-sender-pass")
@@ -311,6 +313,7 @@ func execServe(c *cli.Context) error {
311313
conf.DisallowedTopics = disallowedTopics
312314
conf.WebRoot = webRoot
313315
conf.UpstreamBaseURL = upstreamBaseURL
316+
conf.UpstreamAccessToken = upstreamAccessToken
314317
conf.SMTPSenderAddr = smtpSenderAddr
315318
conf.SMTPSenderUser = smtpSenderUser
316319
conf.SMTPSenderPass = smtpSenderPass

‎docs/config.md

+6
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ To configure it, simply set `upstream-base-url` like so:
759759

760760
``` yaml
761761
upstream-base-url: "https://ntfy.sh"
762+
upstream-access-token: "..." # optional, only if rate limits exceeded, or upstream server protected
762763
```
763764
764765
If set, all incoming messages will publish a poll request to the configured upstream server, containing
@@ -1258,10 +1259,15 @@ variable before running the `ntfy` command (e.g. `export NTFY_LISTEN_HTTP=:80`).
12581259
| `smtp-server-listen` | `NTFY_SMTP_SERVER_LISTEN` | `[ip]:port` | - | Defines the IP address and port the SMTP server will listen on, e.g. `:25` or `1.2.3.4:25` |
12591260
| `smtp-server-domain` | `NTFY_SMTP_SERVER_DOMAIN` | *domain name* | - | SMTP server e-mail domain, e.g. `ntfy.sh` |
12601261
| `smtp-server-addr-prefix` | `NTFY_SMTP_SERVER_ADDR_PREFIX` | *string* | - | Optional prefix for the e-mail addresses to prevent spam, e.g. `ntfy-` |
1262+
| `twilio-account` | `NTFY_TWILIO_ACCOUNT` | *string* | - | Twilio account SID, e.g. AC12345beefbeef67890beefbeef122586 |
1263+
| `twilio-auth-token` | `NTFY_TWILIO_AUTH_TOKEN` | *string* | - | Twilio auth token, e.g. affebeef258625862586258625862586 |
1264+
| `twilio-from-number` | `NTFY_TWILIO_FROM_NUMBER` | *string* | - | Twilio outgoing phone number, e.g. +18775132586 |
1265+
| `twilio-verify-service` | `NTFY_TWILIO_VERIFY_SERVICE` | *string* | - | Twilio Verify service SID, e.g. VA12345beefbeef67890beefbeef122586 |
12611266
| `keepalive-interval` | `NTFY_KEEPALIVE_INTERVAL` | *duration* | 45s | Interval in which keepalive messages are sent to the client. This is to prevent intermediaries closing the connection for inactivity. Note that the Android app has a hardcoded timeout at 77s, so it should be less than that. |
12621267
| `manager-interval` | `NTFY_MANAGER_INTERVAL` | *duration* | 1m | Interval in which the manager prunes old messages, deletes topics and prints the stats. |
12631268
| `global-topic-limit` | `NTFY_GLOBAL_TOPIC_LIMIT` | *number* | 15,000 | Rate limiting: Total number of topics before the server rejects new topics. |
12641269
| `upstream-base-url` | `NTFY_UPSTREAM_BASE_URL` | *URL* | `https://ntfy.sh` | Forward poll request to an upstream server, this is needed for iOS push notifications for self-hosted servers |
1270+
| `upstream-access-token` | `NTFY_UPSTREAM_ACCESS_TOKEN` | *string* | `tk_zyYLYj...` | Access token to use for the upstream server; needed only if upstream rate limits are exceeded or upstream server requires auth |
12651271
| `visitor-attachment-total-size-limit` | `NTFY_VISITOR_ATTACHMENT_TOTAL_SIZE_LIMIT` | *size* | 100M | Rate limiting: Total storage limit used for attachments per visitor, for all attachments combined. Storage is freed after attachments expire. See `attachment-expiry-duration`. |
12661272
| `visitor-attachment-daily-bandwidth-limit` | `NTFY_VISITOR_ATTACHMENT_DAILY_BANDWIDTH_LIMIT` | *size* | 500M | Rate limiting: Total daily attachment download/upload traffic limit per visitor. This is to protect your bandwidth costs from exploding. |
12671273
| `visitor-email-limit-burst` | `NTFY_VISITOR_EMAIL_LIMIT_BURST` | *number* | 16 | Rate limiting:Initial limit of e-mails per visitor |

‎docs/install.md

+30-30
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,37 @@ deb/rpm packages.
2929

3030
=== "x86_64/amd64"
3131
```bash
32-
wget https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_x86_64.tar.gz
33-
tar zxvf ntfy_2.4.0_linux_x86_64.tar.gz
34-
sudo cp -a ntfy_2.4.0_linux_x86_64/ntfy /usr/local/bin/ntfy
35-
sudo mkdir /etc/ntfy && sudo cp ntfy_2.4.0_linux_x86_64/{client,server}/*.yml /etc/ntfy
32+
wget https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_x86_64.tar.gz
33+
tar zxvf ntfy_2.5.0_linux_x86_64.tar.gz
34+
sudo cp -a ntfy_2.5.0_linux_x86_64/ntfy /usr/local/bin/ntfy
35+
sudo mkdir /etc/ntfy && sudo cp ntfy_2.5.0_linux_x86_64/{client,server}/*.yml /etc/ntfy
3636
sudo ntfy serve
3737
```
3838

3939
=== "armv6"
4040
```bash
41-
wget https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_armv6.tar.gz
42-
tar zxvf ntfy_2.4.0_linux_armv6.tar.gz
43-
sudo cp -a ntfy_2.4.0_linux_armv6/ntfy /usr/bin/ntfy
44-
sudo mkdir /etc/ntfy && sudo cp ntfy_2.4.0_linux_armv6/{client,server}/*.yml /etc/ntfy
41+
wget https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_armv6.tar.gz
42+
tar zxvf ntfy_2.5.0_linux_armv6.tar.gz
43+
sudo cp -a ntfy_2.5.0_linux_armv6/ntfy /usr/bin/ntfy
44+
sudo mkdir /etc/ntfy && sudo cp ntfy_2.5.0_linux_armv6/{client,server}/*.yml /etc/ntfy
4545
sudo ntfy serve
4646
```
4747

4848
=== "armv7/armhf"
4949
```bash
50-
wget https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_armv7.tar.gz
51-
tar zxvf ntfy_2.4.0_linux_armv7.tar.gz
52-
sudo cp -a ntfy_2.4.0_linux_armv7/ntfy /usr/bin/ntfy
53-
sudo mkdir /etc/ntfy && sudo cp ntfy_2.4.0_linux_armv7/{client,server}/*.yml /etc/ntfy
50+
wget https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_armv7.tar.gz
51+
tar zxvf ntfy_2.5.0_linux_armv7.tar.gz
52+
sudo cp -a ntfy_2.5.0_linux_armv7/ntfy /usr/bin/ntfy
53+
sudo mkdir /etc/ntfy && sudo cp ntfy_2.5.0_linux_armv7/{client,server}/*.yml /etc/ntfy
5454
sudo ntfy serve
5555
```
5656

5757
=== "arm64"
5858
```bash
59-
wget https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_arm64.tar.gz
60-
tar zxvf ntfy_2.4.0_linux_arm64.tar.gz
61-
sudo cp -a ntfy_2.4.0_linux_arm64/ntfy /usr/bin/ntfy
62-
sudo mkdir /etc/ntfy && sudo cp ntfy_2.4.0_linux_arm64/{client,server}/*.yml /etc/ntfy
59+
wget https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_arm64.tar.gz
60+
tar zxvf ntfy_2.5.0_linux_arm64.tar.gz
61+
sudo cp -a ntfy_2.5.0_linux_arm64/ntfy /usr/bin/ntfy
62+
sudo mkdir /etc/ntfy && sudo cp ntfy_2.5.0_linux_arm64/{client,server}/*.yml /etc/ntfy
6363
sudo ntfy serve
6464
```
6565

@@ -109,31 +109,31 @@ Manually installing the .deb file:
109109

110110
=== "x86_64/amd64"
111111
```bash
112-
wget https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_amd64.deb
112+
wget https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_amd64.deb
113113
sudo dpkg -i ntfy_*.deb
114114
sudo systemctl enable ntfy
115115
sudo systemctl start ntfy
116116
```
117117

118118
=== "armv6"
119119
```bash
120-
wget https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_armv6.deb
120+
wget https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_armv6.deb
121121
sudo dpkg -i ntfy_*.deb
122122
sudo systemctl enable ntfy
123123
sudo systemctl start ntfy
124124
```
125125

126126
=== "armv7/armhf"
127127
```bash
128-
wget https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_armv7.deb
128+
wget https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_armv7.deb
129129
sudo dpkg -i ntfy_*.deb
130130
sudo systemctl enable ntfy
131131
sudo systemctl start ntfy
132132
```
133133

134134
=== "arm64"
135135
```bash
136-
wget https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_arm64.deb
136+
wget https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_arm64.deb
137137
sudo dpkg -i ntfy_*.deb
138138
sudo systemctl enable ntfy
139139
sudo systemctl start ntfy
@@ -143,28 +143,28 @@ Manually installing the .deb file:
143143

144144
=== "x86_64/amd64"
145145
```bash
146-
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_amd64.rpm
146+
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_amd64.rpm
147147
sudo systemctl enable ntfy
148148
sudo systemctl start ntfy
149149
```
150150

151151
=== "armv6"
152152
```bash
153-
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_armv6.rpm
153+
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_armv6.rpm
154154
sudo systemctl enable ntfy
155155
sudo systemctl start ntfy
156156
```
157157

158158
=== "armv7/armhf"
159159
```bash
160-
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_armv7.rpm
160+
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_armv7.rpm
161161
sudo systemctl enable ntfy
162162
sudo systemctl start ntfy
163163
```
164164

165165
=== "arm64"
166166
```bash
167-
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_linux_arm64.rpm
167+
sudo rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_linux_arm64.rpm
168168
sudo systemctl enable ntfy
169169
sudo systemctl start ntfy
170170
```
@@ -192,18 +192,18 @@ NixOS also supports [declarative setup of the ntfy server](https://search.nixos.
192192

193193
## macOS
194194
The [ntfy CLI](subscribe/cli.md) (`ntfy publish` and `ntfy subscribe` only) is supported on macOS as well.
195-
To install, please [download the tarball](https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_macOS_all.tar.gz),
195+
To install, please [download the tarball](https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_macOS_all.tar.gz),
196196
extract it and place it somewhere in your `PATH` (e.g. `/usr/local/bin/ntfy`).
197197

198198
If run as `root`, ntfy will look for its config at `/etc/ntfy/client.yml`. For all other users, it'll look for it at
199199
`~/Library/Application Support/ntfy/client.yml` (sample included in the tarball).
200200

201201
```bash
202-
curl -L https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_macOS_all.tar.gz > ntfy_2.4.0_macOS_all.tar.gz
203-
tar zxvf ntfy_2.4.0_macOS_all.tar.gz
204-
sudo cp -a ntfy_2.4.0_macOS_all/ntfy /usr/local/bin/ntfy
202+
curl -L https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_macOS_all.tar.gz > ntfy_2.5.0_macOS_all.tar.gz
203+
tar zxvf ntfy_2.5.0_macOS_all.tar.gz
204+
sudo cp -a ntfy_2.5.0_macOS_all/ntfy /usr/local/bin/ntfy
205205
mkdir ~/Library/Application\ Support/ntfy
206-
cp ntfy_2.4.0_macOS_all/client/client.yml ~/Library/Application\ Support/ntfy/client.yml
206+
cp ntfy_2.5.0_macOS_all/client/client.yml ~/Library/Application\ Support/ntfy/client.yml
207207
ntfy --help
208208
```
209209

@@ -221,7 +221,7 @@ brew install ntfy
221221

222222
## Windows
223223
The [ntfy CLI](subscribe/cli.md) (`ntfy publish` and `ntfy subscribe` only) is supported on Windows as well.
224-
To install, please [download the latest ZIP](https://github.com/binwiederhier/ntfy/releases/download/v2.4.0/ntfy_2.4.0_windows_x86_64.zip),
224+
To install, please [download the latest ZIP](https://github.com/binwiederhier/ntfy/releases/download/v2.5.0/ntfy_2.5.0_windows_x86_64.zip),
225225
extract it and place the `ntfy.exe` binary somewhere in your `%Path%`.
226226

227227
The default path for the client config file is at `%AppData%\ntfy\client.yml` (not created automatically, sample in the ZIP file).

0 commit comments

Comments
 (0)