123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package main
- import (
- "encoding/json"
- "net/http"
- "strconv"
- )
- 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()
- 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()
- 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()
- jsonData, _ := json.Marshal(config)
- sendJSONResponse(w, string(jsonData))
- }
|