2026-07-01 21:40:53 +08:00
|
|
|
import Foundation
|
|
|
|
|
import GRDB
|
2026-07-02 20:01:59 +08:00
|
|
|
import Libbox
|
2026-07-01 21:40:53 +08:00
|
|
|
|
|
|
|
|
public extension Profile {
|
|
|
|
|
nonisolated func updateRemoteProfile() async throws {
|
|
|
|
|
if type != .remote {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let remoteContent = try HTTPClient().getString(remoteURL)
|
|
|
|
|
var error: NSError?
|
|
|
|
|
LibboxCheckConfig(remoteContent, &error)
|
|
|
|
|
if let error {
|
|
|
|
|
throw error
|
|
|
|
|
}
|
|
|
|
|
try write(remoteContent)
|
|
|
|
|
lastUpdated = Date()
|
|
|
|
|
try await ProfileManager.update(self)
|
|
|
|
|
}
|
|
|
|
|
}
|