Embed static resources (#1466)
* Replace pkger with go:embed for bundling the admin. Closes #844 * Remove references to pkged.go * Point tests to use an updated version of Go * Add comment to new exported function * Cleanup * Add a dummy pkged.go to alert people to stop using it. * Add simple browser test to make sure the admin is available and renders * Don't panic * Embed bot/scraper metadata template. Add browser test to validate the rendering of this template. * Use embedded offline.ts segment * Remove placeholder thumbnail as its unnecessary * Remove copying the static directory into the release * Cleanup
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@@ -17,6 +18,7 @@ import (
|
||||
"github.com/owncast/owncast/core/transcoder"
|
||||
"github.com/owncast/owncast/core/webhooks"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/static"
|
||||
"github.com/owncast/owncast/utils"
|
||||
|
||||
"github.com/grafov/m3u8"
|
||||
@@ -84,8 +86,18 @@ func SetStreamAsDisconnected() {
|
||||
_stats.LastConnectTime = nil
|
||||
_broadcaster = nil
|
||||
|
||||
offlineFileData := static.GetOfflineSegment()
|
||||
offlineFilename := "offline.ts"
|
||||
offlineFilePath := "static/" + offlineFilename
|
||||
offlineTmpFile, err := ioutil.TempFile(os.TempDir(), offlineFilename)
|
||||
if err != nil {
|
||||
log.Errorln("unable to create temp file for offline video segment")
|
||||
}
|
||||
|
||||
if _, err = offlineTmpFile.Write(offlineFileData); err != nil {
|
||||
log.Errorln("unable to write offline segment to disk", err)
|
||||
}
|
||||
|
||||
offlineFilePath := offlineTmpFile.Name()
|
||||
|
||||
transcoder.StopThumbnailGenerator()
|
||||
rtmp.Disconnect()
|
||||
|
||||
Reference in New Issue
Block a user