all repos — honk @ fcde0c7e9374af8d7b6027a3d440771ae823ac0e

my fork of honk

fix for external attachments not having xid anymore
Ted Unangst tedu@tedunangst.com
Thu, 01 Oct 2020 13:18:05 -0400
commit

fcde0c7e9374af8d7b6027a3d440771ae823ac0e

parent

c006ccbf34f6ce4addec57279b124f61c834dcf7

3 files changed, 12 insertions(+), 8 deletions(-)

jump to
M database.godatabase.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.gohonk.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.htmlviews/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" }}