mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-26 15:49:40 -05:00
Only handle GET requests for /push_rules
This commit is contained in:
parent
208251956d
commit
ec638a1602
@ -229,6 +229,9 @@ following regular expressions::
|
|||||||
^/_matrix/client/(api/v1|r0|unstable)/keys/changes$
|
^/_matrix/client/(api/v1|r0|unstable)/keys/changes$
|
||||||
^/_matrix/client/versions$
|
^/_matrix/client/versions$
|
||||||
^/_matrix/client/(api/v1|r0|unstable)/voip/turnServer$
|
^/_matrix/client/(api/v1|r0|unstable)/voip/turnServer$
|
||||||
|
|
||||||
|
Additionally, the following REST endpoints can be handled for GET requests::
|
||||||
|
|
||||||
^/_matrix/client/(api/v1|r0|unstable)/pushrules/.*$
|
^/_matrix/client/(api/v1|r0|unstable)/pushrules/.*$
|
||||||
|
|
||||||
Additionally, the following REST endpoints can be handled, but all requests must
|
Additionally, the following REST endpoints can be handled, but all requests must
|
||||||
|
@ -39,9 +39,13 @@ class PushRuleRestServlet(ClientV1RestServlet):
|
|||||||
super(PushRuleRestServlet, self).__init__(hs)
|
super(PushRuleRestServlet, self).__init__(hs)
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
self.notifier = hs.get_notifier()
|
self.notifier = hs.get_notifier()
|
||||||
|
self._is_worker = hs.config.worker_app is not None
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_PUT(self, request):
|
def on_PUT(self, request):
|
||||||
|
if self._is_worker:
|
||||||
|
raise Exception("Cannot handle PUT /push_rules on worker")
|
||||||
|
|
||||||
spec = _rule_spec_from_path([x.decode('utf8') for x in request.postpath])
|
spec = _rule_spec_from_path([x.decode('utf8') for x in request.postpath])
|
||||||
try:
|
try:
|
||||||
priority_class = _priority_class_from_spec(spec)
|
priority_class = _priority_class_from_spec(spec)
|
||||||
@ -103,6 +107,9 @@ class PushRuleRestServlet(ClientV1RestServlet):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_DELETE(self, request):
|
def on_DELETE(self, request):
|
||||||
|
if self._is_worker:
|
||||||
|
raise Exception("Cannot handle DELETE /push_rules on worker")
|
||||||
|
|
||||||
spec = _rule_spec_from_path([x.decode('utf8') for x in request.postpath])
|
spec = _rule_spec_from_path([x.decode('utf8') for x in request.postpath])
|
||||||
|
|
||||||
requester = yield self.auth.get_user_by_req(request)
|
requester = yield self.auth.get_user_by_req(request)
|
||||||
|
Loading…
Reference in New Issue
Block a user