fix for external attachments not having xid anymore

This commit is contained in:
Ted Unangst 2020-10-01 13:18:05 -04:00
parent 1e9d1f0fc7
commit a81cf01844
3 changed files with 12 additions and 8 deletions

View File

@ -401,6 +401,7 @@ func donksforhonks(honks []*Honk) {
log.Printf("error scanning donk: %s", err)
continue
}
d.External = !strings.HasPrefix(d.URL, serverPrefix)
h := hmap[hid]
h.Donks = append(h.Donks, d)
}

17
honk.go
View File

@ -156,13 +156,14 @@ func (honk *Honk) IsReacted() bool {
}
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 @@ const (
)
var serverName string
var serverPrefix string
var masqName string
var dataDir = "."
var viewDir = "."
@ -281,6 +283,7 @@ func main() {
if masqName == "" {
masqName = serverName
}
serverPrefix = fmt.Sprintf("https://%s/", serverName)
getconfig("usersep", &userSep)
getconfig("honksep", &honkSep)
getconfig("debug", &debugMode)

View File

@ -78,7 +78,7 @@ in reply to: <a href="{{ .RID }}" rel=noreferrer>{{ .RID }}</a>
{{ 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" }}