mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-04-25 16:23:38 -05:00
NAS: Remove deprecated /online endpoint
This commit is contained in:
parent
9cf35793f2
commit
0169c0905f
|
|
@ -1,12 +0,0 @@
|
|||
package common
|
||||
|
||||
var OnlineUsers int
|
||||
|
||||
func init(){
|
||||
OnlineUsers = 0
|
||||
}
|
||||
|
||||
func OnlineStatUpdate(t int) {
|
||||
OnlineUsers += t
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,6 @@ func handleRequest(conn net.Conn) {
|
|||
conn.Write([]byte(payload))
|
||||
|
||||
logging.Notice(session.ModuleName, "Connection established from", conn.RemoteAddr())
|
||||
common.OnlineStatUpdate(1)
|
||||
|
||||
// Here we go into the listening loop
|
||||
for {
|
||||
|
|
@ -151,12 +150,10 @@ func handleRequest(conn net.Conn) {
|
|||
if errors.Is(err, io.EOF) {
|
||||
// Client closed connection, terminate.
|
||||
logging.Notice(session.ModuleName, "Client closed connection")
|
||||
common.OnlineStatUpdate(-1)
|
||||
return
|
||||
}
|
||||
|
||||
logging.Error(session.ModuleName, "Connection lost")
|
||||
common.OnlineStatUpdate(-1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,12 +75,6 @@ func handleRequest(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
// Check for /online
|
||||
if r.URL.String() == "/online" {
|
||||
returnOnlineStats(w)
|
||||
return
|
||||
}
|
||||
|
||||
// Check for /api/groups
|
||||
if r.URL.Path == "/api/groups" {
|
||||
api.HandleGroups(w, r)
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
package nas
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"wwfc/common"
|
||||
)
|
||||
|
||||
func returnOnlineStats(w http.ResponseWriter) {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
w.Header().Set("Content-Length", strconv.Itoa(len(strconv.Itoa(common.OnlineUsers))))
|
||||
w.Write([]byte(strconv.Itoa(common.OnlineUsers)))
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user