fix for external attachments not having xid anymore
Ted Unangst tedu@tedunangst.com
Thu, 01 Oct 2020 13:18:05 -0400
3 files changed,
12 insertions(+),
8 deletions(-)
M
database.go
→
database.go
@@ -401,6 +401,7 @@ if err != nil {
log.Printf("error scanning donk: %s", err) continue } + d.External = !strings.HasPrefix(d.URL, serverPrefix) h := hmap[hid] h.Donks = append(h.Donks, d) }
M
honk.go
→
honk.go
@@ -156,13 +156,14 @@ return honk.Flags&flagIsReacted != 0
} type Donk struct { - FileID int64 - XID string - Name string - Desc string - URL string - Media string - Local bool + FileID int64 + XID string + Name string + Desc string + URL string + Media string + Local bool + External bool } type Place struct {@@ -231,6 +232,7 @@ SomeCollection
) var serverName string +var serverPrefix string var masqName string var dataDir = "." var viewDir = "."@@ -281,6 +283,7 @@ getconfig("masqname", &masqName)
if masqName == "" { masqName = serverName } + serverPrefix = fmt.Sprintf("https://%s/", serverName) getconfig("usersep", &userSep) getconfig("honksep", &honkSep) getconfig("debug", &debugMode)
M
views/honk.html
→
views/honk.html
@@ -78,7 +78,7 @@ <p><img src="/d/{{ .XID }}" title="{{ .Desc }}" alt="{{ .Desc }}">
{{ end }} {{ end }} {{ else }} -{{ if .XID }} +{{ if .External }} <p><a href="{{ .URL }}" rel=noreferrer>External Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }} {{ else }} {{ if eq .Media "video/mp4" }}