Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -490,6 +490,29 @@ app.post("/api/reset", async (req, res) => {
|
|
| 490 |
}
|
| 491 |
});
|
| 492 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 493 |
/* ================= PROXY ================= */
|
| 494 |
const proxy = httpProxy.createProxyServer({
|
| 495 |
target: `http://127.0.0.1:${VITE_PORT}`,
|
|
|
|
| 490 |
}
|
| 491 |
});
|
| 492 |
|
| 493 |
+
|
| 494 |
+
/* ================= FAST RESET (ZERO WAIT TIME) ================= */
|
| 495 |
+
app.post("/api/fast-reset", async (req, res) => {
|
| 496 |
+
if (!verifyToken(req, res)) return;
|
| 497 |
+
|
| 498 |
+
try {
|
| 499 |
+
const files = await fs.readdir(PROJECT_DIR);
|
| 500 |
+
|
| 501 |
+
// Sirf code files udao, Vite aur node_modules ko zinda chhod do
|
| 502 |
+
for (const file of files) {
|
| 503 |
+
if (file !== "node_modules" && file !== "package.json" && file !== "package-lock.json" && file !== "pnpm-lock.yaml") {
|
| 504 |
+
await fs.remove(path.join(PROJECT_DIR, file));
|
| 505 |
+
}
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
pushLog("[SYSTEM] ⚡ Fast reset complete! Ready for new code.", "success");
|
| 509 |
+
res.json({ success: true, message: "Cleaned without rebooting" });
|
| 510 |
+
} catch (e) {
|
| 511 |
+
pushLog("[ERROR] Fast reset failed: " + e.message, "error");
|
| 512 |
+
res.status(500).json({ error: e.message });
|
| 513 |
+
}
|
| 514 |
+
});
|
| 515 |
+
|
| 516 |
/* ================= PROXY ================= */
|
| 517 |
const proxy = httpProxy.createProxyServer({
|
| 518 |
target: `http://127.0.0.1:${VITE_PORT}`,
|