Skip to content

Commit 26b332e

Browse files
committed
Attempted fix for #488, reorderedlogic to use server url only, added flag to change this behavior to use external host value if set
1 parent 10156ca commit 26b332e

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
| MINIMUM_SECONDS_TO_INCLUDE_PLAYBACK | `1` | `10` | The minimum time (in seconds) to include a playback record, which can be used to exclude short playbacks |
4646
| IS_EMBY_API | `false` | `true` | Set to true if using Emby instead of Jellyfin |
4747
| JF_USE_WEBSOCKETS | `true` | `false` | Enables using Jellyfins websocket connection for session data (No effect on Emby) |
48+
| JS_USE_EXTERNAL_HOST | `false` | `true` | Prioritises using External host value for some internal communications and processes |
4849

4950
## Getting Started with Development
5051

backend/classes/jellyfin-api.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,12 @@ class JellyfinAPI {
457457
compareVersions(this.version, "10.11.0") >= 0 &&
458458
(process.env.JF_USE_WEBSOCKETS === undefined || process.env.JF_USE_WEBSOCKETS.toLowerCase() !== "false")
459459
) {
460-
const socketUrl =
461-
(this.config.JF_EXTERNAL_HOST ?? this.config.JF_HOST).replace(/^http/, "ws").replace(/^https/, "wss") + "/socket";
460+
const hostUrl =
461+
process.env.JS_USE_EXTERNAL_HOST === undefined || process.env.JS_USE_EXTERNAL_HOST.toLowerCase() !== "false"
462+
? this.config.JF_HOST
463+
: this.config.JF_EXTERNAL_HOST ?? this.config.JF_HOST;
464+
465+
const socketUrl = hostUrl.replace(/^http/, "ws").replace(/^https/, "wss") + "/socket";
462466
const sessionData = await getSessionData(socketUrl, this.config.JF_API_KEY);
463467
if (sessionData != null) {
464468
return sessionData;

0 commit comments

Comments
 (0)