This commit is contained in:
binwiederhier 2023-01-12 12:04:18 -05:00
parent 24529bd0ad
commit 7007c0a0bd
7 changed files with 38 additions and 19 deletions

View file

@ -47,18 +47,14 @@ import (
- flicker of upgrade banner
- JS constants
Sync:
- "account topic" sync mechanism
- subscribe to sync topic in UI
- "mute" setting
- figure out what settings are "web" or "phone"
- sync problems with "deleteAfter=0" and "displayName="
Delete visitor when tier is changed to refresh rate limiters
Tests:
- Change tier from higher to lower tier (delete reservations)
- Message rate limiting and reset tests
- test that the visitor is based on the IP address when a user has no tier
Docs:
- "expires" field in message
- server.yml: enable-X flags
*/
// Server is the main server, providing the UI and API for ntfy

View file

@ -158,6 +158,19 @@
#
# web-root: app
# Various feature flags used to control the web app, and API access, mainly around user and
# account management.
#
# - enable-signup allows users to sign up via the web app, or API
# - enable-login allows users to log in via the web app, or API
# - enable-reservations allows users to reserve topics (if their tier allows it)
# - enable-payments enables payments integration [preliminary option, may change]
#
# enable-signup: false
# enable-login: false
# enable-reservations: false
# enable-payments: false
# Server URL of a Firebase/APNS-connected ntfy server (likely "https://ntfy.sh").
#
# iOS users:

View file

@ -320,7 +320,7 @@ func (s *Server) handleAccountReservationAdd(w http.ResponseWriter, r *http.Requ
if v.user != nil && v.user.Role == user.RoleAdmin {
return errHTTPBadRequestMakesNoSenseForAdmin
}
req, err := readJSONWithLimit[apiAccountAccessRequest](r.Body, jsonBodyBytesLimit)
req, err := readJSONWithLimit[apiAccountReservationRequest](r.Body, jsonBodyBytesLimit)
if err != nil {
return err
}

View file

@ -23,10 +23,10 @@ const (
// message represents a message published to a topic
type message struct {
ID string `json:"id"` // Random message ID
Time int64 `json:"time"` // Unix time in seconds
Expires int64 `json:"expires"` // Unix time in seconds
Event string `json:"event"` // One of the above
ID string `json:"id"` // Random message ID
Time int64 `json:"time"` // Unix time in seconds
Expires int64 `json:"expires,omitempty"` // Unix time in seconds (not required for open/keepalive)
Event string `json:"event"` // One of the above
Topic string `json:"topic"`
Title string `json:"title,omitempty"`
Message string `json:"message,omitempty"`
@ -281,7 +281,7 @@ type apiAccountResponse struct {
Stats *apiAccountStats `json:"stats,omitempty"`
}
type apiAccountAccessRequest struct {
type apiAccountReservationRequest struct {
Topic string `json:"topic"`
Everyone string `json:"everyone"`
}