Backport pull request #8493 from jellyfin-web/release-12.z

Fix Samsung Browser detection

Original-merge: 351f87be32

Merged-by: thornbill <thornbill@users.noreply.github.com>

Backported-by: thornbill <thornbill@users.noreply.github.com>
This commit is contained in:
MBR-0001 authored and thornbill committed 2026-09-25 10:47:03 -04:00
1 parent b924dc5181
commit 8d232d9561
2 files changed
+18 -4

No files matched your search

-4
View File
@@ -10,10 +10,6 @@ function isTv(userAgent) {
return true;
}
if (userAgent.includes('samsungbrowser')) {
return true;
}
if (userAgent.includes('viera')) {
return true;
}
+18
View File
@@ -35,4 +35,22 @@ describe('Browser', () => {
expect(browser.xboxOne).toBe(true);
expect(browser.tv).toBe(true);
});
it('should identify Samsung Tizen TV devices', () => {
// 2024 Samsung TV (Tizen 8.0)
const browser = detectBrowser('Mozilla/5.0 (SMART-TV; Linux; Tizen 8.0) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.0 Chrome/108.0.5359.1 TV Safari/537.36');
expect(browser.tizen).toBe(true);
expect(browser.tizenVersion).toBe(8);
expect(browser.tv).toBe(true);
expect(browser.mobile).toBeFalsy();
});
it('should not identify Samsung Browser (Android) as a TV', () => {
// Ref: https://developer.samsung.com/browser/user-agent-string-format.html
const browser = detectBrowser('Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/24.0 Chrome/117.0.0.0 Mobile Safari/537.36');
expect(browser.android).toBe(true);
expect(browser.mobile).toBe(true);
expect(browser.tizen).toBeFalsy();
expect(browser.tv).toBeFalsy();
});
});