Disable caching of some GET apis. Closes #1530

This commit is contained in:
Gabe Kangas
2021-11-16 20:58:03 -08:00
parent dc664af3c0
commit 1873151390
5 changed files with 13 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/owncast/owncast/core/data"
"github.com/owncast/owncast/core/transcoder"
"github.com/owncast/owncast/models"
"github.com/owncast/owncast/router/middleware"
"github.com/owncast/owncast/utils"
log "github.com/sirupsen/logrus"
)
@@ -17,7 +18,7 @@ func GetServerConfig(w http.ResponseWriter, r *http.Request) {
ffmpeg := utils.ValidatedFfmpegPath(data.GetFfMpegPath())
usernameBlocklist := data.GetForbiddenUsernameList()
var videoQualityVariants = make([]models.StreamOutputVariant, 0)
videoQualityVariants := make([]models.StreamOutputVariant, 0)
for _, variant := range data.GetStreamOutputVariants() {
videoQualityVariants = append(videoQualityVariants, models.StreamOutputVariant{
Name: variant.GetName(),
@@ -66,6 +67,8 @@ func GetServerConfig(w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Type", "application/json")
middleware.DisableCache(w)
if err := json.NewEncoder(w).Encode(response); err != nil {
log.Errorln(err)
}

View File

@@ -7,6 +7,7 @@ import (
"github.com/owncast/owncast/core"
"github.com/owncast/owncast/core/data"
"github.com/owncast/owncast/models"
"github.com/owncast/owncast/router/middleware"
log "github.com/sirupsen/logrus"
)
@@ -28,6 +29,8 @@ func Status(w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Type", "application/json")
middleware.DisableCache(w)
err := json.NewEncoder(w).Encode(response)
if err != nil {
log.Errorln(err)