mirror of
https://github.com/element-hq/synapse.git
synced 2026-09-17 01:34:28 +00:00
Replace manual notes in documentation with admonitions
As they're generally prettier. Requires https://github.com/element-hq/synapse/pull/19356
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
|
||||
Synapse supports extending its functionality by configuring external modules.
|
||||
|
||||
**Note**: When using third-party modules, you effectively allow someone else to run
|
||||
custom code on your Synapse homeserver. Server admins are encouraged to verify the
|
||||
provenance of the modules they use on their homeserver and make sure the modules aren't
|
||||
running malicious code on their instance.
|
||||
> [!NOTE]
|
||||
> When using third-party modules, you effectively allow someone else to run
|
||||
> custom code on your Synapse homeserver. Server admins are encouraged to verify the
|
||||
> provenance of the modules they use on their homeserver and make sure the modules aren't
|
||||
> running malicious code on their instance.
|
||||
|
||||
## Using modules
|
||||
|
||||
|
||||
@@ -14,10 +14,9 @@ _First introduced in Synapse v1.132.0_
|
||||
async def get_media_config_for_user(user_id: str) -> JsonDict | None
|
||||
```
|
||||
|
||||
**<span style="color:red">
|
||||
Caution: This callback is currently experimental . The method signature or behaviour
|
||||
may change without notice.
|
||||
</span>**
|
||||
> [!CAUTION]
|
||||
> This callback is currently experimental. The method signature or behaviour
|
||||
> may change without notice.
|
||||
|
||||
Called when processing a request from a client for the
|
||||
[media config endpoint](https://spec.matrix.org/latest/client-server-api/#get_matrixclientv1mediaconfig).
|
||||
@@ -44,10 +43,9 @@ _First introduced in Synapse v1.132.0_
|
||||
async def is_user_allowed_to_upload_media_of_size(user_id: str, size: int) -> bool
|
||||
```
|
||||
|
||||
**<span style="color:red">
|
||||
Caution: This callback is currently experimental . The method signature or behaviour
|
||||
may change without notice.
|
||||
</span>**
|
||||
> [!CAUTION]
|
||||
> This callback is currently experimental. The method signature or behaviour
|
||||
> may change without notice.
|
||||
|
||||
Called before media is accepted for upload from a user, in case the module needs to
|
||||
enforce a different limit for the particular user.
|
||||
@@ -73,10 +71,9 @@ _First introduced in Synapse v1.139.0_
|
||||
async def get_media_upload_limits_for_user(user_id: str, size: int) -> list[synapse.module_api.MediaUploadLimit] | None
|
||||
```
|
||||
|
||||
**<span style="color:red">
|
||||
Caution: This callback is currently experimental. The method signature or behaviour
|
||||
may change without notice.
|
||||
</span>**
|
||||
> [!CAUTION]
|
||||
> This callback is currently experimental. The method signature or behaviour
|
||||
> may change without notice.
|
||||
|
||||
Called when processing a request to store content in the media repository. This can be used to dynamically override
|
||||
the [media upload limits configuration](../usage/configuration/config_documentation.html#media_upload_limits).
|
||||
@@ -108,10 +105,9 @@ _First introduced in Synapse v1.139.0_
|
||||
async def on_media_upload_limit_exceeded(user_id: str, limit: synapse.module_api.MediaUploadLimit, sent_bytes: int, attempted_bytes: int) -> None
|
||||
```
|
||||
|
||||
**<span style="color:red">
|
||||
Caution: This callback is currently experimental. The method signature or behaviour
|
||||
may change without notice.
|
||||
</span>**
|
||||
> [!CAUTION]
|
||||
> This callback is currently experimental. The method signature or behaviour
|
||||
> may change without notice.
|
||||
|
||||
Called when a user attempts to upload media that would exceed a
|
||||
[configured media upload limit](../usage/configuration/config_documentation.html#media_upload_limits).
|
||||
|
||||
@@ -14,10 +14,9 @@ _First introduced in Synapse v1.132.0_
|
||||
async def get_ratelimit_override_for_user(user: str, limiter_name: str) -> synapse.module_api.RatelimitOverride | None
|
||||
```
|
||||
|
||||
**<span style="color:red">
|
||||
Caution: This callback is currently experimental . The method signature or behaviour
|
||||
may change without notice.
|
||||
</span>**
|
||||
> [!CAUTION]
|
||||
> This callback is currently experimental. The method signature or behaviour
|
||||
> may change without notice.
|
||||
|
||||
Called when constructing a ratelimiter of a particular type for a user. The module can
|
||||
return a `messages_per_second` and `burst_count` to be used, or `None` if
|
||||
|
||||
@@ -164,8 +164,9 @@ await user_may_send_3pid_invite(
|
||||
)
|
||||
```
|
||||
|
||||
**Note**: If the third-party identifier is already associated with a matrix user ID,
|
||||
[`user_may_invite`](#user_may_invite) will be used instead.
|
||||
> [!NOTE]
|
||||
> If the third-party identifier is already associated with a matrix user ID,
|
||||
> [`user_may_invite`](#user_may_invite) will be used instead.
|
||||
|
||||
The callback must return one of:
|
||||
- `synapse.module_api.NOT_SPAM`, to allow the operation. Other callbacks may still
|
||||
@@ -287,10 +288,9 @@ _First introduced in Synapse v1.132.0_
|
||||
async def user_may_send_state_event(user_id: str, room_id: str, event_type: str, state_key: str, content: JsonDict) -> Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]
|
||||
```
|
||||
|
||||
**<span style="color:red">
|
||||
Caution: This callback is currently experimental . The method signature or behaviour
|
||||
may change without notice.
|
||||
</span>**
|
||||
> [!CAUTION]
|
||||
> This callback is currently experimental. The method signature or behaviour
|
||||
> may change without notice.
|
||||
|
||||
Called when processing a request to [send state events](https://spec.matrix.org/latest/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey) to a room.
|
||||
|
||||
@@ -463,7 +463,8 @@ The value of the first callback that does not return `synapse.module_api.NOT_SPA
|
||||
be used. If this happens, Synapse will not call any of the subsequent implementations of
|
||||
this callback.
|
||||
|
||||
*Note:* This will not be called when a user registers.
|
||||
> [!NOTE]
|
||||
> This will not be called when a user registers.
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
@@ -19,10 +19,9 @@ async def check_event_allowed(
|
||||
) -> tuple[bool, dict | None]
|
||||
```
|
||||
|
||||
**<span style="color:red">
|
||||
This callback is very experimental and can and will break without notice. Module developers
|
||||
are encouraged to implement `check_event_for_spam` from the spam checker category instead.
|
||||
</span>**
|
||||
> [!WARNING]
|
||||
> This callback is very experimental and can and will break without notice. Module developers
|
||||
> are encouraged to implement `check_event_for_spam` from the spam checker category instead.
|
||||
|
||||
Called when processing any incoming event, with the event and a `StateMap`
|
||||
representing the current state of the room the event is being sent into. A `StateMap` is
|
||||
@@ -258,10 +257,9 @@ If multiple modules implement this callback, Synapse runs them all in order.
|
||||
|
||||
_First introduced in Synapse v1.56.0_
|
||||
|
||||
**<span style="color:red">
|
||||
This callback is deprecated in favour of the `on_add_user_third_party_identifier` callback, which
|
||||
features the same functionality. The only difference is in name.
|
||||
</span>**
|
||||
> [!WARNING]
|
||||
> This callback is deprecated in favour of the `on_add_user_third_party_identifier` callback, which
|
||||
> features the same functionality. The only difference is in name.
|
||||
|
||||
```python
|
||||
async def on_threepid_bind(user_id: str, medium: str, address: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user