diff --git a/src/ru/remanga/build.gradle b/src/ru/remanga/build.gradle index c8af60b3a..c288c980a 100644 --- a/src/ru/remanga/build.gradle +++ b/src/ru/remanga/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Remanga' pkgNameSuffix = 'ru.remanga' extClass = '.Remanga' - extVersionCode = 75 + extVersionCode = 76 } dependencies { diff --git a/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt b/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt index 3a4c72da7..91973c32d 100644 --- a/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt +++ b/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt @@ -10,13 +10,14 @@ import eu.kanade.tachiyomi.extension.ru.remanga.dto.BookDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.BranchesDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.ChunksPageDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.ExBookDto +import eu.kanade.tachiyomi.extension.ru.remanga.dto.ExLibraryDto +import eu.kanade.tachiyomi.extension.ru.remanga.dto.ExWrapperDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.LibraryDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.MangaDetDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.MyLibraryDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.PageDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.PageWrapperDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.PagesDto -import eu.kanade.tachiyomi.extension.ru.remanga.dto.SeriesExWrapperDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.SeriesWrapperDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.TagsDto import eu.kanade.tachiyomi.extension.ru.remanga.dto.UserDto @@ -212,7 +213,14 @@ class Remanga : ConfigurableSource, HttpSource() { override fun latestUpdatesParse(response: Response): MangasPage = searchMangaParse(response) override fun searchMangaParse(response: Response): MangasPage { - if (response.request.url.toString().contains("/bookmarks/")) { + if (response.request.url.toString().contains(exManga)) { + val page = json.decodeFromString>>(response.body.string()) + val mangas = page.data.map { + it.toSManga() + } + + return MangasPage(mangas, true) + } else if (response.request.url.toString().contains("/bookmarks/")) { val page = json.decodeFromString>(response.body.string()) val mangas = page.content.map { it.title.toSManga() @@ -229,6 +237,13 @@ class Remanga : ConfigurableSource, HttpSource() { return MangasPage(mangas, page.props.page < page.props.total_pages!!) } } + private fun ExLibraryDto.toSManga(): SManga = + SManga.create().apply { + // Do not change the title name to ensure work with a multilingual catalog! + title = name + url = "/api/titles/$dir/" + thumbnail_url = baseUrl + img + } private fun LibraryDto.toSManga(): SManga = SManga.create().apply { @@ -307,6 +322,11 @@ class Remanga : ConfigurableSource, HttpSource() { url.setQueryParameter("count_chapters_gte", "0") } } + is RequireEX -> { + if (filter.state == 1) { + return GET("$exManga/manga?take=20&skip=${10 * (page - 1)}&name=$query", exHeaders()) + } + } else -> {} } } @@ -461,7 +481,7 @@ class Remanga : ConfigurableSource, HttpSource() { else -> { val mangaID = mangaIDs[manga.url.substringAfter("/api/titles/").substringBefore("/").substringBefore("?")] val exChapters = if (preferences.getBoolean(exPAID_PREF, true)) { - json.decodeFromString>>(client.newCall(GET("$exManga/chapter/history/$mangaID", exHeaders())).execute().body.string()).data + json.decodeFromString>>(client.newCall(GET("$exManga/chapter/history/$mangaID", exHeaders())).execute().body.string()).data } else { emptyList() } @@ -570,7 +590,7 @@ class Remanga : ConfigurableSource, HttpSource() { val heightEmptyChunks = 10 if (chapter.scanlator.equals("exmanga")) { try { - val exPage = json.decodeFromString>>>(body) + val exPage = json.decodeFromString>>>(body) val result = mutableListOf() exPage.data.forEach { it.filter { page -> page.height > heightEmptyChunks }.forEach { page -> @@ -688,6 +708,7 @@ class Remanga : ConfigurableSource, HttpSource() { private class AgeList(ages: List) : Filter.Group("Возрастное ограничение", ages) override fun getFilterList() = FilterList( + RequireEX(), OrderBy(), GenreList(getGenreList()), CategoryList(getCategoryList()), @@ -894,6 +915,11 @@ class Remanga : ConfigurableSource, HttpSource() { "Только проекты с главами", arrayOf("Да", "Все"), ) + + private class RequireEX : Filter.Select( + "Использовать поиск", + arrayOf("Remanga", "ExManga(без фильтров)"), + ) private var isEng: String? = preferences.getString(LANGUAGE_PREF, "eng") override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) { val userAgentSystem = androidx.preference.CheckBoxPreference(screen.context).apply { diff --git a/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/dto/Dto.kt b/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/dto/Dto.kt index 751ad8d31..e9bff02f9 100644 --- a/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/dto/Dto.kt +++ b/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/dto/Dto.kt @@ -97,7 +97,7 @@ data class BookDto( ) @Serializable -data class SeriesExWrapperDto( +data class ExWrapperDto( val data: T, ) @@ -108,6 +108,14 @@ data class ExBookDto( val chapter: String, ) +@Serializable +data class ExLibraryDto( + val id: Long, + val dir: String, + val name: String = "Без названия", + val img: String?, +) + @Serializable data class PagesDto( val id: Int,