Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save shadowandy/0112323b47d76ec77a58e769ac1efaf9 to your computer and use it in GitHub Desktop.

Select an option

Save shadowandy/0112323b47d76ec77a58e769ac1efaf9 to your computer and use it in GitHub Desktop.
Setting up Kobo synchronisation with Calibre-Web and Nginx Proxy Manager (NPM)

Introduction

This article guides you through the process of setting up the Nginx Proxy Manager (NPM) and Calibre-Web to allow collections and books to be synchronised to the Kobo e-reader. Other features like access to Kobo store, Overdrive, Google Drive and Dropbox will not be affected.

Important

  • What is articulate in the rest of this article is to enable public secured Internet accessible synchronisation endpoint for Kobo e-reader.
  • Calibre-Web presents book download endpoint as HTTP (non-HTTPS) with a port number. Other than the implicit understanding that HTTP and HTTP runs on port 80/tcp and 443/tcp respectively, it is not possible to have both HTTP and HTTPS running on the same port number (e.g., 20080/tcp).
  • Only EPUB formatted books can be synchronised. That is, other formats like PDF won't be synchronised due to restrictions on Kobo e-reader.

What's required?

  • Kobo e-reader (e.g., Kobo Libra Color)
  • A computer
  • USB data cable to connect the Kobo e-reader to the computer
  • Nginx Proxy Manager configured to listen on ports 80/tcp and 443/tcp, and valid SSL certificate (e.g., Let's Encrypt)
  • Calibre-Web with EPUB books

1. Nginx Proxy Manager (NPM)

1.1 Settings for Calibre-Web Proxy Host

Navigate to Advanced > Custom Nginx Configuration

proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name //;
proxy_cookie_path / "/; Secure";
proxy_busy_buffers_size 1024k;
proxy_buffers 4 512k;
proxy_buffer_size 1024k;
client_max_body_size 50M;

2. Calibre-Web

2.1 Enabling Kobo Sync Feature

Navigate to Admin > Edit Basic Configuration > Feature Configuration

  • Check "Enable Kobo Sync"
  • Check "Proxy unknown requests to Kobo Store"
  • Specify 80 for "Server External Port (for port forwarded API calls)"
  • Leave "Embed Metadata to Ebook File on Download/Conversion/e-mail (needs Calibre/Kepubify binaries)" Unchecked

2.2 Enabling Kobo Sync (per Calibre-Web user)

Navigate to User Profile (click on your username on the top bar)

  • Check "Sync only books in selected shelves with Kobo"
  • Under "Kobo Sync Token", Click On "Create/View" button
  • Copy the entire api_endpoint=http://url-and-token

2.3 Creating one or multiple Shelf for Synchronisation

  1. On the left of Calibre-Web, Click on "Create a Shelf"
  2. Fill in the name of the shelf (e.g., Kobo shelf)
  3. Check "Sync this shelf with Kobo device"
  4. Click on "Save" button

2.4 Adding books to be synchronised to Kobo e-reader

  1. Navigate to your books (EPUB)
  2. Click on a book (EPUB) and view its book details
  3. At the bottom of the "Book Details", Click on "Add to shelf" and select the newly created shelf (e.g., Kobo shelf)

3. Updating the Kobo

3.1 Updating Kobo e-Reader configuration

  1. Plug in the Kobo e-reader to your computer using a USB cable
  2. Navigate to folder .kobo\Kobo
  3. Duplicate the file Kobo.eReader.conf and name the duplicated file as Kobo.eReader.conf.backup
  4. Open the file Kobo.eReader.conf using a text editor
  5. In the file Kobo.eReader.conf, navigate to the section [OneStoreServices]
  6. Replace the line starting with api_endpoint=https://storeapi.kobo.com with the one created earlier under Enabling Kobo Sync (per Calibre-Web user) (api_endpoint=http://url-and-token)
  7. Safely eject the e-reader

3.2 Test-run

  1. Connect the Kobo e-reader to the WiFi
  2. Click on the sync button and it should create a collection with the same name as the shelf you created earlier (e.g., Kobo shelf). The books (EPUB) should also be downloaded automatically

4. Reverting changes (if required)

To revert back the changes you have made on the Kobo configuration, simply rename the file Kobo.eReader.conf.backup back as Kobo.eReader.conf

@ehcloninger
Copy link

Thank you for the excellent description. I had this working on my local network with http. With your suggestion on the NGINX custom settings, I was able to make Internet sync work. 🍻

The one thing I had to do was remove any non-EPUB versions from my library using Calibre desktop. For some reason, if a KEPUB or MOBI existed, even with an EPUB, it would fail to sync.

@esmcelroy
Copy link

seconded! this was incredibly helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment