From 409495f738dc819c21b39ecbcdccf47977d47a92 Mon Sep 17 00:00:00 2001 From: Kai Chappel Date: Fri, 18 Sep 2026 13:02:56 +1000 Subject: [PATCH] Update openreader to v5.0.0 Co-authored-by: Kai Chappel Co-authored-by: nmfretz --- openreader/docker-compose.yml | 28 ++++++++++++-- openreader/exports.sh | 3 ++ openreader/nginx.conf.template | 67 ++++++++++++++++++++++++++++++++++ openreader/umbrel-app.yml | 15 +++----- 4 files changed, 101 insertions(+), 12 deletions(-) create mode 100644 openreader/nginx.conf.template diff --git a/openreader/docker-compose.yml b/openreader/docker-compose.yml index 2e165a4d5..8d5792cd2 100644 --- a/openreader/docker-compose.yml +++ b/openreader/docker-compose.yml @@ -3,19 +3,41 @@ version: '3.7' services: app_proxy: environment: - APP_HOST: openreader_web_1 - APP_PORT: 3003 + APP_HOST: openreader_gateway_1 + APP_PORT: 8080 + + # OpenReader v5 returns absolute URLs for its separate audio worker. Route the + # UI and signed audio through app_proxy so playback uses the browser's origin + # without publishing a separate worker port. This is an Umbrel workaround; + # upstream support for relative playback URLs would let us drop the response + # rewriting in nginx.conf.template and keep only the proxy routing. + gateway: + image: nginx:1.30.5-alpine@sha256:615b06367e419b29d378b4abc498563db191380469007e5b0153f4387470bff4 + user: "1000:1000" + entrypoint: ["nginx", "-g", "daemon off;"] + restart: on-failure + depends_on: + - web + volumes: + - ${APP_DATA_DIR}/nginx.conf:/etc/nginx/nginx.conf:ro web: - image: ghcr.io/richardr1126/openreader:4.4.0@sha256:2e3ec184dac71082646995a17309add008405827d81a020fb6d264360f7c1a49 + image: ghcr.io/richardr1126/openreader:5.0.0@sha256:32741787d4926af502b2835438a635698664ce60c5124458cbb48ee1a640987e user: "1000:1000" environment: - API_BASE=http://kokoro_web_1:8880/v1 #Set the TTS API_BASE URL and/or API_KEY as the default for all devices. These values can also be overridden in the UI. + - API_MODEL_NAME=kokoro - BASE_URL=http://${DEVICE_DOMAIN_NAME}:3391 - AUTH_SECRET=${APP_SEED} # Allows auth requests from the primary .local URL, device hostname, Tailscale FQDNs, and host IP URLs. - AUTH_TRUSTED_ORIGINS=http://${DEVICE_DOMAIN_NAME}:3391,http://${DEVICE_HOSTNAME}:3391,http://*.ts.net:3391,https://*.ts.net:3391,${APP_OPENREADER_LOCAL_URLS} - USE_ANONYMOUS_AUTH_SESSIONS=true + - TTS_PLAYBACK_TOKEN_SECRET=${APP_OPENREADER_PLAYBACK_SECRET} + - COMPUTE_WORKER_HOST=0.0.0.0 + # Deliberate placeholder: the gateway replaces this origin in the session + # response with a relative audio path. Keep it in sync with the sub_filter + # in nginx.conf.template; browsers must never receive the placeholder. + - COMPUTE_WORKER_PUBLIC_URL=http://openreader-playback.invalid restart: on-failure volumes: - ${APP_DATA_DIR}/data/docstore:/app/docstore diff --git a/openreader/exports.sh b/openreader/exports.sh index 0306a2355..6bffb95d6 100644 --- a/openreader/exports.sh +++ b/openreader/exports.sh @@ -1,4 +1,7 @@ export APP_OPENREADER_PORT="3391" +export APP_OPENREADER_PLAYBACK_SECRET="$(derive_entropy "${app_entropy_identifier}-tts-playback")" +# Preserve Nginx variables through Umbrel's template expansion. +export APP_OPENREADER_NGINX_DOLLAR='$' local_ips=$(hostname --all-ip-addresses 2> /dev/null) || local_ips="" export APP_OPENREADER_LOCAL_IPS="${local_ips}" diff --git a/openreader/nginx.conf.template b/openreader/nginx.conf.template new file mode 100644 index 000000000..9561e2c20 --- /dev/null +++ b/openreader/nginx.conf.template @@ -0,0 +1,67 @@ +worker_processes auto; +pid /tmp/nginx.pid; +error_log /dev/stderr warn; + +events { + worker_connections 1024; +} + +http { + # Audio URLs contain bearer tokens, so do not log request URLs. + access_log off; + client_body_temp_path /tmp/client_temp; + proxy_temp_path /tmp/proxy_temp; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + + map ${APP_OPENREADER_NGINX_DOLLAR}http_x_forwarded_proto ${APP_OPENREADER_NGINX_DOLLAR}forwarded_proto { + default ${APP_OPENREADER_NGINX_DOLLAR}http_x_forwarded_proto; + '' ${APP_OPENREADER_NGINX_DOLLAR}scheme; + } + + server { + listen 8080; + client_max_body_size 0; + proxy_http_version 1.1; + proxy_set_header Host ${APP_OPENREADER_NGINX_DOLLAR}http_host; + proxy_set_header X-Forwarded-Proto ${APP_OPENREADER_NGINX_DOLLAR}forwarded_proto; + proxy_set_header X-Forwarded-For ${APP_OPENREADER_NGINX_DOLLAR}proxy_add_x_forwarded_for; + proxy_set_header Connection ''; + proxy_buffering off; + proxy_request_buffering off; + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + + # v5 emits an absolute worker URL. Only rewrite the session JSON response; + # document bodies, downloads and JavaScript are never filtered. + # Preserve the signed token; the worker still validates it on audio requests. + # Recheck this endpoint and URL format on upstream upgrades. Remove this + # rewrite when OpenReader can emit relative playback URLs natively. + location = /api/tts/stream/sessions { + proxy_pass http://openreader_web_1:3003; + proxy_set_header Host ${APP_OPENREADER_NGINX_DOLLAR}http_host; + proxy_set_header X-Forwarded-Proto ${APP_OPENREADER_NGINX_DOLLAR}forwarded_proto; + proxy_set_header X-Forwarded-For ${APP_OPENREADER_NGINX_DOLLAR}proxy_add_x_forwarded_for; + proxy_set_header Connection ''; + proxy_set_header Accept-Encoding ''; + sub_filter_types application/json; + sub_filter 'http://openreader-playback.invalid/v1/tts-playback/' '/v1/tts-playback/'; + } + + # Expose only signed playback, never worker control or health endpoints. + # Nginx forwards Range requests and streams partial responses unchanged. + location ~ ^/v1/tts-playback/sessions/[^/]+/audio$ { + limit_except GET { deny all; } + proxy_pass http://openreader_web_1:8081; + } + + location /v1/ { + return 404; + } + + location / { + proxy_pass http://openreader_web_1:3003; + } + } +} diff --git a/openreader/umbrel-app.yml b/openreader/umbrel-app.yml index 4c76d6567..21fa40756 100644 --- a/openreader/umbrel-app.yml +++ b/openreader/umbrel-app.yml @@ -5,7 +5,7 @@ storage: name: OpenReader tagline: A document reader with Text-to-Speech capabilities category: ai -version: "4.4.0-patch.1" +version: "5.0.0" port: 3391 description: >- OpenReader WebUI is a web-based document reader that integrates text-to-speech (TTS) functionality, allowing users to listen to text from various document formats, including PDF and EPUB. Designed to enhance accessibility and improve the reading experience, it features synchronized text highlighting, ensuring that the currently read portion of the document is visually emphasized as the speech engine narrates the content. This makes it particularly useful for individuals with visual impairments, reading difficulties, or those who simply prefer an auditory learning style. @@ -33,22 +33,19 @@ gallery: - 3.jpg - 4.jpg releaseNotes: >- - This update adds support for new storage management and configuration options being introduced with umbrelOS 2.0. + ⚠️ Before updating, download any generated audio or audiobooks you want to keep and make a complete backup of your OpenReader app data. Version 5 permanently removes old generated audio and audiobooks. They can be generated again, but changing back to the previous app version will not restore deleted data. - Previous OpenReader 4.4.0 release notes: + When updating from 4.4.0, server-stored documents, folders, accounts, settings, and reading progress are retained. If you are updating from an older version, first download your original documents from the existing app in the browser you used to upload them. Older browser-only data and legacy document storage are not automatically migrated by v5; you may need to upload your documents again, and browser-only folders, preferences, and reading progress may reset. A server backup does not include browser-only data. - ⚠️ Update note: Uploaded documents remain available, but OpenReader 4.4.0 moves browser-only folders, reading progress, toolbar/list preferences, onboarding state, and recently opened timestamps into the server database. Existing browser-only values for those items are not migrated, so they may reset after updating. + This release adds progressive background playback with a new seekable player, worker-backed audiobook/account exports, unified compute rate limiting, user administration, account self-service, email/password recovery support, and improved upload/storage handling. - User-supplied TTS provider API keys are no longer supported. OpenReader will continue using the shared Kokoro provider configured by the Umbrel package. + User-supplied TTS provider API keys remain unsupported on Umbrel. OpenReader continues to use the shared Kokoro provider configured by the Umbrel package. - This release also improves media caching and loading states, and fixes loopback storage playback, HTML/Markdown read-aloud segmentation, and long-segment audio playback. - - - Full release notes can be found at https://github.com/richardr1126/openreader/releases/tag/v4.4.0 + Full release notes can be found at https://github.com/richardr1126/openreader/releases/tag/v5.0.0 dependencies: - kokoro path: ""