mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-18 04:44:18 -05:00
Remove the unspecced and bugged PUT /knock/{roomIdOrAlias} endpoint (#15189)
This commit is contained in:
parent
c4f4dc35cd
commit
c8665dd25d
1
changelog.d/15189.misc
Normal file
1
changelog.d/15189.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Remove the unspecced `PUT` on the `/knock/{roomIdOrAlias}` endpoint.
|
@ -13,7 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
import logging
|
import logging
|
||||||
from typing import TYPE_CHECKING, Awaitable, Dict, List, Optional, Tuple
|
from typing import TYPE_CHECKING, Dict, List, Tuple
|
||||||
|
|
||||||
from synapse.api.constants import Membership
|
from synapse.api.constants import Membership
|
||||||
from synapse.api.errors import SynapseError
|
from synapse.api.errors import SynapseError
|
||||||
@ -24,8 +24,6 @@ from synapse.http.servlet import (
|
|||||||
parse_strings_from_args,
|
parse_strings_from_args,
|
||||||
)
|
)
|
||||||
from synapse.http.site import SynapseRequest
|
from synapse.http.site import SynapseRequest
|
||||||
from synapse.logging.opentracing import set_tag
|
|
||||||
from synapse.rest.client.transactions import HttpTransactionCache
|
|
||||||
from synapse.types import JsonDict, RoomAlias, RoomID
|
from synapse.types import JsonDict, RoomAlias, RoomID
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -45,7 +43,6 @@ class KnockRoomAliasServlet(RestServlet):
|
|||||||
|
|
||||||
def __init__(self, hs: "HomeServer"):
|
def __init__(self, hs: "HomeServer"):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.txns = HttpTransactionCache(hs)
|
|
||||||
self.room_member_handler = hs.get_room_member_handler()
|
self.room_member_handler = hs.get_room_member_handler()
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
|
|
||||||
@ -53,7 +50,6 @@ class KnockRoomAliasServlet(RestServlet):
|
|||||||
self,
|
self,
|
||||||
request: SynapseRequest,
|
request: SynapseRequest,
|
||||||
room_identifier: str,
|
room_identifier: str,
|
||||||
txn_id: Optional[str] = None,
|
|
||||||
) -> Tuple[int, JsonDict]:
|
) -> Tuple[int, JsonDict]:
|
||||||
requester = await self.auth.get_user_by_req(request)
|
requester = await self.auth.get_user_by_req(request)
|
||||||
|
|
||||||
@ -86,7 +82,6 @@ class KnockRoomAliasServlet(RestServlet):
|
|||||||
target=requester.user,
|
target=requester.user,
|
||||||
room_id=room_id,
|
room_id=room_id,
|
||||||
action=Membership.KNOCK,
|
action=Membership.KNOCK,
|
||||||
txn_id=txn_id,
|
|
||||||
third_party_signed=None,
|
third_party_signed=None,
|
||||||
remote_room_hosts=remote_room_hosts,
|
remote_room_hosts=remote_room_hosts,
|
||||||
content=event_content,
|
content=event_content,
|
||||||
@ -94,15 +89,6 @@ class KnockRoomAliasServlet(RestServlet):
|
|||||||
|
|
||||||
return 200, {"room_id": room_id}
|
return 200, {"room_id": room_id}
|
||||||
|
|
||||||
def on_PUT(
|
|
||||||
self, request: SynapseRequest, room_identifier: str, txn_id: str
|
|
||||||
) -> Awaitable[Tuple[int, JsonDict]]:
|
|
||||||
set_tag("txn_id", txn_id)
|
|
||||||
|
|
||||||
return self.txns.fetch_or_execute_request(
|
|
||||||
request, self.on_POST, request, room_identifier, txn_id
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
|
def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
|
||||||
KnockRoomAliasServlet(hs).register(http_server)
|
KnockRoomAliasServlet(hs).register(http_server)
|
||||||
|
Loading…
Reference in New Issue
Block a user