|
|
@@ -7,44 +7,45 @@ import (
|
|
|
)
|
|
|
|
|
|
func AddBanIP(w http.ResponseWriter, r *http.Request) {
|
|
|
- t := time.Now()
|
|
|
-
|
|
|
- IP, _ := mv(r, "IP", false)
|
|
|
- Created := t.Format("2020-12-19 16:00:01 -0800")
|
|
|
+ IP, _ := mv(r, "ip", false)
|
|
|
+ Created := currentTime()
|
|
|
Source := "ArOZ Minecraft Terminal"
|
|
|
Expires := "forever"
|
|
|
- Reason, _ := mv(r, "Reason", false)
|
|
|
+ Reason, _ := mv(r, "reason", false)
|
|
|
Config.WriteBannedIP(IP, Created, Source, Expires, Reason)
|
|
|
sendJSONResponse(w, "OK")
|
|
|
}
|
|
|
|
|
|
func AddBanPlayer(w http.ResponseWriter, r *http.Request) {
|
|
|
- t := time.Now()
|
|
|
-
|
|
|
- UUID, _ := mv(r, "UUID", false)
|
|
|
- Name, _ := mv(r, "Name", false)
|
|
|
- Created := t.Format("2020-12-19 16:00:01 -0800")
|
|
|
+ UUID, _ := mv(r, "uuid", false)
|
|
|
+ Name, _ := mv(r, "name", false)
|
|
|
+ Created := currentTime()
|
|
|
Source := "ArOZ Minecraft Terminal"
|
|
|
Expires := "forever"
|
|
|
- Reason, _ := mv(r, "Reason", false)
|
|
|
+ Reason, _ := mv(r, "reason", false)
|
|
|
Config.WriteBannedPlayer(UUID, Name, Created, Source, Expires, Reason)
|
|
|
sendJSONResponse(w, "OK")
|
|
|
}
|
|
|
|
|
|
func AddOps(w http.ResponseWriter, r *http.Request) {
|
|
|
- UUID, _ := mv(r, "UUID", false)
|
|
|
- Name, _ := mv(r, "Name", false)
|
|
|
- Level, _ := mv(r, "Level", false)
|
|
|
+ UUID, _ := mv(r, "uuid", false)
|
|
|
+ Name, _ := mv(r, "name", false)
|
|
|
+ Level, _ := mv(r, "level", false)
|
|
|
LevelI, _ := strconv.Atoi(Level)
|
|
|
- BypassesPlayerLimit, _ := mv(r, "BypassesPlayerLimit", false)
|
|
|
+ BypassesPlayerLimit, _ := mv(r, "bypass", false)
|
|
|
BypassesPlayerLimitB, _ := strconv.ParseBool(BypassesPlayerLimit)
|
|
|
Config.WriteOps(UUID, Name, LevelI, BypassesPlayerLimitB)
|
|
|
sendJSONResponse(w, "OK")
|
|
|
}
|
|
|
|
|
|
func AddWhitelist(w http.ResponseWriter, r *http.Request) {
|
|
|
- UUID, _ := mv(r, "UUID", false)
|
|
|
- Name, _ := mv(r, "Name", false)
|
|
|
+ UUID, _ := mv(r, "uuid", false)
|
|
|
+ Name, _ := mv(r, "name", false)
|
|
|
Config.WriteWhitelist(UUID, Name)
|
|
|
sendJSONResponse(w, "OK")
|
|
|
}
|
|
|
+
|
|
|
+func currentTime() string {
|
|
|
+ t := time.Now()
|
|
|
+ return t.Format("2006-01-02 15:04:05 -0700")
|
|
|
+}
|