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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 3 deletions

View file

@ -25,5 +25,4 @@ COPY --from=build /build/owncast /app/owncast
COPY --from=build /build/webroot /app/webroot COPY --from=build /build/webroot /app/webroot
COPY --from=build /build/static /app/static COPY --from=build /build/static /app/static
COPY --from=build /build/data /app/data COPY --from=build /build/data /app/data
COPY --from=build /build/webroot/img/logo.svg app/data/logo.svg
CMD ["/app/owncast"] CMD ["/app/owncast"]

View file

@ -69,7 +69,6 @@ build() {
cp "${TMPDIR}tailwind.min.css" ./dist/${NAME}/webroot/js/web_modules/tailwindcss/dist/tailwind.min.css cp "${TMPDIR}tailwind.min.css" ./dist/${NAME}/webroot/js/web_modules/tailwindcss/dist/tailwind.min.css
cp -R static/ dist/${NAME}/static cp -R static/ dist/${NAME}/static
cp README.md dist/${NAME} cp README.md dist/${NAME}
cp webroot/img/logo.svg dist/${NAME}/data/logo.svg
pushd dist/${NAME} >> /dev/null pushd dist/${NAME} >> /dev/null

View file

@ -17,6 +17,8 @@ const (
FfmpegSuggestedVersion = "v4.1.5" // Requires the v FfmpegSuggestedVersion = "v4.1.5" // Requires the v
// BackupDirectory is the directory we write backup files to. // BackupDirectory is the directory we write backup files to.
BackupDirectory = "backup" BackupDirectory = "backup"
// DataDirectory is the directory we save data to.
DataDirectory = "data"
) )
var ( var (

View file

@ -2,12 +2,14 @@ package data
import ( import (
"errors" "errors"
"path/filepath"
"sort" "sort"
"strings" "strings"
"time" "time"
"github.com/owncast/owncast/config" "github.com/owncast/owncast/config"
"github.com/owncast/owncast/models" "github.com/owncast/owncast/models"
"github.com/owncast/owncast/utils"
log "github.com/sirupsen/logrus" 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") 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 return nil
} }

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.4 KiB