README.md 2.44 KB
Newer Older
z's avatar
z committed
1
# yeetdelete
z's avatar
z committed
2
3
4

## About

z's avatar
z committed
5
yeetdelete is a Pleroma post deleting script, inspired by [forget](https://github.com/codl/forget). By default, yeetdelete will delete posts older than 30 days. This variable is editable in the config.
z's avatar
z committed
6

z's avatar
z committed
7
This is my first proper venture into Python. Suggestions and improvements are always welcome. 
z's avatar
z committed
8
9
10
11
12

## Prerequisites

* MySQL 8+ (tested on 8.0.20, might work on older versions)
* Python 3+ (tested on 3.7, might work on older versions)
z's avatar
z committed
13
14
* Pip
* MySQL C API client library. On Ubuntu/Debian this is `$ apt install libmysqlclient-dev`
z's avatar
z committed
15
16
17
18

## Install dependencies

```
z's avatar
z committed
19
$ pip3 install -r requirements.txt
z's avatar
z committed
20
21
22
23
```

## Setup

z's avatar
z committed
24
1. Check config.json, edit the base (instance) URL and MySQL connection URL. Optionally, enable the fireworks, they're fun to watch.
z's avatar
z committed
25
2. Run `setup.py`.
z's avatar
z committed
26
3. If you have a lot of posts, it is recommended to run `run.py` at least once before deploying. Enjoy the fireworks if you enabled them!
z's avatar
z committed
27
28
29

## Usage

z's avatar
z committed
30
31
32
33
34
35
Works with cron. Here's my crontab line: `0 0 * * * cd ~/yeetdelete && python3 run.py`.

Alternatively, just run `run.py` once (ideally twice) if you want to delete all posts older than the set threshold as a one-time operation.

## Q&A

z's avatar
z committed
36
Q: How do I enable fireworks?<br>
z's avatar
z committed
37
38
A: Set `enableFireworks` in the config to "True" or "true".

z's avatar
z committed
39
Q: Your script skipped a post!<br>
z's avatar
z committed
40
A: This script is designed with eventual consistency in mind. Run it again.
z's avatar
z committed
41

z's avatar
z committed
42
Q: Why MySQL?<br>
z's avatar
z committed
43
A: Because I'm a masochist.
z's avatar
z committed
44

z's avatar
z committed
45
Q: I don't want to install MySQL...<br>
z's avatar
z committed
46
47
48
49
50
51
A: If you're fine with Docker, follow these three steps... (you won't believe number 2!)

1. `$ docker run --detach --name=yeetsql --env="MYSQL_ROOT_PASSWORD=yeetdelete" mysql`
2. `$ docker inspect yeetsql`
3. Find the "IPAddress" parameter. If installed Docker just for this, it's probably `172.17.0.2`. That's the URL, shove that into `config.json`

z's avatar
z committed
52
Q: Something broke!<br>
z's avatar
z committed
53
A: DM [zonk](https://neckbeard.xyz/nosleep) with the output of the script.
z's avatar
z committed
54
55
56
57
58
59
60
61

## Roadmap

- [x] OAuth2 Auth
- [x] Initial DB setup
- [x] Save all posts to DB
- [x] Rescrape posts when rerun
- [x] Proper try/except handling
z's avatar
z committed
62
- [x] Post deletion from DB and instance
z's avatar
z committed
63
64
65
66
67
68
69
70
71
72
73
- [x] Tidying up the code
- [x] Rewrite DB setup without sqlalchemy_utils
- [x] Test in clean environment
- [x] Create requirements.txt
- [x] Finish README
- [x] Add pointless easter eggs

## Thanks

- [codl](https://chitter.xyz/@codl) for creating [forget](https://github.com/codl/forget)!
- [0x00](https://social.panthermodern.net/@0x00) for the idea to create "forget but for Pleroma"!