FediStatusPoster/README.md

89 lines
3.4 KiB
Markdown
Raw Normal View History

2024-03-09 17:42:07 -08:00
# ReadMe
FediStatusPoster is a collection of simple CLI tools and scripts to post to the fediverse.
A live example can be found at [GNU/Yandere](https://yandere.cc/YandereLewdBot)
## About
FediStatusPoster is designed to be both simple and minimal. It includes a few helper scripts to make posting easier if you intend to use it manually from the command line.
The ultimate goal of this project was to consolidate four bots I wrote previously in Python3 (each with slighly different behaviours) into a more sane and minimal code base. The strategy I employed previously was to make extensive use of OOP inheritence for each minor change in behavior between bots (yuck!!!).
This project aims to seperate bot-specific behavior (which should be done in shell scripts, not included with this repo), and the tool that is used for posting (this repo).
This project is licensed under the GPLv3. See [LICENSE.txt](./LICENSE.txt).
## Installing
You must have `git` and `python3` installed.
To setup the Python3 environment, run the following commands:
```
git clone 'https://git.yandere.cc/Anon/FediStatusPoster.git'
cd FediStatusPoster
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install Mastodon.py
deactivate
./fedistatusposter.sh -h
```
If everything worked correctly, you should see usage information on FediStatusPoster
## Generating Your OAuth Tokens
Before you can begin posting, you must first create an account on the instance of your choice, and then generate your OAuth tokens.
To generate your tokens, run the following commands and follow the interactive prompts:
```
touch cred.sh
chmod 600 cred.sh
cd ..
git clone 'https://git.yandere.cc/Anon/CreatePleromaApp.git'
cd CreatePleromaApp/
./run.sh > ../FediStatusPoster/cred.sh
# Follow the interactive prompts
```
## Encrypting Your OAuth Tokens
If you are going to be running a bot over a long period of time, consider encrypting your OAuth tokens with GPG encryption and a keyfile.
REMINDER: Your keyfile should typically be stored on a seperate removable device that can be quickly disconnected. If your account is compromised, you should also revoke permissions in your Pleroma settings panel.
```
touch cred.sh.gpg
touch cred.sh.key
chmod 600 cred.sh.key cred.sh.gpg
</dev/random tr -dc 'a-zA-Z0-9' | head -c4096 > cred.sh.key
cd ..
git clone 'https://git.yandere.cc/Anon/CreatePleromaApp.git'
cd CreatePleromaApp/
./run.sh | gpg -q -c --pinentry-mode loopback --passphrase-file ../FediStatusPoster/cred.sh.gpg -o ../FediStatusPoster/cred.sh.gpg -
# Follow the interactive prompts
```
If you do not want to keep a keyfile, but still want encryption, modify the encryption step with the following:
```
./run.sh | gpg -q -c --pinentry-mode loopback -o ../FediStatusPoster/cred.sh.gpg -
```
Be sure to update `./run.sh` to point to your new paths:
```
DEFAULT_CREDENTIALS="cred.sh.gpg"
DEFAULT_KEYFILE="cred.sh.key" or DEFAULT_KEYFILE="-" (if not using a keyfile)
```
# Useful Tips
Post from the command line:
```
./run.sh 'Message' './path/to/image.jpg'
```
Post a random file from a directory:
```
find /path/to/images -type f -print | shuf -n 1 | ./run.sh '#random' -
```
Check out the [FediStatusPosterExtras](https://git.yandere.cc/Anon/FediStatusPosterExtras) repo for more advanced examples.
# Donate
BTC: bc1q8w04c6xt0sm2nskkqatp372llyx8ed33at4k4g
ETH & BAT: 0x2B1C49cc1C93e5bba59a5eD4D0E0a4Da8D6Ce482
XMR: 493HynLQA4z71b3j9ZDXRNQudpdFW8GxeBGD8ahRctKn97RRurMVd35DqVqdAdjv68TcXTJWUwm6ee81ujDXGcmtKFixwQk