fix: 允许同源嵌入实时监看播放器 (#54)

This commit is contained in:
QiuSW
2026-08-13 15:23:42 +08:00
parent 825d64a9d6
commit 36964427fc
2 changed files with 44 additions and 1 deletions
+5 -1
View File
@@ -61,6 +61,10 @@ func (m *Module) player(w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Header().Set("Cache-Control", "no-store")
w.Header().Set("Content-Security-Policy", "default-src 'none'; frame-src http: https:; style-src 'unsafe-inline'")
// This endpoint is the authenticated, same-origin wrapper loaded by the
// live-view page. Keep the global DENY policy everywhere else, and allow
// only Sense itself to embed this wrapper.
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
w.Header().Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'self'; frame-src http: https:; style-src 'unsafe-inline'")
_ = playerTemplate.Execute(w, target)
}