Bug fixes

This commit is contained in:
redphx 2024-07-06 20:48:27 +07:00
parent 691f116ea0
commit cafeed1a3c
2 changed files with 12 additions and 6 deletions

View File

@ -677,7 +677,7 @@ true` + text;
} }
// Find *qe* name // Find *qe* name
const match = /render:.*jsx\)\(([^,]+),/.exec(str.substring(index, index + 100)); const match = /render:.*?jsx\)\(([^,]+),/.exec(str.substring(index, index + 100));
if (!match) { if (!match) {
return false; return false;
} }
@ -687,8 +687,12 @@ true` + text;
// Replace *qe*'s return value // Replace *qe*'s return value
// `return a && r ?` => `return a && r || true ?` // `return a && r ?` => `return a && r || true ?`
index = str.indexOf(`const ${funcName}=e=>{`); index = str.indexOf(`const ${funcName}=e=>{`);
index = str.indexOf('return ', index); index > -1 && (index = str.indexOf('return ', index));
index = str.indexOf('?', index); index > -1 && (index = str.indexOf('?', index));
if (index === -1) {
return false;
}
str = str.substring(0, index) + '|| true' + str.substring(index); str = str.substring(0, index) + '|| true' + str.substring(index);
return str; return str;

View File

@ -7,6 +7,8 @@ type UserAgentConfig = {
custom?: string, custom?: string,
}; };
const SMART_TV_UNIQUE_ID = 'FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA';
let CHROMIUM_VERSION = '123.0.0.0'; let CHROMIUM_VERSION = '123.0.0.0';
if (!!(window as any).chrome || window.navigator.userAgent.includes('Chrome')) { if (!!(window as any).chrome || window.navigator.userAgent.includes('Chrome')) {
// Get Chromium version in the original User-Agent value // Get Chromium version in the original User-Agent value
@ -27,8 +29,8 @@ export class UserAgent {
static #USER_AGENTS: PartialRecord<UserAgentProfile, string> = { static #USER_AGENTS: PartialRecord<UserAgentProfile, string> = {
[UserAgentProfile.WINDOWS_EDGE]: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Safari/537.36 Edg/${CHROMIUM_VERSION}`, [UserAgentProfile.WINDOWS_EDGE]: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Safari/537.36 Edg/${CHROMIUM_VERSION}`,
[UserAgentProfile.MACOS_SAFARI]: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.1', [UserAgentProfile.MACOS_SAFARI]: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.1',
[UserAgentProfile.SMARTTV_GENERIC]: window.navigator.userAgent + ' SmartTV', [UserAgentProfile.SMARTTV_GENERIC]: `${window.navigator.userAgent} SmartTV ${SMART_TV_UNIQUE_ID}`,
[UserAgentProfile.SMARTTV_TIZEN]: `Mozilla/5.0 (SMART-TV; LINUX; Tizen 7.0) AppleWebKit/537.36 (KHTML, like Gecko) ${CHROMIUM_VERSION}/7.0 TV Safari/537.36`, [UserAgentProfile.SMARTTV_TIZEN]: `Mozilla/5.0 (SMART-TV; LINUX; Tizen 7.0) AppleWebKit/537.36 (KHTML, like Gecko) ${CHROMIUM_VERSION}/7.0 TV Safari/537.36 ${SMART_TV_UNIQUE_ID}`,
[UserAgentProfile.VR_OCULUS]: window.navigator.userAgent + ' OculusBrowser VR', [UserAgentProfile.VR_OCULUS]: window.navigator.userAgent + ' OculusBrowser VR',
} }
@ -121,7 +123,7 @@ export class UserAgent {
// Pretend to be Tizen TV // Pretend to be Tizen TV
if (BX_FLAGS.IsSupportedTvBrowser) { if (BX_FLAGS.IsSupportedTvBrowser) {
newUserAgent += 'SmartTV FC4A1DA2-711C-4E9C-BC7F-047AF8A672EA'; newUserAgent += ` SmartTV ${SMART_TV_UNIQUE_ID}`;
} }
// Clear data of navigator.userAgentData, force xCloud to detect browser based on navigator.userAgent // Clear data of navigator.userAgentData, force xCloud to detect browser based on navigator.userAgent