udpate stuff

This commit is contained in:
2026-06-11 09:48:17 -07:00
parent 6bd80a0b3a
commit a2df93097a
14 changed files with 294 additions and 26 deletions

View File

@@ -105,13 +105,17 @@ func generateID(name, url string) string {
}
// FilterChannels returns channels matching the given search term and/or group.
// Always returns a non-nil slice so it encodes as [] rather than null in JSON.
func FilterChannels(channels []models.Channel, search string, group string) []models.Channel {
if search == "" && group == "" {
if channels == nil {
return []models.Channel{}
}
return channels
}
searchLower := strings.ToLower(search)
var result []models.Channel
result := []models.Channel{}
for _, ch := range channels {
if group != "" && !strings.EqualFold(ch.Group, group) {
@@ -127,9 +131,10 @@ func FilterChannels(channels []models.Channel, search string, group string) []mo
}
// GetGroups returns a deduplicated, sorted list of group names from the channel list.
// Always returns a non-nil slice so it encodes as [] rather than null in JSON.
func GetGroups(channels []models.Channel) []string {
seen := make(map[string]bool)
var groups []string
groups := []string{}
for _, ch := range channels {
if ch.Group != "" && !seen[ch.Group] {