Begin README and add license

master
Tanner Collin před 5 roky
rodič 810e8c5ead
revize f293f2b5f9
  1. 21
      LICENSE
  2. 156
      README.md
  3. 19
      apiserver/requirements.txt

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 Tanner Collin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,156 @@
# QotNews
## Self-hosting
Install dependencies:
```text
# Python:
$ sudo apt update
$ sudo apt install python3 python3-pip python-virtualenv python3-virtualenv
# Yarn / nodejs:
# from https://yarnpkg.com/lang/en/docs/install/#debian-stable
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt update
$ sudo apt install yarn
```
Clone this repo:
```text
$ git clone https://gogs.tannercollin.com/tanner/qotnews.git
$ cd qotnews
```
### API Server
Create a venv, activate it, and install:
```text
$ cd apiserver
$ virtualenv -p python3 env
$ source env/bin/activate
(env) $ pip install -r requirements.txt
```
Configure Praw for your Reddit account:
* Go to https://www.reddit.com/prefs/apps
* Click "Create app"
* Name: whatever
* App type: script
* Description: blank
* About URL: blank
* Redirect URL: your GitHub profile
* Submit, copy the client ID and client secret into `praw.ini`:
```text
(env) $ vim praw.ini
[bot]
client_id=paste here
client_secret=paste here
user_agent=script by github/your-username-here
```
Now you can run the server:
```text
(env) $ python server.py
```
### Readability Server
Used as a fallback if outline.com doesn't work
```text
# In a different terminal
$ cd ../readerserver
$ yarn install
```
Now you can run the server:
```text
$ node main.js
```
### Webclient
```text
# In a different terminal
$ cd ../webclient
$ yarn install
$ yarn build
```
The webclient is served by the API server, so you can close this terminal.
### Security
It's recommended to run QotNews as its own Linux user, kept alive with [supervisor](https://pypi.org/project/supervisor/).
Add a `qotnews` Linux user, move the repo into its home folder.
Configure `/etc/supervisor/conf.d/qotnews.conf`:
```text
[program:qotnewsapi]
user=qotnews
directory=/home/qotnews/qotnews/apiserver
command=/home/qotnews/qotnews/apiserver/env/bin/python -u server.py
stopsignal=INT
autostart=true
autorestart=true
stderr_logfile=/var/log/qotnewsapi.log
stderr_logfile_maxbytes=1MB
stdout_logfile=/var/log/qotnewsapi.log
stdout_logfile_maxbytes=1MB
[program:qotnewsreader]
user=qotnews
directory=/home/qotnews/qotnews/readerserver
command=node main.js
autostart=true
autorestart=true
stderr_logfile=/var/log/qotnewsreader.log
stderr_logfile_maxbytes=1MB
stdout_logfile=/var/log/qotnewsreader.log
stdout_logfile_maxbytes=1MB
```
To expose QotNews to http / https, you should configure nginx to reverse proxy:
```text
server {
listen 80;
root /var/www/html;
index index.html index.htm;
server_name news.t0.vc;
location / {
proxy_pass http://127.0.0.1:33842/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
Then run `sudo certbot --nginx` and follow the prompts, enable redirect.
## License
This program is free and open-source software licensed under the MIT License. Please see the `LICENSE` file for details.
That means you have the right to study, change, and distribute the software and source code to anyone and for any purpose as long as you grant the same rights when distributing it. You deserve these rights. Please take advantage of them because I like pull requests and would love to see this code put to use.
## Acknowledgements
This project was inspired by auto-playing videos, "pardon the interruption", paywalls, and GDPR cookie-banners.
Thanks to all the devs behind Python, Flask, Node, React, Readability.js, Outline, and Tildes (u/Deimos).

@ -1,25 +1,22 @@
beautifulsoup4==4.8.0
certifi==2019.6.16
beautifulsoup4==4.8.1
certifi==2019.9.11
chardet==3.0.4
Click==7.0
commonmark==0.9.0
feedparser==5.2.1
commonmark==0.9.1
Flask==1.1.1
Flask-Cors==3.0.8
future==0.17.1
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10.1
Jinja2==2.10.3
MarkupSafe==1.1.1
pkg-resources==0.0.0
praw==6.3.1
praw==6.4.0
prawcore==1.0.1
requests==2.22.0
six==1.12.0
soupsieve==1.9.3
soupsieve==1.9.4
update-checker==0.16
urllib3==1.25.3
webencodings==0.5.1
urllib3==1.25.6
websocket-client==0.56.0
Werkzeug==0.15.5
Werkzeug==0.16.0
Whoosh==2.7.4

Načítá se…
Zrušit
Uložit