fix(jellyfin): ensure deviceID is never empty (#1538)
If the deviceID becomes an empty string, login fails since jellyfin requires a non-null deviceID. This commit adds a fallback to guarantee that deviceID is always set, preventing accidental lockout.
This commit is contained in:
@@ -110,11 +110,18 @@ class JellyfinAPI extends ExternalAPI {
|
|||||||
deviceId?: string | null
|
deviceId?: string | null
|
||||||
) {
|
) {
|
||||||
const settings = getSettings();
|
const settings = getSettings();
|
||||||
|
const safeDeviceId =
|
||||||
|
deviceId && deviceId.length > 0
|
||||||
|
? deviceId
|
||||||
|
: Buffer.from(`BOT_jellyseerr_fallback_${Date.now()}`).toString(
|
||||||
|
'base64'
|
||||||
|
);
|
||||||
|
|
||||||
let authHeaderVal: string;
|
let authHeaderVal: string;
|
||||||
if (authToken) {
|
if (authToken) {
|
||||||
authHeaderVal = `MediaBrowser Client="Jellyseerr", Device="Jellyseerr", DeviceId="${deviceId}", Version="${getAppVersion()}", Token="${authToken}"`;
|
authHeaderVal = `MediaBrowser Client="Jellyseerr", Device="Jellyseerr", DeviceId="${safeDeviceId}", Version="${getAppVersion()}", Token="${authToken}"`;
|
||||||
} else {
|
} else {
|
||||||
authHeaderVal = `MediaBrowser Client="Jellyseerr", Device="Jellyseerr", DeviceId="${deviceId}", Version="${getAppVersion()}"`;
|
authHeaderVal = `MediaBrowser Client="Jellyseerr", Device="Jellyseerr", DeviceId="${safeDeviceId}", Version="${getAppVersion()}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
super(
|
super(
|
||||||
|
|||||||
Reference in New Issue
Block a user