web api secret / go fmt

This commit is contained in:
NatureFreshMilk 2019-01-29 18:00:00 +01:00
parent 4f53a7996e
commit 2ae8559a40
3 changed files with 14 additions and 9 deletions

View File

@ -23,7 +23,11 @@ type Config struct {
}
type WebApiConfig struct {
//mapblock debugging
EnableMapblock bool `json:"enablemapblock"`
//mod http bridge secret
SecretKey string `json:"secretkey"`
}
type RenderStateType struct {
@ -72,6 +76,7 @@ func WriteConfig(filename string, cfg *Config) error {
func ParseConfig(filename string) (*Config, error) {
webapi := WebApiConfig{
EnableMapblock: false,
SecretKey: RandStringRunes(16),
}
rstate := RenderStateType{

View File

@ -1,11 +1,11 @@
package player
type Player struct {
X int `json:"x"`
Y int `json:"y"`
Z int `json:"z"`
Name string `json:"name"`
HP int `json:"hp"`
Breath int `json:"breath"`
X int `json:"x"`
Y int `json:"y"`
Z int `json:"z"`
Name string `json:"name"`
HP int `json:"hp"`
Breath int `json:"breath"`
//TODO: stamina, skin, etc
}

View File

@ -1,7 +1,7 @@
package web
import (
"encoding/json"
"encoding/json"
"mapserver/app"
"net/http"
)
@ -11,7 +11,7 @@ type Minetest struct {
}
func (t *Minetest) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
resp.Header().Add("content-type", "application/json")
json.NewEncoder(resp).Encode("stub")
resp.Header().Add("content-type", "application/json")
json.NewEncoder(resp).Encode("stub")
}