From a2dcd0eda8c319c9de8193ab8e04905f903bd262 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 29 Jan 2024 04:55:26 +0100 Subject: [PATCH] Handle overwriting config setting with unescaped falresolverr url in env var (#84) --- README.md | 72 +++++++++++++++++++-------------------- docker-compose.yml | 2 +- scripts/startup_script.sh | 7 +--- 3 files changed, 38 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index a79a745..d0ea428 100644 --- a/README.md +++ b/README.md @@ -33,42 +33,42 @@ Use the template [docker-compose.yml](./docker-compose.yml) in this repo for cre There are a number of environment variables available to configure Suwayomi: -| Variable | Server Default | Description | -|:--------------------------------:|:-------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| -| **TZ** | `Etc/UTC` | What time zone the container thinks it is. | -| **BIND_IP** | `0.0.0.0` | The interface to listen on, inside the container. You almost never want to change this. | -| **BIND_PORT** | `4567` | Which port Suwayomi will listen on | -| **SOCKS_PROXY_ENABLED** | `false` | Whether Suwayomi will connect through a SOCKS5 proxy | -| **SOCKS_PROXY_HOST** | ` ` | The TCP host of the SOCKS5 proxy | -| **SOCKS_PROXY_PORT** | ` ` | The port of the SOCKS5 proxy | -| **DOWNLOAD_AS_CBZ** | `false` | Whether Suwayomi should save the manga to disk in CBZ format | -| **BASIC_AUTH_ENABLED** | `false` | Whether Suwayomi requires HTTP Basic Auth to get in. | -| **BASIC_AUTH_USERNAME** | ` ` | The username to log in to Suwayomi. | -| **BASIC_AUTH_PASSWORD** | ` ` | The password to log in to Suwayomi. | -| **DEBUG** | `false` | If extra logging is enabled. Useful for development and troubleshooting. | -| **GQL_DEBUG** | `false` | If graphql logging is enabled. Useful for development and troubleshooting. Can overload the log output. | -| **WEB_UI_ENABLED** | `true` | If the server should serve a webUI | -| **WEB_UI_FLAVOR** | `WebUI` | "WebUI" or "Custom" | -| **WEB_UI_CHANNEL** | `stable` | "bundled" (the version bundled with the server release), "stable" or "preview" - the webUI version that should be used | -| **WEB_UI_UPDATE_INTERVAL** | `23` | Time in hours - 0 to disable auto update - range: 1 <= n < 24 - how often the server should check for webUI updates | -| **AUTO_DOWNLOAD_CHAPTERS** | `false` | If new chapters that have been retrieved should get automatically downloaded | -| **AUTO_DOWNLOAD_EXCLUDE_UNREAD** | `true` | Ignore automatic chapter downloads of entries with unread chapters | -| **AUTO_DOWNLOAD_AHEAD_LIMIT** | `0` | 0 to disable - how many unread downloaded chapters should be available - if the limit is reached, new chapters won't be downloaded automatically | -| **EXTENSION_REPOS** | `[]` | Any additional extension repos to use, the format is `["https://github.com/MY_ACCOUNT/MY_REPO/tree/repo", "https://github.com/MY_ACCOUNT_2/MY_REPO_2/"]` | -| **MAX_SOURCES_IN_PARALLEL** | `6` | Range: 1 <= n <= 20 - Sets how many sources can do requests (updates, downloads) in parallel. Updates/Downloads are grouped by source and all mangas of a source are updated/downloaded synchronously | -| **UPDATE_EXCLUDE_UNREAD** | `true` | If unread manga should be excluded from updates | -| **UPDATE_EXCLUDE_STARTED** | `true` | If manga that haven't been started should be excluded from updates | -| **UPDATE_EXCLUDE_COMPLETED** | `true` | If completed manga should be excluded from updates | -| **UPDATE_INTERVAL** | `12` | Time in hours - 0 to disable it - (doesn't have to be full hours e.g. 12.5) - range: 6 <= n < ∞ - Interval in which the global update will be automatically triggered | -| **UPDATE_MANGA_INFO** | `false` | If manga info should be updated along with the chapters | -| **BACKUP_TIME** | `00:00` | Range: hour: 0-23, minute: 0-59 - Time of day at which the automated backup should be triggered | -| **BACKUP_INTERVAL** | `1` | Time in days - 0 to disable it - range: 1 <= n < ∞ - Interval in which the server will automatically create a backup | -| **BACKUP_TTL** | `14` | Time in days - 0 to disable it - range: 1 <= n < ∞ - How long backup files will be kept before they will get deleted | -| **FLARESOLVERR_ENABLED** | `false` | Whether FlareSolverr is enabled and available to use | -| **FLARESOLVERR_URL** | `http:\/\/localhost:8191` | The URL of the FlareSolverr instance, the URL must be escaped! | -| **FLARESOLVERR_TIMEOUT** | `60` | Time in seconds for FlareSolverr to timeout if the challenge is not solved | -| **FLARESOLVERR_SESSION_NAME** | `suwayomi` | The name of the session that Suwayomi will use with FlareSolverr | -| **FLARESOLVERR_SESSION_TTL** | `15` | The time to live for the FlareSolverr session | +| Variable | Server Default | Description | +|:--------------------------------:|:-----------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| **TZ** | `Etc/UTC` | What time zone the container thinks it is. | +| **BIND_IP** | `0.0.0.0` | The interface to listen on, inside the container. You almost never want to change this. | +| **BIND_PORT** | `4567` | Which port Suwayomi will listen on | +| **SOCKS_PROXY_ENABLED** | `false` | Whether Suwayomi will connect through a SOCKS5 proxy | +| **SOCKS_PROXY_HOST** | ` ` | The TCP host of the SOCKS5 proxy | +| **SOCKS_PROXY_PORT** | ` ` | The port of the SOCKS5 proxy | +| **DOWNLOAD_AS_CBZ** | `false` | Whether Suwayomi should save the manga to disk in CBZ format | +| **BASIC_AUTH_ENABLED** | `false` | Whether Suwayomi requires HTTP Basic Auth to get in. | +| **BASIC_AUTH_USERNAME** | ` ` | The username to log in to Suwayomi. | +| **BASIC_AUTH_PASSWORD** | ` ` | The password to log in to Suwayomi. | +| **DEBUG** | `false` | If extra logging is enabled. Useful for development and troubleshooting. | +| **GQL_DEBUG** | `false` | If graphql logging is enabled. Useful for development and troubleshooting. Can overload the log output. | +| **WEB_UI_ENABLED** | `true` | If the server should serve a webUI | +| **WEB_UI_FLAVOR** | `WebUI` | "WebUI" or "Custom" | +| **WEB_UI_CHANNEL** | `stable` | "bundled" (the version bundled with the server release), "stable" or "preview" - the webUI version that should be used | +| **WEB_UI_UPDATE_INTERVAL** | `23` | Time in hours - 0 to disable auto update - range: 1 <= n < 24 - how often the server should check for webUI updates | +| **AUTO_DOWNLOAD_CHAPTERS** | `false` | If new chapters that have been retrieved should get automatically downloaded | +| **AUTO_DOWNLOAD_EXCLUDE_UNREAD** | `true` | Ignore automatic chapter downloads of entries with unread chapters | +| **AUTO_DOWNLOAD_AHEAD_LIMIT** | `0` | 0 to disable - how many unread downloaded chapters should be available - if the limit is reached, new chapters won't be downloaded automatically | +| **EXTENSION_REPOS** | `[]` | Any additional extension repos to use, the format is `["https://github.com/MY_ACCOUNT/MY_REPO/tree/repo", "https://github.com/MY_ACCOUNT_2/MY_REPO_2/"]` | +| **MAX_SOURCES_IN_PARALLEL** | `6` | Range: 1 <= n <= 20 - Sets how many sources can do requests (updates, downloads) in parallel. Updates/Downloads are grouped by source and all mangas of a source are updated/downloaded synchronously | +| **UPDATE_EXCLUDE_UNREAD** | `true` | If unread manga should be excluded from updates | +| **UPDATE_EXCLUDE_STARTED** | `true` | If manga that haven't been started should be excluded from updates | +| **UPDATE_EXCLUDE_COMPLETED** | `true` | If completed manga should be excluded from updates | +| **UPDATE_INTERVAL** | `12` | Time in hours - 0 to disable it - (doesn't have to be full hours e.g. 12.5) - range: 6 <= n < ∞ - Interval in which the global update will be automatically triggered | +| **UPDATE_MANGA_INFO** | `false` | If manga info should be updated along with the chapters | +| **BACKUP_TIME** | `00:00` | Range: hour: 0-23, minute: 0-59 - Time of day at which the automated backup should be triggered | +| **BACKUP_INTERVAL** | `1` | Time in days - 0 to disable it - range: 1 <= n < ∞ - Interval in which the server will automatically create a backup | +| **BACKUP_TTL** | `14` | Time in days - 0 to disable it - range: 1 <= n < ∞ - How long backup files will be kept before they will get deleted | +| **FLARESOLVERR_ENABLED** | `false` | Whether FlareSolverr is enabled and available to use | +| **FLARESOLVERR_URL** | `http://localhost:8191` | The URL of the FlareSolverr instance | +| **FLARESOLVERR_TIMEOUT** | `60` | Time in seconds for FlareSolverr to timeout if the challenge is not solved | +| **FLARESOLVERR_SESSION_NAME** | `suwayomi` | The name of the session that Suwayomi will use with FlareSolverr | +| **FLARESOLVERR_SESSION_TTL** | `15` | The time to live for the FlareSolverr session | # Docker tags diff --git a/docker-compose.yml b/docker-compose.yml index 1af9aef..81e0b1e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: - BASIC_AUTH_USERNAME=manga - BASIC_AUTH_PASSWORD=hello123 - FLARESOLVERR_ENABLED=true - - FLARESOLVERR_URL="http:\/\/flaresolverr:8191" + - FLARESOLVERR_URL="http://flaresolverr:8191" volumes: - ./data:/home/suwayomi/.local/share/Tachidesk ports: diff --git a/scripts/startup_script.sh b/scripts/startup_script.sh index 2b94979..7697fb5 100755 --- a/scripts/startup_script.sh +++ b/scripts/startup_script.sh @@ -68,13 +68,8 @@ sed -i -r "s/server.backupTTL = (.*)/server.backupTTL = ${BACKUP_TTL:-\1}/" /hom # cloudflare bypass -# escape url for sed -if [ -z ${FLARESOLVERR_URL+x} ]; then - FLARESOLVERR_URL=$(echo "${FLARESOLVERR_URL}" | sed 's/[\/&]/\\&/g') - export FLARESOLVERR_URL -fi sed -i -r "s/server.flareSolverrEnabled = (.*)/server.flareSolverrEnabled = ${FLARESOLVERR_ENABLED:-\1}/" /home/suwayomi/.local/share/Tachidesk/server.conf -sed -i -r "s/server.flareSolverrUrl = \"(.*)\"/server.flareSolverrUrl = \"${FLARESOLVERR_URL:-\1}\"/" /home/suwayomi/.local/share/Tachidesk/server.conf +sed -i -r "s|server.flareSolverrUrl = \"(.*)\"|server.flareSolverrUrl = \"${FLARESOLVERR_URL:-\1}\"|" /home/suwayomi/.local/share/Tachidesk/server.conf sed -i -r "s/server.flareSolverrTimeout = (.*)/server.flareSolverrTimeout = ${FLARESOLVERR_TIMEOUT:-\1}/" /home/suwayomi/.local/share/Tachidesk/server.conf sed -i -r "s/server.flareSolverrSessionName = \"(.*)\"/server.flareSolverrSessionName = \"${FLARESOLVERR_SESSION_NAME:-\1}\"/" /home/suwayomi/.local/share/Tachidesk/server.conf sed -i -r "s/server.flareSolverrSessionTtl = (.*)/server.flareSolverrSessionTtl = ${FLARESOLVERR_SESSION_TTL:-\1}/" /home/suwayomi/.local/share/Tachidesk/server.conf