Use stable cover image routes
Some checks failed
CI / Prepare job (push) Has been cancelled
CI / Build extensions (${{ matrix.chunk.number }}) (push) Has been cancelled
CI / Publish extension repo (push) Has been cancelled
Create Release on Merge / release (push) Has been cancelled

This commit is contained in:
2026-05-23 16:35:24 +09:00
parent 509c1b890a
commit 40abc68a67
4 changed files with 8 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ ext {
kmkVersionCode = 1 kmkVersionCode = 1
extName = 'Kavita' extName = 'Kavita'
extClass = '.KavitaFactory' extClass = '.KavitaFactory'
extVersionCode = 23 extVersionCode = 24
isNsfw = false isNsfw = false
} }

View File

@@ -1110,7 +1110,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou
if (isComicLibrary && volume.minNumber.toInt() == KavitaConstants.UNNUMBERED_VOLUME) { if (isComicLibrary && volume.minNumber.toInt() == KavitaConstants.UNNUMBERED_VOLUME) {
for (chapter in volume.chapters) { for (chapter in volume.chapters) {
if (chapter.coverImage.isNotBlank()) { if (chapter.coverImage.isNotBlank()) {
val url = "$apiUrl/Image/chapter-cover?chapterId=${chapter.id}&apiKey=$apiKey" val url = "$apiUrl/Image/chapter-cover/${chapter.id}?apiKey=$apiKey"
coverCandidates.add( coverCandidates.add(
Triple(url, chapter.pagesRead < chapter.pages, chapter.number.toFloatOrNull() ?: 0f), Triple(url, chapter.pagesRead < chapter.pages, chapter.number.toFloatOrNull() ?: 0f),
) )
@@ -1124,7 +1124,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou
ChapterType.of(chapter, volume) == ChapterType.SingleFileVolume ChapterType.of(chapter, volume) == ChapterType.SingleFileVolume
} }
if (hasSingleFile && volume.coverImage.isNotBlank()) { if (hasSingleFile && volume.coverImage.isNotBlank()) {
val url = "$apiUrl/Image/volume-cover?volumeId=${volume.id}&apiKey=$apiKey" val url = "$apiUrl/Image/volume-cover/${volume.id}?apiKey=$apiKey"
val isUnread = volume.pagesRead < volume.pages val isUnread = volume.pagesRead < volume.pages
val number = volume.minNumber.toFloat() val number = volume.minNumber.toFloat()
coverCandidates.add(Triple(url, isUnread, number)) coverCandidates.add(Triple(url, isUnread, number))
@@ -1156,13 +1156,13 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou
// Append cache-busting timestamp to always get the latest cover // Append cache-busting timestamp to always get the latest cover
"$baseUrl&ts=$timestamp" "$baseUrl&ts=$timestamp"
} ?: "$apiUrl/image/series-cover?seriesId=$seriesId&apiKey=$apiKey" } ?: "$apiUrl/image/series-cover/$seriesId?apiKey=$apiKey"
} catch (e: Exception) { } catch (e: Exception) {
Log.e(LOG_TAG, "Error fetching volumes for cover selection", e) Log.e(LOG_TAG, "Error fetching volumes for cover selection", e)
"$apiUrl/image/series-cover?seriesId=${result.seriesId ?: 0}&apiKey=$apiKey" "$apiUrl/image/series-cover/${result.seriesId ?: 0}?apiKey=$apiKey"
} }
} else { } else {
"$apiUrl/image/series-cover?seriesId=${result.seriesId ?: 0}&apiKey=$apiKey" "$apiUrl/image/series-cover/${result.seriesId ?: 0}?apiKey=$apiKey"
} }
manga.status = when (result.publicationStatus) { manga.status = when (result.publicationStatus) {

View File

@@ -73,7 +73,7 @@ class KavitaHelper {
SManga.create().apply { SManga.create().apply {
url = "$baseUrl/Series/${obj.id}" url = "$baseUrl/Series/${obj.id}"
title = obj.name title = obj.name
thumbnail_url = "$baseUrl/image/series-cover?seriesId=${obj.id}&apiKey=$apiKey" thumbnail_url = "$baseUrl/image/series-cover/${obj.id}?apiKey=$apiKey"
} }
fun chapterFromVolume( fun chapterFromVolume(

View File

@@ -169,7 +169,7 @@ data class RelatedSeriesItem(
url = "$baseUrl/Series/$id" url = "$baseUrl/Series/$id"
thumbnail_url = when { thumbnail_url = when {
!coverImage.isNullOrBlank() && (coverImage.startsWith("http://") || coverImage.startsWith("https://")) -> coverImage !coverImage.isNullOrBlank() && (coverImage.startsWith("http://") || coverImage.startsWith("https://")) -> coverImage
else -> "$apiUrl/image/series-cover?seriesId=$id&apiKey=$apiKey" else -> "$apiUrl/image/series-cover/$id?apiKey=$apiKey"
} }
initialized = true initialized = true
} }