mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 08:07:18 +02:00
Compare commits
No commits in common. "typescript" and "v6.6.1" have entirely different histories.
typescript
...
v6.6.1
25
.github/workflows/stale.yaml
vendored
25
.github/workflows/stale.yaml
vendored
@ -1,25 +0,0 @@
|
||||
name: 'Mark stale bug issues'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # Runs daily at midnight UTC
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: |
|
||||
This issue has been marked `stale` due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days.
|
||||
close-issue-message: |
|
||||
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
||||
days-before-stale: 60
|
||||
days-before-close: 30
|
||||
stale-issue-label: 'stale'
|
||||
only-issues: true
|
||||
only-labels: 'bug'
|
2
dist/better-xcloud.meta.js
vendored
2
dist/better-xcloud.meta.js
vendored
@ -1,5 +1,5 @@
|
||||
// ==UserScript==
|
||||
// @name Better xCloud
|
||||
// @namespace https://github.com/redphx
|
||||
// @version 6.6.2
|
||||
// @version 6.6.1
|
||||
// ==/UserScript==
|
||||
|
60
dist/better-xcloud.pretty.user.js
vendored
60
dist/better-xcloud.pretty.user.js
vendored
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name Better xCloud
|
||||
// @namespace https://github.com/redphx
|
||||
// @version 6.6.2
|
||||
// @version 6.6.1
|
||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||
// @author redphx
|
||||
// @license MIT
|
||||
@ -193,7 +193,7 @@ class UserAgent {
|
||||
});
|
||||
}
|
||||
}
|
||||
var SCRIPT_VERSION = "6.6.2", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
||||
var SCRIPT_VERSION = "6.6.1", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
||||
UserAgent.init();
|
||||
var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, STATES = {
|
||||
supportedRegion: !0,
|
||||
@ -5160,30 +5160,6 @@ class PatcherUtils {
|
||||
let newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), [])${separator}`;
|
||||
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
||||
}
|
||||
static findAndParseParams(str, index, maxRange) {
|
||||
let substr = str.substring(index, index + maxRange), startIndex = substr.indexOf("({");
|
||||
if (startIndex < 0) return !1;
|
||||
startIndex += 1;
|
||||
let endIndex = substr.indexOf("})", startIndex);
|
||||
if (endIndex < 0) return !1;
|
||||
endIndex += 1;
|
||||
try {
|
||||
let input = substr.substring(startIndex, endIndex);
|
||||
return PatcherUtils.parseObjectVariables(input);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
static parseObjectVariables(input) {
|
||||
try {
|
||||
let pairs = [...input.matchAll(/(\w+)\s*:\s*([a-zA-Z_$][\w$]*)/g)], result = {};
|
||||
for (let [_, key, value] of pairs)
|
||||
result[key] = value;
|
||||
return result;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
var LOG_TAG2 = "Patcher", PATCHES = {
|
||||
disableAiTrack(str) {
|
||||
@ -5240,7 +5216,7 @@ var LOG_TAG2 = "Patcher", PATCHES = {
|
||||
return str.replace(text, "this.shouldCollectStats=!1");
|
||||
},
|
||||
patchPollGamepads(str) {
|
||||
let index = str.indexOf('()(this,"pollGamepads",');
|
||||
let index = str.indexOf("},this.pollGamepads=()=>{");
|
||||
if (index < 0) return !1;
|
||||
let setTimeoutIndex = str.indexOf("setTimeout(this.pollGamepads", index);
|
||||
if (setTimeoutIndex < 0) return !1;
|
||||
@ -5370,7 +5346,6 @@ if (titleInfo && !titleInfo.details.hasTouchSupport && !titleInfo.details.hasFak
|
||||
let index = str.indexOf("({onCollapse:");
|
||||
if (index < 0) return !1;
|
||||
try {
|
||||
if (!PatcherUtils.findAndParseParams(str, index, 1000)) return !1;
|
||||
let canShowTakHUDVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "canShowTakHUD", index, 500, !0) + 1), guideUIVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "guideUI", index, 500, !0) + 1), onShowStreamMenuVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "onShowStreamMenu", index, 500, !0) + 1), offsetVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "offset", index, 500, !0) + 1), newCode = renderString(stream_hud_default, {
|
||||
guideUI: guideUIVar,
|
||||
onShowStreamMenu: onShowStreamMenuVar,
|
||||
@ -5473,9 +5448,10 @@ true` + text;
|
||||
return str = str.replace(text, text + "return true;"), str;
|
||||
},
|
||||
exposeInputChannel(str) {
|
||||
let text = '()(this,"flushData",(';
|
||||
if (!str.includes(text)) return !1;
|
||||
return str = str.replace(text, '()(window.BX_EXPOSED.inputChannel = this, "flushData", ('), str;
|
||||
let index = str.indexOf("this.flushData=");
|
||||
if (index < 0) return !1;
|
||||
let newCode = "window.BX_EXPOSED.inputChannel = this,";
|
||||
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
||||
},
|
||||
disableNativeRequestPointerLock(str) {
|
||||
let text = "async requestPointerLock(){";
|
||||
@ -5502,7 +5478,7 @@ true` + text;
|
||||
return str = str.substring(0, index) + "|| true" + str.substring(index), str;
|
||||
},
|
||||
ignoreNewsSection(str) {
|
||||
let index = str.indexOf('("CarouselRow"))');
|
||||
let index = str.indexOf('Logger("CarouselRow")');
|
||||
if (index > -1 && (index = PatcherUtils.lastIndexOf(str, "const ", index, 200)), index < 0) return !1;
|
||||
return str = PatcherUtils.insertAt(str, index, "return null;"), str;
|
||||
},
|
||||
@ -5530,9 +5506,8 @@ true` + text;
|
||||
},
|
||||
ignoreSiglSections(str) {
|
||||
let index = str.indexOf("SiglRow-module__heroCard___");
|
||||
if (index >= 0 && (index = PatcherUtils.lastIndexOf(str, "const[", index, 300)), index < 0) return !1;
|
||||
let params = PatcherUtils.findAndParseParams(str, index - 500, 500);
|
||||
if (!params || !params.id) return !1;
|
||||
if (index < 0) return !1;
|
||||
if (index = PatcherUtils.lastIndexOf(str, "const[", index, 300), index < 0) return !1;
|
||||
let PREF_HIDE_SECTIONS = getGlobalPref("ui.hideSections"), siglIds = [], sections = {
|
||||
"native-mkb": "8fa264dd-124f-4af3-97e8-596fcdf4b486",
|
||||
"most-popular": "e7590b22-e299-44db-ae22-25c61405454c",
|
||||
@ -5543,7 +5518,14 @@ true` + text;
|
||||
let galleryId = sections[section];
|
||||
galleryId && siglIds.push(galleryId);
|
||||
}
|
||||
let checkSyntax = siglIds.map((item2) => `${params.id} === "${item2}"`).join(" || "), newCode = `if (${params.id} && (${checkSyntax})) return null;`;
|
||||
let newCode = `
|
||||
if (e && e.id) {
|
||||
const siglId = e.id;
|
||||
if (${siglIds.map((item2) => `siglId === "${item2}"`).join(" || ")}) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
`;
|
||||
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
||||
},
|
||||
ignoreGenresSection(str) {
|
||||
@ -5650,10 +5632,8 @@ ${subsVar} = subs;
|
||||
if (returnIndex < 0) return !1;
|
||||
let productIdIndex = PatcherUtils.lastIndexOf(str, ",productId:", initialIndex, 300);
|
||||
if (productIdIndex < 0) return !1;
|
||||
let params = PatcherUtils.findAndParseParams(str, productIdIndex - 200, 400);
|
||||
if (!params || !params.productId) return !1;
|
||||
let productIdVar = params.productId, supportedInputIconsVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "supportedInputIcons:", initialIndex, 100, !0));
|
||||
if (!supportedInputIconsVar) return !1;
|
||||
let productIdVar = PatcherUtils.getVariableNameAfter(str, productIdIndex + 11), supportedInputIconsVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "supportedInputIcons:", initialIndex, 100, !0));
|
||||
if (!productIdVar || !supportedInputIconsVar) return !1;
|
||||
let newCode = renderString(game_card_icons_default, {
|
||||
productId: productIdVar,
|
||||
supportedInputIcons: supportedInputIconsVar
|
||||
|
16
dist/better-xcloud.user.js
vendored
16
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -110,41 +110,4 @@ export class PatcherUtils {
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static findAndParseParams(str: string, index: number, maxRange: number) {
|
||||
const substr = str.substring(index, index + maxRange);
|
||||
let startIndex = substr.indexOf('({');
|
||||
if (startIndex < 0) {
|
||||
return false;
|
||||
}
|
||||
startIndex += 1;
|
||||
|
||||
let endIndex = substr.indexOf('})', startIndex);
|
||||
if (endIndex < 0) {
|
||||
return false;
|
||||
}
|
||||
endIndex += 1;
|
||||
|
||||
try {
|
||||
const input = substr.substring(startIndex, endIndex);
|
||||
return PatcherUtils.parseObjectVariables(input);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static parseObjectVariables(input: string) {
|
||||
try {
|
||||
const pairs = [...input.matchAll(/(\w+)\s*:\s*([a-zA-Z_$][\w$]*)/g)];
|
||||
|
||||
const result: Record<string, string> = {};
|
||||
for (const [_, key, value] of pairs) {
|
||||
result[key] = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ const PATCHES = {
|
||||
},
|
||||
|
||||
patchPollGamepads(str: string) {
|
||||
const index = str.indexOf('()(this,"pollGamepads",');
|
||||
const index = str.indexOf('},this.pollGamepads=()=>{');
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
@ -399,11 +399,6 @@ if (titleInfo && !titleInfo.details.hasTouchSupport && !titleInfo.details.hasFak
|
||||
}
|
||||
|
||||
try {
|
||||
const params = PatcherUtils.findAndParseParams(str, index, 1000);
|
||||
if (!params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const canShowTakHUDVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'canShowTakHUD', index, 500, true) + 1);
|
||||
const guideUIVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'guideUI', index, 500, true) + 1);
|
||||
const onShowStreamMenuVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'onShowStreamMenu', index, 500, true) + 1);
|
||||
@ -632,12 +627,13 @@ true` + text;
|
||||
},
|
||||
|
||||
exposeInputChannel(str: string) {
|
||||
let text = '()(this,"flushData",(';
|
||||
if (!str.includes(text)) {
|
||||
let index = str.indexOf('this.flushData=');
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
str = str.replace(text, '()(window.BX_EXPOSED.inputChannel = this, "flushData", (');
|
||||
const newCode = 'window.BX_EXPOSED.inputChannel = this,';
|
||||
str = PatcherUtils.insertAt(str, index, newCode);
|
||||
return str;
|
||||
},
|
||||
|
||||
@ -702,7 +698,7 @@ true` + text;
|
||||
|
||||
// Don't render News section
|
||||
ignoreNewsSection(str: string) {
|
||||
let index = str.indexOf('("CarouselRow"))');
|
||||
let index = str.indexOf('Logger("CarouselRow")');
|
||||
index > -1 && (index = PatcherUtils.lastIndexOf(str, 'const ', index, 200));
|
||||
if (index < 0) {
|
||||
return false;
|
||||
@ -772,13 +768,12 @@ true` + text;
|
||||
// home-page.js
|
||||
ignoreSiglSections(str: string) {
|
||||
let index = str.indexOf('SiglRow-module__heroCard___');
|
||||
index >= 0 && (index = PatcherUtils.lastIndexOf(str, 'const[', index, 300));
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const params = PatcherUtils.findAndParseParams(str, index - 500, 500);
|
||||
if (!params || !params.id) {
|
||||
index = PatcherUtils.lastIndexOf(str, 'const[', index, 300);
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -797,9 +792,16 @@ true` + text;
|
||||
galleryId && siglIds.push(galleryId);
|
||||
};
|
||||
|
||||
const checkSyntax = siglIds.map(item => `${params.id} === "${item}"`).join(' || ');
|
||||
const newCode = `if (${params.id} && (${checkSyntax})) return null;`;
|
||||
const checkSyntax = siglIds.map(item => `siglId === "${item}"`).join(' || ');
|
||||
|
||||
const newCode = `
|
||||
if (e && e.id) {
|
||||
const siglId = e.id;
|
||||
if (${checkSyntax}) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
`;
|
||||
str = PatcherUtils.insertAt(str, index, newCode);
|
||||
return str;
|
||||
},
|
||||
@ -1029,16 +1031,12 @@ ${subsVar} = subs;
|
||||
return false;
|
||||
}
|
||||
|
||||
const params = PatcherUtils.findAndParseParams(str, productIdIndex - 200, 400);
|
||||
if (!params || !params.productId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const productIdVar = params.productId;
|
||||
const productIdVar = PatcherUtils.getVariableNameAfter(str, productIdIndex + 11);
|
||||
|
||||
// Find supportedInputIcons and title var names
|
||||
const supportedInputIconsVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'supportedInputIcons:', initialIndex, 100, true));
|
||||
if (!supportedInputIconsVar) {
|
||||
|
||||
if (!productIdVar || !supportedInputIconsVar) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user