Mastodon integration for Plone.
Project description
collective.mastodon
collective.mastodon is a package providing a Plone content rules action to post a status to a Mastodon instance.
Installation
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",
],
Configuration
Obtaining an Access Token
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
.
Configuring Plone
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"}]'
Starting Plone
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.
Contributing
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.
Local Development
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
Update translations
make i18n
Format codebase
make format
Run tests
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
Translations
This product has been translated into:
- English (Érico Andrei)
- Português do Brasil (Érico Andrei)
License
The project is licensed under GPLv2.
One Last Thing
Originally Made in São Paulo, Brazil, with love, by your friends @ Simples Consultoria.
Now maintained by the Plone Collective
Contributors
- Érico Andrei, @ericof
Changelog
1.0.0a2 (2023-08-26)
New features:
- Rewrite keywords with spaces and dashes [@ericof] #1
1.0.0a1 (2023-08-25)
- Initial release [@ericof]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for collective.mastodon-1.0.0a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a1948ee92dfe872049c562a052c60d10c99a39d57991e386ea172757615e033 |
|
MD5 | 23e3a34d0f0acde8f9eed09c78408a64 |
|
BLAKE2b-256 | bd118e137012470d055e2464c6eb0272d363b490f47923fd75dd3b2dba72056f |
Hashes for collective.mastodon-1.0.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 157ba4d04a117eeda67b7543093f6abc2b44941076f5e69d8e5ca87e7ead1944 |
|
MD5 | 0f9542bef9293071213dd5780917eb79 |
|
BLAKE2b-256 | fc8e693fc833238409224921ec43629334e0501f5df6c39e1232fa9728490135 |