Compare commits
2 Commits
269937ff09
...
4b9899c04e
Author | SHA1 | Date | |
---|---|---|---|
4b9899c04e | |||
e9e2b6415f |
@ -19,6 +19,7 @@ import io.ktor.client.plugins.cookies.HttpCookies
|
||||
import io.ktor.client.plugins.logging.LogLevel
|
||||
import io.ktor.client.plugins.logging.Logger
|
||||
import io.ktor.client.plugins.logging.Logging
|
||||
import io.ktor.client.plugins.sse.SSE
|
||||
import io.ktor.client.request.get
|
||||
import io.ktor.client.request.headers
|
||||
import io.ktor.client.request.parameter
|
||||
@ -89,6 +90,7 @@ class SelfossApi(
|
||||
}
|
||||
}
|
||||
}
|
||||
install(SSE)
|
||||
expectSuccess = false
|
||||
}
|
||||
|
||||
@ -363,27 +365,12 @@ class SelfossApi(
|
||||
suspend fun update(): StatusAndData<String> =
|
||||
bodyOrFailure(
|
||||
client.tryToGet(url("/update")) {
|
||||
if (!shouldHavePostLogin()) {
|
||||
parameter("username", appSettingsService.getUserName())
|
||||
parameter("password", appSettingsService.getPassword())
|
||||
}
|
||||
if (appSettingsService
|
||||
.getBasicUserName()
|
||||
.isNotEmpty() &&
|
||||
appSettingsService.getBasicPassword().isNotEmpty()
|
||||
) {
|
||||
headers {
|
||||
append(
|
||||
HttpHeaders.Authorization,
|
||||
constructBasicAuthValue(
|
||||
BasicAuthCredentials(
|
||||
username = appSettingsService.getBasicUserName(),
|
||||
password = appSettingsService.getBasicPassword(),
|
||||
),
|
||||
),
|
||||
HttpHeaders.Accept,
|
||||
"text/event-stream",
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user