randydev commited on
Commit
8908823
·
verified ·
1 Parent(s): 280c5dd

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +3 -2
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() + 5000);
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";