Reaperxxxx commited on
Commit
fc76d1e
·
verified ·
1 Parent(s): c7e66a1

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +4 -2
server.js CHANGED
@@ -61,14 +61,16 @@ app.get('/q', (req, res) => {
61
  const filemoonUrl = req.query.q;
62
 
63
  if (!filemoonUrl || !filemoonUrl.startsWith('https://filemoon.')) {
64
- return res.status(400).send('Invalid or missing Filemoon URL.');
65
  }
66
 
67
  // Generate a random 16-character hex path
68
  const randomPath = crypto.randomBytes(8).toString('hex');
69
 
70
  urlMap.set(randomPath, filemoonUrl);
71
- res.send(`${req.protocol}://${req.get('host')}/${randomPath}`);
 
 
72
  });
73
 
74
  // Dynamic route to serve the embedded Filemoon player
 
61
  const filemoonUrl = req.query.q;
62
 
63
  if (!filemoonUrl || !filemoonUrl.startsWith('https://filemoon.')) {
64
+ return res.status(400).json({ error: 'Invalid or missing Filemoon URL.' });
65
  }
66
 
67
  // Generate a random 16-character hex path
68
  const randomPath = crypto.randomBytes(8).toString('hex');
69
 
70
  urlMap.set(randomPath, filemoonUrl);
71
+ const fullUrl = `${req.protocol}://${req.get('host')}/vid/${randomPath}`;
72
+
73
+ res.json({ url: fullUrl });
74
  });
75
 
76
  // Dynamic route to serve the embedded Filemoon player