Extends room to optionally have a secret code. Upon knocking with a valid code, user is invited to the room.
Send a POST request to /_synapse/client/pangea/v1/knock_with_code with JSON body {access_code: string}. Access code must be 7 digit alphanumeric, with at least 1 digit in there. Response 200 OK format: { message: string, rooms: list[string], already_joined: list[string] }.
Send a GET request to /_synapse/client/pangea/v1/request_room_code to obtain unique room code. Response format: { access_code: string }
From the virtual environment that you use for Synapse, install this module with:
pip install https://github.com/pangeachat/synapse-room-code(If you run into issues, you may need to upgrade pip first, e.g. by running
pip install --upgrade pip)
Then alter your homeserver configuration, adding to your modules configuration:
modules:
- module: synapse_room_code.SynapseRoomCode
config:
knock_with_code_requests_per_burst: 10
knock_with_code_burst_duration_seconds: 60In a virtual environment with pip ≥ 21.1, run
pip install -e .[dev]To run the unit tests, ensure you have postgres installed in your system. You can check this by running which postgres - if it shows a path to your postgres executable then it is ready.
To actually run the unit test, you can either use:
tox -e pyor
trial testsTo run the linters and mypy type checker, use ./scripts-dev/lint.s./scripts-dev/lint.shh.
The exact steps for releasing will vary; but this is an approach taken by the Synapse developers (assuming a Unix-like shell):
-
Set a shell variable to the version you are releasing (this just makes subsequent steps easier):
version=X.Y.Z
-
Update
setup.cfgso that theversionis correct. -
Stage the changed files and commit.
git add -u git commit -m v$version -n -
Push your changes.
git push
-
When ready, create a signed tag for the release:
git tag -s v$versionBase the tag message on the changelog.
-
Push the tag.
git push origin tag v$version -
If applicable: Create a release, based on the tag you just pushed, on GitHub or GitLab.
-
If applicable: Create a source distribution and upload it to PyPI:
python -m build twine upload dist/synapse_room_code-$version*