mirror of
https://github.com/GayPizzaSpecifications/darwin-apk.git
synced 2025-08-03 13:31:32 +00:00
print full fetch url
This commit is contained in:
@ -45,7 +45,7 @@ public extension ApkIndex {
|
|||||||
}
|
}
|
||||||
local = URL(filePath: repository.localName)
|
local = URL(filePath: repository.localName)
|
||||||
case .update:
|
case .update:
|
||||||
print("Fetching \"\(repository.name)\"")
|
print("Fetching \"\(repository.resolved)\"")
|
||||||
local = try await ApkIndexDownloader.fetch(repository: repository)
|
local = try await ApkIndexDownloader.fetch(repository: repository)
|
||||||
}
|
}
|
||||||
let index = try ApkIndex(readFrom: local)
|
let index = try ApkIndex(readFrom: local)
|
||||||
|
@ -14,9 +14,8 @@ public struct ApkIndexRepository: Sendable {
|
|||||||
private static func resolveApkIndex(_ repo: String, _ arch: String)
|
private static func resolveApkIndex(_ repo: String, _ arch: String)
|
||||||
-> String { "\(repo)/\(arch)/APKINDEX.tar.gz" }
|
-> String { "\(repo)/\(arch)/APKINDEX.tar.gz" }
|
||||||
|
|
||||||
public var url: URL {
|
public var resolved: String { Self.resolveApkIndex(self.name, self.arch) }
|
||||||
URL(string: Self.resolveApkIndex(self.name, self.arch))!
|
public var url: URL { URL(string: self.resolved)! }
|
||||||
}
|
|
||||||
|
|
||||||
public var localName: String { "APKINDEX.\(discriminator).tar.gz" }
|
public var localName: String { "APKINDEX.\(discriminator).tar.gz" }
|
||||||
|
|
||||||
@ -25,6 +24,6 @@ public struct ApkIndexRepository: Sendable {
|
|||||||
self.arch = arch
|
self.arch = arch
|
||||||
|
|
||||||
let urlSHA1Digest = Data(Insecure.SHA1.hash(data: Data(Self.resolveApkIndex(repo, arch).utf8)))
|
let urlSHA1Digest = Data(Insecure.SHA1.hash(data: Data(Self.resolveApkIndex(repo, arch).utf8)))
|
||||||
self.discriminator = urlSHA1Digest.subdata(in: 0..<3).map { String(format: "%02x", $0) }.joined()
|
self.discriminator = urlSHA1Digest.subdata(in: 0..<4).map { String(format: "%02x", $0) }.joined()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user