add AUTOMATIC entry to server list API for client compatibility

This commit is contained in:
Reese Norris
2025-05-25 13:52:19 -07:00
parent c0155e78d4
commit 2943735be6
2 changed files with 20 additions and 1 deletions

View File

@@ -145,6 +145,15 @@ func (s *Server) handleGetServersJSON(c *gin.Context) {
ClientsConnectionAllowed: 99,
IsSweatbox: isSweatbox,
},
{
Ident: "AUTOMATIC",
HostnameOrIp: serverHostname,
Location: serverLocation,
Name: serverIdent,
ClientConnectionsAllowed: true,
ClientsConnectionAllowed: 99,
IsSweatbox: isSweatbox,
},
}
res, err := json.Marshal(&dataJson)
@@ -190,6 +199,15 @@ func (s *Server) generateServersTxt() (txt string, err error) {
ClientsConnectionAllowed: 99,
IsSweatbox: false,
},
{
Ident: "AUTOMATIC",
HostnameOrIp: serverHostname,
Location: serverLocation,
Name: serverIdent,
ClientConnectionsAllowed: true,
ClientsConnectionAllowed: 99,
IsSweatbox: false,
},
}
buf := bytes.Buffer{}

View File

@@ -7,6 +7,7 @@ CONNECTED CLIENTS = 1
;
;
!SERVERS:
{{ range . }}{{ .Ident }}:{{ .HostnameOrIp }}:{{ .Location }}:{{ .Ident }}:{{ .ClientsConnectionAllowed }}:{{ end }}
{{ range $index, $element := . }}{{ if $index }}
{{ end }}{{ $element.Ident }}:{{ $element.HostnameOrIp }}:{{ $element.Location }}:{{ $element.Name }}:{{ $element.ClientsConnectionAllowed }}:{{ end }}
;
; END