Use bundled images instead of old webroot files

This commit is contained in:
Gabe Kangas
2022-06-20 21:43:53 -07:00
parent d3a5ebd4be
commit 18a184eeb7
168 changed files with 164 additions and 260 deletions

View File

@@ -2,6 +2,7 @@ package data
import (
"errors"
"os"
"path/filepath"
"sort"
"strings"
@@ -9,6 +10,7 @@ import (
"github.com/owncast/owncast/config"
"github.com/owncast/owncast/models"
"github.com/owncast/owncast/static"
"github.com/owncast/owncast/utils"
log "github.com/sirupsen/logrus"
)
@@ -583,12 +585,10 @@ func VerifySettings() error {
logoPath := GetLogoPath()
if !utils.DoesFileExists(filepath.Join(config.DataDirectory, logoPath)) {
defaultLogo := filepath.Join(config.WebRoot, "img/logo.svg")
log.Traceln(logoPath, "not found in the data directory. copying a default logo.")
if err := utils.Copy(defaultLogo, filepath.Join(config.DataDirectory, "logo.svg")); err != nil {
log.Errorln("error copying default logo: ", err)
}
if err := SetLogoPath("logo.svg"); err != nil {
logo := static.GetLogo()
os.WriteFile(filepath.Join(config.DataDirectory, "logo.png"), logo, 0o600)
if err := SetLogoPath("logo.png"); err != nil {
log.Errorln("unable to set default logo to logo.svg", err)
}
}