diff --git a/src/all/kavita/CHANGELOG.md b/src/all/kavita/CHANGELOG.md index 9c9d5bdf1..42e62e077 100644 --- a/src/all/kavita/CHANGELOG.md +++ b/src/all/kavita/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.3.5 + +### Features + +* Ignore DOH +* Added sort option `Item Added` +* Latest button now shows latest `Item Added` + ## 1.3.4 ### Features diff --git a/src/all/kavita/build.gradle b/src/all/kavita/build.gradle index cf547ab87..93f737fce 100644 --- a/src/all/kavita/build.gradle +++ b/src/all/kavita/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Kavita' pkgNameSuffix = 'all.kavita' extClass = '.KavitaFactory' - extVersionCode = 4 + extVersionCode = 5 } dependencies { diff --git a/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt b/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt index 207e2a218..c51394659 100644 --- a/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt +++ b/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt @@ -46,10 +46,12 @@ import kotlinx.serialization.json.add import kotlinx.serialization.json.buildJsonArray import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.put +import okhttp3.Dns import okhttp3.Headers import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.RequestBody import okhttp3.RequestBody.Companion.toRequestBody @@ -87,7 +89,10 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou } } } - + override val client: OkHttpClient = + network.client.newBuilder() + .dns(Dns.SYSTEM) + .build() override val id by lazy { val key = "${"kavita_$suffix"}/all/$versionId" val bytes = MessageDigest.getInstance("MD5").digest(key.toByteArray()) @@ -148,18 +153,18 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou } override fun latestUpdatesRequest(page: Int): Request { + if (!isLoged) { + doLogin() + } return POST( - "$apiUrl/series/recently-added?pageNumber=$page&libraryId=0&pageSize=20", + "$apiUrl/series/all?pageNumber=$page&libraryId=0&pageSize=20", headersBuilder().build(), - buildFilterBody() + buildFilterBody(MetadataPayload(sorting = 4, sorting_asc = false, forceUseMetadataPayload = true)) ) } override fun latestUpdatesParse(response: Response): MangasPage { - val result = response.parseAs>() - series = result - val mangaList = result.map { item -> helper.createSeriesDto(item, apiUrl) } - return MangasPage(mangaList, helper.hasNextPage(response)) + return popularMangaParse(response) } /** @@ -579,6 +584,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou Pair("Sort name", 1), Pair("Created", 2), Pair("Last modified", 3), + Pair("Item added", 4), ) private class StatusFilter(name: String) : Filter.CheckBox(name, false) private class StatusFilterGroup(filters: List) : @@ -872,7 +878,7 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou } private fun buildFilterBody(filter: MetadataPayload = toFilter): RequestBody { var filter = filter - if (!isFilterOn) { + if (!isFilterOn and !filter.forceUseMetadataPayload) { filter = MetadataPayload() } diff --git a/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/dto/MetadataDto.kt b/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/dto/MetadataDto.kt index e291945a8..44d43c4b0 100644 --- a/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/dto/MetadataDto.kt +++ b/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/dto/MetadataDto.kt @@ -48,6 +48,7 @@ data class MetadataCollections( ) data class MetadataPayload( + val forceUseMetadataPayload: Boolean = true, var sorting: Int = 1, var sorting_asc: Boolean = true, var readStatus: ArrayList = arrayListOf< String>(),