Temporary fix for DDNSDomain leaks (#374)

This commit is contained in:
UUBulb 2024-06-23 15:59:03 +08:00 committed by GitHub
parent cf9bbb5ff4
commit aa9eb533ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -238,9 +238,16 @@ func (cp *commonPage) getServerStat(c *gin.Context) ([]byte, error) {
servers = singleton.SortedServerListForGuest servers = singleton.SortedServerListForGuest
} }
filteredServers := make([]*model.Server, len(servers))
for i, server := range servers {
filteredServer := *server
filteredServer.DDNSDomain = "redacted"
filteredServers[i] = &filteredServer
}
return utils.Json.Marshal(Data{ return utils.Json.Marshal(Data{
Now: time.Now().Unix() * 1000, Now: time.Now().Unix() * 1000,
Servers: servers, Servers: filteredServers,
}) })
}) })
return v.([]byte), err return v.([]byte), err

View File

@ -53,9 +53,7 @@ func ReSortServer() {
for _, s := range ServerList { for _, s := range ServerList {
SortedServerList = append(SortedServerList, s) SortedServerList = append(SortedServerList, s)
if !s.HideForGuest { if !s.HideForGuest {
filteredStat := *s SortedServerListForGuest = append(SortedServerListForGuest, s)
filteredStat.DDNSDomain = "redacted"
SortedServerListForGuest = append(SortedServerListForGuest, &filteredStat)
} }
} }