mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-07-04 13:21:43 +02:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
1f632db6b4 | |||
c07e3297ca | |||
5e43915ff7 | |||
e21375821d | |||
6438e533d6 | |||
e9671cbe5d | |||
b99ec65cc9 | |||
addcf56abf | |||
db17bda673 | |||
0a60119c3b | |||
ef14c78941 | |||
f2dc102996 | |||
02db103a72 | |||
f291047b64 | |||
5866644673 |
2
dist/better-xcloud.meta.js
vendored
2
dist/better-xcloud.meta.js
vendored
@ -1,5 +1,5 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 4.6.0
|
// @version 4.6.2
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
64
dist/better-xcloud.user.js
vendored
64
dist/better-xcloud.user.js
vendored
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 4.6.0
|
// @version 4.6.2
|
||||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||||
// @author redphx
|
// @author redphx
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@ -104,7 +104,7 @@ class UserAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// src/utils/global.ts
|
// src/utils/global.ts
|
||||||
var SCRIPT_VERSION = "4.6.0";
|
var SCRIPT_VERSION = "4.6.2";
|
||||||
var SCRIPT_HOME = "https://github.com/redphx/better-xcloud";
|
var SCRIPT_HOME = "https://github.com/redphx/better-xcloud";
|
||||||
var AppInterface = window.AppInterface;
|
var AppInterface = window.AppInterface;
|
||||||
UserAgent.init();
|
UserAgent.init();
|
||||||
@ -1895,10 +1895,10 @@ class Preferences {
|
|||||||
migrate: function(savedPrefs, value) {
|
migrate: function(savedPrefs, value) {
|
||||||
try {
|
try {
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
if (value < 100) {
|
if (value !== 0 && value < 100) {
|
||||||
value *= 1024000;
|
value *= 1024000;
|
||||||
}
|
}
|
||||||
this.set(PrefKey.BITRATE_VIDEO_MAX, value);
|
this.set(PrefKey.BITRATE_VIDEO_MAX, value, true);
|
||||||
savedPrefs[PrefKey.BITRATE_VIDEO_MAX] = value;
|
savedPrefs[PrefKey.BITRATE_VIDEO_MAX] = value;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
@ -2206,10 +2206,10 @@ class Preferences {
|
|||||||
const savedPrefs = JSON.parse(savedPrefsStr);
|
const savedPrefs = JSON.parse(savedPrefsStr);
|
||||||
for (let settingId in Preferences.SETTINGS) {
|
for (let settingId in Preferences.SETTINGS) {
|
||||||
const setting = Preferences.SETTINGS[settingId];
|
const setting = Preferences.SETTINGS[settingId];
|
||||||
setting.ready && setting.ready.call(this, setting);
|
|
||||||
if (setting.migrate && settingId in savedPrefs) {
|
if (setting.migrate && settingId in savedPrefs) {
|
||||||
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
|
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
|
||||||
}
|
}
|
||||||
|
setting.ready && setting.ready.call(this, setting);
|
||||||
}
|
}
|
||||||
for (let settingId in Preferences.SETTINGS) {
|
for (let settingId in Preferences.SETTINGS) {
|
||||||
const setting = Preferences.SETTINGS[settingId];
|
const setting = Preferences.SETTINGS[settingId];
|
||||||
@ -2270,10 +2270,10 @@ class Preferences {
|
|||||||
}
|
}
|
||||||
return this.#prefs[key];
|
return this.#prefs[key];
|
||||||
}
|
}
|
||||||
set(key, value) {
|
set(key, value, skipSave) {
|
||||||
value = this.#validateValue(key, value);
|
value = this.#validateValue(key, value);
|
||||||
this.#prefs[key] = value;
|
this.#prefs[key] = value;
|
||||||
this.#updateStorage();
|
!skipSave && this.#updateStorage();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
#updateStorage() {
|
#updateStorage() {
|
||||||
@ -3274,15 +3274,23 @@ class MkbHandler {
|
|||||||
}
|
}
|
||||||
this.#mouseDataProvider.init();
|
this.#mouseDataProvider.init();
|
||||||
window.addEventListener("keydown", this.#onKeyboardEvent);
|
window.addEventListener("keydown", this.#onKeyboardEvent);
|
||||||
this.#$message = CE("div", { class: "bx-mkb-pointer-lock-msg bx-gone" }, createButton({
|
this.#$message = CE("div", { class: "bx-mkb-pointer-lock-msg bx-gone" }, CE("div", {}, CE("p", {}, t("mkb-click-to-activate")), CE("p", {}, t("press-key-to-toggle-mkb", { key: "F8" }))), CE("div", {}, createButton({
|
||||||
icon: BxIcon.MOUSE_SETTINGS,
|
icon: BxIcon.MOUSE_SETTINGS,
|
||||||
|
label: t("edit"),
|
||||||
style: ButtonStyle.PRIMARY,
|
style: ButtonStyle.PRIMARY,
|
||||||
onClick: (e) => {
|
onClick: (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
showStreamSettings("mkb");
|
showStreamSettings("mkb");
|
||||||
}
|
}
|
||||||
}), CE("div", {}, CE("p", {}, t("mkb-click-to-activate")), CE("p", {}, t("press-key-to-toggle-mkb", { key: "F8" }))));
|
}), createButton({
|
||||||
|
label: t("disable"),
|
||||||
|
onClick: (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.toggle();
|
||||||
|
}
|
||||||
|
})));
|
||||||
this.#$message.addEventListener("click", this.start.bind(this));
|
this.#$message.addEventListener("click", this.start.bind(this));
|
||||||
document.documentElement.appendChild(this.#$message);
|
document.documentElement.appendChild(this.#$message);
|
||||||
window.addEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this.#onPollingModeChanged);
|
window.addEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this.#onPollingModeChanged);
|
||||||
@ -3780,6 +3788,7 @@ var BxExposed = {
|
|||||||
}
|
}
|
||||||
if (touchControllerAvailability === "off") {
|
if (touchControllerAvailability === "off") {
|
||||||
supportedInputTypes = supportedInputTypes.filter((i) => i !== InputType.CUSTOM_TOUCH_OVERLAY && i !== InputType.GENERIC_TOUCH);
|
supportedInputTypes = supportedInputTypes.filter((i) => i !== InputType.CUSTOM_TOUCH_OVERLAY && i !== InputType.GENERIC_TOUCH);
|
||||||
|
titleInfo.details.supportedTabs = [];
|
||||||
}
|
}
|
||||||
titleInfo.details.hasTouchSupport = supportedInputTypes.includes(InputType.NATIVE_TOUCH) || supportedInputTypes.includes(InputType.CUSTOM_TOUCH_OVERLAY) || supportedInputTypes.includes(InputType.GENERIC_TOUCH);
|
titleInfo.details.hasTouchSupport = supportedInputTypes.includes(InputType.NATIVE_TOUCH) || supportedInputTypes.includes(InputType.CUSTOM_TOUCH_OVERLAY) || supportedInputTypes.includes(InputType.GENERIC_TOUCH);
|
||||||
if (!titleInfo.details.hasTouchSupport && touchControllerAvailability === "all") {
|
if (!titleInfo.details.hasTouchSupport && touchControllerAvailability === "all") {
|
||||||
@ -3877,6 +3886,10 @@ class LoadingScreen {
|
|||||||
#game-stream div[class*=RocketAnimation-module__container] > svg {
|
#game-stream div[class*=RocketAnimation-module__container] > svg {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#game-stream video[class*=RocketAnimationVideo-module__video] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
$bgStyle.textContent += css;
|
$bgStyle.textContent += css;
|
||||||
}
|
}
|
||||||
@ -3965,8 +3978,8 @@ class LoadingScreen {
|
|||||||
LoadingScreen.reset();
|
LoadingScreen.reset();
|
||||||
}
|
}
|
||||||
static reset() {
|
static reset() {
|
||||||
|
LoadingScreen.#$bgStyle && setTimeout(() => LoadingScreen.#$bgStyle.textContent = "", 2000);
|
||||||
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add("bx-gone");
|
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add("bx-gone");
|
||||||
LoadingScreen.#$bgStyle && (LoadingScreen.#$bgStyle.textContent = "");
|
|
||||||
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
|
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
|
||||||
LoadingScreen.#waitTimeInterval = null;
|
LoadingScreen.#waitTimeInterval = null;
|
||||||
}
|
}
|
||||||
@ -5107,8 +5120,8 @@ var resizeVideoPlayer = function() {
|
|||||||
width = parentRect.width;
|
width = parentRect.width;
|
||||||
height = width / videoRatio;
|
height = width / videoRatio;
|
||||||
}
|
}
|
||||||
width = Math.floor(width);
|
width = Math.min(parentRect.width, Math.ceil(width));
|
||||||
height = Math.floor(height);
|
height = Math.min(parentRect.height, Math.ceil(height));
|
||||||
$video.style.width = `${width}px`;
|
$video.style.width = `${width}px`;
|
||||||
$video.style.height = `${height}px`;
|
$video.style.height = `${height}px`;
|
||||||
$video.style.objectFit = "fill";
|
$video.style.objectFit = "fill";
|
||||||
@ -6051,7 +6064,7 @@ div[class*=NotFocusedDialog] {
|
|||||||
height: var(--bx-button-height);
|
height: var(--bx-button-height);
|
||||||
line-height: var(--bx-button-height);
|
line-height: var(--bx-button-height);
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
vertical-align: -webkit-baseline-middle;
|
/* vertical-align: -webkit-baseline-middle; */
|
||||||
color: #fff;
|
color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@ -7011,7 +7024,6 @@ div[data-testid=media-container].bx-taking-screenshot:before {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
.bx-mkb-pointer-lock-msg {
|
.bx-mkb-pointer-lock-msg {
|
||||||
display: flex;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
@ -7035,14 +7047,7 @@ div[data-testid=media-container].bx-taking-screenshot:before {
|
|||||||
.bx-mkb-pointer-lock-msg:hover {
|
.bx-mkb-pointer-lock-msg:hover {
|
||||||
background: #151515;
|
background: #151515;
|
||||||
}
|
}
|
||||||
.bx-mkb-pointer-lock-msg button {
|
.bx-mkb-pointer-lock-msg > div:first-of-type {
|
||||||
margin-right: 12px;
|
|
||||||
height: 60px;
|
|
||||||
}
|
|
||||||
.bx-mkb-pointer-lock-msg svg {
|
|
||||||
width: 32px;
|
|
||||||
}
|
|
||||||
.bx-mkb-pointer-lock-msg div {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -7058,6 +7063,21 @@ div[data-testid=media-container].bx-taking-screenshot:before {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
.bx-mkb-pointer-lock-msg > div:last-of-type {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row;
|
||||||
|
margin-top: 10px;
|
||||||
|
button
|
||||||
|
}
|
||||||
|
.bx-mkb-pointer-lock-msg > div:last-of-type button {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.bx-mkb-pointer-lock-msg > div:last-of-type button:first-of-type {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
.bx-mkb-pointer-lock-msg > div:last-of-type button:last-of-type {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
.bx-mkb-preset-tools {
|
.bx-mkb-preset-tools {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
height: var(--bx-button-height);
|
height: var(--bx-button-height);
|
||||||
line-height: var(--bx-button-height);
|
line-height: var(--bx-button-height);
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
vertical-align: -webkit-baseline-middle;
|
/* vertical-align: -webkit-baseline-middle; */
|
||||||
color: #fff;
|
color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bx-mkb-pointer-lock-msg {
|
.bx-mkb-pointer-lock-msg {
|
||||||
display: flex;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
@ -41,16 +40,7 @@
|
|||||||
background: #151515;
|
background: #151515;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
> div:first-of-type {
|
||||||
margin-right: 12px;
|
|
||||||
height: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
svg {
|
|
||||||
width: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -69,6 +59,26 @@
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> div:last-of-type {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
&:first-of-type {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-of-type {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.bx-mkb-preset-tools {
|
.bx-mkb-preset-tools {
|
||||||
|
@ -46,6 +46,10 @@ export class LoadingScreen {
|
|||||||
#game-stream div[class*=RocketAnimation-module__container] > svg {
|
#game-stream div[class*=RocketAnimation-module__container] > svg {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#game-stream video[class*=RocketAnimationVideo-module__video] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
$bgStyle.textContent += css;
|
$bgStyle.textContent += css;
|
||||||
}
|
}
|
||||||
@ -163,9 +167,9 @@ export class LoadingScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static reset() {
|
static reset() {
|
||||||
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add('bx-gone');
|
LoadingScreen.#$bgStyle && setTimeout(() => LoadingScreen.#$bgStyle.textContent = '', 2000);
|
||||||
LoadingScreen.#$bgStyle && (LoadingScreen.#$bgStyle.textContent = '');
|
|
||||||
|
|
||||||
|
LoadingScreen.#$waitTimeBox && LoadingScreen.#$waitTimeBox.classList.add('bx-gone');
|
||||||
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
|
LoadingScreen.#waitTimeInterval && clearInterval(LoadingScreen.#waitTimeInterval);
|
||||||
LoadingScreen.#waitTimeInterval = null;
|
LoadingScreen.#waitTimeInterval = null;
|
||||||
}
|
}
|
||||||
|
@ -464,20 +464,34 @@ export class MkbHandler {
|
|||||||
window.addEventListener('keydown', this.#onKeyboardEvent);
|
window.addEventListener('keydown', this.#onKeyboardEvent);
|
||||||
|
|
||||||
this.#$message = CE('div', {'class': 'bx-mkb-pointer-lock-msg bx-gone'},
|
this.#$message = CE('div', {'class': 'bx-mkb-pointer-lock-msg bx-gone'},
|
||||||
createButton({
|
|
||||||
icon: BxIcon.MOUSE_SETTINGS,
|
|
||||||
style: ButtonStyle.PRIMARY,
|
|
||||||
onClick: e => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
showStreamSettings('mkb');
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
CE('div', {},
|
CE('div', {},
|
||||||
CE('p', {}, t('mkb-click-to-activate')),
|
CE('p', {}, t('mkb-click-to-activate')),
|
||||||
CE('p', {}, t('press-key-to-toggle-mkb', {key: 'F8'})),
|
CE('p', {}, t('press-key-to-toggle-mkb', {key: 'F8'})),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
CE('div', {},
|
||||||
|
createButton({
|
||||||
|
icon: BxIcon.MOUSE_SETTINGS,
|
||||||
|
label: t('edit'),
|
||||||
|
style: ButtonStyle.PRIMARY,
|
||||||
|
onClick: e => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
showStreamSettings('mkb');
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
|
createButton({
|
||||||
|
label: t('disable'),
|
||||||
|
onClick: e => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
|
||||||
|
this.toggle();
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.#$message.addEventListener('click', this.start.bind(this));
|
this.#$message.addEventListener('click', this.start.bind(this));
|
||||||
|
@ -485,8 +485,8 @@ function resizeVideoPlayer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prevent floating points
|
// Prevent floating points
|
||||||
width = Math.floor(width);
|
width = Math.min(parentRect.width, Math.ceil(width));
|
||||||
height = Math.floor(height);
|
height = Math.min(parentRect.height, Math.ceil(height));
|
||||||
|
|
||||||
// Update size
|
// Update size
|
||||||
$video.style.width = `${width}px`;
|
$video.style.width = `${width}px`;
|
||||||
|
1
src/types/index.d.ts
vendored
1
src/types/index.d.ts
vendored
@ -59,6 +59,7 @@ type XcloudTitleInfo = {
|
|||||||
details: {
|
details: {
|
||||||
productId: string;
|
productId: string;
|
||||||
supportedInputTypes: InputType[];
|
supportedInputTypes: InputType[];
|
||||||
|
supportedTabs: any[];
|
||||||
hasTouchSupport: boolean;
|
hasTouchSupport: boolean;
|
||||||
hasFakeTouchSupport: boolean;
|
hasFakeTouchSupport: boolean;
|
||||||
hasMkbSupport: boolean;
|
hasMkbSupport: boolean;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { ControllerShortcut } from "@/modules/controller-shortcut";
|
import { ControllerShortcut } from "@/modules/controller-shortcut";
|
||||||
import { GameBar } from "@modules/game-bar/game-bar";
|
|
||||||
import { BxEvent } from "@utils/bx-event";
|
import { BxEvent } from "@utils/bx-event";
|
||||||
import { STATES } from "@utils/global";
|
import { STATES } from "@utils/global";
|
||||||
import { getPref, PrefKey } from "@utils/preferences";
|
import { getPref, PrefKey } from "@utils/preferences";
|
||||||
@ -49,11 +48,11 @@ export const BxExposed = {
|
|||||||
gamepadFound && (touchControllerAvailability = 'off');
|
gamepadFound && (touchControllerAvailability = 'off');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (touchControllerAvailability === 'off') {
|
if (touchControllerAvailability === 'off') {
|
||||||
// Disable touch on all games (not native touch)
|
// Disable touch on all games (not native touch)
|
||||||
supportedInputTypes = supportedInputTypes.filter(i => i !== InputType.CUSTOM_TOUCH_OVERLAY && i !== InputType.GENERIC_TOUCH);
|
supportedInputTypes = supportedInputTypes.filter(i => i !== InputType.CUSTOM_TOUCH_OVERLAY && i !== InputType.GENERIC_TOUCH);
|
||||||
|
// Empty TABs
|
||||||
|
titleInfo.details.supportedTabs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre-check supported input types
|
// Pre-check supported input types
|
||||||
|
@ -344,11 +344,10 @@ export class Preferences {
|
|||||||
migrate: function(savedPrefs: any, value: any) {
|
migrate: function(savedPrefs: any, value: any) {
|
||||||
try {
|
try {
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
if (value < 100) {
|
if (value !== 0 && value < 100) {
|
||||||
value *= 1024 * 1000;
|
value *= 1024 * 1000;
|
||||||
}
|
}
|
||||||
|
this.set(PrefKey.BITRATE_VIDEO_MAX, value, true);
|
||||||
this.set(PrefKey.BITRATE_VIDEO_MAX, value);
|
|
||||||
savedPrefs[PrefKey.BITRATE_VIDEO_MAX] = value;
|
savedPrefs[PrefKey.BITRATE_VIDEO_MAX] = value;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
},
|
},
|
||||||
@ -701,11 +700,12 @@ export class Preferences {
|
|||||||
|
|
||||||
for (let settingId in Preferences.SETTINGS) {
|
for (let settingId in Preferences.SETTINGS) {
|
||||||
const setting = Preferences.SETTINGS[settingId];
|
const setting = Preferences.SETTINGS[settingId];
|
||||||
setting.ready && setting.ready.call(this, setting);
|
|
||||||
|
|
||||||
if (setting.migrate && settingId in savedPrefs) {
|
if (setting.migrate && settingId in savedPrefs) {
|
||||||
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
|
setting.migrate.call(this, savedPrefs, savedPrefs[settingId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setting.ready && setting.ready.call(this, setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let settingId in Preferences.SETTINGS) {
|
for (let settingId in Preferences.SETTINGS) {
|
||||||
@ -716,7 +716,7 @@ export class Preferences {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore deprecated settings
|
// Ignore deprecated/migrated settings
|
||||||
if (setting.migrate) {
|
if (setting.migrate) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -783,11 +783,11 @@ export class Preferences {
|
|||||||
return this.#prefs[key];
|
return this.#prefs[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
set(key: PrefKey, value: any): any {
|
set(key: PrefKey, value: any, skipSave?: boolean): any {
|
||||||
value = this.#validateValue(key, value);
|
value = this.#validateValue(key, value);
|
||||||
|
|
||||||
this.#prefs[key] = value;
|
this.#prefs[key] = value;
|
||||||
this.#updateStorage();
|
!skipSave && this.#updateStorage();
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user