fix for external attachments not having xid anymore
This commit is contained in:
parent
1e9d1f0fc7
commit
a81cf01844
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
17
honk.go
17
honk.go
|
@ -156,13 +156,14 @@ func (honk *Honk) IsReacted() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Donk struct {
|
type Donk struct {
|
||||||
FileID int64
|
FileID int64
|
||||||
XID string
|
XID string
|
||||||
Name string
|
Name string
|
||||||
Desc string
|
Desc string
|
||||||
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)
|
||||||
|
|
|
@ -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" }}
|
||||||
|
|
Loading…
Reference in New Issue