sender_localpart -> shortcode. Give appservices also an exclusive namespace for users and aliases.

matrix-delivery
Jason Robinson 2020-12-24 15:36:38 +02:00
rodzic dfc7264465
commit 499d222719
3 zmienionych plików z 16 dodań i 14 usunięć

Wyświetl plik

@ -4,16 +4,7 @@
### Added
* Add `federation.hostmeta` generators for Matrix client and server well-known files.
Django views and url configuration also included for convenience.
* Add `register_dendrite_user` Matrix protocol utility to register users on Dendrite
homeservers using a shared registration secret.
* Added configuration for a Matrix appservice to be registered with a homeserver.
* Added a Django view to push incoming Matrix appservice transactions into the congigured
payload processing function.
* WIP Matrix support over an appservice.
## [0.21.0] - 2020-12-20

Wyświetl plik

@ -241,8 +241,8 @@ Some settings need to be set in Django settings. An example is below:
"appservice": {
# Unique ID to register with at the homeserver. Don't change this after creating.
"id": "uniqueid",
# Appservice user localpart (lowercase, should ideally start with _)
"sender_localpart": "_myawesomeapp",
# Short code (a-z only), used for various things like namespacing
"shortcode": "federatedapp",
# Secret token for communication
"token": "secret_token",
},

Wyświetl plik

@ -23,19 +23,30 @@ def get_registration_config() -> Dict:
"url": f"{config['base_url']}/matrix",
"as_token": matrix_config["appservice"]["token"],
"hs_token": matrix_config["appservice"]["token"],
"sender_localpart": matrix_config["appservice"]["sender_localpart"],
"sender_localpart": f'_{matrix_config["appservice"]["shortcode"]}',
"namespaces": {
# We reserve two namespaces
# One is not exclusive, since we're interested in events of "real" users
# One is exclusive, the ones that represent "remote to us but managed by us towards Matrix"
"users": [
{
"exclusive": False,
"regex": "@.*",
},
{
"exclusive": True,
"regex": f"@_{matrix_config['appservice']['shortcode']}_.*"
},
],
"aliases": [
{
"exclusive": False,
"regex": "#.*",
}
},
{
"exclusive": True,
"regex": f"#_{matrix_config['appservice']['shortcode']}_.*"
},
],
"rooms": [],
}