Use template.JS for ShareInfo and APlayerScript

Wrap ShareInfo and APlayerScript with template.JS to ensure they are safely injected as JavaScript in templates, preventing potential escaping issues.
This commit is contained in:
Sora 2026-01-20 10:20:10 +08:00
parent 08b5e3bc85
commit 1ddc8ccbf4

View File

@ -183,8 +183,8 @@ func (pub *Router) handleAPlayer(w http.ResponseWriter, r *http.Request) {
data := map[string]interface{}{
"ShareDescription": description,
"ShareInfo": string(shareInfoJSON),
"APlayerScript": string(scriptContent),
"ShareInfo": template.JS(shareInfoJSON),
"APlayerScript": template.JS(scriptContent),
"BaseURL": baseURL,
}