File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ package stats
2121import (
2222 "fmt"
2323 "net/http"
24+ "slices"
2425 "strconv"
2526
2627 "github.com/flatgrassdotnet/cloudbox/db"
@@ -53,7 +54,7 @@ func MapLoad(w http.ResponseWriter, r *http.Request) {
5354
5455 // platform ("win32", "linux", or "osx")
5556 platform := utils .UnBinHexString (r .URL .Query ().Get ("platform" ))
56- if ! ( platform == "win32" || platform == "linux" || platform == "osx" ) {
57+ if ! slices . Contains ([] string { "win32" , "linux" , "osx" }, platform ) {
5758 utils .WriteError (w , r , "invalid platform value" )
5859 return
5960 }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ package toyboxapi
2121import (
2222 "fmt"
2323 "net/http"
24+ "slices"
2425
2526 "github.com/flatgrassdotnet/cloudbox/db"
2627 "github.com/flatgrassdotnet/cloudbox/utils"
@@ -48,14 +49,14 @@ func Error(w http.ResponseWriter, r *http.Request) {
4849
4950 // realm ("client", or "server")
5051 realm := utils .UnBinHexString (r .URL .Query ().Get ("realm" ))
51- if ! ( realm == "client" || realm == "server" ) {
52+ if ! slices . Contains ([] string { "client" , "server" }, realm ) {
5253 utils .WriteError (w , r , "invalid realm value" )
5354 return
5455 }
5556
5657 // platform ("win32", "linux", or "osx")
5758 platform := utils .UnBinHexString (r .URL .Query ().Get ("platform" ))
58- if ! ( platform == "win32" || platform == "linux" || platform == "osx" ) {
59+ if ! slices . Contains ([] string { "win32" , "linux" , "osx" }, platform ) {
5960 utils .WriteError (w , r , "invalid platform value" )
6061 return
6162 }
You can’t perform that action at this time.
0 commit comments