NAS: Remove deprecated /online endpoint

This commit is contained in:
mkwcat 2024-01-02 18:53:59 -05:00
parent 9cf35793f2
commit 0169c0905f
No known key found for this signature in database
GPG Key ID: 7A505679CE9E7AA9
4 changed files with 0 additions and 34 deletions

View File

@ -1,12 +0,0 @@
package common
var OnlineUsers int
func init(){
OnlineUsers = 0
}
func OnlineStatUpdate(t int) {
OnlineUsers += t
}

View File

@ -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
}

View File

@ -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)

View File

@ -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)))
}