Files
UUVPN/iOS-SwiftUI-Code/Library/Database/Profile+Update.swift
T
2025-01-28 12:28:03 +08:00

21 lines
504 B
Swift

import Foundation
import GRDB
import Libbox
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)
}
}