Skip to content

Easily add URLs to a domain block list

Notifications You must be signed in to change notification settings

reeseovine/ezblocklist

Repository files navigation

ezblocklist

basic express server for adding websites to a blocklist

To do

  • basic API
    • block a website
      • add url or domain name, depending on config option, to blocklist.txt
      • sort alphabetically and remove duplicates
      • add a commented header specified in config to the top
    • get blocklist
      • convert it to hosts format (0.0.0.0 example.com # Comment)
      • convert it to ABP/uBo format (||example.com^, ! Comment)
  • config validation

Will not do

  • make a frontend. i'm keeping it simple, why not fork it and add one yourself? 😉

Setup

Docker

docker run -d \
  -p 3000:80 \
  -e API_KEY=2266d1f5f188a50f \
  -v ./ezblocklist:/data \
  reeseovine/ezblocklist:latest

Docker Compose

services:
  ezblocklist:
    image: reeseovine/ezblocklist:latest
    restart: unless-stopped
    ports:
      - 3000:80
    volumes:
      - ./ezblocklist:/data
    environment:
      API_KEY: 2266d1f5f188a50f  # generate a strong secret with `openssl rand -hex 32`
      
      # these variables are optional, and the defaults are provided for reference.
      PORT: 80
      BLOCKLIST_ROOT: /data
      BLOCK_TYPE: hostname
      BLOCKLIST_HEADER: |
        generated by ezblocklist
        (https://github.com/reeseovine/ezblocklist)

Environment variables

variable description
API_KEY The password needed to be able to add URLs to block. Fetching the list is, for now, not protected by this key.
PORT The port within the container that the server runs on.
BLOCKLIST_ROOT Where to store the blocklist within the Docker container.
BLOCK_TYPE What to block from the given URL. Valid options are hostname to use the FQDN or IP address (default) and exact to use the full URL.
BLOCKLIST_HEADER A descriptive header to add to the top of the file. Comment characters are automatically prepended to each line.

Usage

Web browser

  1. Copy the bookmarklet code from the logs and replace <SERVER_ADDRESS> with the IP address or domain name.
  2. Create a new bookmark in your browser (in the bookmarks bar for easy access, perhaps) and set the URL to the bookmarklet code.
  3. Go to an article that you want to save, click the bookmark, et voila!

Android

  1. Install HTTP Shortcuts from F-Droid or the Play Store.
  2. Download readerss_http_shortcut.json from this repo to your device.
  3. Open HTTP Shortcuts, tap the vertical 3 dots in the top right corner, tap "Import/Export", then tap "Import from file". Select the json file you downloaded earlier.
  4. Go back to the main page, tap the 3 dot button again, then tap "Variables", and edit the values of readerss_instance and readerss_api_key to match those of your instance.
  5. Try using the share button on an app. A new item "Send to..." should appear on the share sheet. You can also save an article by tapping the shortcut inside the HTTP Shortcuts app itself.

RSS feed reader

The RSS feed URL is <SERVER_ADDRESS>/feed?key=<API_KEY>. Replace the placeholders with your proper values and add it to your feed reader of choice. If it doesn't work in your reader, open an issue and I will try my best to fix it!