Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Support disabling the web UI with disableWebFeatures. Closes #32
Gabe Kangas3957d405507a
diff --git a/config/config.go b/config/config.goindex db0a3be8db..53badff3f2 100644--- a/config/config.go+++ b/config/config.go@@ -14,16 +14,17 @@ import (var Config *configtype config struct {- IPFS ipfs `yaml:"ipfs"`- PublicHLSPath string `yaml:"publicHLSPath"`- PrivateHLSPath string `yaml:"privateHLSPath"`- VideoSettings videoSettings `yaml:"videoSettings"`- Files files `yaml:"files"`- FFMpegPath string `yaml:"ffmpegPath"`- WebServerPort int `yaml:"webServerPort"`- S3 s3 `yaml:"s3"`- InstanceDetails InstanceDetails `yaml:"instanceDetails"`- VersionInfo string `yaml:"-"`+ IPFS ipfs `yaml:"ipfs"`+ PublicHLSPath string `yaml:"publicHLSPath"`+ PrivateHLSPath string `yaml:"privateHLSPath"`+ VideoSettings videoSettings `yaml:"videoSettings"`+ Files files `yaml:"files"`+ FFMpegPath string `yaml:"ffmpegPath"`+ WebServerPort int `yaml:"webServerPort"`+ S3 s3 `yaml:"s3"`+ InstanceDetails InstanceDetails `yaml:"instanceDetails"`+ VersionInfo string `yaml:"-"`+ DisableWebFeatures bool `yaml:"disableWebFeatures"`}// InstanceDetails defines the user-visible information about this particular instance.diff --git a/controllers/index.go b/controllers/index.goindex e42c2f4a21..932e242d7a 100644--- a/controllers/index.go+++ b/controllers/index.go@@ -29,9 +29,18 @@ type MetadataPage struct {func IndexHandler(w http.ResponseWriter, r *http.Request) {middleware.EnableCors(&w)+ isIndexRequest := r.URL.Path == "/" || r.URL.Path == "/index.html"++ // Reject requests for the web UI if it's disabled.+ if isIndexRequest && config.Config.DisableWebFeatures {+ w.WriteHeader(http.StatusNotFound)+ w.Write([]byte("404 - y u ask 4 this? If this is an error let us know: https://github.com/gabek/owncast/issues"))+ return+ }+ua := user_agent.New(r.UserAgent())- if ua != nil && ua.Bot() && (r.URL.Path == "/" || r.URL.Path == "/index.html") {+ if ua != nil && ua.Bot() && isIndexRequest {handleScraperMetadataPage(w, r)return}diff --git a/router/router.go b/router/router.goindex ac5821c2ec..b310bf19cb 100644--- a/router/router.go+++ b/router/router.go@@ -14,9 +14,6 @@ import (//Start starts the router for the http, ws, and rtmpfunc Start() error {- // websocket chat server- go chat.Start()-// start the rtmp servergo rtmp.Start()@@ -26,11 +23,16 @@ func Start() error {// status of the systemhttp.HandleFunc("/status", controllers.GetStatus)- // chat rest api- http.HandleFunc("/chat", controllers.GetChatMessages)+ if !config.Config.DisableWebFeatures {+ // websocket chat server+ go chat.Start()++ // chat rest api+ http.HandleFunc("/chat", controllers.GetChatMessages)- // web config api- http.HandleFunc("/config", controllers.GetWebConfig)+ // web config api+ http.HandleFunc("/config", controllers.GetWebConfig)+ }port := config.Config.WebServerPort