mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add link out URL for link only reddit articles
This commit is contained in:
@@ -98,6 +98,7 @@ struct RedditLinkData: Codable {
|
||||
html += "width=\"\(width)\" height=\"\(height)\" "
|
||||
}
|
||||
html += "src=\"\(videoPreviewURL)\"></video>"
|
||||
html += linkOutURL(url)
|
||||
return html
|
||||
}
|
||||
|
||||
@@ -107,10 +108,18 @@ struct RedditLinkData: Codable {
|
||||
html += "width=\"\(width)\" height=\"\(height)\" "
|
||||
}
|
||||
html += "></a></figure>"
|
||||
html += linkOutURL(url)
|
||||
return html
|
||||
}
|
||||
|
||||
return nil
|
||||
return linkOutURL(url)
|
||||
}
|
||||
|
||||
func linkOutURL(_ url: String) -> String {
|
||||
guard let urlComponents = URLComponents(string: url), let host = urlComponents.host, !host.hasSuffix("reddit.com") else {
|
||||
return ""
|
||||
}
|
||||
return "<div><a href=\"\(url)\">\(url)</a></div>"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user