From fddea626b68936efb1bdf2fed6df54272a0eb79b Mon Sep 17 00:00:00 2001 From: Mohamed Maged Date: Fri, 22 May 2026 04:19:58 +0300 Subject: [PATCH 1/5] updated komf to work with kavita 0.9.0 --- Komelia | 2 +- .../komf/mediaserver/kavita/KavitaClient.kt | 22 +++++++++---------- .../kavita/KavitaMediaServerClientAdapter.kt | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Komelia b/Komelia index 117d5582..90599490 160000 --- a/Komelia +++ b/Komelia @@ -1 +1 @@ -Subproject commit 117d5582a08f8a0241c3605bc20cf095bbf40e7f +Subproject commit 905994904114fa59c5d8c43f47d51345368df218 diff --git a/komf-mediaserver/src/commonMain/kotlin/snd/komf/mediaserver/kavita/KavitaClient.kt b/komf-mediaserver/src/commonMain/kotlin/snd/komf/mediaserver/kavita/KavitaClient.kt index 89cd5e3c..bb0034bb 100644 --- a/komf-mediaserver/src/commonMain/kotlin/snd/komf/mediaserver/kavita/KavitaClient.kt +++ b/komf-mediaserver/src/commonMain/kotlin/snd/komf/mediaserver/kavita/KavitaClient.kt @@ -127,7 +127,8 @@ class KavitaClient( val response = ktor.get("api/series/volume") { parameter("volumeId", volumeId.value) } - if (response.status == HttpStatusCode.NoContent) throw snd.komf.mediaserver.kavita.KavitaResourceNotFoundException() + if (response.status == HttpStatusCode.NoContent || response.status == HttpStatusCode.NotFound) + throw KavitaResourceNotFoundException() return response.body() } @@ -136,7 +137,8 @@ class KavitaClient( val response = ktor.get("api/series/chapter") { parameter("chapterId", chapterId.value) } - if (response.status == HttpStatusCode.NoContent) throw snd.komf.mediaserver.kavita.KavitaResourceNotFoundException() + if (response.status == HttpStatusCode.NoContent || response.status == HttpStatusCode.NotFound) + throw KavitaResourceNotFoundException() return response.body() } @@ -172,11 +174,13 @@ class KavitaClient( return ktor.get("api/library/libraries").body() } - suspend fun scanSeries(seriesId: KavitaSeriesId) { + suspend fun scanSeries(seriesId: KavitaSeriesId, libraryId: KavitaLibraryId) { ktor.post("api/series/scan") { contentType(ContentType.Application.Json) - setBody(buildJsonObject { put("seriesId", seriesId.value) }) - + setBody(buildJsonObject { + put("seriesId", seriesId.value) + put("libraryId", libraryId.value) + }) } } @@ -187,13 +191,9 @@ class KavitaClient( } suspend fun resetChapterLock(chapterId: KavitaChapterId) { - ktor.post("api/upload/reset-chapter-lock") { + ktor.post("api/upload/chapter") { contentType(ContentType.Application.Json) - setBody(buildJsonObject { - put("id", chapterId.value) - put("url", "") - }) - + setBody(KavitaCoverUploadRequest(id = chapterId.value, url = "", lockCover = false)) } } diff --git a/komf-mediaserver/src/commonMain/kotlin/snd/komf/mediaserver/kavita/KavitaMediaServerClientAdapter.kt b/komf-mediaserver/src/commonMain/kotlin/snd/komf/mediaserver/kavita/KavitaMediaServerClientAdapter.kt index 13a4385d..9c3bf839 100644 --- a/komf-mediaserver/src/commonMain/kotlin/snd/komf/mediaserver/kavita/KavitaMediaServerClientAdapter.kt +++ b/komf-mediaserver/src/commonMain/kotlin/snd/komf/mediaserver/kavita/KavitaMediaServerClientAdapter.kt @@ -172,7 +172,7 @@ class KavitaMediaServerClientAdapter(private val kavitaClient: KavitaClient) : M override suspend fun refreshMetadata(libraryId: MediaServerLibraryId, seriesId: MediaServerSeriesId) { kavitaClient.scanLibrary(libraryId.toKavitaLibraryId()) - kavitaClient.scanSeries(seriesId.toKavitaSeriesId()) + kavitaClient.scanSeries(seriesId.toKavitaSeriesId(), libraryId.toKavitaLibraryId()) } } From 9d1088407dbae9177e097e56c3206e85bb538925 Mon Sep 17 00:00:00 2001 From: Mohamed Maged Date: Fri, 22 May 2026 04:36:12 +0300 Subject: [PATCH 2/5] Add Kavita 0.9.x+ compatibility fixes API changes: - Handle 404 NotFound (in addition to 204 NoContent) for getVolume and getChapter endpoints, which now return 404 instead of 204 when a resource is not found - Include libraryId in api/series/scan request body to match the new RefreshSeriesDto contract that requires both seriesId and libraryId - Handle 404 NotFound (in addition to 204 NoContent) for getVolume and getChapter endpoints, which now return 404 instead of 204 when a resource is not found - Include libraryId in api/series/scan request body to match the new RefreshSeriesDto contract that requires both seriesId and libraryId - Replace removed api/upload/reset-chapter-lock endpoint with api/upload/chapter using an empty URL and lockCover=false to reset chapter cover locks Browser extension: - Fix Kavita detection in AppState to match the new title format "Page (Kavita)" in addition to the standalone "Kavita" title used on the home page - Fix navbar button not remounting after reader mode; the Angular @if directive removes and re-adds the