Update index.js
Browse files
index.js
CHANGED
@@ -279,7 +279,8 @@ app.post("/api/v2/key/upgrade-key", authenticateApiKey, apiLimiter, async (req,
|
|
279 |
try {
|
280 |
const bannedCollection = dbClient.collection("banned_users");
|
281 |
const userIdNumber = Number(req.query.user_id);
|
282 |
-
|
|
|
283 |
if (isNaN(userIdNumber) || userIdNumber === 0) {
|
284 |
return res.status(400).json({ error: "Invalid or missing user_id" });
|
285 |
}
|
@@ -296,7 +297,7 @@ app.post("/api/v2/key/upgrade-key", authenticateApiKey, apiLimiter, async (req,
|
|
296 |
}
|
297 |
|
298 |
const expirationDate = new Date();
|
299 |
-
expirationDate.setDate(expirationDate.getDate() +
|
300 |
|
301 |
existingUser.expiresAt = expirationDate;
|
302 |
existingUser.type = "premium";
|
|
|
279 |
try {
|
280 |
const bannedCollection = dbClient.collection("banned_users");
|
281 |
const userIdNumber = Number(req.query.user_id);
|
282 |
+
const expire_number = Number(req.query.expire) || 0;
|
283 |
+
|
284 |
if (isNaN(userIdNumber) || userIdNumber === 0) {
|
285 |
return res.status(400).json({ error: "Invalid or missing user_id" });
|
286 |
}
|
|
|
297 |
}
|
298 |
|
299 |
const expirationDate = new Date();
|
300 |
+
expirationDate.setDate(expirationDate.getDate() + expire_number);
|
301 |
|
302 |
existingUser.expiresAt = expirationDate;
|
303 |
existingUser.type = "premium";
|