Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

fix: add finger print header fixing 1034 error #70

Merged
merged 3 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//

import Foundation
import UIKit

// MARK: - URLRequestHelperConfiguration

/// Abstract class storing salt, version, etc for API.
enum URLRequestHelperConfiguration {
Expand Down Expand Up @@ -53,7 +56,7 @@ enum URLRequestHelperConfiguration {
static func xRpcAppVersion(region: Region) -> String {
switch region {
case .china:
return "2.37.1"
return "2.50.1"
case .global:
return "2.9.0"
}
Expand Down Expand Up @@ -92,6 +95,15 @@ enum URLRequestHelperConfiguration {
"Accept-Language": "zh-CN,zh-Hans;q=0.9",
"Accept": "application/json, text/plain, */*",
"Connection": "keep-alive",
"x-rpc-device_fp": getDeviceFingerPrint(),
]
}
}

private func getDeviceFingerPrint() -> String {
if let uuidString = UIDevice.current.identifierForVendor?.uuidString {
return String(uuidString.md5.prefix(13))
} else {
return ""
}
}