fix: resolve "undefined" server display on Samsung TVs and add mDNS (.local) warning

Fixes #319 — Server appears as "undefined" on Samsung TV after network interruptions
when using mDNS (.local) hostnames.

Root cause:
The injected jellyfin_credentials in localStorage were missing the `Name` property.
When the TV couldn't reach the server (mDNS resolution failure), Jellyfin Web had
no cached server name to display, resulting in literal "undefined".

Changes:
- Add `Name` property to injected auto-login credentials using the real ServerName
  from /System/Info/Public, with fallback to the server URL
- Store JellyfinServerName in AppSettings (fetched during server validation and
  authentication, cleared on logout)
- Add the server's LocalAddress (IP-based) as a fallback entry in config.json so
  the TV can still connect when mDNS resolution fails
- Add a visible warning banner in the UI when a .local hostname is detected,
  advising users to use a direct IP address instead
- Add lblMdnsWarning localization key to all 28 language files (translated for
  da, nl, en, fr, de, pt, tr — English fallback for remaining languages)
This commit is contained in:
kingchenc
2026-04-16 04:51:00 +02:00
parent a128e1be6b
commit 75ac9d6e2e
32 changed files with 118 additions and 33 deletions

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Opdatering mislykkedes",
"UpdateCheckFailed": "Kunne ikke tjekke for opdateringer",
"IncompatiblePackage": "Pakkeversionen er ikke kompatibel med enheden.",
"IncompatiblePackageDetailed": "Pakkeversion {0} er ikke kompatibel med Tizen OS {1}"
"IncompatiblePackageDetailed": "Pakkeversion {0} er ikke kompatibel med Tizen OS {1}",
"lblMdnsWarning": "Advarsel: Du bruger et mDNS-hostnavn (.local). Samsung TV'er kan ikke p\u00e5lideligt opl\u00f8se .local-adresser, hvilket kan f\u00e5 serveren til at vises som \"undefined\" p\u00e5 dit TV \u2014 is\u00e6r efter netv\u00e6rksafbrydelser. Brug en direkte IP-adresse (f.eks. 192.168.1.100) i stedet for en stabil forbindelse."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update fehlgeschlagen",
"UpdateCheckFailed": "Update-Überprüfung fehlgeschlagen",
"IncompatiblePackage": "Paketversion ist nicht mit dem Gerät kompatibel.",
"IncompatiblePackageDetailed": "Paketversion {0} nicht kompatibel mit Tizen OS {1}"
"IncompatiblePackageDetailed": "Paketversion {0} nicht kompatibel mit Tizen OS {1}",
"lblMdnsWarning": "Warnung: Du verwendest einen mDNS-Hostnamen (.local). Samsung TVs k\u00f6nnen .local-Adressen nicht zuverl\u00e4ssig aufl\u00f6sen, was dazu f\u00fchren kann, dass der Server auf deinem TV als \"undefined\" angezeigt wird \u2014 besonders nach Netzwerkunterbrechungen. Verwende stattdessen eine direkte IP-Adresse (z.B. 192.168.1.100) f\u00fcr eine stabile Verbindung."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Échec de la mise à jour",
"UpdateCheckFailed": "Échec de la vérification des mises à jour",
"IncompatiblePackage": "Version du package non compatible avec l'appareil.",
"IncompatiblePackageDetailed": "La version du package {0} n'est pas compatible avec Tizen OS {1}"
"IncompatiblePackageDetailed": "La version du package {0} n'est pas compatible avec Tizen OS {1}",
"lblMdnsWarning": "Attention : Vous utilisez un nom d'h\u00f4te mDNS (.local). Les TV Samsung ne peuvent pas r\u00e9soudre de mani\u00e8re fiable les adresses .local, ce qui peut faire appara\u00eetre le serveur comme \"undefined\" sur votre TV \u2014 surtout apr\u00e8s des interruptions r\u00e9seau. Utilisez plut\u00f4t une adresse IP directe (ex. 192.168.1.100) pour une connexion stable."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update mislukt",
"UpdateCheckFailed": "Controle op updates mislukt",
"IncompatiblePackage": "Pakketversie niet compatibel met apparaat.",
"IncompatiblePackageDetailed": "Pakketversie {0} niet compatibel met Tizen OS {1}"
"IncompatiblePackageDetailed": "Pakketversie {0} niet compatibel met Tizen OS {1}",
"lblMdnsWarning": "Waarschuwing: Je gebruikt een mDNS-hostnaam (.local). Samsung TV's kunnen .local-adressen niet betrouwbaar omzetten, waardoor de server als \"undefined\" op je TV kan verschijnen \u2014 vooral na netwerkonderbrekingen. Gebruik in plaats daarvan een direct IP-adres (bijv. 192.168.1.100) voor een stabiele verbinding."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Aviso: Voc\u00ea est\u00e1 usando um nome de host mDNS (.local). TVs Samsung n\u00e3o conseguem resolver endere\u00e7os .local de forma confi\u00e1vel, o que pode fazer o servidor aparecer como \"undefined\" na sua TV \u2014 especialmente ap\u00f3s interrup\u00e7\u00f5es de rede. Use um endere\u00e7o IP direto (ex. 192.168.1.100) para uma conex\u00e3o est\u00e1vel."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Güncelleme başarısız",
"UpdateCheckFailed": "Güncelleme kontrolü başarısız",
"IncompatiblePackage": "Paket sürümü cihazla uyumlu değil.",
"IncompatiblePackageDetailed": "Paket sürümü {0}, Tizen OS {1} ile uyumlu değil"
"IncompatiblePackageDetailed": "Paket sürümü {0}, Tizen OS {1} ile uyumlu değil",
"lblMdnsWarning": "Uyar\u0131: Bir mDNS ana bilgisayar ad\u0131 (.local) kullan\u0131yorsunuz. Samsung TV'ler .local adreslerini g\u00fcvenilir \u015fekilde \u00e7\u00f6z\u00fcmleyemez, bu da sunucunun TV'nizde \"undefined\" olarak g\u00f6r\u00fcnmesine neden olabilir \u2014 \u00f6zellikle a\u011f kesintilerinden sonra. Kararl\u0131 bir ba\u011flant\u0131 i\u00e7in bunun yerine do\u011frudan bir IP adresi (ör. 192.168.1.100) kullan\u0131n."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -149,5 +149,6 @@
"UpdateError": "Update failed",
"UpdateCheckFailed": "Failed to check for updates",
"IncompatiblePackage": "Package version not compatible with device.",
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}"
"IncompatiblePackageDetailed": "Package version {0} not compatible with Tizen OS {1}",
"lblMdnsWarning": "Warning: You are using an mDNS hostname (.local). Samsung TVs cannot reliably resolve .local addresses, which may cause the server to appear as \"undefined\" on your TV — especially after network interruptions. Use a direct IP address (e.g. 192.168.1.100) instead for a stable connection."
}

View File

@@ -46,6 +46,7 @@ namespace Jellyfin2Samsung.Helpers
public string JellyfinAccessToken { get; set; } = "";
public string JellyfinServerId { get; set; } = "";
public string JellyfinServerLocalAddress { get; set; } = "";
public string JellyfinServerName { get; set; } = "";
public string AudioLanguagePreference { get; set; } = "";
public string SubtitleLanguagePreference { get; set; } = "";
public bool EnableBackdrops { get; set; } = false;

View File

@@ -76,6 +76,18 @@ namespace Jellyfin2Samsung.Helpers.Jellyfin.Patches
if (!servers.Any(s => s?.GetValue<string>() == serverUrl))
servers.Add(serverUrl);
// Add LocalAddress (IP-based) as fallback when the primary URL uses mDNS (.local)
// Samsung TVs (Tizen) cannot reliably resolve mDNS hostnames, especially after network disruptions
var localAddress = UrlHelper.NormalizeServerUrl(AppSettings.Default.JellyfinServerLocalAddress);
if (!string.IsNullOrEmpty(localAddress) &&
localAddress != serverUrl &&
UrlHelper.IsValidHttpUrl(localAddress) &&
!servers.Any(s => s?.GetValue<string>() == localAddress))
{
servers.Add(localAddress);
Trace.WriteLine($"[UpdateServerAddress] Added LocalAddress fallback: {localAddress}");
}
await File.WriteAllTextAsync(path, config.ToJsonString());
}
@@ -92,6 +104,7 @@ namespace Jellyfin2Samsung.Helpers.Jellyfin.Patches
var serverUrl = UrlHelper.NormalizeServerUrl(AppSettings.Default.JellyfinFullUrl);
var serverId = AppSettings.Default.JellyfinServerId;
var localAddress = AppSettings.Default.JellyfinServerLocalAddress;
var serverName = AppSettings.Default.JellyfinServerName;
if (string.IsNullOrEmpty(accessToken) || string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(serverUrl))
{
@@ -99,19 +112,21 @@ namespace Jellyfin2Samsung.Helpers.Jellyfin.Patches
return;
}
// If server ID is not stored, try to fetch it now
if (string.IsNullOrEmpty(serverId))
// If server ID or server name is not stored, try to fetch it now
if (string.IsNullOrEmpty(serverId) || string.IsNullOrEmpty(serverName))
{
Trace.WriteLine("[InjectAutoLogin] Server ID not cached, fetching from server...");
Trace.WriteLine("[InjectAutoLogin] Server ID/Name not cached, fetching from server...");
var serverInfo = await _apiClient.GetPublicSystemInfoAsync(serverUrl);
if (serverInfo != null && !string.IsNullOrEmpty(serverInfo.Id))
{
serverId = serverInfo.Id;
localAddress = serverInfo.LocalAddress ?? "";
serverName = serverInfo.ServerName ?? "";
AppSettings.Default.JellyfinServerId = serverId;
AppSettings.Default.JellyfinServerLocalAddress = localAddress;
AppSettings.Default.JellyfinServerName = serverName;
AppSettings.Default.Save();
Trace.WriteLine($"[InjectAutoLogin] Fetched and stored server ID: {serverId}");
Trace.WriteLine($"[InjectAutoLogin] Fetched and stored server ID: {serverId}, Name: {serverName}");
}
else
{
@@ -138,6 +153,7 @@ namespace Jellyfin2Samsung.Helpers.Jellyfin.Patches
credentialsScript.AppendLine($" var serverUrl = '{HtmlUtils.EscapeJsString(serverUrl)}';");
credentialsScript.AppendLine($" var serverId = '{HtmlUtils.EscapeJsString(serverId)}';");
credentialsScript.AppendLine($" var localAddress = '{HtmlUtils.EscapeJsString(localAddress)}';");
credentialsScript.AppendLine($" var serverName = '{HtmlUtils.EscapeJsString(serverName)}';");
credentialsScript.AppendLine($" var userId = '{HtmlUtils.EscapeJsString(userId)}';");
credentialsScript.AppendLine($" var accessToken = '{HtmlUtils.EscapeJsString(accessToken)}';");
credentialsScript.AppendLine();
@@ -145,6 +161,7 @@ namespace Jellyfin2Samsung.Helpers.Jellyfin.Patches
credentialsScript.AppendLine(" // Using real server ID (GUID) from /System/Info/Public");
credentialsScript.AppendLine(" var credentials = {");
credentialsScript.AppendLine(" Servers: [{");
credentialsScript.AppendLine(" Name: serverName || serverUrl,");
credentialsScript.AppendLine(" ManualAddress: serverUrl,");
credentialsScript.AppendLine(" LocalAddress: localAddress || serverUrl,");
credentialsScript.AppendLine(" Id: serverId,");
@@ -157,7 +174,7 @@ namespace Jellyfin2Samsung.Helpers.Jellyfin.Patches
credentialsScript.AppendLine(" // Store in localStorage");
credentialsScript.AppendLine(" localStorage.setItem('jellyfin_credentials', JSON.stringify(credentials));");
credentialsScript.AppendLine();
credentialsScript.AppendLine(" console.log('[Auto-Login] Credentials injected for server: ' + serverUrl + ' with ID: ' + serverId);");
credentialsScript.AppendLine(" console.log('[Auto-Login] Credentials injected for server: ' + serverName + ' (' + serverUrl + ') with ID: ' + serverId);");
credentialsScript.AppendLine(" } catch(e) {");
credentialsScript.AppendLine(" console.error('[Auto-Login] Failed to inject credentials:', e);");
credentialsScript.AppendLine(" }");

View File

@@ -137,6 +137,9 @@ namespace Jellyfin2Samsung.ViewModels
[ObservableProperty]
private bool canOpenDebugWindow;
[ObservableProperty]
private bool showMdnsWarning = false;
[ObservableProperty]
private string selectedServerInputMode = "IP : Port";
@@ -297,6 +300,7 @@ namespace Jellyfin2Samsung.ViewModels
public string LblValidateCss => _localizationService.GetString("lblValidateCss");
public string LblCssValidationStatus => _localizationService.GetString("lblCssValidationStatus");
public string LblClearCss => _localizationService.GetString("lblClearCss");
public string LblMdnsWarning => _localizationService.GetString("lblMdnsWarning");
// Main Settings Tab labels
@@ -430,6 +434,7 @@ namespace Jellyfin2Samsung.ViewModels
OnPropertyChanged(nameof(LblCssHint));
OnPropertyChanged(nameof(LblValidateCss));
OnPropertyChanged(nameof(LblCssValidationStatus));
OnPropertyChanged(nameof(LblMdnsWarning));
// Main Settings Tab labels
OnPropertyChanged(nameof(LblTabMainSettings));
OnPropertyChanged(nameof(LblMainSettings));
@@ -534,6 +539,8 @@ namespace Jellyfin2Samsung.ViewModels
OnPropertyChanged(nameof(JellyfinBasePath));
AppSettings.Default.Save();
CheckForMdnsHostname(uri.Host);
// Auto-validate the server connection
_ = AutoValidateServerAsync();
}
@@ -680,6 +687,7 @@ namespace Jellyfin2Samsung.ViewModels
AppSettings.Default.JellyfinUserId = "";
AppSettings.Default.JellyfinServerId = "";
AppSettings.Default.JellyfinServerLocalAddress = "";
AppSettings.Default.JellyfinServerName = "";
AppSettings.Default.IsJellyfinAdmin = false;
AppSettings.Default.Save();
@@ -753,6 +761,12 @@ namespace Jellyfin2Samsung.ViewModels
Trace.WriteLine($"[ServerID] Stored server LocalAddress: {serverInfo.LocalAddress}");
}
if (!string.IsNullOrEmpty(serverInfo.ServerName))
{
AppSettings.Default.JellyfinServerName = serverInfo.ServerName;
Trace.WriteLine($"[ServerID] Stored server name: {serverInfo.ServerName}");
}
AppSettings.Default.Save();
}
}
@@ -1203,6 +1217,7 @@ namespace Jellyfin2Samsung.ViewModels
SelectedJellyfinProtocol = uri.Scheme;
JellyfinServerIp = uri.Host;
SelectedJellyfinPort = uri.Port.ToString();
CheckForMdnsHostname(uri.Host);
}
else
{
@@ -1291,9 +1306,21 @@ namespace Jellyfin2Samsung.ViewModels
Trace.WriteLine($"Updated Jellyfin IP: {AppSettings.Default.JellyfinIP}");
AppSettings.Default.Save();
UpdateServerIpStatus();
CheckForMdnsHostname(JellyfinServerIp);
}
}
/// <summary>
/// Checks if the given hostname is an mDNS (.local) address and shows a warning.
/// Samsung TVs (Tizen) cannot reliably resolve mDNS hostnames, which causes
/// the server to appear as "undefined" on the TV after network disruptions.
/// </summary>
private void CheckForMdnsHostname(string? hostname)
{
ShowMdnsWarning = !string.IsNullOrEmpty(hostname) &&
hostname.EndsWith(".local", StringComparison.OrdinalIgnoreCase);
}
private void UpdateServerIpStatus()
{
ServerIpSet = !string.IsNullOrEmpty(AppSettings.Default.JellyfinIP) ||

View File

@@ -408,6 +408,18 @@
</StackPanel>
</Grid>
<!-- mDNS (.local) Warning -->
<Border IsVisible="{Binding ShowMdnsWarning}"
Background="#FFF3CD"
CornerRadius="4"
Padding="10,8"
Margin="0,4,0,0">
<TextBlock Text="{Binding LblMdnsWarning}"
Foreground="#856404"
FontSize="12"
TextWrapping="Wrap"/>
</Border>
</StackPanel>
<Border Height="1" Background="{DynamicResource SystemControlForegroundBaseMediumLowBrush}" Margin="0,4"/>