Skip to main content

Loki Bot

Gatekeeper bot for the Unimore Informatica unofficial Matrix space, successor to Thor Bot.

Website   On PyPI   Chat

Functionality

This bot monitors a pre-configured public Matrix space for join events, sending a welcome message to every new joiner.

The welcome message contains a link, which when clicked starts the user verification process:

  1. a page describing the bot is opened, and it allows users to login with a pre-configured OpenID Connect Identity Provider;
  2. the claims of the OIDC IdP are verified, and the user's email address is checked to verify that its domain matches a pre-configured RegEx with specific email requirements;
  3. if the email address fullfils all the requirements, an invitation to a different, pre-configured private Matrix space is sent to the user.

Additionally, the bot monitors for leave events from both spaces, deleting user data if no longer needed to protect the user's privacy.

Setting up a development environment

Dependencies

This project uses Poetry to manage the dependencies.

To install all dependencies in a venv, run:

$ poetry install

TIP: For easier venv management, you may want to set:

$ poetry config virtualenvs.in-project true

To activate the venv, run:

$ poetry shell

To run something in the venv without activating it, run:

$ poetry run <COMMAND>

Environment

Loki requires a lot of environment variables to be set, therefore it makes use of cfig to simplify the setup.

To view the current configuration, followed by a description of each variable, run:

$ poetry run python -m lokiunimore.config

Deploying in production

Use the pre-built Docker image, or build it from the provided Dockerfile.

Run the image without any command to view and validate the current configuration.

Run the image with the gunicorn -b 0.0.0.0:80 lokiunimore.web.app:rp_app command to launch the production web server on local port 80, expecting to be behind a reverse proxy.

Run the image with the lokiunimore.matrix command to launch the Matrix bot.

Metadata

Release files for lokiunimore 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lokiunimore 0.7.1
File Size Uploaded
lokiunimore-0.7.1.tar.gz 260.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lokiunimore 0.7.1
File Interpreter ABI Platform
lokiunimore-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 529.8 kB

Release files / lokiunimore-0.7.1.tar.gz

Download URL lokiunimore-0.7.1.tar.gz
Size 260.8 kB
Tags Source
SHA-256 checksum
How to use checksums
443c9cf34d59b3d81cb3fa17b4a03b9da6626f4a1625a368e097336e892f7c68
BLAKE2b-256 checksum
How to use checksums
f38232d3c30ac67243e04fe85cfc20feb6cb3933308d4f0b17375732609d31aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / lokiunimore-0.7.1-py3-none-any.whl

Download URL lokiunimore-0.7.1-py3-none-any.whl
Size 269.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c130683ae61ba4cb4a0f0a79db9b035d312a80d725c8642228ba6af3f1ea0bd
BLAKE2b-256 checksum
How to use checksums
2a25b90f05a79335a3860c83dd8f1c8f5bd71629f513942dc772359daf165a39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page