mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-19 17:50:12 +00:00
fix(server-group): hide guest-empty groups from guest listing
listServerGroup returned every group, including ones whose only servers are HideForGuest=true (or that have zero members), to unauthenticated callers. The group name itself is then leaked to guests even though every server it references is hidden from them. Guest visitors now only see groups that contain at least one guest- visible server. Authenticated members and admins keep full visibility (including their own empty groups) so management UI still works. Co-authored-by: cloudcode <cloudcode@users.noreply.github.com>
This commit is contained in:
@@ -58,6 +58,9 @@ func listServerGroup(c *gin.Context) ([]*model.ServerGroupResponseItem, error) {
|
||||
if isMember && !isAdmin && !s.HasPermission(c) {
|
||||
continue
|
||||
}
|
||||
if !isMember && len(groupServers[s.ID]) == 0 {
|
||||
continue
|
||||
}
|
||||
sgRes = append(sgRes, &model.ServerGroupResponseItem{
|
||||
Group: s,
|
||||
Servers: groupServers[s.ID],
|
||||
|
||||
Reference in New Issue
Block a user