Add ability to use normal website's layout on TV

This commit is contained in:
redphx 2024-05-04 15:00:27 +07:00
parent 7588f37472
commit 8a7be5d523
2 changed files with 6 additions and 4 deletions

View File

@ -67,14 +67,15 @@ const PATCHES = {
return str.replace(text, text + 'return;');
},
// Set TV layout
tvLayout(str: string) {
// Set custom website layout
websiteLayout(str: string) {
const text = '?"tv":"default"';
if (!str.includes(text)) {
return false;
}
return str.replace(text, '?"tv":"tv"');
const layout = getPref(PrefKey.UI_LAYOUT) === 'tv' ? 'tv' : 'default';
return str.replace(text, `?"${layout}":"${layout}"`);
},
// Replace "/direct-connect" with "/play"
@ -465,7 +466,7 @@ let PATCH_ORDERS: PatchArray = [
'overrideSettings',
'broadcastPollingMode',
getPref(PrefKey.UI_LAYOUT) === 'tv' && 'tvLayout',
getPref(PrefKey.UI_LAYOUT) !== 'default' && 'websiteLayout',
getPref(PrefKey.LOCAL_CO_OP_ENABLED) && 'supportLocalCoOp',
getPref(PrefKey.GAME_FORTNITE_FORCE_CONSOLE) && 'forceFortniteConsole',

View File

@ -417,6 +417,7 @@ export class Preferences {
default: 'default',
options: {
default: t('default'),
normal: t('normal'),
tv: t('smart-tv'),
},
},