From 271d69e00f6deb7851ba3a8423764ad929859a23 Mon Sep 17 00:00:00 2001 From: binarygeek119 <72405030+binarygeek119@users.noreply.github.com> Date: Tue, 21 Apr 2026 20:18:54 -0500 Subject: [PATCH 1/2] Harden Jellyfin/Emby axios GETs against spurious maxContentLength aborts. Use pooled keep-alive HTTP(S) agents, gzip-friendly Accept-Encoding, and retries for the misleading axios 0.27 maxContentLength -1/Infinity errors on large /Users/{id}/Items responses. Made-with: Cursor --- classes/mediaservers/embyJellyfinBase.js | 36 ++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/classes/mediaservers/embyJellyfinBase.js b/classes/mediaservers/embyJellyfinBase.js index 8d9d28e..5597d29 100644 --- a/classes/mediaservers/embyJellyfinBase.js +++ b/classes/mediaservers/embyJellyfinBase.js @@ -1,4 +1,6 @@ const axios = require("axios"); +const http = require("http"); +const https = require("https"); const fs = require("fs"); const path = require("path"); const mediaCard = require("./../cards/MediaCard"); @@ -145,6 +147,19 @@ const LIBRARY_ITEMS_FIRST_PAGE_HTTP_RETRIES = (() => { return 1; })(); +/** + * Pooled keep-alive agents + explicit Accept-Encoding reduce flaky Node/axios 0.27 “maxContentLength + * size of -1 exceeded” errors (misleading message when the response stream aborts; see axios#4806). + */ +const _EMBY_JF_HTTP_AGENT = new http.Agent({ + keepAlive: true, + maxSockets: 64, +}); +const _EMBY_JF_HTTPS_AGENT = new https.Agent({ + keepAlive: true, + maxSockets: 64, +}); + function _axiosErrCode(e) { if (!e || typeof e !== "object") return ""; if (e.code != null) return String(e.code); @@ -180,6 +195,13 @@ function _axiosErrorIsRetriableNetwork(e) { ); } +/** Axios 0.27 node adapter: stream abort is often reported as “maxContentLength size of -1 exceeded”. */ +function _axiosErrorIsMisleadingMaxContentLengthAbort(e) { + const msg = String((e && e.message) || "").toLowerCase(); + if (!msg.includes("maxcontentlength")) return false; + return msg.includes("-1") || msg.includes("infinity"); +} + /** * Same filtering as the legacy “load entire library then filter” path, applied to one page of Items. * @param {object[]} items @@ -430,15 +452,22 @@ class EmbyJellyfinBase { while (true) { try { const res = await axios.get(url, { - headers, + headers: { + ...headers, + "Accept-Encoding": "gzip, deflate", + Connection: "keep-alive", + }, timeout: timeoutMs, + httpAgent: _EMBY_JF_HTTP_AGENT, + httpsAgent: _EMBY_JF_HTTPS_AGENT, }); return res.data; } catch (e) { const canRetry = attempt < maxRetries && (_axiosErrorIsRetriableTimeout(e) || - _axiosErrorIsRetriableNetwork(e)); + _axiosErrorIsRetriableNetwork(e) || + _axiosErrorIsMisleadingMaxContentLengthAbort(e)); if (canRetry) { attempt++; const backoffMs = Math.min( @@ -2125,7 +2154,8 @@ class EmbyJellyfinBase { e && (e.code === "ECONNABORTED" || msg.includes("timeout") || - status >= 500); + status >= 500 || + _axiosErrorIsMisleadingMaxContentLengthAbort(e)); if (isFirstPageFallbackCandidate && isRetriableFirstPageError) { const halved = Math.floor(pageLimit / 2); firstPageLimit = Math.max( From 9c1fd28ffc5af4afbea37ece6775bdf084744635 Mon Sep 17 00:00:00 2001 From: binarygeek119 <72405030+binarygeek119@users.noreply.github.com> Date: Wed, 17 Jun 2026 21:56:50 -0500 Subject: [PATCH 2/2] Update support links to posterrX repo, Discord, and UbuntuDisplayOS. Point app and README at binarygeek119/posterrX and the new maintainer Discord invite; add ubuntudisplayos sister project in Settings About. Co-authored-by: Cursor --- README.md | 22 +++++++++++----------- myviews/debug.ejs | 2 +- myviews/logon.ejs | 2 +- myviews/settings.ejs | 10 ++++++---- scripts/scriptdoco.md | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9cae16e..3b3ef40 100644 --- a/README.md +++ b/README.md @@ -3,24 +3,24 @@ > **About this repository** > **PosterX** is an **AI-assisted fork** of [Posterr](https://github.com/petersem/posterr) by **binarygeek119**. Upstream owns the original design and core product; this repo adds the features in **New in this fork** below. -> **Source:** [github.com/binarygeek119/posterr](https://github.com/binarygeek119/posterr) · **Docker image:** [`binarygeek119/posterrx`](https://hub.docker.com/r/binarygeek119/posterrx) (`:latest` / `:testing` from CI) +> **Source:** [github.com/binarygeek119/posterrX](https://github.com/binarygeek119/posterrX) · **Docker image:** [`binarygeek119/posterrx`](https://hub.docker.com/r/binarygeek119/posterrx) (`:latest` / `:testing` from CI) > **Sister project:** [binarygeek119/ubuntudisplayos](https://github.com/binarygeek119/ubuntudisplayos) for Ubuntu-based multi-display kiosk hosts that pair well with PosterX. -![GitHub stars](https://img.shields.io/github/stars/binarygeek119/posterr?style=flat) -![Fork version](https://img.shields.io/github/package-json/v/binarygeek119/posterr?label=version&logoColor=blue) -![Last commit](https://img.shields.io/github/last-commit/binarygeek119/posterr) -![Docker Pulls](https://img.shields.io/docker/pulls/binarygeek119/posterr) -![Docker image size](https://img.shields.io/docker/image-size/binarygeek119/posterr/latest?logo=docker) +![GitHub stars](https://img.shields.io/github/stars/binarygeek119/posterrX?style=flat) +![Fork version](https://img.shields.io/github/package-json/v/binarygeek119/posterrX?label=version&logoColor=blue) +![Last commit](https://img.shields.io/github/last-commit/binarygeek119/posterrX) +![Docker Pulls](https://img.shields.io/docker/pulls/binarygeek119/posterrx) +![Docker image size](https://img.shields.io/docker/image-size/binarygeek119/posterrx/latest?logo=docker) ![Platforms](https://img.shields.io/badge/platform-docker-blue) [![Upstream wiki](https://img.shields.io/badge/upstream-wiki-informational?logo=github)](https://github.com/petersem/posterr/wiki/Posterr-Configuration) ![Slides](https://github.com/petersem/posterr/blob/master/doco/posterr.jpg?raw=true) ![Awtrix](https://github.com/petersem/posterr/blob/master/doco/awtrix.gif?raw=true) -**PosterX maintainer Discord:** [https://discord.gg/vftKQvpT](https://discord.gg/vftKQvpT) — updates and limited support for this fork. +**PosterX maintainer Discord:** [https://discord.gg/AEhVjqX4Af](https://discord.gg/AEhVjqX4Af) — updates and limited support for this fork. Original Posterr community Discord: [https://discord.gg/TcnEkMEf9J](https://discord.gg/TcnEkMEf9J). Please do not ask the original Posterr developer for support when using PosterX. -For fork support, use GitHub: [https://github.com/binarygeek119/posterr](https://github.com/binarygeek119/posterr). +For fork support, use GitHub: [https://github.com/binarygeek119/posterrX](https://github.com/binarygeek119/posterrX). **Default settings password:** `raidisnotabackup` --- @@ -54,7 +54,7 @@ These are additions on top of upstream behaviour (current fork **`package.json`* | Area | What changed | |------|----------------| | **Release notice** | After an upgrade, a **red banner** on the **home poster view**, **`/now-showing`**, and **settings** pages reminds you that new features shipped. It clears after you open **Settings** and click **Acknowledge there are new features**. Your choice is stored in `settings.json` (`newFeaturesAcknowledgedVersion`); the banner comes back when the app **version string** in `package.json` changes again (any **X.Y.Z** bump). | -| **Settings → About** | Identifies this app as **PosterX** (a **binarygeek119** fork of Posterr), **purely AI-modified**, with a link to **[github.com/binarygeek119/posterr](https://github.com/binarygeek119/posterr)**. Original author credits and upstream links stay in the same tab. | +| **Settings → About** | Identifies this app as **PosterX** (a **binarygeek119** fork of Posterr), **purely AI-modified**, with a link to **[github.com/binarygeek119/posterrX](https://github.com/binarygeek119/posterrX)**. Original author credits and upstream links stay in the same tab. | | **Settings navigation** | **Sync**, **Cache**, **Now Showing**, and **TMDB API** pages use the **same sidebar and mobile icons** as each other, including **Debug** and **About**, so entries no longer disappear when you switch pages. | | **Ads (main deck + `/settings/ads`)** | When **Enabled**, ad slides rotate with the home posters (**every *n* posters**, optional **only show ads**). Upload images, prices, and optional per-slide backgrounds; metadata in **`config/ads.db`**, files under **`config/ads`**. | | **Dedicated `/ads` view** | Full-screen ad slideshow: **seconds per ad** advances each slide; **seconds on full `/ads` page before returning home** is separate (`0` = manual leave; otherwise **30–86400** seconds then redirect to **`/`**). Optional backdrop from **`config/ads-view`** (`**/custom/ads-view/**`). | @@ -239,10 +239,10 @@ Should you encounter a problem, the solution may be listed [HERE](https://github --- ## Support - - **PosterX maintainer Discord:** [https://discord.gg/vftKQvpT](https://discord.gg/vftKQvpT) (this fork). + - **PosterX maintainer Discord:** [https://discord.gg/AEhVjqX4Af](https://discord.gg/AEhVjqX4Af) (this fork). - Original Posterr community: [https://discord.gg/TcnEkMEf9J](https://discord.gg/TcnEkMEf9J). - Do not ask the original Posterr developer for support when using PosterX. - - For fork support, use GitHub: [https://github.com/binarygeek119/posterr](https://github.com/binarygeek119/posterr). + - For fork support, use GitHub: [https://github.com/binarygeek119/posterrX](https://github.com/binarygeek119/posterrX). --- ### Support my efforts and continued development diff --git a/myviews/debug.ejs b/myviews/debug.ejs index 48a445e..14b9a97 100644 --- a/myviews/debug.ejs +++ b/myviews/debug.ejs @@ -30,7 +30,7 @@

PosterX Debug Page


Use this page to help debug any connectivity issues with PosterX

-

Support (maintainer): Discord — discord.gg/vftKQvpT

+

Support (maintainer): Discord — discord.gg/AEhVjqX4Af


Software Version

PosterX Verson: <%=version%>

diff --git a/myviews/logon.ejs b/myviews/logon.ejs index 26dd6fc..ad7e256 100644 --- a/myviews/logon.ejs +++ b/myviews/logon.ejs @@ -42,7 +42,7 @@ color: whitesmoke;

PosterX Settings

Media display software for Plex, Jellyfin, Emby, Kodi, Sonarr, Radarr, Lidarr, and Readarr.

-

PosterX Discord (support)

+

PosterX Discord (support)

diff --git a/myviews/settings.ejs b/myviews/settings.ejs index fea5b76..a5f9a96 100644 --- a/myviews/settings.ejs +++ b/myviews/settings.ejs @@ -1467,7 +1467,8 @@
ABOUT POSTERX v<%= version %>

PosterX is a fork of Posterr (Matt Petersen). This build is maintained by binarygeek119.

-

GitHub — binarygeek119/posterr

+

GitHub — binarygeek119/posterrX

+

Sister project: binarygeek119/ubuntudisplayos — Ubuntu-based multi-display kiosk hosts that pair well with PosterX.

This fork is purely AI-modified.

Support my efforts and continued development.
Project Details