Update plugins/antiban.js
Browse files- plugins/antiban.js +3 -3
plugins/antiban.js
CHANGED
@@ -310,10 +310,10 @@ AntibanRoutes.get("/api/v1/user/creation-date", authenticateApiKey, apiLimiter,
|
|
310 |
res.json({ user_id: userId, estimated_creation: result });
|
311 |
});
|
312 |
|
313 |
-
AntibanRoutes.get("/api/v1/user/api-key-info", apiLimiter, async (req, res) => {
|
314 |
const dbClient = new Database("AkenoXJs");
|
315 |
const collectionKey = dbClient.collection("api_keys");
|
316 |
-
const apiKey = req.
|
317 |
try {
|
318 |
if (!apiKey) {
|
319 |
return res.status(400).json({ error: "Missing API key" });
|
@@ -325,7 +325,7 @@ AntibanRoutes.get("/api/v1/user/api-key-info", apiLimiter, async (req, res) => {
|
|
325 |
res.json({
|
326 |
owner_id: existingUserKey.owner,
|
327 |
key: existingUserKey.key,
|
328 |
-
ip_addresses: existingUserKey.ip_addresses ||
|
329 |
});
|
330 |
} catch (error) {
|
331 |
res.status(500).json({ error: "Failed to fetch user info" });
|
|
|
310 |
res.json({ user_id: userId, estimated_creation: result });
|
311 |
});
|
312 |
|
313 |
+
AntibanRoutes.get("/api/v1/user/api-key-info", authenticateApiKey, apiLimiter, async (req, res) => {
|
314 |
const dbClient = new Database("AkenoXJs");
|
315 |
const collectionKey = dbClient.collection("api_keys");
|
316 |
+
const apiKey = req.headers["x-api-key"];
|
317 |
try {
|
318 |
if (!apiKey) {
|
319 |
return res.status(400).json({ error: "Missing API key" });
|
|
|
325 |
res.json({
|
326 |
owner_id: existingUserKey.owner,
|
327 |
key: existingUserKey.key,
|
328 |
+
ip_addresses: existingUserKey.ip_addresses || []
|
329 |
});
|
330 |
} catch (error) {
|
331 |
res.status(500).json({ error: "Failed to fetch user info" });
|