Lines 333-373javascript
334 // --- upgrade: compare .volt/version to npm latest, and run the update ---
335 if (req.method === "GET" && p === "/setup/upgrade-check") {
336 const vf = path.join(__dirname, ".volt", "version");
337 const current = (fs.existsSync(vf) ? fs.readFileSync(vf, "utf8").trim() : "") || "?";
338 fetch("https://registry.npmjs.org/create-volt/latest")
339 .then((r) => r.json())
341 const latest = j.version || "?";
342 res.setHeader("Content-Type", "application/json");
343 res.end(JSON.stringify({ current, latest, available: latest !== "?" && current !== "?" && latest !== current }));
346 res.setHeader("Content-Type", "application/json");
347 res.end(JSON.stringify({ current, latest: "?", available: false }));
351 if (req.method === "POST" && p === "/setup/upgrade") {
352 res.setHeader("Content-Type", "application/json");
354 const r = spawnSync("npx", ["--yes", "create-volt@latest", "update"], { cwd: __dirname, encoding: "utf8", shell: process.platform === "win32" });
355 res.end(JSON.stringify({ ok: r.status === 0, output: ((r.stdout || "") + (r.stderr || "")).slice(-2000) }));
357 res.statusCode = 500;
358 res.end(JSON.stringify({ ok: false, error: e.message }));
362 // --- generate a free hosted-AI token from the gateway (self-service) ---
363 if (req.method === "POST" && p === "/setup/gen-token") {
364 res.setHeader("Content-Type", "application/json");
365 const env = readEnvFile();
366 const base = (env.VOLT_AI_GATEWAY || "https://voltjs.com/api/ai").replace(/\/api\/ai\/?$/, "");
367 fetch(base + "/api/register", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ app: env.SITE_NAME || "volt-app" }) })
HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
templates/business/server.jsView on unpkg · L353 368 .then((r) => (r.ok ? r.json() : { ok: false, error: `hosted AI gateway not available (HTTP ${r.status}) — is it deployed?` }))
369 .then((j) => res.end(JSON.stringify(j)))
370 .catch(() => res.end(JSON.stringify({ ok: false, error: "hosted AI gateway unreachable" })));
373 // --- AI proxy for the in-config editor (RTEPro). Uses a local provider key