remove trailing slashes from api

use correct handler to provide server logs
remove Baerer from Authorization header to compare it with known tokens
fix wings-api.paw routes
This commit is contained in:
Jakob Schrettenbrunner
2018-05-17 21:18:02 +02:00
parent 09da18f42e
commit 53a3fbc464
5 changed files with 11 additions and 12 deletions

View File

@@ -51,7 +51,7 @@ func (api *InternalAPI) Listen() {
func (api *InternalAPI) register() {
v1 := api.router.Group("/api/v1")
{
v1.GET("/", AuthHandler(""), GetIndex)
v1.GET("", AuthHandler(""), GetIndex)
//v1.PATCH("/config", AuthHandler("c:config"), PatchConfiguration)
v1.GET("/servers", AuthHandler("c:list"), handleGetServers)
@@ -59,15 +59,15 @@ func (api *InternalAPI) register() {
v1ServerRoutes := v1.Group("/servers/:server")
{
v1ServerRoutes.GET("/", AuthHandler("s:get"), handleGetServer)
v1ServerRoutes.PATCH("/", AuthHandler("s:config"), handlePatchServer)
v1ServerRoutes.DELETE("/", AuthHandler("g:server:delete"), handleDeleteServer)
v1ServerRoutes.GET("", AuthHandler("s:get"), handleGetServer)
v1ServerRoutes.PATCH("", AuthHandler("s:config"), handlePatchServer)
v1ServerRoutes.DELETE("", AuthHandler("g:server:delete"), handleDeleteServer)
v1ServerRoutes.POST("/reinstall", AuthHandler("s:install-server"), handlePostServerReinstall)
v1ServerRoutes.POST("/rebuild", AuthHandler("g:server:rebuild"), handlePostServerRebuild)
v1ServerRoutes.POST("/password", AuthHandler(""), handlePostServerPassword)
v1ServerRoutes.POST("/power", AuthHandler("s:power"), handlePostServerPower)
v1ServerRoutes.POST("/command", AuthHandler("s:command"), handlePostServerCommand)
v1ServerRoutes.GET("/log", AuthHandler("s:console"), handleGetServerLog)
v1ServerRoutes.GET("/log", AuthHandler("s:console"), handleGetConsole)
v1ServerRoutes.POST("/suspend", AuthHandler(""), handlePostServerSuspend)
v1ServerRoutes.POST("/unsuspend", AuthHandler(""), handlePostServerUnsuspend)
}