Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: easily switch api_endpoint #141

Open
barrymossel opened this issue Jun 15, 2023 · 2 comments
Open

Feature request: easily switch api_endpoint #141

barrymossel opened this issue Jun 15, 2023 · 2 comments

Comments

@barrymossel
Copy link

Currently I use calibre-web as my api_endpoint, but that's hosted locally and on vacation I rather use the bol/kobo store. Would it be possible to have a switch in NickelMenu to change the api_endpoint (and reboot), so I can choose where to download books from?

@ragusa87
Copy link

ragusa87 commented Aug 11, 2024

What I did is this:

  1. Edit your configuration file Kobo eReader.conf to include an additional key api_endpoint_backup=....
  2. Next to this file, create a file switch.sh with the content below:
#/bin/bash
set -e
SCRIPT_DIR=$(dirname -- "$( readlink -f -- "$0"; )")
cd "${SCRIPT_DIR}"

INPUT="Kobo eReader.conf"

# Extract the values into variables
api_endpoint_value=$(sed -n 's/^api_endpoint=//p' "$INPUT")
api_endpoint_backup_value=$(sed -n 's/^api_endpoint_backup=//p' "$INPUT")
# Replace values
sed -i.bak \
    -e "s|^api_endpoint=.*|api_endpoint=$api_endpoint_backup_value|" \
    -e "s|^api_endpoint_backup=.*|api_endpoint_backup=$api_endpoint_value|" "$INPUT"

# Output result
cat "${INPUT}" | grep "api_endpoint\="
  1. Make sure to chmod +x switch.sh
  2. Edit your config file /mnt/onboard/.adds/nm/config and add the line below: menu_item :main :SwitchEndpoint :cmd_output :500:/mnt/onboard/.kobo/Kobo/switch.sh

You can then run this action from the NickelMenu and reboot your Kobo to apply it.

@eric09230
Copy link

@ragusa87 Thank you sir! It's working!

Regarding the first point, please remember to add the following two lines to your Kobo eReader.conf:

api_endpoint=https://yourdomain/kobo/...........
api_endpoint_backup=https://storeapi.kobo.com/

This ensures that your Kobo device will have the correct main and backup API endpoints configured.

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

No branches or pull requests

4 participants