Browse Source

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

pull/918/head
Gabe Kangas 4 years ago committed by GitHub
parent
commit
36be7b76c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      build/release/Dockerfile-build
  2. 1
      build/release/build.sh
  3. 2
      config/constants.go
  4. 12
      core/data/config.go
  5. 1
      data/logo.svg

1
build/release/Dockerfile-build

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

1
build/release/build.sh

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

2
config/constants.go

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

12
core/data/config.go

@ -2,12 +2,14 @@ package data @@ -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 { @@ -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
}

1
data/logo.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.4 KiB

Loading…
Cancel
Save