|
@@ -0,0 +1,45 @@
|
|
|
+package main
|
|
|
+
|
|
|
+import (
|
|
|
+ "net/http"
|
|
|
+ "strconv"
|
|
|
+)
|
|
|
+
|
|
|
+func AddBanIP(w http.ResponseWriter, r *http.Request) {
|
|
|
+ IP, _ := mv(r, "IP", false)
|
|
|
+ Created, _ := mv(r, "Created", false)
|
|
|
+ Source, _ := mv(r, "Source", false)
|
|
|
+ Expires, _ := mv(r, "Expires", false)
|
|
|
+ Reason, _ := mv(r, "Reason", false)
|
|
|
+ Config.WriteBannedIP(IP, Created, Source, Expires, Reason)
|
|
|
+ sendJSONResponse(w, "OK")
|
|
|
+}
|
|
|
+
|
|
|
+func AddBanPlayer(w http.ResponseWriter, r *http.Request) {
|
|
|
+ UUID, _ := mv(r, "UUID", false)
|
|
|
+ Name, _ := mv(r, "Name", false)
|
|
|
+ Created, _ := mv(r, "Created", false)
|
|
|
+ Source, _ := mv(r, "Source", false)
|
|
|
+ Expires, _ := mv(r, "Expires", 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)
|
|
|
+ LevelI, _ := strconv.Atoi(Level)
|
|
|
+ BypassesPlayerLimit, _ := mv(r, "BypassesPlayerLimit", 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)
|
|
|
+ Config.WriteWhitelist(UUID, Name)
|
|
|
+ sendJSONResponse(w, "OK")
|
|
|
+}
|