diff --git a/.gitignore b/.gitignore index 90063a8..f5189cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ docs/build/ __pycache__ feedlist -data *.swp *.pyc *.db @@ -9,5 +8,3 @@ data *.txt *.bck *.png -*.yml -.env diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index c6ca6e7..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM python:3.7-bullseye - -ADD . /app -WORKDIR /app - -RUN python3 setup.py install; \ - chmod +x docker_entrypoint.sh; \ - mkdir -p /data /root/.config; \ - rm -rf docke.yml - -WORKDIR /data - -CMD ["/app/docker_entrypoint.sh"] diff --git a/README.md b/README.md index dc85036..61b4fcd 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,64 @@ -# Feed2Toot Docker - -Feed2Toot Docker is a fork of [chaica/feed2toot](https://gitlab.com/chaica/feed2toot) that allows for simple deployment over Docker. In the future I'll try to add other useful features. - -### Usage - -With Docker Compose: -```yaml -version: '3' - -services: - feed2toot: - image: gitea.massivebox.net/massivebox/feed2toot-docker:latest - environment: - - USERNAME=sampleusername@sampleinstance.url - - PASSWORD=samplepassword - - INSTANCE=https://sampleinstance.url - restart: always - volumes: - - ./data:/data -``` -Insert your full username (including the part with your homeserver's address), password and instance URL where required. -You also need to create a working `feed2toot.ini` in the `./data` folder. See the [upstream docs](`https://feed2toot.readthedocs.io/en/latest/configure.html#create-feed2toot-configuration`) for the guide. - -After the first successful run, you can remove the entire `environment` block if you want, however, if you delete and re-create the container, you will need to put it back. - -### Support - -Don't ask the upstream developers for help, if something is broken it's more likely that it is my fault. -You can get support by opening an [issue](https://gitea.massivebox.net/massivebox/feed2toot-docker/issues), or by [contacting me](https://massivebox.net/contact.html), or in the [Matrix support room](https://matrix.to/#/#support:massivebox.net). - ### Feed2toot -The following links and addresses are the upstream developers'. I don't want donations for this project, but I encourage you to donate to them. +Feed2toot automatically parses rss feeds, identifies new posts and posts them on the [Mastodon](https://mastodon.social) social network. +For the full documentation, [read it online](https://feed2toot.readthedocs.io/en/latest/). + +If you would like, you can [support the development of this project on Liberapay](https://liberapay.com/carlchenet/). +Alternatively you can donate cryptocurrencies: -- [Liberapay](https://liberapay.com/carlchenet/) - BTC: 1AW12Zw93rx4NzWn5evcG7RNNEM2RSLmAC - XMR: 43GGv8KzVhxehv832FWPTF7FSVuWjuBarFd17QP163uxMaFyoqwmDf1aiRtS5jWgCiRsi73yqedNJJ6V1La2joznKHGAhDi +### Quick Install + +* Install Feed2toot from PyPI + + # pip3 install feed2toot + +* Install Feed2toot from sources + *(see the installation guide for full details) + [Installation Guide](http://feed2toot.readthedocs.io/en/latest/install.html)* + + + # tar zxvf feed2toot-0.17.tar.gz + # cd feed2toot + # python3 setup.py install + # # or + # python3 setup.py install --install-scripts=/usr/bin + +### Create the authorization for the Feed2toot app + +* Just launch the following command:: + + $ register_feed2toot_app + +### Use Feed2toot + +* Create or modify feed2toot.ini file in order to configure feed2toot: + + [mastodon] + instance_url=https://mastodon.social + user_credentials=feed2toot_usercred.txt + client_credentials=feed2toot_clientcred.txt + ; Default visibility is public, but you can override it: + ; toot_visibility=unlisted + + [cache] + cachefile=cache.db + + [rss] + uri=https://www.journalduhacker.net/rss + toot={title} {link} + + [hashtaglist] + several_words_hashtags_list=hashtags.txt + +* Launch Feed2toot + + $ feed2toot -c /path/to/feed2toot.ini + ### Authors -* MassiveBox * Carl Chenet * Antoine Beaupré * First developed by Todd Eddy diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh deleted file mode 100755 index 7360431..0000000 --- a/docker_entrypoint.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -cd /data - -if [[ ! -f "feed2toot_clientcred.txt" || ! -f "feed2toot_usercred.txt" ]]; then - register_feed2toot_app --instance $INSTANCE --username $USERNAME --password $PASSWORD -fi - -while :; do - feed2toot -c ./feed2toot.ini - sleep 5m -done diff --git a/scripts/register_feed2toot_app b/scripts/register_feed2toot_app index 7453ecc..22975e8 100755 --- a/scripts/register_feed2toot_app +++ b/scripts/register_feed2toot_app @@ -34,9 +34,6 @@ parser.add_argument('--version', action='version', version=__version__) parser.add_argument('--client-credentials-file', dest='clientcredfile', help='the name of the client credentials for the Mastodon app', default='feed2toot_clientcred.txt') parser.add_argument('--user-credentials-file', dest='usercredfile', help='the name of the user credentials for the Mastodon app', default='feed2toot_usercred.txt') parser.add_argument('--name', help='the name of the Mastodon app', default='feed2toot') -parser.add_argument('--instance', help='the URL of the Mastodon instance') -parser.add_argument('--username', help='the username of your Mastodon account') -parser.add_argument('--password', help='the password of your Mastodon account') opts = parser.parse_args() clientcredfile=opts.clientcredfile @@ -47,9 +44,7 @@ print(headline) # get the instance -instance = opts.instance -if not instance: - instance = input('Mastodon instance URL (defaults to https://mastodon.social): ') +instance = input('Mastodon instance URL (defaults to https://mastodon.social): ') if not instance: instance = 'https://mastodon.social' elif not instance.startswith('http'): @@ -57,25 +52,19 @@ elif not instance.startswith('http'): # get the username userok = False -quit_on_error = True while not userok: - user = opts.username - if not user: - user = input('Mastodon login: ') - quit_on_error = False + user = input('Mastodon login: ') if not user: print('Your Mastodon username can not be empty.') + userok = False elif '@' not in user or '.' not in user: print('Your Mastodon username should be an email.') + userok = False else: userok = True - if not userok and quit_on_error: - exit() # get the password -password = opts.password -if not password: - password = getpass(prompt='Mastodon password: ') +password = getpass(prompt='Mastodon password: ') Mastodon.create_app( opts.name, api_base_url=instance,