Add support for overriding embedded offline.ts. Closes #1507
This commit is contained in:
parent
6ffa020c5f
commit
676aa96f40
14
static/static.go
vendored
14
static/static.go
vendored
@ -3,6 +3,8 @@ package static
|
|||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed admin/*
|
//go:embed admin/*
|
||||||
@ -32,5 +34,15 @@ var offlineVideoSegment []byte
|
|||||||
|
|
||||||
// GetOfflineSegment will return the offline video segment data.
|
// GetOfflineSegment will return the offline video segment data.
|
||||||
func GetOfflineSegment() []byte {
|
func GetOfflineSegment() []byte {
|
||||||
return offlineVideoSegment
|
return getFileSystemStaticFileOrDefault("offline.ts", offlineVideoSegment)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFileSystemStaticFileOrDefault(path string, defaultData []byte) []byte {
|
||||||
|
fullPath := filepath.Join("static", path)
|
||||||
|
data, err := os.ReadFile(fullPath) //nolint: gosec
|
||||||
|
if err != nil {
|
||||||
|
return defaultData
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user