@fudrouter/fsrouter 0.6.117 → 0.6.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -400,13 +400,21 @@ export async function OPTIONS() {
|
|
|
400
400
|
*/
|
|
401
401
|
export async function GET(req, res) {
|
|
402
402
|
try {
|
|
403
|
+
// Require auth: do not publicly expose the model catalog.
|
|
404
|
+
const authHeader = (req.headers && (req.headers.authorization || req.headers.Authorization)) ||
|
|
405
|
+
(typeof req.get === "function" ? req.get("authorization") : undefined);
|
|
406
|
+
if (!authHeader || !/^Bearer\s+/i.test(String(authHeader))) {
|
|
407
|
+
return res.status(401).json({
|
|
408
|
+
error: { message: "Authentication required to list models", type: "authentication_error" },
|
|
409
|
+
});
|
|
410
|
+
}
|
|
403
411
|
const data = await buildModelsList([LLM_KIND]);
|
|
404
|
-
return
|
|
405
|
-
headers: { "Access-Control-Allow-Origin": "*" },
|
|
406
|
-
});
|
|
412
|
+
return res.status(200).json({ object: "list", data });
|
|
407
413
|
}
|
|
408
414
|
catch (error) {
|
|
409
415
|
console.log("Error fetching models:", error);
|
|
410
|
-
return
|
|
416
|
+
return res.status(500).json({
|
|
417
|
+
error: { message: error.message, type: "server_error" },
|
|
418
|
+
});
|
|
411
419
|
}
|
|
412
420
|
}
|