Minor updates

This commit is contained in:
redphx 2024-07-19 06:24:17 +07:00
parent 0e03d4dc32
commit 2ecd995e47
3 changed files with 11 additions and 4 deletions

View File

@ -217,5 +217,9 @@
border: 1px solid #2d2d2d; border: 1px solid #2d2d2d;
background: #212121; background: #212121;
white-space: break-spaces; white-space: break-spaces;
&:hover {
background: #272727;
}
} }
} }

View File

@ -476,7 +476,7 @@ export function setupSettingsUi() {
const $debugInfo = CE('div', {class: 'bx-debug-info'}, const $debugInfo = CE('div', {class: 'bx-debug-info'},
createButton({ createButton({
label: 'Debug info', label: 'Debug info',
style: ButtonStyle.GHOST | ButtonStyle.FULL_WIDTH, style: ButtonStyle.GHOST | ButtonStyle.FULL_WIDTH | ButtonStyle.FOCUSABLE,
onClick: e => { onClick: e => {
console.log(e); console.log(e);
(e.target as HTMLElement).closest('button')?.nextElementSibling?.classList.toggle('bx-gone'); (e.target as HTMLElement).closest('button')?.nextElementSibling?.classList.toggle('bx-gone');
@ -494,7 +494,7 @@ export function setupSettingsUi() {
} }
}, },
}, },
}, JSON.stringify(debugInfo, null, ' ')), }, '```\n' + JSON.stringify(debugInfo, null, ' ') + '\n```'),
); );
$wrapper.appendChild($debugInfo); $wrapper.appendChild($debugInfo);

View File

@ -14,7 +14,7 @@ type BxFlags = Partial<{
DeviceInfo: Partial<{ DeviceInfo: Partial<{
deviceType: 'android' | 'android-tv' | 'webos' | 'unknown', deviceType: 'android' | 'android-tv' | 'webos' | 'unknown',
userAgent: string, userAgent?: string,
}>, }>,
}> }>
@ -33,7 +33,6 @@ const DEFAULT_FLAGS: BxFlags = {
DeviceInfo: { DeviceInfo: {
deviceType: 'unknown', deviceType: 'unknown',
userAgent: window.navigator.userAgent,
}, },
} }
@ -42,4 +41,8 @@ try {
delete window.BX_FLAGS; delete window.BX_FLAGS;
} catch (e) {} } catch (e) {}
if (!BX_FLAGS.DeviceInfo!.userAgent) {
BX_FLAGS.DeviceInfo!.userAgent = window.navigator.userAgent;
}
export const NATIVE_FETCH = window.fetch; export const NATIVE_FETCH = window.fetch;