Added UrlRandomToken in template data

This commit is contained in:
Andrea Spacca 2021-05-09 09:21:54 +02:00
parent 16e94447f7
commit 0512452111

View File

@ -174,23 +174,25 @@ func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) {
webAddress := resolveWebAddress(r, s.proxyPath, s.proxyPort) webAddress := resolveWebAddress(r, s.proxyPath, s.proxyPort)
data := struct { data := struct {
ContentType string ContentType string
Content html_template.HTML Content html_template.HTML
Filename string Filename string
Url string Url string
UrlGet string UrlGet string
Hostname string UrlRandomToken string
WebAddress string Hostname string
ContentLength uint64 WebAddress string
GAKey string ContentLength uint64
UserVoiceKey string GAKey string
QRCode string UserVoiceKey string
QRCode string
}{ }{
contentType, contentType,
content, content,
filename, filename,
resolvedURL, resolvedURL,
resolvedURLGet, resolvedURLGet,
token,
hostname, hostname,
webAddress, webAddress,
contentLength, contentLength,
@ -1007,7 +1009,6 @@ func (s *Server) getHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-Remaining-Downloads", remainingDownloads) w.Header().Set("X-Remaining-Downloads", remainingDownloads)
w.Header().Set("X-Remaining-Days", remainingDays) w.Header().Set("X-Remaining-Days", remainingDays)
if disposition == "inline" && strings.Contains(contentType, "html") { if disposition == "inline" && strings.Contains(contentType, "html") {
reader = ioutil.NopCloser(bluemonday.UGCPolicy().SanitizeReader(reader)) reader = ioutil.NopCloser(bluemonday.UGCPolicy().SanitizeReader(reader))
} }