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) log.Printf("error scanning donk: %s", err)
continue continue
} }
d.External = !strings.HasPrefix(d.URL, serverPrefix)
h := hmap[hid] h := hmap[hid]
h.Donks = append(h.Donks, d) h.Donks = append(h.Donks, d)
} }

View File

@ -163,6 +163,7 @@ type Donk struct {
URL string URL string
Media string Media string
Local bool Local bool
External bool
} }
type Place struct { type Place struct {
@ -231,6 +232,7 @@ const (
) )
var serverName string var serverName string
var serverPrefix string
var masqName string var masqName string
var dataDir = "." var dataDir = "."
var viewDir = "." var viewDir = "."
@ -281,6 +283,7 @@ func main() {
if masqName == "" { if masqName == "" {
masqName = serverName masqName = serverName
} }
serverPrefix = fmt.Sprintf("https://%s/", serverName)
getconfig("usersep", &userSep) getconfig("usersep", &userSep)
getconfig("honksep", &honkSep) getconfig("honksep", &honkSep)
getconfig("debug", &debugMode) getconfig("debug", &debugMode)

View File

@ -78,7 +78,7 @@ in reply to: <a href="{{ .RID }}" rel=noreferrer>{{ .RID }}</a>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ if .XID }} {{ if .External }}
<p><a href="{{ .URL }}" rel=noreferrer>External Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }} <p><a href="{{ .URL }}" rel=noreferrer>External Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }}
{{ else }} {{ else }}
{{ if eq .Media "video/mp4" }} {{ if eq .Media "video/mp4" }}