Freeze the user agent as Evergreen (macOS; RSS Reader; https://ranchero.com/evergreen/). (An iOS version would say iOS rather than macOS, but would be the same otherwise.)

This commit is contained in:
Brent Simmons 2017-12-31 10:09:40 -08:00
parent 834b0bdb54
commit e970caf459
2 changed files with 2 additions and 21 deletions

View File

@ -31,9 +31,7 @@
<key>SUFeedURL</key> <key>SUFeedURL</key>
<string>https://ranchero.com/downloads/evergreen-beta.xml</string> <string>https://ranchero.com/downloads/evergreen-beta.xml</string>
<key>UserAgent</key> <key>UserAgent</key>
<string>Evergreen</string> <string>Evergreen (macOS; RSS Reader; https://ranchero.com/evergreen/)</string>
<key>UserAgentParentheticalAddition</key>
<string>Macintosh; RSS Reader; ranchero.com/evergreen/</string>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
<dict> <dict>
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>

View File

@ -12,24 +12,7 @@ public struct UserAgent {
public static func fromInfoPlist() -> String? { public static func fromInfoPlist() -> String? {
guard let userAgentName = Bundle.main.object(forInfoDictionaryKey: "UserAgent") else { return Bundle.main.object(forInfoDictionaryKey: "UserAgent") as? String
return nil
}
guard let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") else {
return nil
}
if let userAgentParentheticalAddition = Bundle.main.object(forInfoDictionaryKey: "UserAgentParentheticalAddition") {
return "\(userAgentName)/\(version) (\(userAgentParentheticalAddition))"
}
#if os(macOS)
let osString = "Macintosh"
#elseif os(iOS)
let osString = "iOS"
#endif
return "\(userAgentName)/\(version) (\(osString))"
} }
public static func headers() -> [AnyHashable: String]? { public static func headers() -> [AnyHashable: String]? {