1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package main
- import (
- "encoding/json"
- "net/http"
- "strconv"
- "aytechnology.us/gominecraft/mod/mc"
- )
- func ReadLog(w http.ResponseWriter, r *http.Request) {
- log := MCServer.ReadAllLog()
- jsonData, _ := json.Marshal(log)
- sendJSONResponse(w, string(jsonData))
- }
- func ReadLogFrom(w http.ResponseWriter, r *http.Request) {
- start, _ := mv(r, "start", false)
- startInt, _ := strconv.Atoi(start)
- end := MCServer.LenLog()
- if startInt > MCServer.LenLog()-1 {
- sendJSONResponse(w, "[]")
- } else {
- log := MCServer.ReadRangeLog(startInt, end)
- jsonData, _ := json.Marshal(log)
- sendJSONResponse(w, string(jsonData))
- }
- }
- func ReadBanIP(w http.ResponseWriter, r *http.Request) {
- config := Config.ReadAllBannedIPs()
- jsonData, _ := json.Marshal(config)
- sendJSONResponse(w, string(jsonData))
- }
- func ReadBanPlayer(w http.ResponseWriter, r *http.Request) {
- config := Config.ReadAllBannedPlayers()
- for _, item := range config {
- skin := mc.NewHandler(item.UUID, serverConfig.Folder+"/skin/")
- skin.DownloadSkin()
- }
- jsonData, _ := json.Marshal(config)
- sendJSONResponse(w, string(jsonData))
- }
- func ReadEULA(w http.ResponseWriter, r *http.Request) {
- config := Config.ReadEULA()
- jsonData, _ := json.Marshal(config)
- sendJSONResponse(w, string(jsonData))
- }
- func ReadOps(w http.ResponseWriter, r *http.Request) {
- config := Config.ReadAllOps()
- for _, item := range config {
- skin := mc.NewHandler(item.UUID, serverConfig.Folder+"/skin/")
- skin.DownloadSkin()
- }
- jsonData, _ := json.Marshal(config)
- sendJSONResponse(w, string(jsonData))
- }
- func ReadProperties(w http.ResponseWriter, r *http.Request) {
- config := Config.ReadAllProperties()
- jsonData, _ := json.Marshal(config)
- sendJSONResponse(w, string(jsonData))
- }
- func ReadWhitelist(w http.ResponseWriter, r *http.Request) {
- config := Config.ReadAllWhitelists()
- for _, item := range config {
- skin := mc.NewHandler(item.UUID, serverConfig.Folder+"/skin/")
- skin.DownloadSkin()
- }
- jsonData, _ := json.Marshal(config)
- sendJSONResponse(w, string(jsonData))
- }
|