mirror of
https://github.com/xtool-org/xtool.git
synced 2026-11-21 10:45:53 +03:00
Compare commits
6 Commits
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"originHash" : "4a80ae2e9e4c4e1e4e29c32e93dc624202a42a942e44d358035684ec5e0746f7",
|
||||
"originHash" : "87792a9d5953dfe62ed2edf7c4f142774813bd3ea31882cbf6659b62fb2827ab",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "combine-schedulers",
|
||||
@@ -10,6 +10,15 @@
|
||||
"version" : "1.2.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "opencombine",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/OpenCombine/OpenCombine.git",
|
||||
"state" : {
|
||||
"revision" : "8576f0d579b27020beccbccc3ea6844f3ddfc2c2",
|
||||
"version" : "0.14.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-case-paths",
|
||||
"kind" : "remoteSourceControl",
|
||||
|
||||
@@ -17,6 +17,9 @@ let package = Package(
|
||||
dependencies: [
|
||||
.package(path: "../ExampleSupport"),
|
||||
.package(url: "https://github.com/pointfreeco/swift-composable-architecture.git", from: "1.0.0"),
|
||||
// we don't use this but need the explicit dependency to keep the lockfile stable.
|
||||
// TODO: remove once https://github.com/pointfreeco/combine-schedulers/issues/120 is fixed
|
||||
.package(url: "https://github.com/OpenCombine/OpenCombine.git", from: "0.14.0"),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
|
||||
@@ -17,6 +17,13 @@ public struct Packer: Sendable {
|
||||
try? FileManager.default.removeItem(at: packageDir)
|
||||
try FileManager.default.createDirectory(at: packageDir, withIntermediateDirectories: true)
|
||||
|
||||
if URL(fileURLWithPath: "Packages").dirExists {
|
||||
try FileManager.default.createSymbolicLink(
|
||||
atPath: packageDir.appendingPathComponent("Packages").path,
|
||||
withDestinationPath: "../../Packages"
|
||||
)
|
||||
}
|
||||
|
||||
let packageSwift = packageDir.appendingPathComponent("Package.swift")
|
||||
let contents = """
|
||||
// swift-tools-version: 6.0
|
||||
|
||||
@@ -79,6 +79,22 @@ extension AppGroupEntitlement: EntitlementWithCapability {
|
||||
}
|
||||
}
|
||||
|
||||
extension AppleSignInEntitlement: EntitlementWithCapability {
|
||||
var capability: DeveloperServicesCapability {
|
||||
// A primary App ID: the app is its own Sign in with Apple group.
|
||||
DeveloperServicesCapability(
|
||||
.appleIdAuth,
|
||||
isFree: false,
|
||||
settings: [
|
||||
.init(
|
||||
key: .init(.appleIdAuthAppConsent),
|
||||
options: [.init(key: .init(.primaryAppConsent))]
|
||||
)
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
extension AssociatedDomainsEntitlement: EntitlementWithCapability {
|
||||
var capability: DeveloperServicesCapability {
|
||||
DeveloperServicesCapability(.associatedDomains, isFree: false)
|
||||
|
||||
@@ -4,7 +4,7 @@ import ConcurrencyExtras
|
||||
import Dependencies
|
||||
|
||||
public protocol RawADIProvider: Sendable {
|
||||
func clientInfo() async throws -> String
|
||||
func clientInfo() async throws -> ClientInfoWithUserAgent
|
||||
|
||||
func startProvisioning(
|
||||
spim: Data,
|
||||
@@ -18,6 +18,11 @@ public protocol RawADIProvider: Sendable {
|
||||
) async throws -> (machineID: Data, otp: Data)
|
||||
}
|
||||
|
||||
public struct ClientInfoWithUserAgent: Sendable {
|
||||
public let clientInfo: String
|
||||
public let akdUserAgent: String
|
||||
}
|
||||
|
||||
private struct UnimplementedRawADIProvider: RawADIProvider {
|
||||
func startProvisioning(
|
||||
spim: Data,
|
||||
@@ -36,8 +41,8 @@ private struct UnimplementedRawADIProvider: RawADIProvider {
|
||||
return try await closure(userID, &routingInfo, provisioningInfo)
|
||||
}
|
||||
|
||||
func clientInfo() async throws -> String {
|
||||
let closure: () async throws -> String = unimplemented()
|
||||
func clientInfo() async throws -> ClientInfoWithUserAgent {
|
||||
let closure: () async throws -> ClientInfoWithUserAgent = unimplemented()
|
||||
return try await closure()
|
||||
}
|
||||
}
|
||||
@@ -80,7 +85,7 @@ public struct ADIDataProvider: AnisetteDataProvider {
|
||||
private let localUserUID: UUID
|
||||
private let localUserID: String
|
||||
|
||||
private let _clientInfo = LockIsolated<String?>(nil)
|
||||
private let _clientInfo = LockIsolated<ClientInfoWithUserAgent?>(nil)
|
||||
|
||||
public init() {
|
||||
@Dependency(\.keyValueStorage) var storage
|
||||
@@ -145,7 +150,7 @@ public struct ADIDataProvider: AnisetteDataProvider {
|
||||
return encoder
|
||||
}()
|
||||
|
||||
private func clientInfo() async throws -> String {
|
||||
private func clientInfo() async throws -> ClientInfoWithUserAgent {
|
||||
if let clientInfo = _clientInfo.value { return clientInfo }
|
||||
let clientInfo = try await rawProvider.clientInfo()
|
||||
_clientInfo.setValue(clientInfo)
|
||||
@@ -275,9 +280,11 @@ public struct ADIDataProvider: AnisetteDataProvider {
|
||||
}
|
||||
|
||||
public func deviceInfo() async throws -> DeviceInfo {
|
||||
DeviceInfo(
|
||||
let clientInfo = try await clientInfo()
|
||||
return DeviceInfo(
|
||||
deviceID: localUserUID.uuidString,
|
||||
clientInfo: try await clientInfo(),
|
||||
clientInfo: clientInfo.clientInfo,
|
||||
akdUserAgent: clientInfo.akdUserAgent,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import Foundation
|
||||
public struct DeviceInfo: Codable, Sendable {
|
||||
public static let xcodeVersionKey = "X-Xcode-Version"
|
||||
public static let xcodeVersion = "26.5 (17F42)"
|
||||
public static let akdUserAgent = "akd/1.0 CFNetwork/808.1.4"
|
||||
|
||||
public static let deviceIDKey = "X-Mme-Device-Id"
|
||||
public let deviceID: String
|
||||
@@ -11,6 +10,8 @@ public struct DeviceInfo: Codable, Sendable {
|
||||
public static let clientInfoKey = "X-MMe-Client-Info"
|
||||
public let clientInfo: String
|
||||
|
||||
public let akdUserAgent: String
|
||||
|
||||
public var dictionary: [String: String] {
|
||||
[
|
||||
Self.clientInfoKey: clientInfo,
|
||||
|
||||
@@ -27,15 +27,19 @@ struct OmnisetteADIProvider: RawADIProvider {
|
||||
return encoder
|
||||
}()
|
||||
|
||||
func clientInfo() async throws -> String {
|
||||
func clientInfo() async throws -> ClientInfoWithUserAgent {
|
||||
struct ClientInfo: Decodable {
|
||||
let clientInfo: String
|
||||
let userAgent: String
|
||||
}
|
||||
let body = try await client.makeRequest(
|
||||
HTTPRequest(url: url.appendingPathComponent("v3/client_info"))
|
||||
).body
|
||||
let clientInfo = try Self.decoder.decode(ClientInfo.self, from: body)
|
||||
return clientInfo.clientInfo
|
||||
return ClientInfoWithUserAgent(
|
||||
clientInfo: clientInfo.clientInfo,
|
||||
akdUserAgent: clientInfo.userAgent,
|
||||
)
|
||||
}
|
||||
|
||||
func startProvisioning(spim: Data, userID: UUID) async throws -> (RawADIProvisioningSession, Data) {
|
||||
|
||||
@@ -31,7 +31,7 @@ actor GrandSlamLookupManager {
|
||||
|
||||
var request = HTTPRequest(url: Self.lookupURL)
|
||||
request.headerFields = [
|
||||
.userAgent: DeviceInfo.akdUserAgent,
|
||||
.userAgent: deviceInfo.akdUserAgent,
|
||||
.init(AnisetteData.iLocaleKey)!: Locale.current.identifier,
|
||||
.init(AnisetteData.timeZoneKey)!: TimeZone.current.identifier,
|
||||
.init("X-Apple-I-TimeZone-Offset")!: "\(TimeZone.current.secondsFromGMT())"
|
||||
|
||||
@@ -71,7 +71,7 @@ extension GrandSlamOperationRequest {
|
||||
|
||||
func configure(request: inout HTTPRequest, anisetteData: AnisetteData) {
|
||||
request.headerFields[.accept] = "*/*"
|
||||
request.headerFields[.userAgent] = DeviceInfo.akdUserAgent
|
||||
request.headerFields[.userAgent] = anisetteData.deviceInfo.akdUserAgent
|
||||
}
|
||||
|
||||
func method(anisetteData: AnisetteData) -> GrandSlamMethod {
|
||||
|
||||
@@ -20,7 +20,7 @@ extension GrandSlamTwoFactorRequest {
|
||||
func configure(request: inout HTTPRequest, anisetteData: AnisetteData) {
|
||||
request.headerFields[.accept] = "application/x-buddyml"
|
||||
request.headerFields[.contentType] = "application/x-plist"
|
||||
request.headerFields[.userAgent] = DeviceInfo.akdUserAgent
|
||||
request.headerFields[.userAgent] = anisetteData.deviceInfo.akdUserAgent
|
||||
request.headerFields[.init("X-Apple-App-Info")!] = "com.apple.gs.xcode.auth"
|
||||
request.headerFields[.init(DeviceInfo.xcodeVersionKey)!] = DeviceInfo.xcodeVersion
|
||||
request.headerFields[.init("X-Apple-Identity-Token")!] = loginData.identityToken
|
||||
|
||||
@@ -29,6 +29,7 @@ extension EntitlementContainer {
|
||||
WiFiAwareEntitlement.self,
|
||||
HomeKitEntitlement.self,
|
||||
HealthKitEntitlement.self,
|
||||
AppleSignInEntitlement.self,
|
||||
]
|
||||
}
|
||||
|
||||
@@ -99,6 +100,21 @@ public struct AssociatedDomainsEntitlement: Entitlement, RawRepresentable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct AppleSignInEntitlement: Entitlement, RawRepresentable {
|
||||
public static let identifier = "com.apple.developer.applesignin"
|
||||
|
||||
public var rawValue: [String]
|
||||
public init(rawValue: [String]) { self.rawValue = rawValue }
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
rawValue = try decoder.singleValueContainer().decode([String].self)
|
||||
}
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
public enum APSEnvironmentEntitlement: String, Entitlement {
|
||||
public static let identifier = "aps-environment"
|
||||
|
||||
|
||||
@@ -244,11 +244,33 @@ struct SDKBuilder {
|
||||
)
|
||||
|
||||
if let envOverride, let path = ProcessInfo.processInfo.environment[envOverride] {
|
||||
let archive = URL(fileURLWithPath: path)
|
||||
print("[Extracting \(displayName)] \(archive.path)")
|
||||
let source = URL(fileURLWithPath: path)
|
||||
if source.dirExists {
|
||||
print("[Copying \(displayName)] \(source.path)")
|
||||
try await Subprocess.run(
|
||||
.name("cp"),
|
||||
arguments: ["-RL", "\(source.path)/.", "."],
|
||||
workingDirectory: FilePath(directory),
|
||||
output: .discarded,
|
||||
error: .discarded,
|
||||
)
|
||||
.checkSuccess()
|
||||
// later steps write into the copy
|
||||
try await Subprocess.run(
|
||||
.name("chmod"),
|
||||
arguments: ["-R", "u+w", "."],
|
||||
workingDirectory: FilePath(directory),
|
||||
output: .discarded,
|
||||
error: .discarded,
|
||||
)
|
||||
.checkSuccess()
|
||||
return
|
||||
}
|
||||
|
||||
print("[Extracting \(displayName)] \(source.path)")
|
||||
try await Subprocess.run(
|
||||
.name("tar"),
|
||||
arguments: ["xzf", archive.path],
|
||||
arguments: ["xzf", source.path],
|
||||
workingDirectory: FilePath(directory),
|
||||
output: .discarded,
|
||||
error: .discarded,
|
||||
|
||||
Reference in New Issue
Block a user