Improved docs

This commit is contained in:
Dylan 2023-07-03 19:49:43 +01:00
parent b19f552e70
commit 886dc0e09f
3 changed files with 77 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
config.json
__pycache__
venv/
links.json

14
config.json Normal file
View File

@ -0,0 +1,14 @@
{
"config": {
"appname": "vxTwitter",
"color": "#43B581",
"database": "[url to mongo database goes here]",
"link_cache": "ram",
"method": "hybrid",
"repo": "https://github.com/dylanpdx/BetterTwitFix",
"table": "[database table here]",
"url": "https://vxtwitter.com",
"combination_method": "local",
"gifConvertAPI": "local"
}
}

View File

@ -7,6 +7,7 @@ fxtwitter exposed all recently processed tweets publicly via a "latest" and "top
Even though Tweets are public, it was a personal concern for me that a tweet with potentially sensitive information in it could suddenly be shown to however many people were browsing the latest tweets page, and could be used as a tool for harassment. This was removed in [The following commit](https://github.com/dylanpdx/BetterTwitFix/commit/87ba86ba502e73ddb370bd4e5b964548d3272400#diff-a11c36d9b2d53672d6b3d781dca5bef9129159947de66bc3ffaec5fab389d80cL115)
Additionally, vxTwitter has a 'none' cache option, which is intended to be used behind a service like CloudFlare. vxtwitter.com currently runs with this option enabled to protect user privacy.
## How to use (discord side)
just put the url to the server, and directly after, the full URL to the tweet you want to embed
@ -23,13 +24,72 @@ You can also simply type out 'vx' directly before 'twitter.com' in any valid twi
I do not monitor any tweets processed by this server. Additionally, if you plan on hosting the code yourself and are concerned about this, be sure to check how to disable logging on the web server you are using (i.e Nginx)
## How to run (server side)
## How to host
### Ubuntu Linux Server
The following instructions were tested with Ubuntu 22.10, and assumes a stock OS
Edit config.json to fit your setup
First, get everything updated by running `sudo apt-get update`
Verify Python is installed by running `python3 --version` or `python --version`. Versions 3.7, 3.8, 3.9, and 3.10 are supported (This includes versions like 3.10.7)
Run the following command: `git clone https://github.com/dylanpdx/BetterTwitFix`
This will download all the code for vxTwitter. Once that is done, you can run `cd BetterTwitFix` to enter the newly downloaded folder.
Install pip and venv by running the following command: `apt install python3-pip python3-venv`
Create a virtual enviornment for all of BetterTwitFix's dependencies to live in by running `python3 -m venv venv` and then `source venv/bin/activate`
After that completes, install all the requirements for BetterTwitFix by running `pip3 install -r requirements.txt` and then `pip3 install uwsgi`
Test that everything is correct by running `python3 twitfix.py`. If all worked out well you should see a message that says it's running! You're not done yet though! Press CTRL+C to exit out of that for now.
Edit the twitfix.service file. You can use nano for this by running `nano twitfix.service`
Edit the variables under the [Service] secton. User and Group will need to be changed to the user you want to run this under, and WorkingDirectory, Environment, and ExecStart will all need to have `/home/dylan/BetterTwitFix` replaced with the directory you downloaded the code to. After that, you can save & exit the file (`CTRL+X then Y` on nano) and copy it to your system services by running `sudo cp twitfix.service /etc/systemd/system/`
Finally, get everything going by running `systemctl start twitfix` and `systemctl enable twitfix`
this script uses the youtube-dl python module, along with flask, twitter and pymongo, so install those with pip (you can use `pip install -r requirements.txt`) and start the server with `python twitfix.py`
I have included some files to give you a head start on setting this server up with uWSGI, though if you decide to use uWSGI I suggest you set up mongoDB link caching
After that, you need to set up an nginx proxy to point towards `/tmp/twitfix.sock`, which isn't covered here.
### Config
### Docker Setup
The following instructions were tested with Ubuntu 22.10, and assumes a stock OS
Edit config.json to fit your setup
First, install docker by following these instructions: [Install using the apt repository](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
Run the following command: `git clone https://github.com/dylanpdx/BetterTwitFix`
This will download all the code for vxTwitter. Once that is done, you can run `cd BetterTwitFix` to enter the newly downloaded folder.
Remove the following lines in twitfix.ini:
```ini
socket = /var/run/twitfix.sock
chmod-socket = 660
```
and replace with
```ini
socket = 0.0.0.0:9000
buffer-size = 8192
```
Finally, run this command to set up everything through Docker: `docker-compose up -d --build`
### Serverless Setup
This assumes your AWS credentials are set up
Run the following command: `git clone https://github.com/dylanpdx/BetterTwitFix`
Enter into that directory and install serverless framework into it by running `npm install -g serverless`
Then run `serverless deploy`
Finally, set up a new API gateway resource to point towards the main Lambda function (should start with vxTwitter)
## Config
vxTwitter generates a config.json in its root directory the first time you run it, the options are: