Change user agent (#1250)
This commit is contained in:
parent
f911aa9432
commit
27353a3bdb
|
@ -31,7 +31,11 @@ public final class APIService {
|
||||||
|
|
||||||
public init(backgroundManagedObjectContext: NSManagedObjectContext) {
|
public init(backgroundManagedObjectContext: NSManagedObjectContext) {
|
||||||
self.backgroundManagedObjectContext = backgroundManagedObjectContext
|
self.backgroundManagedObjectContext = backgroundManagedObjectContext
|
||||||
self.session = URLSession(configuration: .default)
|
|
||||||
|
let appVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
|
||||||
|
let configuration = URLSessionConfiguration.default
|
||||||
|
configuration.httpAdditionalHeaders = ["User-Agent" : "mastodon-ios/" + appVersion]
|
||||||
|
self.session = URLSession(configuration: configuration)
|
||||||
|
|
||||||
// setup cache. 10MB RAM + 50MB Disk
|
// setup cache. 10MB RAM + 50MB Disk
|
||||||
URLCache.shared = URLCache(memoryCapacity: 10 * 1024 * 1024, diskCapacity: 50 * 1024 * 1024, diskPath: nil)
|
URLCache.shared = URLCache(memoryCapacity: 10 * 1024 * 1024, diskCapacity: 50 * 1024 * 1024, diskPath: nil)
|
||||||
|
|
Loading…
Reference in New Issue