BUGFIX: fix embedded links not being clickable
- also improve the display to show the domain name when other info is missing
This commit is contained in:
parent
34d3e16439
commit
4c81846d15
@ -32,7 +32,7 @@ func main() {
|
|||||||
flag.BoolVar(show_version_flag, "v", false, "")
|
flag.BoolVar(show_version_flag, "v", false, "")
|
||||||
|
|
||||||
session_name := flag.String("session", "", "Name of session file to use")
|
session_name := flag.String("session", "", "Name of session file to use")
|
||||||
addr := flag.String("addr", "localhost:1488", "port to listen on") // Random port that's probably not in use
|
addr := flag.String("addr", "localhost:1973", "port to listen on") // Random port that's probably not in use
|
||||||
|
|
||||||
how_many := flag.Int("n", 50, "")
|
how_many := flag.Int("n", 50, "")
|
||||||
flag.IntVar(how_many, "number", 50, "")
|
flag.IntVar(how_many, "number", 50, "")
|
||||||
|
@ -70,24 +70,25 @@
|
|||||||
</video>
|
</video>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{range $main_tweet.Urls}}
|
{{range $main_tweet.Urls}}
|
||||||
<a
|
<div class="click-eater" hx-trigger="click consume">
|
||||||
class="embedded-link rounded-gray-outline unstyled-link"
|
<a
|
||||||
target="_blank"
|
class="embedded-link rounded-gray-outline unstyled-link"
|
||||||
href="{{.Text}}"
|
target="_blank"
|
||||||
style="max-width: {{if (ne .ThumbnailWidth 0)}}{{.ThumbnailWidth}}px {{else}}fit-content {{end}}"
|
href="{{.Text}}"
|
||||||
hx-trigger="click consume"
|
style="max-width: {{if (ne .ThumbnailWidth 0)}}{{.ThumbnailWidth}}px {{else}}fit-content {{end}}"
|
||||||
>
|
>
|
||||||
<img src="/content/link_preview_images/{{.ThumbnailLocalPath}}"
|
<img src="/content/link_preview_images/{{.ThumbnailLocalPath}}"
|
||||||
class="embedded-link-preview"
|
class="embedded-link-preview"
|
||||||
width="{{.ThumbnailWidth}}" height="{{.ThumbnailHeight}}"
|
width="{{.ThumbnailWidth}}" height="{{.ThumbnailHeight}}"
|
||||||
/>
|
/>
|
||||||
<h3 class="embedded-link-title">{{.Title}}</h3>
|
<h3 class="embedded-link-title">{{.Title}}</h3>
|
||||||
<p class="embedded-link-description">{{.Description}}</p>
|
<p class="embedded-link-description">{{.Description}}</p>
|
||||||
<span class="row embedded-link-domain-container">
|
<span class="row embedded-link-domain-container">
|
||||||
<img class="svg-icon" src="/static/icons/link3.svg" />
|
<img class="svg-icon" src="/static/icons/link3.svg" />
|
||||||
<span class="embedded-link-domain">{{.Domain}}</span>
|
<span class="embedded-link-domain">{{(.GetDomain)}}</span>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{range $main_tweet.Polls}}
|
{{range $main_tweet.Polls}}
|
||||||
{{template "poll" .}}
|
{{template "poll" .}}
|
||||||
|
@ -26,6 +26,17 @@ type Url struct {
|
|||||||
IsContentDownloaded bool `db:"is_content_downloaded"`
|
IsContentDownloaded bool `db:"is_content_downloaded"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u Url) GetDomain() string {
|
||||||
|
if u.Domain != "" {
|
||||||
|
return u.Domain
|
||||||
|
}
|
||||||
|
urlstruct, err := url.Parse(u.Text)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return urlstruct.Host
|
||||||
|
}
|
||||||
|
|
||||||
func ParseAPIUrlCard(apiCard APICard) Url {
|
func ParseAPIUrlCard(apiCard APICard) Url {
|
||||||
values := apiCard.BindingValues
|
values := apiCard.BindingValues
|
||||||
ret := Url{}
|
ret := Url{}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user