Add "Prefer IPv6 server" option for Remote Play

This commit is contained in:
redphx 2025-06-21 17:24:37 +07:00
parent 80f47a93d4
commit c76a3cc7a4
7 changed files with 43 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,14 +2,18 @@
margin-bottom: 12px; margin-bottom: 12px;
padding-bottom: 12px; padding-bottom: 12px;
border-bottom: 1px solid #2d2d2d; border-bottom: 1px solid #2d2d2d;
display: flex;
flex-direction: column;
gap: 10px;
> div { > div {
display: flex; display: flex;
} min-height: 30px;
label { > label {
flex: 1; flex: 1;
font-size: 14px; font-size: 14px;
align-self: center;
p { p {
margin: 4px 0 0; margin: 4px 0 0;
@ -20,6 +24,9 @@
} }
} }
}
.bx-remote-play-resolution { .bx-remote-play-resolution {
display: block; display: block;

View File

@ -80,6 +80,7 @@ export const enum GlobalPref {
AUDIO_VOLUME_CONTROL_ENABLED = 'audio.volume.booster.enabled', AUDIO_VOLUME_CONTROL_ENABLED = 'audio.volume.booster.enabled',
REMOTE_PLAY_STREAM_RESOLUTION = 'xhome.video.resolution', REMOTE_PLAY_STREAM_RESOLUTION = 'xhome.video.resolution',
REMOTE_PLAY_PREFER_IPV6 = 'xhome.ipv6.prefer',
GAME_FORTNITE_FORCE_CONSOLE = 'game.fortnite.forceConsole', GAME_FORTNITE_FORCE_CONSOLE = 'game.fortnite.forceConsole',
} }
@ -99,6 +100,7 @@ export type GlobalPrefTypeMap = {
[GlobalPref.NATIVE_MKB_FORCED_GAMES]: string[]; [GlobalPref.NATIVE_MKB_FORCED_GAMES]: string[];
[GlobalPref.NATIVE_MKB_MODE]: NativeMkbMode; [GlobalPref.NATIVE_MKB_MODE]: NativeMkbMode;
[GlobalPref.REMOTE_PLAY_STREAM_RESOLUTION]: StreamResolution; [GlobalPref.REMOTE_PLAY_STREAM_RESOLUTION]: StreamResolution;
[GlobalPref.REMOTE_PLAY_PREFER_IPV6]: boolean;
[GlobalPref.SCREENSHOT_APPLY_FILTERS]: boolean; [GlobalPref.SCREENSHOT_APPLY_FILTERS]: boolean;
[GlobalPref.SERVER_BYPASS_RESTRICTION]: string; [GlobalPref.SERVER_BYPASS_RESTRICTION]: string;
[GlobalPref.SERVER_PREFER_IPV6]: boolean; [GlobalPref.SERVER_PREFER_IPV6]: boolean;
@ -233,6 +235,7 @@ export const ALL_PREFS: {
GlobalPref.NATIVE_MKB_FORCED_GAMES, GlobalPref.NATIVE_MKB_FORCED_GAMES,
GlobalPref.NATIVE_MKB_MODE, GlobalPref.NATIVE_MKB_MODE,
GlobalPref.REMOTE_PLAY_STREAM_RESOLUTION, GlobalPref.REMOTE_PLAY_STREAM_RESOLUTION,
GlobalPref.REMOTE_PLAY_PREFER_IPV6,
GlobalPref.SCREENSHOT_APPLY_FILTERS, GlobalPref.SCREENSHOT_APPLY_FILTERS,
GlobalPref.SERVER_BYPASS_RESTRICTION, GlobalPref.SERVER_BYPASS_RESTRICTION,
GlobalPref.SERVER_PREFER_IPV6, GlobalPref.SERVER_PREFER_IPV6,

View File

@ -1,4 +1,4 @@
import { ButtonStyle, CE, createButton } from "@/utils/html"; import { ButtonStyle, CE, createButton, escapeCssSelector } from "@/utils/html";
import { NavigationDialog, type NavigationElement } from "./navigation-dialog"; import { NavigationDialog, type NavigationElement } from "./navigation-dialog";
import { GlobalPref } from "@/enums/pref-keys"; import { GlobalPref } from "@/enums/pref-keys";
import { BxIcon } from "@/utils/bx-icon"; import { BxIcon } from "@/utils/bx-icon";
@ -11,6 +11,7 @@ import { BxLogger } from "@/utils/bx-logger";
import { StreamResolution } from "@/enums/pref-values"; import { StreamResolution } from "@/enums/pref-values";
import { setNearby } from "@/utils/navigation-utils"; import { setNearby } from "@/utils/navigation-utils";
import { AppInterface } from "@/utils/global"; import { AppInterface } from "@/utils/global";
import { SettingElement } from "@/utils/setting-element";
export class RemotePlayDialog extends NavigationDialog { export class RemotePlayDialog extends NavigationDialog {
@ -67,6 +68,9 @@ export class RemotePlayDialog extends NavigationDialog {
}, CE('div', false, }, CE('div', false,
CE('label', false, t('target-resolution'), $settingNote), CE('label', false, t('target-resolution'), $settingNote),
$resolutions, $resolutions,
), CE('div', false,
CE('label', { 'for': `bx_setting_${escapeCssSelector(GlobalPref.REMOTE_PLAY_PREFER_IPV6)}` }, t('prefer-ipv6-server')),
SettingElement.fromPref(GlobalPref.REMOTE_PLAY_PREFER_IPV6),
)); ));
$fragment.appendChild($qualitySettings); $fragment.appendChild($qualitySettings);

View File

@ -109,7 +109,7 @@ export async function patchIceCandidates(request: Request, consoleAddrs?: Remote
} }
const options = { const options = {
preferIpv6Server: getGlobalPref(GlobalPref.SERVER_PREFER_IPV6), preferIpv6Server: getGlobalPref(consoleAddrs ? GlobalPref.REMOTE_PLAY_PREFER_IPV6 : GlobalPref.SERVER_PREFER_IPV6),
consoleAddrs: consoleAddrs, consoleAddrs: consoleAddrs,
}; };

View File

@ -535,6 +535,11 @@ export class GlobalSettingsStorage extends BaseSettingsStorage<GlobalPref> {
}, },
}, },
[GlobalPref.REMOTE_PLAY_PREFER_IPV6]: {
requiredVariants: 'full',
default: false,
},
[GlobalPref.GAME_FORTNITE_FORCE_CONSOLE]: { [GlobalPref.GAME_FORTNITE_FORCE_CONSOLE]: {
requiredVariants: 'full', requiredVariants: 'full',
label: '🎮 ' + t('fortnite-force-console-version'), label: '🎮 ' + t('fortnite-force-console-version'),