teddit/README.md

136 lines
4.2 KiB
Markdown
Raw Normal View History

2020-11-17 21:44:32 +01:00
# teddit
2020-11-17 22:02:20 +01:00
[teddit.net](https://teddit.net)
2020-11-17 21:44:32 +01:00
A free and open source alternative Reddit front-end focused on privacy.
Inspired by the [Nitter](https://github.com/zedeus/nitter) project.
* No JavaScript or ads
* All requests go through the backend, client never talks to Reddit
* Prevents Reddit from tracking your IP or JavaScript fingerprint
* Lightweight (teddit frontpage: ~30 HTTP requests with ~270 KB of data downloaded vs. Reddit frontpage: ~190 requests with ~24 MB)
2020-11-19 06:55:25 +01:00
** teddit is still in an alpha version, so expect runtime errors and downtimes **
2020-11-17 21:44:32 +01:00
XMR: 832ogRwuoSs2JGYg7wJTqshidK7dErgNdfpenQ9dzMghNXQTJRby1xGbqC3gW3GAifRM9E84J91VdMZRjoSJ32nkAZnaCEj
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
BTC: bc1qlcrmt2pvlh4eq69l3l4h6z5jg74z2m2q3pasan
## TODO
* Subreddit sidebars
* Sort comments in post
* User attributes
* Comment and post attributes (e.g. stickies)
* Subreddit flairs
* User trophies
* "other discussions" feature
* ... and lot of other small stuff
## Roadmap
* Unofficial reddit API through teddit
* Themes
* User settings
* HLS video streaming? (Would require browser JavaScript)
* Onion site
* User login, so people can use their Reddit account through teddit to comment and up/downvote posts etc.
2020-11-17 21:44:32 +01:00
## Installation
This is a quick guide how to run teddit on your own server. Tested on fresh install of Debian 10. You can install teddit also locally without certificates and so on, but there's no guide for it (not yet).
Run as root:
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# apt update && apt upgrade`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# curl -sL https://deb.nodesource.com/setup_14.x | bash -`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# apt install -y nodejs redis-server ffmpeg git curl certbot` *leave ffmpeg out if you don't want video support*
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# adduser teddit`
2020-11-17 21:57:40 +01:00
`# mkdir -p /home/teddit/letsencrypt/ /home/teddit/letsencrypt/logs/ /home/teddit/letsencrypt/lib/`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# chown teddit:teddit -R /home/teddit/letsencrypt/`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080` *route port 8080 to 80*
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8088` *route port 8088 to 443*
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# apt install iptables-persistent` *save iptables configuration to be persistent*
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Edit redis.conf file and set **maxmemory** value suitable for your server (e.g. 75% of your total RAM):
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# nano /etc/redis/redis.conf`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Add this to the end of the file:
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`maxmemory 2gb`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Also add maxmemory-policy:
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`maxmemory-policy volatile-ttl`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Save and exit the file.
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Restart redis:
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# systemctl restart redis`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Let's log in for teddit user.
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`# su - teddit`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ git clone https://codeberg.org/teddit/teddit`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ cd teddit`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ npm install && npm update`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Let's obtain certificates. Run HTTP server:
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ nohup node setup_server.js </dev/null &>/dev/null &`
2020-11-17 21:57:40 +01:00
Then run certbot. Change "teddit.net" to your domain, and also change the "ADD_YOUR_EMAIL_ADDRESS@SOMETHING.ORG" email.
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ certbot certonly --webroot -w /home/teddit/teddit/dist/ -d teddit.net --agree-tos --no-eff-email --manual-public-ip-logging-ok --config-dir /home/teddit/letsencrypt/ --logs-dir /home/teddit/letsencrypt/logs/ --work-dir /home/teddit/letsencrypt/lib/ --email ADD_YOUR_EMAIL_ADDRESS@SOMETHING.ORG`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Kill the node HTTP server:
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ ps aux | grep node`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ kill -9 [PID HERE]`
2020-11-17 21:57:40 +01:00
Change config variables in app.js for domain and Reddit app ID. Note: It's recommended that you get your own Reddit app ID. For testing purposes it's okay to use this project's default app ID. Create your Reddit app here: [https://old.reddit.com/prefs/apps/](https://old.reddit.com/prefs/apps/). Make sure to create an "installed app" type of app.
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ nano app.js`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Save and exit.
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
Now let's start teddit:
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ nohup node app.js > output.log &`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
If everything went okay, you should have teddit instance running on your domain with a valid SSL certificate.
Tailing output.log:
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
`$ tail -f output.log`
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
You should see something like:
2020-11-17 21:57:40 +01:00
2020-11-17 21:44:32 +01:00
```
Teddit running on https://teddit.net
Teddit running on http://teddit.net
Successfully obtained a reddit API key.
```
2020-11-20 16:28:20 +01:00
### Other
2020-11-20 16:35:29 +01:00
* Using nohup for starting and killing the node process might be a bit of a hassle, but this project aims to be as minimalistic as possible. If you want to use process managers like [pm2](https://www.npmjs.com/package/pm2) it's perfectly fine.
2020-11-20 16:28:20 +01:00
* Teddit doesn't have any fancy logging built in. There's no IP address or even timestamp logging.