From a7bc64d61e3e7b83bc6064a403654513bc3b1a20 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Sat, 12 Apr 2025 22:43:24 +0200 Subject: [PATCH] Support SSE for source updates This uses the Server Side Events added in Selfoss API 6.1.0 when calling GET /update This change only supports the new response format but provides no change for the users. The older versions are still supported. --- .../bou/amine/apps/readerforselfossv2/rest/SelfossApi.kt | 6 ++++++ 1 file changed, 6 insertions(+) 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..01b4be8 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 } @@ -382,6 +384,10 @@ class SelfossApi( ), ), ) + append( + HttpHeaders.Accept, + "text/event-stream", + ) } } },