scnario commited on
Commit
13a47fe
·
verified ·
1 Parent(s): 7597a9d

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +4 -3
server.js CHANGED
@@ -19,12 +19,13 @@ const rand = (length) =>
19
  app.use("/tmp", express.static(tempDir));
20
 
21
  app.all("/", async (req, res) => {
22
- const captcha = new CaptchaGenerator({ text: rand(6), height: 200, width: 600 })
23
-
 
24
  const fileName = `temp_${generateRandomHex(8)}.png`;
25
  const filePath = path.join(tempDir, fileName);
26
 
27
- const buffer = await captcha.generate()
28
 
29
  fs.writeFile(filePath, buffer, (err) => {
30
  if (err) return res.status(500).json({ error: "Failed to save captcha" });
 
19
  app.use("/tmp", express.static(tempDir));
20
 
21
  app.all("/", async (req, res) => {
22
+ const captcha = new CaptchaGenerator({ height: 200, width: 600 })
23
+ .setDimension(200, 6000)
24
+ .setCaptcha({ text: rand(6) })
25
  const fileName = `temp_${generateRandomHex(8)}.png`;
26
  const filePath = path.join(tempDir, fileName);
27
 
28
+ const buffer = await captcha.generateSync()
29
 
30
  fs.writeFile(filePath, buffer, (err) => {
31
  if (err) return res.status(500).json({ error: "Failed to save captcha" });