randydev commited on
Commit
fc8b3f7
·
verified ·
1 Parent(s): 5a9990a

Update plugins/antiban.js

Browse files
Files changed (1) hide show
  1. plugins/antiban.js +30 -7
plugins/antiban.js CHANGED
@@ -205,13 +205,13 @@ AntibanRoutes.get("/api/v1/user/raw/getchat", authenticateApiKey, apiLimiter, as
205
 
206
  /**
207
  * @swagger
208
- * /api/v1/user/story-dl:
209
  * get:
210
  * summary: Telegram User Story Downloader
211
  * tags: [User]
212
  * parameters:
213
  * - in: query
214
- * name: link
215
  * required: true
216
  * description: null
217
  * schema:
@@ -226,8 +226,8 @@ AntibanRoutes.get("/api/v1/user/raw/getchat", authenticateApiKey, apiLimiter, as
226
  * 200:
227
  * description: Success
228
  */
229
- AntibanRoutes.get("/api/v1/user/story-dl", authenticateApiKey, apiLimiter, async (req, res) => {
230
- const Links = req.query.link;
231
  if (!Links) {
232
  return res.status(400).json({ error: "Invalid or missing link" });
233
  }
@@ -246,12 +246,35 @@ AntibanRoutes.get("/api/v1/user/story-dl", authenticateApiKey, apiLimiter, async
246
  } catch (err) {
247
  await Job.findOneAndUpdate({ job_id }, { status: "failed" });
248
  }
249
- }, 10000);
250
  res.json({ message: "Download started", job_id });
251
  });
252
 
253
- AntibanRoutes.get("/api/v1/user/story/task", authenticateApiKey, apiLimiter, async (req, res) => {
254
- const job = await Job.findOne({ job_id: req.query.job_id });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
  if (!job) return res.status(404).json({ error: "Job not found" });
257
  res.json({
 
205
 
206
  /**
207
  * @swagger
208
+ * /api/v1/story/task:
209
  * get:
210
  * summary: Telegram User Story Downloader
211
  * tags: [User]
212
  * parameters:
213
  * - in: query
214
+ * name: story_url
215
  * required: true
216
  * description: null
217
  * schema:
 
226
  * 200:
227
  * description: Success
228
  */
229
+ AntibanRoutes.get("/api/v1/story/task/:story_url", authenticateApiKey, apiLimiter, async (req, res) => {
230
+ const Links = req.params.story_url;
231
  if (!Links) {
232
  return res.status(400).json({ error: "Invalid or missing link" });
233
  }
 
246
  } catch (err) {
247
  await Job.findOneAndUpdate({ job_id }, { status: "failed" });
248
  }
249
+ }, 15000);
250
  res.json({ message: "Download started", job_id });
251
  });
252
 
253
+ /**
254
+ * @swagger
255
+ * /api/v1/user/story/task/:job_id:
256
+ * get:
257
+ * summary: Telegram User Story Task Job
258
+ * tags: [User]
259
+ * parameters:
260
+ * - in: query
261
+ * name: story_url
262
+ * required: true
263
+ * description: null
264
+ * schema:
265
+ * type: string
266
+ * - in: header
267
+ * name: x-api-key
268
+ * required: true
269
+ * description: API key for authentication
270
+ * schema:
271
+ * type: string
272
+ * responses:
273
+ * 200:
274
+ * description: Success
275
+ */
276
+ AntibanRoutes.get("/api/v1/user/story/task/:job_id", authenticateApiKey, apiLimiter, async (req, res) => {
277
+ const job = await Job.findOne({ job_id: req.params.job_id });
278
 
279
  if (!job) return res.status(404).json({ error: "Job not found" });
280
  res.json({