fullpwerr commited on
Commit
3bc9ec5
·
1 Parent(s): 9f94caa
Files changed (1) hide show
  1. app.js +2 -1
app.js CHANGED
@@ -57,7 +57,8 @@ app.post("/upload", upload.single("file"), (req, res) => {
57
  }
58
 
59
  const filePath = req.file.filename;
60
- const expiresAt = Date.now() + EXPIRATION_TIME;
 
61
  fileData[filePath] = expiresAt;
62
  fs.writeFile(META_FILE, JSON.stringify(fileData, null, 2), (err) => {
63
  if (err) console.error("Gagal menulis ke api.json:", err);
 
57
  }
58
 
59
  const filePath = req.file.filename;
60
+ const customExpiration = req.body.expires_in ? parseInt(req.body.expires_in) * 1000 : EXPIRATION_TIME;
61
+ const expiresAt = Date.now() + customExpiration;
62
  fileData[filePath] = expiresAt;
63
  fs.writeFile(META_FILE, JSON.stringify(fileData, null, 2), (err) => {
64
  if (err) console.error("Gagal menulis ke api.json:", err);