mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: user-agent format (#27488)
* fix: user-agent format * ci: fix static analysis --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -53,7 +53,7 @@ import javax.net.ssl.TrustManagerFactory
|
||||
import javax.net.ssl.X509KeyManager
|
||||
import javax.net.ssl.X509TrustManager
|
||||
|
||||
const val USER_AGENT = "Immich_Android_${BuildConfig.VERSION_NAME}"
|
||||
const val USER_AGENT = "immich-android/${BuildConfig.VERSION_NAME}"
|
||||
private const val CERT_ALIAS = "client_cert"
|
||||
private const val PREFS_NAME = "immich.ssl"
|
||||
private const val PREFS_CERT_ALIAS = "immich.client_cert"
|
||||
|
||||
@@ -36,7 +36,7 @@ extension UserDefaults {
|
||||
/// Old sessions are kept alive by Dart's FFI retain until all isolates release them.
|
||||
class URLSessionManager: NSObject {
|
||||
static let shared = URLSessionManager()
|
||||
|
||||
|
||||
private(set) var session: URLSession
|
||||
let delegate: URLSessionManagerDelegate
|
||||
private static let cacheDir: URL = {
|
||||
@@ -53,7 +53,7 @@ class URLSessionManager: NSObject {
|
||||
)
|
||||
static let userAgent: String = {
|
||||
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "unknown"
|
||||
return "Immich_iOS_\(version)"
|
||||
return "immich-ios/\(version)"
|
||||
}()
|
||||
static let cookieStorage = HTTPCookieStorage.sharedCookieStorage(forGroupContainerIdentifier: APP_GROUP)
|
||||
private static var serverUrls: [String] = []
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
Future<String> getUserAgentString() async {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
String platform;
|
||||
if (Platform.isAndroid) {
|
||||
platform = 'Android';
|
||||
platform = 'android';
|
||||
} else if (Platform.isIOS) {
|
||||
platform = 'iOS';
|
||||
platform = 'ios';
|
||||
} else {
|
||||
platform = 'Unknown';
|
||||
platform = 'unknown';
|
||||
}
|
||||
return 'Immich_${platform}_${packageInfo.version}';
|
||||
return 'immich-$platform/${packageInfo.version}';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user