Spaces:
Paused
Paused
Update server.js
Browse files
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({
|
| 23 |
-
|
|
|
|
| 24 |
const fileName = `temp_${generateRandomHex(8)}.png`;
|
| 25 |
const filePath = path.join(tempDir, fileName);
|
| 26 |
|
| 27 |
-
const buffer = await captcha.
|
| 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" });
|