<div align="center"><img alt="logo" src="./docs/_static/images/icon.png" width="70" /></div>
<h1 align="center">collective.mastodon</h1>
<div align="center">
[![PyPI](https://img.shields.io/pypi/v/collective.mastodon)](https://pypi.org/project/collective.mastodon/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/collective.mastodon)](https://pypi.org/project/collective.mastodon/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/collective.mastodon)](https://pypi.org/project/collective.mastodon/)
[![PyPI - License](https://img.shields.io/pypi/l/collective.mastodon)](https://pypi.org/project/collective.mastodon/)
[![PyPI - Status](https://img.shields.io/pypi/status/collective.mastodon)](https://pypi.org/project/collective.mastodon/)
[![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/collective.mastodon)](https://pypi.org/project/collective.mastodon/)
[![Meta](https://github.com/collective/collective.mastodon/actions/workflows/meta.yml/badge.svg)](https://github.com/collective/collective.mastodon/actions/workflows/meta.yml)
![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000)
[![GitHub contributors](https://img.shields.io/github/contributors/collective/collective.mastodon)](https://github.com/collective/collective.mastodon)
[![GitHub Repo stars](https://img.shields.io/github/stars/collective/collective.mastodon?style=social)](https://github.com/collective/collective.mastodon)
</div>
**collective.mastodon** is a package providing a [Plone](https://plone.org/) 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`:
```bash
pip install collective.mastodon
```
or add it as a dependency on your package's `setup.py`
```python
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:
```shell
MASTODON_APPS='[{"name": "localhost-user","instance":"http://localhost","token":"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M","user":"user"}]'
```
### Starting Plone
Now, you can start your local Plone installation with:
```shell
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:
```yaml
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!
- [Issue Tracker](https://github.com/collective/collective.mastodon/issues)
- [Source Code](https://github.com/collective/collective.mastodon/)
- [Documentation](https://collective.github.io/collective.mastodon)
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:
```bash
make build
```
### Update translations
```bash
make i18n
```
### Format codebase
```bash
make format
```
### Run tests
Testing of this package is done with [`pytest`](https://docs.pytest.org/) and [`tox`](https://tox.wiki/).
Run all tests with:
```bash
make test
```
Run all tests but stop on the first error and open a `pdb` session:
```bash
./bin/tox -e test -- -x --pdb
```
Run only tests that match `TestAppDiscovery`:
```bash
./bin/tox -e test -- -k TestAppDiscovery
```
Run only tests that match `TestAppDiscovery`, but stop on the first error and open a `pdb` session:
```bash
./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](https://github.com/collective)
# Contributors
- Érico Andrei, @ericof
# Changelog
<!--
You should *NOT* be adding new change log entries to this file.
You should create a file in the news directory instead.
For helpful instructions, please see:
https://github.com/plone/plone.releaser/blob/master/ADD-A-NEWS-ITEM.rst
-->
<!-- towncrier release notes start -->
## 1.0.0a2 (2023-08-26)
### New features:
- Rewrite keywords with spaces and dashes [@ericof] [#1](https://github.com/collective/collective.mastodon/issues/1)
## 1.0.0a1 (2023-08-25)
- Initial release [@ericof]
Raw data
{
"_id": null,
"home_page": "https://pypi.python.org/pypi/collective.mastodon",
"name": "collective.mastodon",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.0",
"maintainer_email": "",
"keywords": "Python Plone Mastodon ContentRules SocialNetwork",
"author": "\u00c9rico Andrei",
"author_email": "ericof@plone.org",
"download_url": "https://files.pythonhosted.org/packages/bd/11/8e137012470d055e2464c6eb0272d363b490f47923fd75dd3b2dba72056f/collective.mastodon-1.0.0a2.tar.gz",
"platform": null,
"description": "\n<div align=\"center\"><img alt=\"logo\" src=\"./docs/_static/images/icon.png\" width=\"70\" /></div>\n\n<h1 align=\"center\">collective.mastodon</h1>\n\n<div align=\"center\">\n\n[![PyPI](https://img.shields.io/pypi/v/collective.mastodon)](https://pypi.org/project/collective.mastodon/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/collective.mastodon)](https://pypi.org/project/collective.mastodon/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/collective.mastodon)](https://pypi.org/project/collective.mastodon/)\n[![PyPI - License](https://img.shields.io/pypi/l/collective.mastodon)](https://pypi.org/project/collective.mastodon/)\n[![PyPI - Status](https://img.shields.io/pypi/status/collective.mastodon)](https://pypi.org/project/collective.mastodon/)\n\n\n[![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/collective.mastodon)](https://pypi.org/project/collective.mastodon/)\n\n[![Meta](https://github.com/collective/collective.mastodon/actions/workflows/meta.yml/badge.svg)](https://github.com/collective/collective.mastodon/actions/workflows/meta.yml)\n![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000)\n\n[![GitHub contributors](https://img.shields.io/github/contributors/collective/collective.mastodon)](https://github.com/collective/collective.mastodon)\n[![GitHub Repo stars](https://img.shields.io/github/stars/collective/collective.mastodon?style=social)](https://github.com/collective/collective.mastodon)\n\n</div>\n\n**collective.mastodon** is a package providing a [Plone](https://plone.org/) content rules action to post a status to a Mastodon instance.\n\n\n# Installation\n\nThis package supports Plone sites using Volto and ClassicUI.\n\nFor proper Volto support, the requirements are:\n\n* plone.restapi >= 8.34.0\n* Volto >= 16.10.0\n\nAdd **collective.mastodon** to the Plone installation using `pip`:\n\n```bash\npip install collective.mastodon\n```\n\nor add it as a dependency on your package's `setup.py`\n\n```python\n install_requires = [\n \"collective.mastodon\",\n \"Plone\",\n \"plone.restapi\",\n \"setuptools\",\n ],\n```\n\n## Configuration\n\n### Obtaining an Access Token\nBefore you can use this package, you have to register an application on Mastodon.\nTo 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`).\nGo to the newly created application page and copy the value of `Your access token`.\n\n### Configuring Plone\n\nThis package is configured via the `MASTODON_APPS` environment variable which should contain a valid JSON array with your Mastodon Application information.\n\nEach application registration requires the following information:\n\n| Key | Description | Example Value |\n| -- | -- | -- |\n| name | Identifier for the application | localhost-user |\n| instance | URL of your instance, without the trailing slash | http://localhost |\n| token | Access token of your Mastodon Application | jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M |\n| user | User on the Mastodon instance. (Only used to generate a friendly name on Plone) | user |\n\nUsing the information above, the environment variable would look like:\n\n```shell\nMASTODON_APPS='[{\"name\": \"localhost-user\",\"instance\":\"http://localhost\",\"token\":\"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M\",\"user\":\"user\"}]'\n```\n\n### Starting Plone\n\nNow, you can start your local Plone installation with:\n\n```shell\nMASTODON_APPS='[{\"name\": \"localhost-user\",\"instance\":\"http://localhost\",\"token\":\"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M\",\"user\":\"user\"}]' make start\n```\n\nor, if you are using a `docker compose` configuration, add the new environment variable under the `environment` key:\n\n```yaml\n environment:\n - MASTODON_APPS='[{\"name\": \"localhost-user\",\"instance\":\"http://localhost\",\"token\":\"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M\",\"user\":\"user\"}]'\n```\n\nAfter start-up visit the `Content Rules` Control Panel, and create a new content rule.\n\nNo additional configuration is needed for Volto support.\n\n# Contributing\n\nIf you want to help with the development (improvement, update, bug-fixing, ...) of `collective.mastodon` this is a great idea!\n\n- [Issue Tracker](https://github.com/collective/collective.mastodon/issues)\n- [Source Code](https://github.com/collective/collective.mastodon/)\n- [Documentation](https://collective.github.io/collective.mastodon)\n\nWe appreciate any contribution and if a release is needed to be done on PyPI, please just contact one of us.\n\n## Local Development\n\nYou need a working `python` environment (system, `virtualenv`, `pyenv`, etc) version 3.8 or superior.\n\nThen install the dependencies and a development instance using:\n\n```bash\nmake build\n```\n### Update translations\n\n```bash\nmake i18n\n```\n\n### Format codebase\n\n```bash\nmake format\n```\n\n### Run tests\n\nTesting of this package is done with [`pytest`](https://docs.pytest.org/) and [`tox`](https://tox.wiki/).\n\nRun all tests with:\n\n```bash\nmake test\n```\n\nRun all tests but stop on the first error and open a `pdb` session:\n\n```bash\n./bin/tox -e test -- -x --pdb\n```\n\nRun only tests that match `TestAppDiscovery`:\n\n```bash\n./bin/tox -e test -- -k TestAppDiscovery\n```\n\nRun only tests that match `TestAppDiscovery`, but stop on the first error and open a `pdb` session:\n\n```bash\n./bin/tox -e test -- -k TestAppDiscovery -x --pdb\n```\n\n## Translations\n\nThis product has been translated into:\n\n- English (\u00c9rico Andrei)\n- Portugu\u00eas do Brasil (\u00c9rico Andrei)\n\n# License\n\nThe project is licensed under GPLv2.\n\n# One Last Thing\n\nOriginally Made in S\u00e3o Paulo, Brazil, with love, by your friends @ Simples Consultoria.\n\nNow maintained by the [Plone Collective](https://github.com/collective)\n\n\n# Contributors\n\n- \u00c9rico Andrei, @ericof\n\n\n# Changelog\n\n<!--\n You should *NOT* be adding new change log entries to this file.\n You should create a file in the news directory instead.\n For helpful instructions, please see:\n https://github.com/plone/plone.releaser/blob/master/ADD-A-NEWS-ITEM.rst\n-->\n\n<!-- towncrier release notes start -->\n\n## 1.0.0a2 (2023-08-26)\n\n\n### New features:\n\n- Rewrite keywords with spaces and dashes [@ericof] [#1](https://github.com/collective/collective.mastodon/issues/1)\n\n\n## 1.0.0a1 (2023-08-25)\n\n- Initial release [@ericof]\n\n\n",
"bugtrack_url": null,
"license": "GPL version 2",
"summary": "Mastodon integration for Plone.",
"version": "1.0.0a2",
"project_urls": {
"Documentation": "https://collective.github.io/collective.mastodon",
"Homepage": "https://pypi.python.org/pypi/collective.mastodon",
"PyPI": "https://pypi.python.org/pypi/collective.mastodon",
"Source": "https://github.com/collective/collective.mastodon",
"Tracker": "https://github.com/collective/collective.mastodon/issues"
},
"split_keywords": [
"python",
"plone",
"mastodon",
"contentrules",
"socialnetwork"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fc8e693fc833238409224921ec43629334e0501f5df6c39e1232fa9728490135",
"md5": "0f9542bef9293071213dd5780917eb79",
"sha256": "157ba4d04a117eeda67b7543093f6abc2b44941076f5e69d8e5ca87e7ead1944"
},
"downloads": -1,
"filename": "collective.mastodon-1.0.0a2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0f9542bef9293071213dd5780917eb79",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.0",
"size": 35186,
"upload_time": "2023-08-26T16:25:23",
"upload_time_iso_8601": "2023-08-26T16:25:23.040645Z",
"url": "https://files.pythonhosted.org/packages/fc/8e/693fc833238409224921ec43629334e0501f5df6c39e1232fa9728490135/collective.mastodon-1.0.0a2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bd118e137012470d055e2464c6eb0272d363b490f47923fd75dd3b2dba72056f",
"md5": "23e3a34d0f0acde8f9eed09c78408a64",
"sha256": "5a1948ee92dfe872049c562a052c60d10c99a39d57991e386ea172757615e033"
},
"downloads": -1,
"filename": "collective.mastodon-1.0.0a2.tar.gz",
"has_sig": false,
"md5_digest": "23e3a34d0f0acde8f9eed09c78408a64",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.0",
"size": 194548,
"upload_time": "2023-08-26T16:25:25",
"upload_time_iso_8601": "2023-08-26T16:25:25.284071Z",
"url": "https://files.pythonhosted.org/packages/bd/11/8e137012470d055e2464c6eb0272d363b490f47923fd75dd3b2dba72056f/collective.mastodon-1.0.0a2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-26 16:25:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "collective",
"github_project": "collective.mastodon",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "collective.mastodon"
}