diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/rest/SelfossApi.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/rest/SelfossApi.kt index 9bab495..bd0447f 100644 --- a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/rest/SelfossApi.kt +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/rest/SelfossApi.kt @@ -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,26 +365,11 @@ class SelfossApi( suspend fun update(): StatusAndData = 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(), - ), - ), - ) - } + headers { + append( + HttpHeaders.Accept, + "text/event-stream", + ) } }, )