diff --git a/services/matrix/matrix.service.js b/services/matrix/matrix.service.js index 9ba15f02ebaee..f16cc689a080f 100644 --- a/services/matrix/matrix.service.js +++ b/services/matrix/matrix.service.js @@ -5,9 +5,15 @@ import { pathParam, queryParam, } from '../index.js' +import { nonNegativeInteger } from '../validators.js' + +const fetchModeEnum = ['guest', 'summary'] const queryParamSchema = Joi.object({ server_fqdn: Joi.string().hostname(), + fetchMode: Joi.string() + .valid(...fetchModeEnum) + .default('guest'), }).required() const matrixRegisterSchema = Joi.object({ @@ -31,9 +37,16 @@ const matrixStateSchema = Joi.array() ) .required() +const matrixSummarySchema = Joi.object({ + num_joined_members: nonNegativeInteger, +}).required() + const description = ` In order for this badge to work, the host of your room must allow guest accounts or dummy accounts to register, and the room must be world readable (chat history visible to anyone). +Alternatively access via the experimental summary endpoint ([MSC3266](https://github.com/matrix-org/matrix-spec-proposals/pull/3266)) can be configured with the query parameter fetchMode for less server load and better performance, if supported by the homeserver
+For the matrix.org homeserver fetchMode is hard-coded to summary. + The following steps will show you how to setup the badge URL using the Element Matrix client.