Cleanup some warnings
This commit is contained in:
parent
718d6d312b
commit
86305c3028
@ -8,6 +8,11 @@ import (
|
||||
"github.com/owncast/owncast/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
contentTypeJPEG = "image/jpeg"
|
||||
contentTypeGIF = "image/gif"
|
||||
)
|
||||
|
||||
// GetThumbnail will return the thumbnail image as a response.
|
||||
func GetThumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
imageFilename := "thumbnail.jpg"
|
||||
@ -28,9 +33,8 @@ func GetThumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
contentType := "image/jpeg"
|
||||
cacheTime := utils.GetCacheDurationSecondsForPath(imagePath)
|
||||
writeBytesAsImage(imageBytes, contentType, w, cacheTime)
|
||||
writeBytesAsImage(imageBytes, contentTypeJPEG, w, cacheTime)
|
||||
}
|
||||
|
||||
// GetPreview will return the preview gif as a response.
|
||||
@ -53,7 +57,6 @@ func GetPreview(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
contentType := "image/jpeg"
|
||||
cacheTime := utils.GetCacheDurationSecondsForPath(imagePath)
|
||||
writeBytesAsImage(imageBytes, contentType, w, cacheTime)
|
||||
writeBytesAsImage(imageBytes, contentTypeGIF, w, cacheTime)
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
@ -12,6 +11,7 @@ import (
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/static"
|
||||
"github.com/owncast/owncast/utils"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -587,9 +587,11 @@ func VerifySettings() error {
|
||||
if !utils.DoesFileExists(filepath.Join(config.DataDirectory, logoPath)) {
|
||||
log.Traceln(logoPath, "not found in the data directory. copying a default logo.")
|
||||
logo := static.GetLogo()
|
||||
os.WriteFile(filepath.Join(config.DataDirectory, "logo.png"), logo, 0o600)
|
||||
if err := os.WriteFile(filepath.Join(config.DataDirectory, "logo.png"), logo, 0o600); err != nil {
|
||||
return errors.Wrap(err, "failed to write logo to disk")
|
||||
}
|
||||
if err := SetLogoPath("logo.png"); err != nil {
|
||||
log.Errorln("unable to set default logo to logo.svg", err)
|
||||
return errors.Wrap(err, "failed to save logo filename")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user