mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-14 11:47:33 +00:00
Return 507 for UP publishers without subscribers
This commit is contained in:
parent
d5052d79e6
commit
70cd267ff5
3 changed files with 7 additions and 7 deletions
|
@ -92,7 +92,5 @@ var (
|
|||
errHTTPInternalError = &errHTTP{50001, http.StatusInternalServerError, "internal server error", ""}
|
||||
errHTTPInternalErrorInvalidPath = &errHTTP{50002, http.StatusInternalServerError, "internal server error: invalid path", ""}
|
||||
errHTTPInternalErrorMissingBaseURL = &errHTTP{50003, http.StatusInternalServerError, "internal server error: base-url must be be configured for this feature", "https://ntfy.sh/docs/config/"}
|
||||
errHTTPInsufficientStorage = &errHTTP{50701, http.StatusInsufficientStorage, "internal server error: cannot publish to UnifiedPush topic without active subscriber", ""}
|
||||
)
|
||||
|
||||
// errHTTPConflictCannotPublishWithoutRateVisitor = &errHTTP{40904, http.StatusConflict, "conflict: cannot publish to UnifiedPush topic without active subscriber", ""}
|
||||
|
||||
|
|
|
@ -581,10 +581,9 @@ func (s *Server) handlePublishWithoutResponse(r *http.Request, v *visitor) (*mes
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
/*if unifiedpush && t.RateVisitor() == nil {
|
||||
return nil, errHTTPConflictCannotPublishWithoutRateVisitor
|
||||
} else*/
|
||||
if !util.ContainsIP(s.config.VisitorRequestExemptIPAddrs, v.ip) && !vrate.MessageAllowed() {
|
||||
if unifiedpush && t.RateVisitor() == nil {
|
||||
return nil, errHTTPInsufficientStorage
|
||||
} else if !util.ContainsIP(s.config.VisitorRequestExemptIPAddrs, v.ip) && !vrate.MessageAllowed() {
|
||||
return nil, errHTTPTooManyRequestsLimitMessages
|
||||
} else if email != "" && !vrate.EmailAllowed() {
|
||||
return nil, errHTTPTooManyRequestsLimitEmails
|
||||
|
|
|
@ -72,6 +72,9 @@ type matrixResponse struct {
|
|||
}
|
||||
|
||||
// errMatrix represents an error when handing Matrix gateway messages
|
||||
//
|
||||
// If the pushKey is set, the app server will remove it and will never send messages using the same
|
||||
// push key again, until the user repairs it.
|
||||
type errMatrix struct {
|
||||
pushKey string
|
||||
err error
|
||||
|
|
Loading…
Reference in a new issue