Compare commits

..

No commits in common. "main" and "v0.3.0" have entirely different histories.
main ... v0.3.0

3 changed files with 4 additions and 25 deletions

View File

@ -1,22 +1,6 @@
this is a simple [maubot](https://github.com/maubot/maubot) plugin which interacts with a this is a simple [maubot](https://github.com/maubot/maubot) plugin which interacts with a [matrix-registration](https://github.com/zeratax/matrix-registration) deployment and generates invite tokens.
[matrix-registration](https://github.com/zeratax/matrix-registration) deployment and generates invite tokens.
NOTICE: this bot depends on Maubot engine and matrix-registration. it does not work with synapse's native registration modify the config to point to your matrix-registration url, include your admin secret to authenticate, and ensure that you're in the list of approved users.
tokens. reasons you may still prefer this project:
1. you already have set up maubot
2. you already have set up matrix-registration
3. this bot only requires administrative access to matrix-registration, whereas the ability to generate synapse
registration tokens would require the bot to be a server administrator
if you would prefer to use native synapse registration tokens, please check out
[matrix-registration-bot](https://github.com/moan0s/matrix-registration-bot/), an unrelated but similar project which is
a standalone bot (no maubot engine).
## usage
modify the config to point to your matrix-registration url, include your admin secret to authenticate, and ensure that
you're in the list of approved users.
*please note* that matrix-registration versions BELOW 0.9.0 have different API endpoints, expected date structures, json *please note* that matrix-registration versions BELOW 0.9.0 have different API endpoints, expected date structures, json
arguments, etc. and require the `legacy_mr` value in your config to be set to `True`! If your matrix-registration arguments, etc. and require the `legacy_mr` value in your config to be set to `True`! If your matrix-registration

View File

@ -69,14 +69,9 @@ class Invite(Plugin):
try: try:
response = await self.http.post(f"{self.config['api_url']}/token", headers=headers, \ response = await self.http.post(f"{self.config['api_url']}/token", headers=headers, \
json={"max_usage": 1, "one_time": True, "ex_date": ex_date, "expiration_date": ex_date}) json={"max_usage": 1, "one_time": True, "ex_date": ex_date, "expiration_date": ex_date})
status = response.status
resp_json = await response.json() resp_json = await response.json()
except Exception as e: except Exception as e:
body = await response.text() await evt.respond(f"request failed: {e.message}")
await evt.respond(f"Uh oh! I got a {status} response from your registration endpoint:<br /> \
{body}<br /> \
which prompted me to produce this error:<br /> \
<code>{e.message}</code>", allow_html=True)
return None return None
try: try:
token = resp_json['name'] token = resp_json['name']

View File

@ -1,6 +1,6 @@
maubot: 0.1.0 maubot: 0.1.0
id: org.jobmachine.invitebot id: org.jobmachine.invitebot
version: 0.3.1 version: 0.3.0
license: MIT license: MIT
modules: modules:
- invite - invite