mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-07 16:17:20 +02:00
Fix script not being loaded after refreshing token
This commit is contained in:
parent
c93db035f3
commit
45bda4bb24
20
src/index.ts
20
src/index.ts
@ -37,13 +37,19 @@ import { updateVideoPlayer } from "./modules/stream/stream-settings-utils";
|
|||||||
|
|
||||||
// Handle login page
|
// Handle login page
|
||||||
if (window.location.pathname.includes('/auth/msa')) {
|
if (window.location.pathname.includes('/auth/msa')) {
|
||||||
window.addEventListener('load', e => {
|
const nativePushState = window.history['pushState'];
|
||||||
window.location.search.includes('loggedIn') && window.setTimeout(() => {
|
window.history['pushState'] = function(...args: any[]) {
|
||||||
const location = window.location;
|
const url = args[2];
|
||||||
// @ts-ignore
|
if (url && (url.startsWith('/play') || url.substring(6).startsWith('/play'))) {
|
||||||
location.pathname.includes('/play') && location.reload(true);
|
console.log('Redirecting to xbox.com/play');
|
||||||
}, 2000);
|
window.stop();
|
||||||
});
|
window.location.href = 'https://www.xbox.com' + url;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
return nativePushState.apply(this, arguments);
|
||||||
|
}
|
||||||
// Stop processing the script
|
// Stop processing the script
|
||||||
throw new Error('[Better xCloud] Refreshing the page after logging in');
|
throw new Error('[Better xCloud] Refreshing the page after logging in');
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,8 @@ export function patchMeControl() {
|
|||||||
API: {
|
API: {
|
||||||
setDisplayMode: () => {},
|
setDisplayMode: () => {},
|
||||||
setMobileState: () => {},
|
setMobileState: () => {},
|
||||||
|
addEventListener: () => {},
|
||||||
|
removeEventListener: () => {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user