Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"dependsOn": [
"buildfrontend",
],
"command": "rsync -azp --delete --rsh='ssh -p ${config:deckport} ${config:deckkey}' dist deck@${config:deckip}:${config:deckdir}/homebrew/plugins/ControllerTools",
"command": "rsync -azp --delete --rsh='ssh -p ${config:deckport} ${config:deckkey}' dist deck@${config:deckip}:${config:deckdir}/homebrew/plugins/ControllerTools && DECKIP=${config:deckip} node scripts/reload_frontend.js",
"problemMatcher": []
},
{
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@rollup/plugin-typescript": "^8.3.3",
"@types/react": "16.14.0",
"@types/webpack": "^5.28.0",
"chrome-remote-interface": "^0.31.3",
"rollup": "^2.77.1",
"rollup-plugin-import-assets": "^1.1.1",
"shx": "^0.3.4",
Expand All @@ -65,4 +66,4 @@
]
}
}
}
}
34 changes: 34 additions & 0 deletions scripts/reload_frontend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Thanks for Sky Leite: https://discord.com/channels/960281551428522045/960284327445418044/1057401742591021077
const plugin = require("../plugin.json");
const CDP = require('chrome-remote-interface');

const options = {
host: process.env.DECKIP,
port: 8081,
};

async function main() {
let client;
try {
// connect to endpoint
client = await CDP({
...options,
target: (targets) => targets.find((target) => target.title == "Steam"),
});

// extract domains
const { Network, Page, Runtime } = client;

await Runtime.evaluate({ expression: `console.log("Reloading ${plugin.name} from an unbelievably stupid dev script")` });
await Runtime.evaluate({ expression: `importDeckyPlugin("${plugin.name}")` });
console.log("Frontend reloaded");
} catch (err) {
console.error(err);
} finally {
if (client) {
await client.close();
}
}
}

main();