Ayeantics commited on
Commit
72161dc
·
verified ·
1 Parent(s): febb60b

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +4 -1
server.js CHANGED
@@ -47,12 +47,15 @@ function validateModel(req, res, next) {
47
  const modelRequested = req.query.model; // Assuming the model name is passed as a query parameter
48
 
49
  if (!allowedModels.includes(modelRequested)) {
50
- return res.status(403).send(`Access denied for model: ${modelRequested}. This model is not allowed.`);
 
51
  }
52
 
 
53
  next();
54
  }
55
 
 
56
  function authenticateApiKey(req, res, next) {
57
  const receivedApiKey = req.headers['authorization'];
58
  if (!receivedApiKey) {
 
47
  const modelRequested = req.query.model; // Assuming the model name is passed as a query parameter
48
 
49
  if (!allowedModels.includes(modelRequested)) {
50
+ console.log(`Forbidden model access attempted: ${modelRequested}`);
51
+ return res.status(403).send(`Forbidden: Model ${modelRequested} is not allowed.`);
52
  }
53
 
54
+ console.log(`Model ${modelRequested} access granted.`);
55
  next();
56
  }
57
 
58
+
59
  function authenticateApiKey(req, res, next) {
60
  const receivedApiKey = req.headers['authorization'];
61
  if (!receivedApiKey) {