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)
}

View File

@ -163,6 +163,7 @@ type Donk struct {
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" }}