fix some merge fails
This commit is contained in:
parent
659dbcb8c3
commit
72ac95267b
|
@ -21,15 +21,12 @@ func NewAPI() InternalAPI {
|
|||
|
||||
// Configure the API and begin listening on the configured IP and Port.
|
||||
func (api *InternalAPI) Listen() {
|
||||
listener := fmt.Sprintf("%s:%d", viper.GetString(config.APIHost), viper.GetInt(config.APIPort))
|
||||
|
||||
if !viper.GetBool(config.Debug) {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
}
|
||||
|
||||
api.router = gin.Default()
|
||||
api.router.RedirectTrailingSlash = false
|
||||
api.RegisterRoutes()
|
||||
|
||||
api.router.Use(func(c *gin.Context) {
|
||||
c.Header("Access-Control-Allow-Origin", "*")
|
||||
|
@ -40,7 +37,7 @@ func (api *InternalAPI) Listen() {
|
|||
c.Header("Access-Control-Allow-Headers", "X-Access-Token")
|
||||
})
|
||||
|
||||
api.registerRoutes()
|
||||
api.RegisterRoutes()
|
||||
|
||||
listenString := fmt.Sprintf("%s:%d", viper.GetString(config.APIHost), viper.GetInt(config.APIPort))
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ type incomingConfiguration struct {
|
|||
}
|
||||
|
||||
// handlePatchConfig handles PATCH /config
|
||||
func handlePatchConfig(c *gin.Context) {
|
||||
func PatchConfiguration(c *gin.Context) {
|
||||
// reqBody, err := ioutil.ReadAll(c.Request.Body)
|
||||
// if err != nil {
|
||||
// log.WithError(err).Error("Failed to read input.")
|
||||
|
|
|
@ -5,7 +5,7 @@ func (api *InternalAPI) RegisterRoutes() {
|
|||
// the existing Nodejs Daemon API.
|
||||
v1 := api.router.Group("/v1")
|
||||
{
|
||||
v1.GET("/", AuthHandler(""), GetIndex)
|
||||
v1.GET("", AuthHandler(""), GetIndex)
|
||||
v1.PATCH("/config", AuthHandler("c:config"), PatchConfiguration)
|
||||
|
||||
v1.GET("/servers", AuthHandler("c:list"), handleGetServers)
|
||||
|
@ -13,9 +13,9 @@ func (api *InternalAPI) RegisterRoutes() {
|
|||
|
||||
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)
|
||||
|
@ -26,24 +26,24 @@ func (api *InternalAPI) RegisterRoutes() {
|
|||
v1ServerRoutes.POST("/unsuspend", AuthHandler(""), handlePostServerUnsuspend)
|
||||
}
|
||||
|
||||
v1ServerFileRoutes := v1.Group("/servers/:server/files")
|
||||
{
|
||||
v1ServerFileRoutes.GET("/file/:file", AuthHandler("s:files:read"), handleGetFile)
|
||||
v1ServerFileRoutes.GET("/stat/:file", AuthHandler("s:files:"), handleGetFileStat)
|
||||
v1ServerFileRoutes.GET("/dir/:directory", AuthHandler("s:files:get"), handleGetDirectory)
|
||||
|
||||
v1ServerFileRoutes.POST("/dir/:directory", AuthHandler("s:files:create"), handlePostFilesFolder)
|
||||
v1ServerFileRoutes.POST("/file/:file", AuthHandler("s:files:post"), handlePostFile)
|
||||
|
||||
v1ServerFileRoutes.POST("/copy/:file", AuthHandler("s:files:copy"), handlePostFileCopy)
|
||||
v1ServerFileRoutes.POST("/move/:file", AuthHandler("s:files:move"), handlePostFileMove)
|
||||
v1ServerFileRoutes.POST("/rename/:file", AuthHandler("s:files:move"), handlePostFileMove)
|
||||
v1ServerFileRoutes.POST("/compress/:file", AuthHandler("s:files:compress"), handlePostFileCompress)
|
||||
v1ServerFileRoutes.POST("/decompress/:file", AuthHandler("s:files:decompress"), handlePostFileDecompress)
|
||||
|
||||
v1ServerFileRoutes.DELETE("/file/:file", AuthHandler("s:files:delete"), handleDeleteFile)
|
||||
|
||||
v1ServerFileRoutes.GET("/download/:token", handleGetDownloadFile)
|
||||
}
|
||||
//v1ServerFileRoutes := v1.Group("/servers/:server/files")
|
||||
//{
|
||||
// v1ServerFileRoutes.GET("/file/:file", AuthHandler("s:files:read"), handleGetFile)
|
||||
// v1ServerFileRoutes.GET("/stat/:file", AuthHandler("s:files:"), handleGetFileStat)
|
||||
// v1ServerFileRoutes.GET("/dir/:directory", AuthHandler("s:files:get"), handleGetDirectory)
|
||||
//
|
||||
// v1ServerFileRoutes.POST("/dir/:directory", AuthHandler("s:files:create"), handlePostFilesFolder)
|
||||
// v1ServerFileRoutes.POST("/file/:file", AuthHandler("s:files:post"), handlePostFile)
|
||||
//
|
||||
// v1ServerFileRoutes.POST("/copy/:file", AuthHandler("s:files:copy"), handlePostFileCopy)
|
||||
// v1ServerFileRoutes.POST("/move/:file", AuthHandler("s:files:move"), handlePostFileMove)
|
||||
// v1ServerFileRoutes.POST("/rename/:file", AuthHandler("s:files:move"), handlePostFileMove)
|
||||
// v1ServerFileRoutes.POST("/compress/:file", AuthHandler("s:files:compress"), handlePostFileCompress)
|
||||
// v1ServerFileRoutes.POST("/decompress/:file", AuthHandler("s:files:decompress"), handlePostFileDecompress)
|
||||
//
|
||||
// v1ServerFileRoutes.DELETE("/file/:file", AuthHandler("s:files:delete"), handleDeleteFile)
|
||||
//
|
||||
// v1ServerFileRoutes.GET("/download/:token", handleGetDownloadFile)
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@ func Execute() {
|
|||
}
|
||||
|
||||
func run(cmd *cobra.Command, args []string) {
|
||||
tools.InitLogging()
|
||||
utils.InitLogging()
|
||||
log.Info("Loading configuration...")
|
||||
if err := config.LoadConfiguration(configPath); err != nil {
|
||||
log.WithError(err).Fatal("Failed to find configuration file")
|
||||
}
|
||||
tools.ConfigureLogging()
|
||||
utils.ConfigureLogging()
|
||||
|
||||
log.Info(` ____`)
|
||||
log.Info(`__ Pterodactyl _____/___/_______ _______ ______`)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package tools
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
|
Loading…
Reference in New Issue
Block a user