Update index.js
Browse files
index.js
CHANGED
@@ -163,7 +163,7 @@ app.post('/webhook', (req, res) => {
|
|
163 |
res.status(200).send('Webhook received');
|
164 |
});
|
165 |
|
166 |
-
app.delete("/api/v2/delete-key", async (req, res) => {
|
167 |
const apiKey = req.query.api_key;
|
168 |
if (!apiKey) {
|
169 |
return res.status(400).json({ error: "Missing 'api_key' parameter" });
|
@@ -181,7 +181,7 @@ app.delete("/api/v2/delete-key", async (req, res) => {
|
|
181 |
}
|
182 |
});
|
183 |
|
184 |
-
app.delete("/api/v1/delete-key", async (req, res) => {
|
185 |
const dbClient = new Database("AkenoXJs");
|
186 |
const collection = dbClient.collection("api_keys");
|
187 |
const apiKey = req.query.api_key;
|
@@ -208,7 +208,7 @@ app.get("/runtime", async (req, res) => {
|
|
208 |
})
|
209 |
|
210 |
|
211 |
-
app.post('/api/v2/key/generate-key', async (req, res) => {
|
212 |
try {
|
213 |
const newKey = generateAkenoKey();
|
214 |
const userIdNumber = Number(req.query.user_id);
|
@@ -250,7 +250,7 @@ app.post('/api/v2/key/generate-key', async (req, res) => {
|
|
250 |
}
|
251 |
});
|
252 |
|
253 |
-
app.post("/api/v1/key/revoked-key", async (req, res) => {
|
254 |
const dbClient = new Database("AkenoXJs");
|
255 |
const collection = dbClient.collection("api_keys");
|
256 |
|
@@ -300,7 +300,7 @@ app.post("/api/v1/key/revoked-key", async (req, res) => {
|
|
300 |
});
|
301 |
|
302 |
|
303 |
-
app.post("/api/v1/key/api-key-unban", async (req, res) => {
|
304 |
const dbClient = new Database("AkenoXJs");
|
305 |
const collection = dbClient.collection("api_keys");
|
306 |
|
@@ -376,7 +376,7 @@ app.get("/api/v1/key/apikey-banlist", async (req, res) => {
|
|
376 |
}
|
377 |
});
|
378 |
|
379 |
-
app.post("/api/v1/key/api-key-ban", async (req, res) => {
|
380 |
const dbClient = new Database("AkenoXJs");
|
381 |
const collection = dbClient.collection("api_keys");
|
382 |
|
@@ -433,7 +433,7 @@ app.post("/api/v1/key/api-key-ban", async (req, res) => {
|
|
433 |
}
|
434 |
});
|
435 |
|
436 |
-
app.post('/api/v1/key/generate-key', async (req, res) => {
|
437 |
const dbClient = new Database("AkenoXJs");
|
438 |
const collection = dbClient.collection('api_keys');
|
439 |
try {
|
@@ -484,10 +484,6 @@ app.get("/policy", ( req, res ) => {
|
|
484 |
res.sendFile(path.join(__dirname + "/public/policy.html"));
|
485 |
});
|
486 |
|
487 |
-
app.get("/scraper/read", ( req, res ) => {
|
488 |
-
res.sendFile(path.join(__dirname + "/public/docs.html"));
|
489 |
-
});
|
490 |
-
|
491 |
app.use(
|
492 |
'/docs',
|
493 |
serve,
|
|
|
163 |
res.status(200).send('Webhook received');
|
164 |
});
|
165 |
|
166 |
+
app.delete("/api/v2/delete-key", authenticateApiKey, apiLimiter, async (req, res) => {
|
167 |
const apiKey = req.query.api_key;
|
168 |
if (!apiKey) {
|
169 |
return res.status(400).json({ error: "Missing 'api_key' parameter" });
|
|
|
181 |
}
|
182 |
});
|
183 |
|
184 |
+
app.delete("/api/v1/delete-key", authenticateApiKey, apiLimiter, async (req, res) => {
|
185 |
const dbClient = new Database("AkenoXJs");
|
186 |
const collection = dbClient.collection("api_keys");
|
187 |
const apiKey = req.query.api_key;
|
|
|
208 |
})
|
209 |
|
210 |
|
211 |
+
app.post('/api/v2/key/generate-key', authenticateApiKey, apiLimiter, async (req, res) => {
|
212 |
try {
|
213 |
const newKey = generateAkenoKey();
|
214 |
const userIdNumber = Number(req.query.user_id);
|
|
|
250 |
}
|
251 |
});
|
252 |
|
253 |
+
app.post("/api/v1/key/revoked-key", authenticateApiKey, apiLimiter, async (req, res) => {
|
254 |
const dbClient = new Database("AkenoXJs");
|
255 |
const collection = dbClient.collection("api_keys");
|
256 |
|
|
|
300 |
});
|
301 |
|
302 |
|
303 |
+
app.post("/api/v1/key/api-key-unban", authenticateApiKey, apiLimiter, async (req, res) => {
|
304 |
const dbClient = new Database("AkenoXJs");
|
305 |
const collection = dbClient.collection("api_keys");
|
306 |
|
|
|
376 |
}
|
377 |
});
|
378 |
|
379 |
+
app.post("/api/v1/key/api-key-ban", authenticateApiKey, apiLimiter, async (req, res) => {
|
380 |
const dbClient = new Database("AkenoXJs");
|
381 |
const collection = dbClient.collection("api_keys");
|
382 |
|
|
|
433 |
}
|
434 |
});
|
435 |
|
436 |
+
app.post('/api/v1/key/generate-key', authenticateApiKey, apiLimiter, async (req, res) => {
|
437 |
const dbClient = new Database("AkenoXJs");
|
438 |
const collection = dbClient.collection('api_keys');
|
439 |
try {
|
|
|
484 |
res.sendFile(path.join(__dirname + "/public/policy.html"));
|
485 |
});
|
486 |
|
|
|
|
|
|
|
|
|
487 |
app.use(
|
488 |
'/docs',
|
489 |
serve,
|