Update plugins/antiban.js
Browse files- plugins/antiban.js +1 -51
plugins/antiban.js
CHANGED
@@ -5,57 +5,7 @@ import { predictCreationDate } from '../lib/create-date.js';
|
|
5 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
6 |
const AntibanRoutes = express.Router();
|
7 |
|
8 |
-
const protectedUsers = [6477856957, 1191668125, 1448273246, 1054295664, 6444305696];
|
9 |
-
|
10 |
-
const TelegramUser = async (user_id) => {
|
11 |
-
const options = {
|
12 |
-
method: 'GET',
|
13 |
-
url: 'https://randydev-meta-ai.hf.space',
|
14 |
-
params: {
|
15 |
-
user_id: user_id
|
16 |
-
}
|
17 |
-
};
|
18 |
-
try {
|
19 |
-
const response = await axios.request(options);
|
20 |
-
return response.data;
|
21 |
-
} catch (error) {
|
22 |
-
console.error(error);
|
23 |
-
return null;
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @swagger
|
29 |
-
* /api/v1/user/info:
|
30 |
-
* get:
|
31 |
-
* summary: Telegram User Info
|
32 |
-
* tags: [User]
|
33 |
-
* parameters:
|
34 |
-
* - in: query
|
35 |
-
* name: user_id
|
36 |
-
* required: true
|
37 |
-
* description: null
|
38 |
-
* schema:
|
39 |
-
* type: number
|
40 |
-
* - in: header
|
41 |
-
* name: x-api-key
|
42 |
-
* required: true
|
43 |
-
* description: API key for authentication
|
44 |
-
* schema:
|
45 |
-
* type: string
|
46 |
-
* responses:
|
47 |
-
* 200:
|
48 |
-
* description: Success
|
49 |
-
*/
|
50 |
-
AntibanRoutes.get("/api/v1/user/info", authenticateApiKey, apiLimiter, (req, res) => {
|
51 |
-
const userId = req.query.user_id;
|
52 |
-
if (!userId) {
|
53 |
-
return res.status(400).json({ error: "Invalid or missing user_id" });
|
54 |
-
}
|
55 |
-
const result = await TelegramUser(userId);
|
56 |
-
|
57 |
-
res.json(result);
|
58 |
-
});
|
59 |
|
60 |
/**
|
61 |
* @swagger
|
|
|
5 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
6 |
const AntibanRoutes = express.Router();
|
7 |
|
8 |
+
const protectedUsers = [6477856957, 1191668125, 1448273246, 1054295664, 6444305696];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
/**
|
11 |
* @swagger
|