tootgroup.py with GoToSocial
I installed #GoToSocial on my #yunohost and wanted am trying to add two features to the installation:
- putting a feed (timeline for an account, local feed) on its own webpage
- defining a group of accounts to work as editorial stuff for a newsfeed
The latter I solved by adopting tootgroup.py to GoToSocial.
Shoutout and thanks to
- @andi@fed.sonnenmulde.at for the nice script and being very responsive and helpful when it initially didn't work with GoToSocial
- @dumpsterqueer:ondergrond.org and @gruf:matrix.iim.gay on GoToSocial Help for there support understanding how Mastodon and GoToSocial differ
- Val Lorentz on #mastodon at irc.libera.chat who seems to know everything about mastodon and answeres nearly any question
Background
Mastodon and GoToSocial use a different format for notification IDs.
Mastodon uses a string representing an integer that is counting up - tootgroup.py expects this and converts the string to integer and sorts notifications by their number.
GoToSocial uses an ulid as notification ID. These can be sorted lexically.
Both is covered by the mastodon documentation which doesn't even guarantee that notification could be sorted by their ID.
Val warned on IRC that using an integer in Mastodon could change in future.
To get a quick proof of concept that tootgroup.py
works with GoToSocial I opted for replacing the integer sort that fails by a lexical sort for the ulids of GoToSocial.
In the issue I opened there is some discussion on how to make tootgroup.py
compatible with the Mastodon and GoToSocial way in future - comments are welcome!
install
Below are the steps I used on my #yunohost based on #Debian to install #tootgroupPy.
create user and homedir
apt-get install python3-pip useradd -s /bin/bash -m tootgroup sudo -u tootgroup -i
install tootgroup.py
for GoToSocial
as user tootgroup:
######################################################## ### the commands below are run as **user tootgroup** ### ######################################################## git clone -b GoToSocial --single-branch https://github.com/chri2/tootgroup.py.git python3 -m venv venv . venv/bin/activate echo -e '\n. ~/venv/bin/activate\n' >> .bashrc pip3 install Mastodon.py pip3 install platformdirs chmod +x tootgroup.py/tootgroup.py
setup
The integrated setup of tootgroup.py
will start when it is called the first time.
This didn't work for me with my GoToSocial instance
To try execute it as user tootgroup:
(venv) tootgroup@myhost:~$ tootgroup.py/tootgroup.py No configuration found! tootgroup.py will continue to run but first ask for all information it requires... Configuration will then be stored under /home/tootgroup/.local/share/tootgroup.py/ Group "default" not in configuration. - Setting it up now... We need a Mastodon server to connect to! Enter the URL of the Mastodon instance your group account is running on:
Otherwise look at this issue and follow the instruction in the GoToSocial documentation to get a token and write your configuration using an editor.
create cronjob
This is the cronjob I use to run the script on my system. Replace <user@doma.in>
by your email address.
# cat /etc/cron.d/tootgroup SHELL=/bin/bash PATH=/home/tootgroup/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin VIRTUAL_ENV=/home/tootgroup/venv MAILTO= * * * * * tootgroup /home/tootgroup/tootgroup.py/tootgroup.py | grep -v '^Successful tootgroup.py run'