mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-03 06:07:19 +02:00
Fix "injectErrorPageUseEffect" patch
This commit is contained in:
parent
9e851fbd15
commit
256f28695e
8
dist/better-xcloud.pretty.user.js
vendored
8
dist/better-xcloud.pretty.user.js
vendored
@ -5154,8 +5154,8 @@ class PatcherUtils {
|
|||||||
end += 1;
|
end += 1;
|
||||||
return str.substring(start, end);
|
return str.substring(start, end);
|
||||||
}
|
}
|
||||||
static injectUseEffect(str, index, group, eventName) {
|
static injectUseEffect(str, index, group, eventName, separator = ";") {
|
||||||
let newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), []);`;
|
let newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), [])${separator}`;
|
||||||
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5658,8 +5658,8 @@ ${subsVar} = subs;
|
|||||||
},
|
},
|
||||||
injectErrorPageUseEffect(str) {
|
injectErrorPageUseEffect(str) {
|
||||||
let index = str.indexOf('"PureErrorPage-module__container');
|
let index = str.indexOf('"PureErrorPage-module__container');
|
||||||
if (index > -1 && (index = PatcherUtils.lastIndexOf(str, "return", index, 200)), index < 0) return !1;
|
if (index > -1 && (index = PatcherUtils.lastIndexOf(str, "})=>(0,", index, 200)), index < 0) return !1;
|
||||||
return PatcherUtils.injectUseEffect(str, index, "Script", "ui.error.rendered");
|
return PatcherUtils.injectUseEffect(str, index + 4, "Script", "ui.error.rendered", ",");
|
||||||
},
|
},
|
||||||
injectStreamMenuUseEffect(str) {
|
injectStreamMenuUseEffect(str) {
|
||||||
let index = str.indexOf('"StreamMenu-module__container');
|
let index = str.indexOf('"StreamMenu-module__container');
|
||||||
|
4
dist/better-xcloud.user.js
vendored
4
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -104,8 +104,8 @@ export class PatcherUtils {
|
|||||||
return str.substring(start, end);
|
return str.substring(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
static injectUseEffect<T extends 'Stream' | 'Script'>(str: string, index: number, group: T, eventName: T extends 'Stream' ? keyof StreamEvents : keyof ScriptEvents) {
|
static injectUseEffect<T extends 'Stream' | 'Script'>(str: string, index: number, group: T, eventName: T extends 'Stream' ? keyof StreamEvents : keyof ScriptEvents, separator: string = ';') {
|
||||||
const newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), []);`;
|
const newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), [])${separator}`;
|
||||||
str = PatcherUtils.insertAt(str, index, newCode);
|
str = PatcherUtils.insertAt(str, index, newCode);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
@ -1118,12 +1118,12 @@ ${subsVar} = subs;
|
|||||||
|
|
||||||
injectErrorPageUseEffect(str: string) {
|
injectErrorPageUseEffect(str: string) {
|
||||||
let index = str.indexOf('"PureErrorPage-module__container');
|
let index = str.indexOf('"PureErrorPage-module__container');
|
||||||
index > -1 && (index = PatcherUtils.lastIndexOf(str, 'return', index, 200));
|
index > -1 && (index = PatcherUtils.lastIndexOf(str, '})=>(0,', index, 200));
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PatcherUtils.injectUseEffect(str, index, 'Script', 'ui.error.rendered');
|
return PatcherUtils.injectUseEffect(str, index + 4, 'Script', 'ui.error.rendered', ',');
|
||||||
},
|
},
|
||||||
|
|
||||||
injectStreamMenuUseEffect(str: string) {
|
injectStreamMenuUseEffect(str: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user