From 9f0097fd8c3b73c49fbf3865b2ca8536b1e98392 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:18:02 +0700 Subject: [PATCH] Handle xHome's /play request --- src/utils/network.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/utils/network.ts b/src/utils/network.ts index 29dc473..4ccef24 100644 --- a/src/utils/network.ts +++ b/src/utils/network.ts @@ -226,6 +226,19 @@ class XhomeInterceptor { return NATIVE_FETCH(request); } + static async #handlePlay(request: RequestInfo | URL) { + const clone = (request as Request).clone(); + const body = await clone.json(); + + // body.settings.useIceConnection = true; + + const newRequest = new Request(request, { + body: JSON.stringify(body), + }); + + return NATIVE_FETCH(newRequest); + } + static async handle(request: Request) { TouchController.disable(); @@ -267,6 +280,8 @@ class XhomeInterceptor { // Get console IP if (url.includes('/configuration')) { return XhomeInterceptor.#handleConfiguration(request); + } else if (url.endsWith('/sessions/home/play')) { + return XhomeInterceptor.#handlePlay(request); } else if (url.includes('inputconfigs')) { return XhomeInterceptor.#handleInputConfigs(request, opts); } else if (url.includes('/login/user')) {