collective.mastodon is a package providing a Plone content rules action to post a status to a Mastodon instance.
This package supports Plone sites using Volto and ClassicUI.
For proper Volto support, the requirements are:
- plone.restapi >= 8.34.0
- Volto >= 16.10.0
Add collective.mastodon to the Plone installation using pip
:
pip install collective.mastodon
or add it as a dependency on your package's setup.py
install_requires = [
"collective.mastodon",
"Plone",
"plone.restapi",
"setuptools",
],
Before you can use this package, you have to register an application on Mastodon.
To do so, log in to your account, visit settings/applications/new
and create the application. (Please select read
and write
scopes, and keep the default Redirect URI
).
Go to the newly created application page and copy the value of Your access token
.
This package is configured via the MASTODON_APPS
environment variable which should contain a valid JSON array with your Mastodon Application information.
Each application registration requires the following information:
Key | Description | Example Value |
---|---|---|
name | Identifier for the application | localhost-user |
instance | URL of your instance, without the trailing slash | http://localhost |
token | Access token of your Mastodon Application | jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M |
user | User on the Mastodon instance. (Only used to generate a friendly name on Plone) | user |
Using the information above, the environment variable would look like:
MASTODON_APPS='[{"name": "localhost-user","instance":"http://localhost","token":"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M","user":"user"}]'
Now, you can start your local Plone installation with:
MASTODON_APPS='[{"name": "localhost-user","instance":"http://localhost","token":"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M","user":"user"}]' make start
or, if you are using a docker compose
configuration, add the new environment variable under the environment
key:
environment:
- MASTODON_APPS='[{"name": "localhost-user","instance":"http://localhost","token":"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M","user":"user"}]'
After start-up visit the Content Rules
Control Panel, and create a new content rule.
No additional configuration is needed for Volto support.
If you want to help with the development (improvement, update, bug-fixing, ...) of collective.mastodon
this is a great idea!
We appreciate any contribution and if a release is needed to be done on PyPI, please just contact one of us.
You need a working python
environment (system, virtualenv
, pyenv
, etc) version 3.8 or superior.
Then install the dependencies and a development instance using:
make build
make i18n
make format
Testing of this package is done with pytest
and tox
.
Run all tests with:
make test
Run all tests but stop on the first error and open a pdb
session:
./bin/tox -e test -- -x --pdb
Run only tests that match TestAppDiscovery
:
./bin/tox -e test -- -k TestAppDiscovery
Run only tests that match TestAppDiscovery
, but stop on the first error and open a pdb
session:
./bin/tox -e test -- -k TestAppDiscovery -x --pdb
This product has been translated into:
- English (Érico Andrei)
- Português do Brasil (Érico Andrei)
The project is licensed under GPLv2.
Originally Made in São Paulo, Brazil, with love, by your friends @ Simples Consultoria.
Now maintained by the Plone Collective