const { RemoteTerminal } = require('./remote_exec'); async function main() { const term = new RemoteTerminal('wss://soc-gateway-28cd1dc4e034.hosted.ghaymah.systems/ws'); await term.connect(); console.log('Writing /tmp/test.html...'); await term.exec('printf "

SOC DASHBOARD ACTIVE

" > /tmp/test.html'); console.log('Starting ttyd on 7682 with -I /tmp/test.html...'); await term.exec('pkill -f "ttyd -p 7682" || true'); await term.exec('ttyd -p 7682 -I /tmp/test.html -W bash > /tmp/7682.log 2>&1 &'); await new Promise(r => setTimeout(r, 1200)); const log = await term.exec('cat /tmp/7682.log'); console.log('ttyd log:\n', log.output); const wgetRes = await term.exec('wget -qO- http://localhost:7682/'); console.log('Wget response from port 7682:\n', wgetRes.output); term.close(); } main().catch(console.error);