mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 20:11:59 +00:00
"fix" react-devtools
works well enough lol
This commit is contained in:
@@ -429,6 +429,7 @@ class Utilities:
|
|||||||
async with ClientSession() as web:
|
async with ClientSession() as web:
|
||||||
res = await web.request("GET", "http://" + ip + ":8097", ssl=helpers.get_ssl_context())
|
res = await web.request("GET", "http://" + ip + ":8097", ssl=helpers.get_ssl_context())
|
||||||
script = """
|
script = """
|
||||||
|
try {
|
||||||
if (!window.deckyHasConnectedRDT) {
|
if (!window.deckyHasConnectedRDT) {
|
||||||
window.deckyHasConnectedRDT = true;
|
window.deckyHasConnectedRDT = true;
|
||||||
// This fixes the overlay when hovering over an element in RDT
|
// This fixes the overlay when hovering over an element in RDT
|
||||||
@@ -436,10 +437,20 @@ class Utilities:
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
get: function() {
|
get: function() {
|
||||||
return (GamepadNavTree?.m_context?.m_controller || FocusNavController)?.m_ActiveContext?.ActiveWindow || window;
|
return window?.DFL?.findSP?.() || window;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
""" + await res.text() + "\n}"
|
""" + await res.text() + """
|
||||||
|
// they broke the script so we have to do this ourselves
|
||||||
|
ReactDevToolsBackend.initialize({
|
||||||
|
appendComponentStack: true,
|
||||||
|
breakOnConsoleErrors: false,
|
||||||
|
showInlineWarningsAndErrors: true,
|
||||||
|
hideConsoleLogsInStrictMode: false
|
||||||
|
});
|
||||||
|
ReactDevToolsBackend.connectToDevTools({port: 8097, host: 'localhost', useHttps: false});
|
||||||
|
} } catch(e) {console.error('RDT LOAD ERROR', e);}console.log('LOADED RDT');
|
||||||
|
"""
|
||||||
if res.status != 200:
|
if res.status != 200:
|
||||||
self.logger.error("Failed to connect to React DevTools at " + ip)
|
self.logger.error("Failed to connect to React DevTools at " + ip)
|
||||||
return False
|
return False
|
||||||
@@ -447,7 +458,10 @@ class Utilities:
|
|||||||
self.logger.info("Connected to React DevTools, loading script")
|
self.logger.info("Connected to React DevTools, loading script")
|
||||||
tab = await get_gamepadui_tab()
|
tab = await get_gamepadui_tab()
|
||||||
# RDT needs to load before React itself to work.
|
# RDT needs to load before React itself to work.
|
||||||
|
try:
|
||||||
await close_old_tabs()
|
await close_old_tabs()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
result = await tab.reload_and_evaluate(script)
|
result = await tab.reload_and_evaluate(script)
|
||||||
self.logger.info(result)
|
self.logger.info(result)
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
nodePackages.pnpm
|
nodePackages.pnpm
|
||||||
poetry
|
poetry
|
||||||
jq
|
jq
|
||||||
|
electron_30-bin
|
||||||
# fixes local pyright not being able to see the pythonpath properly.
|
# fixes local pyright not being able to see the pythonpath properly.
|
||||||
(pkgs.writeShellScriptBin "pyright" ''
|
(pkgs.writeShellScriptBin "pyright" ''
|
||||||
${pkgs.pyright}/bin/pyright --pythonpath `which python3` "$@" '')
|
${pkgs.pyright}/bin/pyright --pythonpath `which python3` "$@" '')
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
"lint": "prettier -c src",
|
"lint": "prettier -c src",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"format": "prettier -c src -w",
|
"format": "prettier -c src -w",
|
||||||
"localize": "i18next"
|
"localize": "i18next",
|
||||||
|
"react-devtools": "electron node_modules/react-devtools/app"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@decky/api": "^1.1.1",
|
"@decky/api": "^1.1.1",
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
"prettier": "^3.3.2",
|
"prettier": "^3.3.2",
|
||||||
"prettier-plugin-import-sort": "^0.0.7",
|
"prettier-plugin-import-sort": "^0.0.7",
|
||||||
"react": "18.3.1",
|
"react": "18.3.1",
|
||||||
|
"react-devtools": "^6.0.0",
|
||||||
"react-dom": "18.3.1",
|
"react-dom": "18.3.1",
|
||||||
"rollup": "^4.18.0",
|
"rollup": "^4.18.0",
|
||||||
"rollup-plugin-delete": "^2.0.0",
|
"rollup-plugin-delete": "^2.0.0",
|
||||||
|
|||||||
Generated
+1081
File diff suppressed because it is too large
Load Diff
@@ -87,10 +87,10 @@ class RouterHook extends Logger {
|
|||||||
this.patchGamepadRouter();
|
this.patchGamepadRouter();
|
||||||
break;
|
break;
|
||||||
// Not fully implemented yet
|
// Not fully implemented yet
|
||||||
// case UIMode.Desktop:
|
case UIMode.Desktop:
|
||||||
// this.debug("Patching desktop router");
|
this.debug("Patching desktop router");
|
||||||
// this.patchDesktopRouter();
|
this.patchDesktopRouter();
|
||||||
// break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.warn(`Router patch not implemented for UI mode ${mode}`);
|
this.warn(`Router patch not implemented for UI mode ${mode}`);
|
||||||
break;
|
break;
|
||||||
@@ -131,7 +131,6 @@ class RouterHook extends Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Currently unused
|
// Currently unused
|
||||||
// @ts-expect-error 6133
|
|
||||||
private async patchDesktopRouter() {
|
private async patchDesktopRouter() {
|
||||||
const root = getReactRoot(document.getElementById('root') as any);
|
const root = getReactRoot(document.getElementById('root') as any);
|
||||||
const findRouterNode = () =>
|
const findRouterNode = () =>
|
||||||
|
|||||||
Reference in New Issue
Block a user