pre cw with probe and a bunch script to read game behavior
This commit is contained in:
1 parent
5120219ae2
commit
da8a32f60d
310 files changed
+219693
-872
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package sdkserver
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"gac-hkrpg-go/internal/common"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func apiToolSession(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost {
|
||||
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
var req struct {
|
||||
Connected bool `json:"connected"`
|
||||
Client string `json:"client"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil || (r.Header.Get("X-GaC-Srtool") != "1" && req.Client != "GaC-Srtool") {
|
||||
http.Error(w, "explicit Srtool connection required", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
seconds, err := common.SetSrtoolConnection(req.Connected)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
writeJSON(w, map[string]any{"status": 200, "connected": req.Connected, "lease_seconds": seconds})
|
||||
}
|
||||
Reference in new issue
Block a user