Go to file
2020-11-02 17:09:59 +13:00
apiserver add webworm/substack as a feed. 2020-11-02 17:09:59 +13:00
readerserver Make qotnews work with WaPo 2020-10-29 04:55:34 +00:00
searchserver Add instructions to download search server 2020-10-26 21:58:36 +00:00
webclient Fix index.html indentation 2020-11-02 00:38:34 +00:00
LICENSE Begin README and add license 2019-10-15 16:40:55 -06:00
README.md Fix copy/paste error, switch to info logging 2019-10-16 05:26:47 +00:00

QotNews

Self-hosting

Install dependencies:

# 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:

$ git clone https://gogs.tannercollin.com/tanner/qotnews.git
$ cd qotnews

API Server

Create a venv, activate it, and install:

$ 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:
(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:

(env) $ python server.py

Readability Server

Used as a fallback if outline.com doesn't work

# In a different terminal
$ cd ../readerserver
$ yarn install

Now you can run the server:

$ node main.js

Webclient

# 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.

Add a qotnews Linux user, move the repo into its home folder.

Configure /etc/supervisor/conf.d/qotnews.conf:

[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:

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. 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).