Update HTTPClient usage
This commit is contained in:
@@ -65,11 +65,10 @@ class UpdateProfileWork {
|
|||||||
val remoteProfiles = ProfileManager.list()
|
val remoteProfiles = ProfileManager.list()
|
||||||
.filter { it.typed.type == TypedProfile.Type.Remote && it.typed.autoUpdate }
|
.filter { it.typed.type == TypedProfile.Type.Remote && it.typed.autoUpdate }
|
||||||
if (remoteProfiles.isEmpty()) return Result.success()
|
if (remoteProfiles.isEmpty()) return Result.success()
|
||||||
val httpClient = HTTPClient()
|
|
||||||
var success = true
|
var success = true
|
||||||
for (profile in remoteProfiles) {
|
for (profile in remoteProfiles) {
|
||||||
try {
|
try {
|
||||||
val content = httpClient.getString(profile.typed.remoteURL)
|
val content = HTTPClient().use { it.getString(profile.typed.remoteURL) }
|
||||||
Libbox.checkConfig(content)
|
Libbox.checkConfig(content)
|
||||||
File(profile.typed.path).writeText(content)
|
File(profile.typed.path).writeText(content)
|
||||||
profile.typed.lastUpdated = Date()
|
profile.typed.lastUpdated = Date()
|
||||||
|
|||||||
Reference in New Issue
Block a user