Skip to content

Commit

Permalink
fix: Fix CBCS support in recent WebOS
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed Nov 21, 2024
1 parent 222f72d commit 2e09c79
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,10 @@ function checkSupportedScheme(scheme, supportedScheme) {

if (scheme == 'cbcs' || scheme == 'cbcs-1-9') {
if (EncryptionSchemePolyfills.isRecentFirefox ||
EncryptionSchemePolyfills.isRecentWebOS ||
EncryptionSchemePolyfills.isChromecast) {
// Firefox >= 100 supports CBCS, but doesn't support queries yet.
// WebOS >= 6 supports CBCS, but doesn't support queries yet.
// Older Chromecast devices are assumed to support CBCS as well.
return true;
}
Expand Down Expand Up @@ -718,6 +720,23 @@ EncryptionSchemePolyfills.isChromecast =
EncryptionSchemePolyfills.isRecentFirefox =
parseInt(navigator.userAgent.split('Firefox/').pop(), 10) >= 100;

/**
* @const {boolean}
*/
EncryptionSchemePolyfills.isRecentWebOS = (() => {
const userAgent = navigator.userAgent || '';
const isWebOS = userAgent.includes('Web0S');
if (!isWebOS) {
return false;
}
const chromeVersionMatch = userAgent.match(/Chrome\/(\d+)/);
if (!chromeVersionMatch) {
return false;
}
const chromeVersion = parseInt(chromeVersionMatch[1], 10);
return chromeVersion >= 79;
})();

// Support for CommonJS and AMD module formats.
/** @suppress {undefinedVars} */
(() => {
Expand Down

0 comments on commit 2e09c79

Please sign in to comment.