Exempt NetNewsWire blog and inessential.com from Cache-Control checking.
This commit is contained in:
parent
0072f9c65a
commit
a12b8479fb
@ -36,7 +36,7 @@ final class LocalAccountRefresher {
|
|||||||
|
|
||||||
public func refreshFeeds(_ feeds: Set<WebFeed>, completion: (() -> Void)? = nil) {
|
public func refreshFeeds(_ feeds: Set<WebFeed>, completion: (() -> Void)? = nil) {
|
||||||
|
|
||||||
let filteredFeeds = feeds.filter { !feedShouldBeSkipped($0) }
|
let filteredFeeds = feeds.filter { !Self.feedShouldBeSkipped($0) }
|
||||||
|
|
||||||
guard !filteredFeeds.isEmpty else {
|
guard !filteredFeeds.isEmpty else {
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
@ -176,14 +176,24 @@ private extension LocalAccountRefresher {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func feedShouldBeSkipped(_ feed: WebFeed) -> Bool {
|
// These hosts are immune to Cache-Control checking.
|
||||||
|
// We could certainly add more hosts to this if requested by site owners.
|
||||||
|
static let hostsThatShouldNeverBeSkipped = Set(["inessential.com", "netnewswire.blog", "nnw.ranchero.com"])
|
||||||
|
|
||||||
|
static func feedShouldBeSkipped(_ feed: WebFeed) -> Bool {
|
||||||
|
|
||||||
|
if let host = url(for: feed)?.host() {
|
||||||
|
if hostsThatShouldNeverBeSkipped.contains(host) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let cacheControlInfo = feed.cacheControlInfo, !cacheControlInfo.canResume {
|
if let cacheControlInfo = feed.cacheControlInfo, !cacheControlInfo.canResume {
|
||||||
os_log(.debug, "Dropping request for Cache-Control reasons: \(feed.url)")
|
os_log(.debug, "Dropping request for Cache-Control reasons: \(feed.url)")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return Self.feedIsDisallowed(feed)
|
return feedIsDisallowed(feed)
|
||||||
}
|
}
|
||||||
|
|
||||||
static var urlCache = [String: URL]()
|
static var urlCache = [String: URL]()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user