upstream: https://git.tannercollin.com/tanner/qotnews.git

Jason Schwarzenberger 53bb7bb66c test idea with svelte. 2 days ago
apiserver d5b2851bf6 git ignore. 2 days ago
readerserver @ 57ae9614a0 448e5a1e0e update declutter 2 days ago
searchserver f95df227f1 Add instructions to download search server 2 months ago
webapp 53bb7bb66c test idea with svelte. 2 days ago
webclient a70c2a976c update logo. 1 month ago
.gitmodules f5b38f5c6b remove readerserver, add declutter. 2 months ago
LICENSE f293f2b5f9 Begin README and add license 1 year ago
README.md e0960d59f3 update readme. 2 months ago

README.md

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 --recurse-submodules https://git.1j.nz/jason/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 (optional):

  • 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 settings.py below
(env) $ vim settings.py.example

Edit it and save it as settings.py.

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