readme write

This commit is contained in:
Thomas Faour 2026-01-06 18:23:07 -05:00
parent d7e7342276
commit 4e2e96bac7

View File

@ -1,3 +1,100 @@
# KOReaderServerFetcher # KOReaderServerFetcher
A KOReader plugin plus server combo A simple setup to push books from your computer to your e-reader. Hit a button on your Kindle/Kobo, get your books just that easy.
## What This Does
- **Server**: Python HTTP server that serves files from a folder and archives them after sending
- **Plugin**: KOReader plugin that fetches those files with one tap
## Setup
### Server Side
1. Put `server.py` somewhere on your computer
2. Create a config at the top of the file:
- Set `AUTH_TOKEN` to something secret
- Set `SOURCE_DIR` to where you drop books (e.g., `/home/you/books/inbox`)
- Set `ARCHIVE_DIR` to where served books go (e.g., `/home/you/books/sent`)
3. Run it:
```bash
python3 server.py
```
4. (Optional) Make it a service so it starts automatically:
```bash
sudo cp file-server.service /etc/systemd/system/
# Edit the file to fix paths and username
sudo systemctl enable file-server
sudo systemctl start file-server
```
### KOReader Plugin
1. Copy the plugin folder to your device:
```
koreader/plugins/fetch.koplugin/
├── main.lua
└── config.lua
```
2. Edit `config.lua`:
```lua
return {
server_url = "http://your-server:8000/get",
auth_token = "your-secret-token-here"
}
```
3. Restart KOReader
## Usage
1. Drop books into your server's inbox folder
2. On your e-reader: Menu → Fetch Files → Fetch Now
3. Books appear in your configured directory
First time setup: go to Menu → Fetch Files → Configure Home Directory to pick where books should go.
## How It Works
The server zips up everything in the source folder and sends it over. After sending, it moves those files to the archive folder so you don't get duplicates next time.
The plugin downloads the zip, extracts it, and cleans up after itself.
## Nginx Setup
If you want to access this over the internet, put it behind nginx with SSL:
```nginx
location /get {
proxy_pass http://localhost:8000;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
```
## Troubleshooting
**Plugin doesn't show up**: Check KOReader's crash.log
**Can't connect to server**: Make sure the URL in config.lua is correct and the server is running
**Authentication failed**: Token mismatch between server.py and config.lua
**Files not extracting**: The plugin needs `unzip` available on your device (it usually is)
**Server logs wrong IP**: Make sure nginx is forwarding the X-Forwarded-For header
## Requirements
- Python 3.6+
- KOReader
- `unzip` command on your e-reader (standard on most devices)
## License
Do whatever you want with this.