Update plugins/antiban.js
Browse files- plugins/antiban.js +55 -0
plugins/antiban.js
CHANGED
@@ -24,6 +24,61 @@ const TelegramUser = async (user_id) => {
|
|
24 |
}
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
/**
|
28 |
* @swagger
|
29 |
* /api/v1/user/info:
|
|
|
24 |
}
|
25 |
}
|
26 |
|
27 |
+
const TelegramUserStoryDL = async (user_id) => {
|
28 |
+
const options = {
|
29 |
+
method: 'GET',
|
30 |
+
url: 'https://randydev-meta-ai.hf.space/user/get_story',
|
31 |
+
params: {
|
32 |
+
user_id: user_id
|
33 |
+
}
|
34 |
+
};
|
35 |
+
try {
|
36 |
+
const response = await axios.request(options);
|
37 |
+
return response.data;
|
38 |
+
} catch (error) {
|
39 |
+
console.error(error);
|
40 |
+
return null;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @swagger
|
46 |
+
* /api/v1/user/story-dl:
|
47 |
+
* get:
|
48 |
+
* summary: Telegram User Story Downloader
|
49 |
+
* tags: [User]
|
50 |
+
* parameters:
|
51 |
+
* - in: query
|
52 |
+
* name: user_id
|
53 |
+
* required: true
|
54 |
+
* description: null
|
55 |
+
* schema:
|
56 |
+
* type: string
|
57 |
+
* - in: header
|
58 |
+
* name: x-api-key
|
59 |
+
* required: true
|
60 |
+
* description: API key for authentication
|
61 |
+
* schema:
|
62 |
+
* type: string
|
63 |
+
* responses:
|
64 |
+
* 200:
|
65 |
+
* description: Success
|
66 |
+
*/
|
67 |
+
AntibanRoutes.get("/api/v1/user/story-dl", authenticateApiKey, apiLimiter, async (req, res) => {
|
68 |
+
const userId = req.query.user_id;
|
69 |
+
if (!userId) {
|
70 |
+
return res.status(400).json({ error: "Invalid or missing user_id" });
|
71 |
+
}
|
72 |
+
|
73 |
+
try {
|
74 |
+
const result = await TelegramUserStoryDL(userId);
|
75 |
+
res.json(result);
|
76 |
+
} catch (error) {
|
77 |
+
res.status(500).json({ error: "Failed to fetch user info" });
|
78 |
+
}
|
79 |
+
});
|
80 |
+
|
81 |
+
|
82 |
/**
|
83 |
* @swagger
|
84 |
* /api/v1/user/info:
|