Spaces:
Paused
Paused
Update server.js
Browse files
server.js
CHANGED
|
@@ -31,6 +31,8 @@ const deleteOldFiles = (folderPath, maxAgeMinutes = 10) => {
|
|
| 31 |
}, 60000);
|
| 32 |
};
|
| 33 |
|
|
|
|
|
|
|
| 34 |
deleteOldFiles(tempDir, 5)
|
| 35 |
app.use("/tmp", express.static(tempDir));
|
| 36 |
|
|
@@ -46,8 +48,9 @@ app.all("/", async (req, res) => {
|
|
| 46 |
if (err) return res.status(500).json({ error: "Failed to save captcha" });
|
| 47 |
|
| 48 |
res.json({
|
| 49 |
-
|
| 50 |
-
|
|
|
|
| 51 |
});
|
| 52 |
});
|
| 53 |
});
|
|
|
|
| 31 |
}, 60000);
|
| 32 |
};
|
| 33 |
|
| 34 |
+
const exp = (minutes) => Date.now() - minutes * 60 * 1000;
|
| 35 |
+
|
| 36 |
deleteOldFiles(tempDir, 5)
|
| 37 |
app.use("/tmp", express.static(tempDir));
|
| 38 |
|
|
|
|
| 48 |
if (err) return res.status(500).json({ error: "Failed to save captcha" });
|
| 49 |
|
| 50 |
res.json({
|
| 51 |
+
expired: `${exp(5)} mins.`,
|
| 52 |
+
text: captcha.text,
|
| 53 |
+
image: `https://${req.hostname}/tmp/${fileName}`
|
| 54 |
});
|
| 55 |
});
|
| 56 |
});
|