Add read-only multi-server API (step 2) + dedupe serverID validation
GET /servers lists registered servers; GET /servers/:id/clients returns that server's client list (filtered in-handler, store.GetClients isn't server-scoped yet - that's a later step). Old routes untouched. Also factors the repeated serverID validation guard in jsondb.go's new server-scoped methods into one validateServerID() helper, per a code simplification review.
This commit is contained in:
@@ -251,6 +251,8 @@ func main() {
|
||||
app.GET(util.BasePath+"/global-settings", handler.GlobalSettings(db), handler.ValidSession, handler.RefreshSession, handler.NeedsAdmin)
|
||||
app.POST(util.BasePath+"/global-settings", handler.GlobalSettingSubmit(db), handler.ValidSession, handler.ContentTypeJson, handler.NeedsAdmin)
|
||||
app.GET(util.BasePath+"/status", handler.Status(db), handler.ValidSession, handler.RefreshSession)
|
||||
app.GET(util.BasePath+"/servers", handler.ListServers(db), handler.ValidSession)
|
||||
app.GET(util.BasePath+"/servers/:id/clients", handler.GetServerClients(db), handler.ValidSession)
|
||||
app.GET(util.BasePath+"/api/clients", handler.GetClients(db), handler.ValidSession)
|
||||
app.GET(util.BasePath+"/api/client/:id", handler.GetClient(db), handler.ValidSession)
|
||||
app.GET(util.BasePath+"/api/machine-ips", handler.MachineIPAddresses(), handler.ValidSession)
|
||||
|
||||
Reference in New Issue
Block a user