feat: adhere to image loading preference
This commit is contained in:
parent
10946dcafb
commit
fb7dc85905
@ -141,13 +141,20 @@ func ViewQuestion(c *gin.Context) {
|
||||
answers = append(answers, template.HTML(answerBodyHTML))
|
||||
})
|
||||
|
||||
imagePolicy := "https:"
|
||||
|
||||
if c.MustGet("disable_images").(bool) {
|
||||
imagePolicy = "'none'"
|
||||
}
|
||||
|
||||
c.HTML(200, "question.html", gin.H{
|
||||
"title": questionText,
|
||||
"body": template.HTML(questionBodyParentHTML),
|
||||
"timestamp": questionTimestamp,
|
||||
"author": questionAuthor,
|
||||
"authorURL": questionAuthorURL,
|
||||
"answers": answers,
|
||||
"title": questionText,
|
||||
"body": template.HTML(questionBodyParentHTML),
|
||||
"timestamp": questionTimestamp,
|
||||
"author": questionAuthor,
|
||||
"authorURL": questionAuthorURL,
|
||||
"answers": answers,
|
||||
"imagePolicy": imagePolicy,
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; style-src 'self'; script-src 'none'; img-src https:;"
|
||||
content="default-src 'none'; style-src 'self'; script-src 'none'; img-src {{ .imagePolicy }};"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
|
Loading…
x
Reference in New Issue
Block a user