Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 1 lines 965 B view raw
1import WebSocket from "ws"; import { get } from "http"; const getTargets = () => new Promise((resolve, reject) => { get("http://host.docker.internal:9222/json", { headers: { Host: "localhost" } }, (res) => { let data = ""; res.on("data", chunk => data += chunk); res.on("end", () => resolve(JSON.parse(data))); }).on("error", reject); }); const targets = await getTargets(); const page = targets[0]; const ws = new WebSocket("ws://host.docker.internal:9222/devtools/page/" + page.id, { headers: { Host: "localhost" } }); let id = 1; const send = (method, params = {}) => new Promise((resolve) => { const msgId = id++; ws.once("message", (data) => resolve(JSON.parse(data).result)); ws.send(JSON.stringify({ id: msgId, method, params })); }); ws.on("open", async () => { await send("Page.navigate", { url: "https://myh.godaddy.com/hosting/thomaslawson.com" }); console.log("Going to GoDaddy hosting for thomaslawson.com..."); setTimeout(() => ws.close(), 2000); });