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", ""}
|
errHTTPInternalError = &errHTTP{50001, http.StatusInternalServerError, "internal server error", ""}
|
||||||
errHTTPInternalErrorInvalidPath = &errHTTP{50002, http.StatusInternalServerError, "internal server error: invalid path", ""}
|
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/"}
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
/*if unifiedpush && t.RateVisitor() == nil {
|
if unifiedpush && t.RateVisitor() == nil {
|
||||||
return nil, errHTTPConflictCannotPublishWithoutRateVisitor
|
return nil, errHTTPInsufficientStorage
|
||||||
} else*/
|
} else if !util.ContainsIP(s.config.VisitorRequestExemptIPAddrs, v.ip) && !vrate.MessageAllowed() {
|
||||||
if !util.ContainsIP(s.config.VisitorRequestExemptIPAddrs, v.ip) && !vrate.MessageAllowed() {
|
|
||||||
return nil, errHTTPTooManyRequestsLimitMessages
|
return nil, errHTTPTooManyRequestsLimitMessages
|
||||||
} else if email != "" && !vrate.EmailAllowed() {
|
} else if email != "" && !vrate.EmailAllowed() {
|
||||||
return nil, errHTTPTooManyRequestsLimitEmails
|
return nil, errHTTPTooManyRequestsLimitEmails
|
||||||
|
|
|
@ -72,6 +72,9 @@ type matrixResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// errMatrix represents an error when handing Matrix gateway messages
|
// 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 {
|
type errMatrix struct {
|
||||||
pushKey string
|
pushKey string
|
||||||
err error
|
err error
|
||||||
|
|
Loading…
Reference in a new issue