mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-09 00:10:10 +01:00
defe6054b3
* Autodocument Swagger API with JSDocs on /v1/ endpoints for API access implement single-player API keys WIP Admin API Keys * Create new api keys as both single and multi-user * Add boot and telem * Complete Admin API * Complete endpoints dark mode swagger * update docs * undo debug * update docs and readme
34 lines
848 B
JavaScript
34 lines
848 B
JavaScript
const { validApiKey } = require("../../../utils/middleware/validApiKey");
|
|
|
|
function apiAuthEndpoints(app) {
|
|
if (!app) return;
|
|
|
|
app.get("/v1/auth", [validApiKey], (_, response) => {
|
|
/*
|
|
#swagger.tags = ['Authentication']
|
|
#swagger.description = 'Verify the attached Authentication header contains a valid API token.'
|
|
#swagger.responses[200] = {
|
|
description: 'Valid auth token was found.',
|
|
content: {
|
|
"application/json": {
|
|
schema: {
|
|
type: 'object',
|
|
example: {
|
|
authenticated: true,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#swagger.responses[403] = {
|
|
schema: {
|
|
"$ref": "#/definitions/InvalidAPIKey"
|
|
}
|
|
}
|
|
*/
|
|
response.status(200).json({ authenticated: true });
|
|
});
|
|
}
|
|
|
|
module.exports = { apiAuthEndpoints };
|