fix(db): remove authorization for battery status endpoint

This endpoint is now publicly available without the need of an authorization

Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
2026-05-21 12:47:23 +02:00
parent c34ec94a6b
commit 022fb97153
2 changed files with 4 additions and 2 deletions

View File

@@ -18,4 +18,3 @@ Authorization: Basic {{username}} {{password}}
### GET battery status of all devices
GET {{host}}/api/v1/battery
Authorization: Basic {{username}} {{password}}

View File

@@ -63,6 +63,10 @@ func (g *RestGateway) setupRoutes() {
g.engine.Use(cors.New(corsConfig))
v1 := g.engine.Group("/api/v1")
// Public endpoints (no auth required)
v1.GET("/battery", g.getBattery)
if g.username != "" && g.password != "" {
v1.Use(gin.BasicAuth(gin.Accounts{
g.username: g.password,
@@ -73,7 +77,6 @@ func (g *RestGateway) setupRoutes() {
v1.GET("/rooms", g.getRooms)
v1.GET("/rooms/:room-id/current", g.getRoomCurrent)
v1.GET("/rooms/:room-id/history", g.getRoomHistory)
v1.GET("/battery", g.getBattery)
}
g.engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))