Files

21 lines
741 B
JavaScript

const { RemoteTerminal } = require('./remote_exec');
async function main() {
const term = new RemoteTerminal('wss://soc-tester-9b6540e2d4ed.hosted.ghaymah.systems/ws');
await term.connect();
console.log('Testing custom index.html with ttyd on port 7682...');
await term.exec('echo "<html><body><h1>SOC TEST SUCCESS</h1></body></html>" > /tmp/soc_test.html');
await term.exec('ttyd -p 7682 -I /tmp/soc_test.html bash > /dev/null 2>&1 &');
await new Promise(r => setTimeout(r, 1200));
const wgetRes = await term.exec('wget -qO- http://localhost:7682/');
console.log('Wget output from port 7682:');
console.log(wgetRes.output);
await term.exec('killall -9 ttyd || true');
term.close();
}
main().catch(console.error);