If no logo exists copy a default one into data on launch. Closes #909 (#916)

This commit is contained in:
Gabe Kangas
2021-04-11 16:44:50 -07:00
committed by GitHub
parent 2409cab5b6
commit 36be7b76c2
5 changed files with 14 additions and 3 deletions

View File

@@ -2,12 +2,14 @@ package data
import (
"errors"
"path/filepath"
"sort"
"strings"
"time"
"github.com/owncast/owncast/config"
"github.com/owncast/owncast/models"
"github.com/owncast/owncast/utils"
log "github.com/sirupsen/logrus"
)
@@ -469,6 +471,16 @@ func VerifySettings() error {
return errors.New("no stream key set. Please set one in your config file")
}
logoPath := GetLogoPath()
if !utils.DoesFileExists(filepath.Join(config.DataDirectory, logoPath)) {
defaultLogo := filepath.Join(config.WebRoot, "img/logo.svg")
log.Infoln(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)
}
SetLogoPath("logo.svg")
}
return nil
}