Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Stabilize MSC2659 support #15528

Merged
merged 4 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Stabilize MSC2659 support
Signed-off-by: Tulir Asokan <tulir@maunium.net>
  • Loading branch information
tulir committed May 3, 2023
commit d42cedbb18116af2acebcd1ee429709f280423fe
1 change: 1 addition & 0 deletions changelog.d/15528.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stabilized support for [MSC2659](https://github.com/matrix-org/matrix-spec-proposals/pull/2659): application service ping endpoint. Contributed by Tulir @ Beeper.
clokep marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion synapse/appservice/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ async def ping(self, service: "ApplicationService", txn_id: Optional[str]) -> No
assert service.hs_token is not None

await self.post_json_get_json(
uri=f"{service.url}{APP_SERVICE_UNSTABLE_PREFIX}/fi.mau.msc2659/ping",
uri=f"{service.url}{APP_SERVICE_PREFIX}/ping",
clokep marked this conversation as resolved.
Show resolved Hide resolved
post_json={"transaction_id": txn_id},
headers={"Authorization": [f"Bearer {service.hs_token}"]},
)
Expand Down
3 changes: 0 additions & 3 deletions synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
# MSC3967: Do not require UIA when first uploading cross signing keys
self.msc3967_enabled = experimental.get("msc3967_enabled", False)

# MSC2659: Application service ping endpoint
self.msc2659_enabled = experimental.get("msc2659_enabled", False)

# MSC3981: Recurse relations
self.msc3981_recurse_relations = experimental.get(
"msc3981_recurse_relations", False
Expand Down
10 changes: 4 additions & 6 deletions synapse/rest/client/appservice_ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@

class AppservicePingRestServlet(RestServlet):
PATTERNS = client_patterns(
"/fi.mau.msc2659/appservice/(?P<appservice_id>[^/]*)/ping",
unstable=True,
releases=(),
"/appservice/(?P<appservice_id>[^/]*)/ping",
releases=("v1",),
)

def __init__(self, hs: "HomeServer"):
Expand Down Expand Up @@ -107,9 +106,8 @@ async def on_POST(

duration = time.monotonic() - start

return HTTPStatus.OK, {"duration": int(duration * 1000)}
return HTTPStatus.OK, {"duration_ms": int(duration * 1000)}


def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
if hs.config.experimental.msc2659_enabled:
AppservicePingRestServlet(hs).register(http_server)
AppservicePingRestServlet(hs).register(http_server)
2 changes: 1 addition & 1 deletion synapse/rest/client/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def on_GET(self, request: Request) -> Tuple[int, JsonDict]:
# Allows moderators to fetch redacted event content as described in MSC2815
"fi.mau.msc2815": self.config.experimental.msc2815_enabled,
# Adds a ping endpoint for appservices to check HS->AS connection
"fi.mau.msc2659": self.config.experimental.msc2659_enabled,
"fi.mau.msc2659.stable": True, # TODO: remove when "v1.7" is added above
# Adds support for login token requests as per MSC3882
"org.matrix.msc3882": self.config.experimental.msc3882_enabled,
# Adds support for remotely enabling/disabling pushers, as per MSC3881
Expand Down