noahc3 / PegaScape

A user-friendly public frontend for common PegaSwitch scripts including Nereba, Caffeine, HBL and more.
https://pegascape.sdsetup.com
ISC License
68 stars 30 forks source link

No-node version? #20

Open clbr opened 3 years ago

clbr commented 3 years ago

Do you know if anybody's made a version that runs without node.js? Running on any http server would make it easier to self-host.

Specifically, I'm looking to use caffeine on a local temporary wlan with no internet access.

I checked all the forks and googled, but didn't find anything.

noahc3 commented 3 years ago

It's been something I've wanted to do for a long time but I can't find time to do it.

It's been done before for other PegaSwitch exploits, namely nx-hbexploit300 for the original 3.0.0 homebrew entrypoint. In theory it shouldn't be too hard to mimic, just load all the scripts statically client-side rather than pass them over a websocket. But unfortunately I don't have time right now.

clbr commented 3 years ago

Managed to get a minimal version running. The most painful part was, unsurprisingly, node.js :P I used an Ubuntu 18.04 VM to get node, browserify and the bundle generated, but hit lots of snags with the version of node in the repo.

My steps:

index.html

<html><head><title>Hello Cafe</title></head>
<body>

Hello Cafe

<script src="minmain.js"></script>
<script>
window.showAlbumMessage = function showAlbumMessage() {
}
window.showExitMessage = function showExitMessage() {
}

window.minmain();
</script>

</body></html>

With this, I have caffeine working on a 2.3.0 switch. Using busybox httpd, so no websocket support etc. I used busybox dnsd to get the captive portal popup (direct conntest.nintendowifi.net to your IP) - I read that fake news can be detected, so wanted the safer option just in case I ever go online on the pristine main nand.

devingDev commented 2 years ago

Managed to get a minimal version running. The most painful part was, unsurprisingly, node.js :P I used an Ubuntu 18.04 VM to get node, browserify and the bundle generated, but hit lots of snags with the version of node in the repo.

My steps:

  • copy caffeine, minmain and gadgetcache for my switch, named appropriately
  • add a local str2ab function to caffeine.js since it can't access utils
  • edit bundle.js to load caffeine.js right before setupListener(sc), using the same approach as in loadRun in minmain.js

index.html

<html><head><title>Hello Cafe</title></head>
<body>

Hello Cafe

<script src="minmain.js"></script>
<script>
window.showAlbumMessage = function showAlbumMessage() {
}
window.showExitMessage = function showExitMessage() {
}

window.minmain();
</script>

</body></html>

With this, I have caffeine working on a 2.3.0 switch. Using busybox httpd, so no websocket support etc. I used busybox dnsd to get the captive portal popup (direct conntest.nintendowifi.net to your IP) - I read that fake news can be detected, so wanted the safer option just in case I ever go online on the pristine main nand.

is there a way to run this on a ESP8266? For a switch on 4.1.0 using Caffeine (since RCM payload injection isn't working on this device)

Could you release this as a repo?

clbr commented 2 years ago

No, what I did won't work on an esp8266 directly. Probably possible to port it with some effort, if someone with such hw does the work. My steps are for a Linux host, so a RPi could work.

Repo - sorry, not interested.