mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-09-22 12:09:35 +02:00
Add "Disable features" setting
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { CE } from "@utils/html";
|
||||
import { compressCss, renderStylus } from "@macros/build" with { type: "macro" };
|
||||
import { UiSection } from "@/enums/pref-values";
|
||||
import { BlockFeature, UiSection } from "@/enums/pref-values";
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { getPref } from "./settings-storages/global-settings-storage";
|
||||
|
||||
@@ -18,7 +18,7 @@ export function addCss() {
|
||||
}
|
||||
|
||||
// Hide BYOG section
|
||||
if (getPref(PrefKey.BYOG_DISABLED)) {
|
||||
if (getPref<BlockFeature[]>(PrefKey.BLOCK_FEATURES).includes(BlockFeature.BYOG)) {
|
||||
selectorToHide.push('#BodyContent > div[class*=ByogRow-module__container___]');
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export function addCss() {
|
||||
}
|
||||
|
||||
// Hide "Start a party" button in the Guide menu
|
||||
if (getPref(PrefKey.BLOCK_SOCIAL_FEATURES)) {
|
||||
if (getPref<BlockFeature[]>(PrefKey.BLOCK_FEATURES).includes(BlockFeature.FRIENDS)) {
|
||||
selectorToHide.push('#gamepass-dialog-root div[class^=AchievementsPreview-module__container] + button[class*=HomeLandingPage-module__button]');
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { BX_FLAGS } from "./bx-flags";
|
||||
import { getPref } from "./settings-storages/global-settings-storage";
|
||||
import { NativeMkbMode } from "@/enums/pref-values";
|
||||
import { BlockFeature, NativeMkbMode } from "@/enums/pref-values";
|
||||
|
||||
export let FeatureGates: { [key: string]: boolean } = {
|
||||
PwaPrompt: false,
|
||||
@@ -17,13 +17,17 @@ if (nativeMkbMode !== NativeMkbMode.DEFAULT) {
|
||||
}
|
||||
|
||||
// Disable chat feature
|
||||
if (getPref(PrefKey.BLOCK_SOCIAL_FEATURES)) {
|
||||
const blockFeatures = getPref<BlockFeature[]>(PrefKey.BLOCK_FEATURES);
|
||||
if (blockFeatures.includes(BlockFeature.CHAT)) {
|
||||
FeatureGates.EnableGuideChatTab = false;
|
||||
}
|
||||
|
||||
if (blockFeatures.includes(BlockFeature.FRIENDS)) {
|
||||
FeatureGates.EnableFriendsAndFollowers = false;
|
||||
}
|
||||
|
||||
// Disable BYOG feature
|
||||
if (getPref(PrefKey.BYOG_DISABLED)) {
|
||||
if (blockFeatures.includes(BlockFeature.BYOG)) {
|
||||
FeatureGates.EnableBYOG = false;
|
||||
FeatureGates.EnableBYOGPurchase = false;
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ import { XcloudInterceptor } from "./xcloud-interceptor";
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { getPref } from "./settings-storages/global-settings-storage";
|
||||
import type { RemotePlayConsoleAddresses } from "@/types/network";
|
||||
import { StreamResolution } from "@/enums/pref-values";
|
||||
import { BlockFeature, StreamResolution } from "@/enums/pref-values";
|
||||
|
||||
type RequestType = 'xcloud' | 'xhome';
|
||||
|
||||
@@ -137,13 +137,20 @@ export function interceptHttpRequests() {
|
||||
]);
|
||||
}
|
||||
|
||||
if (getPref(PrefKey.BLOCK_SOCIAL_FEATURES)) {
|
||||
|
||||
// 'https://notificationinbox.xboxlive.com',
|
||||
// 'https://accounts.xboxlive.com/family/memberXuid',
|
||||
const blockFeatures = getPref<BlockFeature[]>(PrefKey.BLOCK_FEATURES);
|
||||
if (blockFeatures.includes(BlockFeature.CHAT)) {
|
||||
BLOCKED_URLS = BLOCKED_URLS.concat([
|
||||
'https://xblmessaging.xboxlive.com/network/xbox/users/me/inbox',
|
||||
]);
|
||||
}
|
||||
|
||||
if (blockFeatures.includes(BlockFeature.FRIENDS)) {
|
||||
BLOCKED_URLS = BLOCKED_URLS.concat([
|
||||
'https://peoplehub.xboxlive.com/users/me/people/social',
|
||||
'https://peoplehub.xboxlive.com/users/me/people/recommendations',
|
||||
'https://xblmessaging.xboxlive.com/network/xbox/users/me/inbox',
|
||||
// 'https://notificationinbox.xboxlive.com',
|
||||
// 'https://accounts.xboxlive.com/family/memberXuid',
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@ import { CE } from "../html";
|
||||
import { t, SUPPORTED_LANGUAGES } from "../translation";
|
||||
import { UserAgent } from "../user-agent";
|
||||
import { BaseSettingsStore as BaseSettingsStorage } from "./base-settings-storage";
|
||||
import { CodecProfile, StreamResolution, TouchControllerMode, TouchControllerStyleStandard, TouchControllerStyleCustom, GameBarPosition, DeviceVibrationMode, NativeMkbMode, UiLayout, UiSection, StreamPlayerType, StreamVideoProcessing, VideoRatio, StreamStat, VideoPosition } from "@/enums/pref-values";
|
||||
import { CodecProfile, StreamResolution, TouchControllerMode, TouchControllerStyleStandard, TouchControllerStyleCustom, GameBarPosition, DeviceVibrationMode, NativeMkbMode, UiLayout, UiSection, StreamPlayerType, StreamVideoProcessing, VideoRatio, StreamStat, VideoPosition, BlockFeature } from "@/enums/pref-values";
|
||||
import { MkbMappingDefaultPresetId } from "../local-db/mkb-mapping-presets-table";
|
||||
import { KeyboardShortcutDefaultId } from "../local-db/keyboard-shortcuts-table";
|
||||
import { GhPagesUtils } from "../gh-pages";
|
||||
@@ -586,25 +586,29 @@ export class GlobalSettingsStorage extends BaseSettingsStorage {
|
||||
},
|
||||
},
|
||||
|
||||
[PrefKey.BYOG_DISABLED]: {
|
||||
label: t('disable-byog-feature'),
|
||||
default: false,
|
||||
},
|
||||
|
||||
[PrefKey.UI_GAME_CARD_SHOW_WAIT_TIME]: {
|
||||
requiredVariants: 'full',
|
||||
label: t('show-wait-time-in-game-card'),
|
||||
default: true,
|
||||
},
|
||||
|
||||
[PrefKey.BLOCK_SOCIAL_FEATURES]: {
|
||||
label: t('disable-social-features'),
|
||||
default: false,
|
||||
},
|
||||
[PrefKey.BLOCK_TRACKING]: {
|
||||
label: t('disable-xcloud-analytics'),
|
||||
default: false,
|
||||
},
|
||||
[PrefKey.BLOCK_FEATURES]: {
|
||||
label: t('disable-features'),
|
||||
default: [],
|
||||
multipleOptions: {
|
||||
[BlockFeature.CHAT]: t('chat'),
|
||||
[BlockFeature.FRIENDS]: t('friends-followers'),
|
||||
[BlockFeature.BYOG]: t('byog'),
|
||||
// [BlockFeature.NOTIFICATIONS_INVITES]: ut('Notifications: Invites'),
|
||||
// [BlockFeature.NOTIFICATIONS_ACHIEVEMENTS]: ut('Notifications: Achievements'),
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
[PrefKey.USER_AGENT_PROFILE]: {
|
||||
label: t('user-agent-profile'),
|
||||
note: '⚠️ ' + t('unexpected-behavior'),
|
||||
|
@@ -27,6 +27,10 @@ export const SUPPORTED_LANGUAGES = {
|
||||
};
|
||||
|
||||
const Texts = {
|
||||
"chat": "Chat",
|
||||
"friends-followers": "Friends and followers",
|
||||
"byog": "Stream your own game",
|
||||
"disable-features": "Disable features",
|
||||
"activate": "Activate",
|
||||
"activated": "Activated",
|
||||
"active": "Active",
|
||||
|
Reference in New Issue
Block a user