Spaces:
Paused
Paused
Update server.js
Browse files
server.js
CHANGED
|
@@ -1,40 +1,28 @@
|
|
| 1 |
-
const
|
| 2 |
-
const
|
| 3 |
-
const
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
const bot = new TelegramBot('7727911031:AAFcPGWeyTynR1FR7Hhpr4HoGDeA4hk9Ebs', { polling: true });
|
| 6 |
const app = express();
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
const
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
if (!match) return;
|
| 26 |
-
|
| 27 |
-
bot.sendMessage(cid, 'Please wait...');
|
| 28 |
-
|
| 29 |
-
const inpo = await fetchInfo(match[1]);
|
| 30 |
-
if (!inpo.ok) return;
|
| 31 |
-
|
| 32 |
-
const params = { shareid: inpo.shareid, uk: inpo.uk, sign: inpo.sign, timestamp: inpo.timestamp };
|
| 33 |
-
|
| 34 |
-
for (const file of inpo.list || []) {
|
| 35 |
-
const odon = await fetchDownload({ ...params, fs_id: file.fs_id });
|
| 36 |
-
if (odon.ok) await bot.sendVideo(cid, odon.downloadUrl);
|
| 37 |
-
}
|
| 38 |
});
|
| 39 |
|
| 40 |
-
app.listen(7860, () => console.log(
|
|
|
|
| 1 |
+
const express = require("express");
|
| 2 |
+
const captcha = require("captcha");
|
| 3 |
+
const fs = require("fs");
|
| 4 |
+
const os = require("os");
|
| 5 |
+
const path = require("path");
|
| 6 |
|
|
|
|
| 7 |
const app = express();
|
| 8 |
+
const tempDir = os.tmpdir();
|
| 9 |
+
|
| 10 |
+
app.get("/captcha", (req, res) => {
|
| 11 |
+
const captchaCode = Math.random().toString(36).substring(2, 6).toUpperCase();
|
| 12 |
+
const captchaImage = captcha.create({ width: 150, height: 50, text: captchaCode });
|
| 13 |
+
|
| 14 |
+
const fileName = `temp_${Math.random().toString(36).substring(2, 6).toUpperCase()}.png`;
|
| 15 |
+
const filePath = path.join(tempDir, fileName);
|
| 16 |
+
|
| 17 |
+
fs.writeFile(filePath, captchaImage.buffer, (err) => {
|
| 18 |
+
if (err) {
|
| 19 |
+
return res.status(500).json({ error: "Failed to save captcha" });
|
| 20 |
+
}
|
| 21 |
+
res.json({
|
| 22 |
+
answer: captchaCode,
|
| 23 |
+
url: filePath
|
| 24 |
+
});
|
| 25 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
});
|
| 27 |
|
| 28 |
+
app.listen(7860, () => console.log("Server running on port 7860"));
|