47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package engine
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo"
|
|
)
|
|
|
|
// GetInfo return the relevant repo specific info to the client
|
|
func (Server *GVCServer) GetInfo(context echo.Context) error {
|
|
repo := context.Param("repoName")
|
|
config := Server.Config
|
|
var repoInfo RepoInfoRequest // Create an engine struct that contains basic server info as well as all repo info
|
|
for _, knownRepo := range config.Repos {
|
|
if knownRepo.RepoName == repo {
|
|
repoInfo.BindIP = config.BindIP
|
|
repoInfo.Port = config.Port
|
|
repoInfo.RawPort = config.RawPort
|
|
repoInfo.Version = config.Version
|
|
repoInfo.Repo = knownRepo
|
|
for i := range repoInfo.Repo.KnownClients { // Blank out the client keys
|
|
repoInfo.Repo.KnownClients[i].Key = "REDACTED"
|
|
}
|
|
}
|
|
}
|
|
return context.JSONPretty(http.StatusAccepted, repoInfo, " ")
|
|
}
|
|
|
|
// LockFile just locks the file/folder/wildcard
|
|
func (Server *GVCServer) LockFile(context echo.Context) error {
|
|
fileType := context.Param("type")
|
|
fileName := context.Param("name")
|
|
switch fileType {
|
|
case "file":
|
|
//common.CheckFileTypes(fileName, fileType,)
|
|
fmt.Println("Filename: ", fileName)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Hello just verifies the server is running //TODO remove this, just extra shit we are sending
|
|
func (Server *GVCServer) Hello(context echo.Context) error {
|
|
helloMsg := "server alive"
|
|
return context.JSON(http.StatusOK, helloMsg)
|
|
}
|