Stabilize MSC2659 support for AS ping endpoint. (#15528)
parent
d3bd03559b
commit
86d541f37c
|
@ -0,0 +1 @@
|
||||||
|
Stabilize support for [MSC2659](https://github.com/matrix-org/matrix-spec-proposals/pull/2659): application service ping endpoint. Contributed by Tulir @ Beeper.
|
|
@ -108,10 +108,10 @@ class Codes(str, Enum):
|
||||||
|
|
||||||
USER_AWAITING_APPROVAL = "ORG.MATRIX.MSC3866_USER_AWAITING_APPROVAL"
|
USER_AWAITING_APPROVAL = "ORG.MATRIX.MSC3866_USER_AWAITING_APPROVAL"
|
||||||
|
|
||||||
AS_PING_URL_NOT_SET = "FI.MAU.MSC2659_URL_NOT_SET"
|
AS_PING_URL_NOT_SET = "M_URL_NOT_SET"
|
||||||
AS_PING_BAD_STATUS = "FI.MAU.MSC2659_BAD_STATUS"
|
AS_PING_BAD_STATUS = "M_BAD_STATUS"
|
||||||
AS_PING_CONNECTION_TIMEOUT = "FI.MAU.MSC2659_CONNECTION_TIMEOUT"
|
AS_PING_CONNECTION_TIMEOUT = "M_CONNECTION_TIMEOUT"
|
||||||
AS_PING_CONNECTION_FAILED = "FI.MAU.MSC2659_CONNECTION_FAILED"
|
AS_PING_CONNECTION_FAILED = "M_CONNECTION_FAILED"
|
||||||
|
|
||||||
# Attempt to send a second annotation with the same event type & annotation key
|
# Attempt to send a second annotation with the same event type & annotation key
|
||||||
# MSC2677
|
# MSC2677
|
||||||
|
|
|
@ -326,7 +326,7 @@ class ApplicationServiceApi(SimpleHttpClient):
|
||||||
assert service.hs_token is not None
|
assert service.hs_token is not None
|
||||||
|
|
||||||
await self.post_json_get_json(
|
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",
|
||||||
post_json={"transaction_id": txn_id},
|
post_json={"transaction_id": txn_id},
|
||||||
headers={"Authorization": [f"Bearer {service.hs_token}"]},
|
headers={"Authorization": [f"Bearer {service.hs_token}"]},
|
||||||
)
|
)
|
||||||
|
|
|
@ -189,9 +189,6 @@ class ExperimentalConfig(Config):
|
||||||
# MSC3967: Do not require UIA when first uploading cross signing keys
|
# MSC3967: Do not require UIA when first uploading cross signing keys
|
||||||
self.msc3967_enabled = experimental.get("msc3967_enabled", False)
|
self.msc3967_enabled = experimental.get("msc3967_enabled", False)
|
||||||
|
|
||||||
# MSC2659: Application service ping endpoint
|
|
||||||
self.msc2659_enabled = experimental.get("msc2659_enabled", False)
|
|
||||||
|
|
||||||
# MSC3981: Recurse relations
|
# MSC3981: Recurse relations
|
||||||
self.msc3981_recurse_relations = experimental.get(
|
self.msc3981_recurse_relations = experimental.get(
|
||||||
"msc3981_recurse_relations", False
|
"msc3981_recurse_relations", False
|
||||||
|
|
|
@ -39,9 +39,8 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class AppservicePingRestServlet(RestServlet):
|
class AppservicePingRestServlet(RestServlet):
|
||||||
PATTERNS = client_patterns(
|
PATTERNS = client_patterns(
|
||||||
"/fi.mau.msc2659/appservice/(?P<appservice_id>[^/]*)/ping",
|
"/appservice/(?P<appservice_id>[^/]*)/ping",
|
||||||
unstable=True,
|
releases=("v1",),
|
||||||
releases=(),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, hs: "HomeServer"):
|
def __init__(self, hs: "HomeServer"):
|
||||||
|
@ -107,9 +106,8 @@ class AppservicePingRestServlet(RestServlet):
|
||||||
|
|
||||||
duration = time.monotonic() - start
|
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:
|
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)
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ class VersionsRestServlet(RestServlet):
|
||||||
# Allows moderators to fetch redacted event content as described in MSC2815
|
# Allows moderators to fetch redacted event content as described in MSC2815
|
||||||
"fi.mau.msc2815": self.config.experimental.msc2815_enabled,
|
"fi.mau.msc2815": self.config.experimental.msc2815_enabled,
|
||||||
# Adds a ping endpoint for appservices to check HS->AS connection
|
# 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
|
# Adds support for login token requests as per MSC3882
|
||||||
"org.matrix.msc3882": self.config.experimental.msc3882_enabled,
|
"org.matrix.msc3882": self.config.experimental.msc3882_enabled,
|
||||||
# Adds support for remotely enabling/disabling pushers, as per MSC3881
|
# Adds support for remotely enabling/disabling pushers, as per MSC3881
|
||||||
|
|
Loading…
Reference in New Issue