Commit Graph
105 Commits
Author SHA1 Message Date
binwiederhier 5bd36bdcd9 Merge remote-tracking branch 'origin/main' into up-payer
# Conflicts:
#	server/errors.go
2026-11-01 20:30:27 +00:00
binwiederhier cc67c2b31c Carry the whole limit decision on a 429 instead of only its wait
errHTTP.WithLimitDecision replaces RetryAfter: handleError writes Retry-After and the RateLimit headers from it, and the decision names its own kind. A request that is allowed gets its RateLimit headers right away; a denied one gets them with the error.
2026-11-01 13:50:00 +00:00
binwiederhier 7ad3e3d6ea Answer 410 Gone (41002) instead of 404 for an abandoned UnifiedPush topic
Every app server that drops a subscription on a 404 also drops it on a 410, and Misskey and its forks only do on a 410. 410 is also what Mozilla's and Apple's push services answer for an expired subscription.
2026-11-01 13:33:56 +00:00
binwiederhier f3d415cac3 Merge remote-tracking branch 'origin/main' into up-payer
# Conflicts:
#	docs/releases.md
#	server/errors.go
#	server/server_test.go
2026-11-01 13:15:17 +00:00
binwiederhier 5306dfaa97 Send a Retry-After header with rate limit 429 responses 2026-11-01 11:47:56 +00:00
binwiederhier 9c6733d06c Bill UnifiedPush pushes to the topic's payer on every node, answer 404 for topics abandoned for 7 days 2026-10-31 11:31:09 +00:00
binwiederhier e0ee4b090f Merge remote-tracking branch 'origin/main' into adminsock-api
# Conflicts:
#	docs/releases.md
#	server/server_admin.go
#	server/server_admin_test.go
2026-10-29 01:46:43 +00:00
binwiederhier 1fd5477981 Call it draining on shutdown, not maintenance mode
Other systems keep two things apart: draining before a shutdown (ephemeral, cleared by the restart: RabbitMQ drain, CockroachDB node drain) and an operator's maintenance flag (persistent cluster state: Kubernetes cordon, Nomad eligibility, Consul maint). This PR is the former, so it is named that way: Server.Drain (synchronous again; the on/off API is gone until the persistent maintenance flag exists), Cluster.SetDraining/Draining, the read-only phase flag readOnly, /v1/ready reports "draining": true, error 50301 says the node is shutting down, and docs/config.md has a "Draining on shutdown" section. A drain duration of 0 now closes all streams at once instead of disabling the drain.
2026-10-23 21:20:57 +00:00
binwiederhier b76ad0c037 Call the shutdown drain maintenance mode
A node draining before a shutdown is in maintenance mode: /v1/ready reports "maintenance": true (was "draining"), and the 503 says the node is in maintenance mode. Maintenance is a runtime state next to the configured role, not a role: a later admin command can enter and leave it without a shutdown, with the same semantics. server_drain.go is now server_maintenance.go.
2026-10-23 12:38:39 +00:00
binwiederhier af9ade095e Drain cluster nodes on shutdown
On SIGTERM, an active cluster node with another healthy active node first drains: new subscriptions (HTTP streams and WebSockets) get 503, which a load balancer retries on another node, /v1/ready fails with "draining": true, and the open streams are closed evenly over experimental-cluster-drain-duration (default 1m, fits systemd's 90s stop timeout; 0 disables). Clients reconnect a few at a time and resume with since=, instead of all at once. Publishes and polls are still served, since a load balancer does not retry a POST. A second signal skips the rest of the drain.

A stream registry on the server tracks open subscriber connections once each, however many topics they subscribe to.
2026-10-23 04:27:01 +00:00
binwiederhier f468f74492 Admin API: tokens, tiers, password reset links, role changes over the admin socket
Fill the gaps between the admin HTTP API and what the ntfy CLI does
directly against the database: list/add/remove other users' tokens,
manage tiers (ported from the user-management branch), create password
reset links (optionally emailed), remove a user's tier, reset a user's
or the whole ACL, and return provisioned flags, tier names and the
default access in GET /v1/users.

All admin routes go through adminHandler, which the admin socket will
share. Requests marked as coming over the socket may set roles and
change or delete admins; the network API still refuses that. User
manager errors now map to 4xx errors instead of 500s.
2026-10-22 02:55:52 +00:00
binwiederhier 85d7d3f1a4 De-duplicate subscription topics and limit them to 150
Repeating a topic in a subscription replayed its cache once per repetition.
2026-10-18 13:00:55 +00:00
binwiederhier 08a99f352f Require Twilio approved status for phone verification
A wrong code returns 200 OK with status pending; only approved means verified.
2026-10-18 12:50:04 +00:00
Bee mines 7961282490 Add timezone support for delayed notifications 2026-09-21 14:27:20 +08:00
binwiederhier 7826c86f67 Remove message-poll-limit again, hardcode title/tags/etc limits, count polls toward bandwidth limit 2026-08-27 19:42:30 +00:00
binwiederhier 7ed7fea081 Limit memory usage in templates 2026-08-03 18:34:29 +02:00
binwiederhier 165f012ae6 Add AST check to catch calls, remove regex for block and template 2026-07-08 21:56:57 +02:00
binwiederhier a001ac5195 Template execution rework 2026-07-08 21:08:07 +02:00
binwiederhier 99bc803271 Code review 2026-06-16 21:18:58 -04:00
binwiederhier d8c87d04e7 Update privacy policy, code review 2026-06-16 20:56:22 -04:00
binwiederhier 9fa8550ef6 Remove Close() on Sender; words on password dialog 2026-06-13 13:42:32 -04:00
binwiederhier f558935c1e Re-wording, chips 2026-06-12 22:33:09 -04:00
binwiederhier 33ae31055c Phase 3+4 2026-06-12 14:23:32 -04:00
binwiederhier 30dd4840a2 Phase 2, email verification rework, ui stuff 2026-06-12 11:40:59 -04:00
binwiederhier acb4c1b3cc Add visitor-topic-creation-limit-* options 2026-05-17 11:33:07 -04:00
binwiederhier 3e634e0a5a Refine 2026-03-30 08:51:18 -04:00
binwiederhier 61dd788dac WIP: Email verification 2026-03-29 22:47:38 -04:00
binwiederhier d9efe50848 Email validation 2026-03-16 21:03:33 -04:00
binwiederhier 08eaafa77b Fix log spam from http: response.WriteHeader on hijacked connection for WebSocket errors 2026-02-04 06:05:54 -08:00
binwiederhier 2cc4bf7d28 Fix webpush stuff 2026-01-15 21:55:20 -05:00
binwiederhier 5ad3de2904 Switch to event type 2026-01-08 20:50:23 -05:00
binwiederhier 1ab7ca876c Rename to sequence_id 2026-01-08 14:27:18 -05:00
binwiederhier 1c2550d749 Merge branch 'main' into 303-update-notifications 2026-01-05 15:34:42 -05:00
Hunter Kehoe 83b5470bc5 publish messages with a custom sequence ID 2025-10-17 19:01:41 -06:00
binwiederhier c4c4916bc8 Do not allow changing tokens, user role, or delete users 2025-08-04 22:22:59 +02:00
Hunter Kehoe 81463614c9 prevent changing a provisioned user's password 2025-08-03 16:07:24 -06:00
binwiederhier dde07adbdc Add some limits 2025-07-19 16:46:53 +02:00
binwiederhier b1e935da45 TEmplate dir 2025-07-16 13:49:15 +02:00
Hunter Kehoe e4c2b938d3 clean up invalid username code 2024-04-05 08:43:56 -06:00
Hunter Kehoe fc7cf5933f fix error message for invalid username/password 2024-04-03 21:58:43 -06:00
binwiederhier 7fed392e0c Disallow certain templates 2024-03-24 23:19:16 -04:00
binwiederhier b9c176ddba Tests 2024-03-22 22:01:41 -04:00
binwiederhier de65d07518 Simplify(?) templating cases 2024-03-20 21:33:54 -04:00
Hunter Kehoe 7fd5f0b29d allow large HTTP body so long as resulting message is small 2024-03-19 21:56:55 -06:00
binwiederhier 22f48c5ad3 Change mod path 2023-11-16 20:54:58 -05:00
binwiederhier 75a4b5bd88 Small refactor 2023-06-08 12:20:12 -04:00
nimbleghost 46f34ca1e3 Add push service allowlist and topic limit 2023-06-07 21:09:13 +02:00
nimbleghost ff5c854192 Add PWA, service worker and Web Push
- Use new notification request/opt-in flow for push
- Implement unsubscribing
- Implement muting
- Implement emojis in title
- Add iOS specific PWA warning
- Don’t use websockets when web push is enabled
- Fix duplicate notifications
- Implement default web push setting
- Implement changing subscription type
- Implement web push subscription refresh
- Implement web push notification click
2023-06-07 20:38:20 +02:00
binwiederhier ac029c389e Self-review 2023-05-17 10:39:15 -04:00
binwiederhier 2c81773d01 Add call verification 2023-05-16 22:27:48 -04:00