Spaces:
Running
Running
Update server.js
Browse files
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 |
-
|
|
|
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) {
|