Use stable cover image routes
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user