scnario commited on
Commit
c1a7224
·
verified ·
1 Parent(s): 80971ae

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +5 -2
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
- answer: captcha.text,
50
- url: `https://${req.hostname}/tmp/${fileName}`
 
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
  });