Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ping to OpenAPI Doc #3598

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/controllers/ServerController.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
paths:
/ping:
get:
operationId: ping
summary: Ping the server
description: This endpoint is a simple check to see if the server is operating and responding with JSON correctly.
tags:
- Server
responses:
200:
description: ping OK
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: true
/healthcheck:
get:
operationId: healthcheck
summary: Health check
description: This endpoint is a simple check to see if the server is operating and can respond.
tags:
- Server
responses:
200:
description: healthcheck OK
content: {}
4 changes: 4 additions & 0 deletions docs/root.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ components:
security:
- BearerAuth: []
paths:
/ping:
$ref: './controllers/ServerCONTROLLER.yaml#/paths/~1ping'
/api/authors/{id}:
$ref: './controllers/AuthorController.yaml#/paths/~1api~1authors~1{id}'
/api/authors/{id}/image:
Expand Down Expand Up @@ -90,3 +92,5 @@ tags:
description: Notifications endpoints
- name: Podcasts
description: Podcast endpoints
- name: Server
description: Server endpoints
4 changes: 2 additions & 2 deletions server/controllers/LibraryController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1314,12 +1314,12 @@ class LibraryController {
* @param {NextFunction} next
*/
async middleware(req, res, next) {
if (!req.user.checkCanAccessLibrary(req.params.id)) {
if (!req.user.checkCanAccessLibrary(req.params.id.toLowerCase())) {
Logger.warn(`[LibraryController] Library ${req.params.id} not accessible to user ${req.user.username}`)
return res.sendStatus(403)
}

const library = await Database.libraryModel.findByIdWithFolders(req.params.id)
const library = await Database.libraryModel.findByIdWithFolders(req.params.id.toLowerCase())
if (!library) {
return res.status(404).send('Library not found')
}
Expand Down