From ac728373b738b1d06a07b4c26f3664f76ee1ead8 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Thu, 1 Sep 2022 10:05:06 -0700 Subject: [PATCH] query caps only when using them in response --- net/server/internal/api_getChannels.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/server/internal/api_getChannels.go b/net/server/internal/api_getChannels.go index d123f74a..8029bb5d 100644 --- a/net/server/internal/api_getChannels.go +++ b/net/server/internal/api_getChannels.go @@ -50,10 +50,6 @@ func GetChannels(w http.ResponseWriter, r *http.Request) { } } - video := getBoolConfigValue(CNFEnableVideo, true); - audio := getBoolConfigValue(CNFEnableAudio, true); - image := getBoolConfigValue(CNFEnableImage, true); - response := []*Channel{} tokenType := ParamTokenType(r) if tokenType == APPTokenAgent { @@ -84,6 +80,9 @@ func GetChannels(w http.ResponseWriter, r *http.Request) { if channelRevisionSet { response = append(response, getChannelRevisionModel(&slot, true)) } else if slot.Channel != nil { + video := getBoolConfigValue(CNFEnableVideo, true); + audio := getBoolConfigValue(CNFEnableAudio, true); + image := getBoolConfigValue(CNFEnableImage, true); response = append(response, getChannelModel(&slot, true, true, image, audio, video)) } } @@ -128,6 +127,9 @@ func GetChannels(w http.ResponseWriter, r *http.Request) { if channelRevisionSet { response = append(response, getChannelRevisionModel(&slot, shared)) } else if shared { + video := getBoolConfigValue(CNFEnableVideo, true); + audio := getBoolConfigValue(CNFEnableAudio, true); + image := getBoolConfigValue(CNFEnableImage, true); response = append(response, getChannelModel(&slot, true, false, image, audio, video)) } }