feat: Add optional web app flag which requires a login for every action

This commit is contained in:
Thea Tischbein
2025-05-05 11:13:07 +02:00
parent 630f2957de
commit 03aeb707f2
10 changed files with 39 additions and 13 deletions

View File

@@ -240,6 +240,7 @@ func NewConfig() *Config {
EnableSignup: false,
EnableLogin: false,
EnableReservations: false,
RequireLogin: false,
AccessControlAllowOrigin: "*",
Version: "",
WebPushPrivateKey: "",

View File

@@ -583,6 +583,7 @@ func (s *Server) handleWebConfig(w http.ResponseWriter, _ *http.Request, _ *visi
EnableCalls: s.config.TwilioAccount != "",
EnableEmails: s.config.SMTPSenderFrom != "",
EnableReservations: s.config.EnableReservations,
ReuqireLogin: s.config.RequireLogin,
EnableWebPush: s.config.WebPushPublicKey != "",
BillingContact: s.config.BillingContact,
WebPushPublicKey: s.config.WebPushPublicKey,

View File

@@ -214,10 +214,12 @@
# - 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)
# - require-login all user actions via the web app require a login
#
# enable-signup: false
# enable-login: false
# enable-reservations: false
# require-login: false
# Server URL of a Firebase/APNS-connected ntfy server (likely "https://ntfy.sh").
#

View File

@@ -401,6 +401,7 @@ type apiConfigResponse struct {
EnableEmails bool `json:"enable_emails"`
EnableReservations bool `json:"enable_reservations"`
EnableWebPush bool `json:"enable_web_push"`
RequireLogin bool `json:"require_login"`
BillingContact string `json:"billing_contact"`
WebPushPublicKey string `json:"web_push_public_key"`
DisallowedTopics []string `json:"disallowed_topics"`