reorder some calls on renderEvent.

This commit is contained in:
fiatjaf
2023-10-21 14:38:52 -03:00
parent 9d86539349
commit 617cd5882a

View File

@@ -15,9 +15,6 @@ import (
)
func renderEvent(w http.ResponseWriter, r *http.Request) {
fmt.Println(r.URL.Path, "#/", r.Header.Get("user-agent"))
w.Header().Set("Content-Type", "text/html")
code := r.URL.Path[1:] // hopefully a nip19 code
// it's the homepage
@@ -36,6 +33,8 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
return
}
fmt.Println(r.URL.Path, "#/", r.Header.Get("user-agent"))
// force note1 to become nevent1
if strings.HasPrefix(code, "note1") {
_, redirectHex, err := nip19.Decode(code)
@@ -188,6 +187,7 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
// we must do this because inside <blockquotes> we must treat <img>s different when telegram_instant_view
}
w.Header().Set("Content-Type", "text/html")
if data.templateId == TelegramInstantView {
w.Header().Set("Cache-Control", "no-cache")
} else if len(data.content) != 0 {