mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-17 04:53:02 +02:00
25 lines
733 B
TypeScript
25 lines
733 B
TypeScript
import { STATES } from "@utils/global";
|
|
import { UserAgent } from "@utils/user-agent";
|
|
|
|
|
|
export class PreloadedState {
|
|
static override() {
|
|
Object.defineProperty(window, '__PRELOADED_STATE__', {
|
|
configurable: true,
|
|
get: () => {
|
|
// Override User-Agent
|
|
const userAgent = UserAgent.spoof();
|
|
if (userAgent) {
|
|
(this as any)._state.appContext.requestInfo.userAgent = userAgent;
|
|
}
|
|
|
|
return (this as any)._state;
|
|
},
|
|
set: state => {
|
|
(this as any)._state = state;
|
|
STATES.appContext = structuredClone(state.appContext);
|
|
}
|
|
});
|
|
}
|
|
}
|