Discard images that are too wide to be used as icons. Issue #1264
This commit is contained in:
parent
5ce45c8977
commit
b0f9d97650
|
@ -9,7 +9,7 @@
|
|||
import Foundation
|
||||
|
||||
enum ArticleExtractorConfig {
|
||||
static let clientId = "{MERCURYID}"
|
||||
static let clientSecret = "{MERCURYSECRET}"
|
||||
static let clientId = "netnewswire"
|
||||
static let clientSecret = "PM9QZZwckFPLcJdUt4BADDqwHdKCAy8zxaAakjmpGdbjEjfcAdU3CTNdBf8Lw"
|
||||
static let clientURL = "https://extract.feedbin.com/parser"
|
||||
}
|
||||
|
|
|
@ -20,6 +20,9 @@ extension RSHTMLMetadata {
|
|||
var bestImage: RSHTMLOpenGraphImage? = nil
|
||||
|
||||
for image in openGraphImages {
|
||||
if image.width / image.height > 2 {
|
||||
continue
|
||||
}
|
||||
if bestImage == nil {
|
||||
bestImage = image
|
||||
continue
|
||||
|
@ -51,6 +54,9 @@ extension RSHTMLMetadata {
|
|||
var bestImage: RSHTMLMetadataAppleTouchIcon? = nil
|
||||
|
||||
for image in icons {
|
||||
if image.size.width / image.size.height > 2 {
|
||||
continue
|
||||
}
|
||||
if bestImage == nil {
|
||||
bestImage = image
|
||||
continue
|
||||
|
|
|
@ -182,7 +182,7 @@ private extension AppDelegate {
|
|||
let homePageURLsWithNoFaviconURL = tempDir.appendingPathComponent("HomePageURLsWithNoFaviconURLCache.plist")
|
||||
|
||||
// If the image disk cache hasn't been flushed for 3 days and the network is available, delete it
|
||||
if let flushDate = AppDefaults.lastImageCacheFlushDate, flushDate.addingTimeInterval(3600*24*3) < Date() {
|
||||
// if let flushDate = AppDefaults.lastImageCacheFlushDate, flushDate.addingTimeInterval(3600*24*3) < Date() {
|
||||
if let reachability = try? Reachability(hostname: "apple.com") {
|
||||
if reachability.connection != .unavailable {
|
||||
for tempItem in [faviconsFolderURL, imagesFolderURL, homePageToIconURL, homePagesWithNoIconURL, homePageToFaviconURL, homePageURLsWithNoFaviconURL] {
|
||||
|
@ -196,7 +196,7 @@ private extension AppDelegate {
|
|||
AppDefaults.lastImageCacheFlushDate = Date()
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
try! FileManager.default.createDirectory(at: faviconsFolderURL, withIntermediateDirectories: true, attributes: nil)
|
||||
let faviconsFolder = faviconsFolderURL.absoluteString
|
||||
|
|
Loading…
Reference in New Issue