1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-31 02:29:18 +02:00

More self-review

This commit is contained in:
binwiederhier 2023-05-17 10:58:28 -04:00
parent ac029c389e
commit 92c384374a
11 changed files with 62 additions and 44 deletions
server

View file

@ -550,6 +550,7 @@ func (s *Server) handleWebConfig(w http.ResponseWriter, _ *http.Request, _ *visi
EnableSignup: s.config.EnableSignup,
EnablePayments: s.config.StripeSecretKey != "",
EnableCalls: s.config.TwilioAccount != "",
EnableEmails: s.config.SMTPSenderFrom != "",
EnableReservations: s.config.EnableReservations,
BillingContact: s.config.BillingContact,
DisallowedTopics: s.config.DisallowedTopics,
@ -911,7 +912,7 @@ func (s *Server) parsePublishParams(r *http.Request, m *message) (cache bool, fi
return false, false, "", "", false, errHTTPBadRequestEmailDisabled
}
call = readParam(r, "x-call", "call")
if call != "" && s.config.TwilioAccount == "" && s.userManager == nil {
if call != "" && (s.config.TwilioAccount == "" || s.userManager == nil) {
return false, false, "", "", false, errHTTPBadRequestPhoneCallsDisabled
} else if call != "" && !isBoolValue(call) && !phoneNumberRegex.MatchString(call) {
return false, false, "", "", false, errHTTPBadRequestPhoneNumberInvalid