Fix hashes for standalone video/chat (#1472)
* Fix hashes for standalone video/chat * Set Header vor embed
This commit is contained in:
@@ -2,19 +2,30 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/owncast/owncast/router/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetChatEmbedreadwrite gets the embed for readwrite chat.
|
// GetChatEmbedreadwrite gets the embed for readwrite chat.
|
||||||
func GetChatEmbedreadwrite(w http.ResponseWriter, r *http.Request) {
|
func GetChatEmbedreadwrite(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Set our global HTTP headers
|
||||||
|
middleware.SetHeaders(w)
|
||||||
|
|
||||||
http.ServeFile(w, r, "webroot/index-standalone-chat-readwrite.html")
|
http.ServeFile(w, r, "webroot/index-standalone-chat-readwrite.html")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetChatEmbedreadonly gets the embed for readonly chat.
|
// GetChatEmbedreadonly gets the embed for readonly chat.
|
||||||
func GetChatEmbedreadonly(w http.ResponseWriter, r *http.Request) {
|
func GetChatEmbedreadonly(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Set our global HTTP headers
|
||||||
|
middleware.SetHeaders(w)
|
||||||
|
|
||||||
http.ServeFile(w, r, "webroot/index-standalone-chat-readonly.html")
|
http.ServeFile(w, r, "webroot/index-standalone-chat-readonly.html")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetVideoEmbed gets the embed for video.
|
// GetVideoEmbed gets the embed for video.
|
||||||
func GetVideoEmbed(w http.ResponseWriter, r *http.Request) {
|
func GetVideoEmbed(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Set our global HTTP headers
|
||||||
|
middleware.SetHeaders(w)
|
||||||
|
|
||||||
http.ServeFile(w, r, "webroot/index-video-only.html")
|
http.ServeFile(w, r, "webroot/index-video-only.html")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func SetHeaders(w http.ResponseWriter) {
|
|||||||
}
|
}
|
||||||
// Content security policy
|
// Content security policy
|
||||||
csp := []string{
|
csp := []string{
|
||||||
fmt.Sprintf("script-src 'self' %s 'sha256-2HPCfJIJHnY0NrRDPTOdC7AOSJIcQyNxzUuut3TsYRY=' 'sha256-qYEKg5UMg/KbbMBkyPIGsxtkfn/safeLBT08DK3592g=' 'sha256-2erOadwY1DsoNdxVjGlxldMJrFEUzr5sLDdB8lmm9m8=' 'sha256-DgrU+KwEGMFcB8B2ZdQyuxWWvTm7LeGpc+8SkxbSxGA='", unsafeEval),
|
fmt.Sprintf("script-src 'self' %s 'sha256-2HPCfJIJHnY0NrRDPTOdC7AOSJIcQyNxzUuut3TsYRY=' 'sha256-PzXGlTLvNFZ7et6GkP2nD3XuSaAKQVBSYiHzU2ZKm8o=' 'sha256-/wqazZOqIpFSIrNVseblbKCXrezG73X7CMqRSTf+8zw=' 'sha256-jCj2f+ICtd8fvdb0ngc+Hkr/ZnZOMvNkikno/XR6VZs='", unsafeEval),
|
||||||
"worker-src 'self' blob:", // No single quotes around blob:
|
"worker-src 'self' blob:", // No single quotes around blob:
|
||||||
}
|
}
|
||||||
w.Header().Set("Content-Security-Policy", strings.Join(csp, "; "))
|
w.Header().Set("Content-Security-Policy", strings.Join(csp, "; "))
|
||||||
|
|||||||
Reference in New Issue
Block a user