Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

logo

collective.mastodon

PyPI PyPI - Python Version PyPI - Wheel PyPI - License PyPI - Status

PyPI - Plone Versions

Meta Code Style

GitHub contributors GitHub Repo stars

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]

Metadata

Release files for collective.mastodon 1.0.0a2

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

Source distribution (sdist)

Source distribution for collective.mastodon 1.0.0a2
File Size Uploaded
collective.mastodon-1.0.0a2.tar.gz 194.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for collective.mastodon 1.0.0a2
File Interpreter ABI Platform
collective.mastodon-1.0.0a2-py3-none-any.whl Python 3 none any Details

Total release size: 229.7 kB

Release files / collective.mastodon-1.0.0a2.tar.gz

Download URL collective.mastodon-1.0.0a2.tar.gz
Size 194.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5a1948ee92dfe872049c562a052c60d10c99a39d57991e386ea172757615e033
BLAKE2b-256 checksum
How to use checksums
bd118e137012470d055e2464c6eb0272d363b490f47923fd75dd3b2dba72056f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / collective.mastodon-1.0.0a2-py3-none-any.whl

Download URL collective.mastodon-1.0.0a2-py3-none-any.whl
Size 35.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
157ba4d04a117eeda67b7543093f6abc2b44941076f5e69d8e5ca87e7ead1944
BLAKE2b-256 checksum
How to use checksums
fc8e693fc833238409224921ec43629334e0501f5df6c39e1232fa9728490135
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

1.0.0a2 This release

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