diff --git a/src/pt/saikaiscan/build.gradle b/src/pt/saikaiscan/build.gradle index a3fc8f984..e6e60d779 100644 --- a/src/pt/saikaiscan/build.gradle +++ b/src/pt/saikaiscan/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Saikai Scan' pkgNameSuffix = 'pt.saikaiscan' extClass = '.SaikaiScan' - extVersionCode = 10 + extVersionCode = 11 } apply from: "$rootDir/common.gradle" diff --git a/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScan.kt b/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScan.kt index 893a9e4c8..3e0dc7760 100644 --- a/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScan.kt +++ b/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScan.kt @@ -22,7 +22,7 @@ class SaikaiScan : HttpSource() { override val name = SOURCE_NAME - override val baseUrl = "https://saikai.com.br" + override val baseUrl = "https://saikaiscans.net" override val lang = "pt-BR" @@ -51,7 +51,7 @@ class SaikaiScan : HttpSource() { .addQueryParameter("page", page.toString()) .addQueryParameter("per_page", PER_PAGE) .addQueryParameter("relationships", "language,type,format") - .toString() + .build() return GET(apiEndpointUrl, apiHeaders) } @@ -60,9 +60,8 @@ class SaikaiScan : HttpSource() { val result = response.parseAs() val mangaList = result.data!!.map(SaikaiScanStoryDto::toSManga) - val hasNextPage = result.meta!!.currentPage < result.meta.lastPage - return MangasPage(mangaList, hasNextPage) + return MangasPage(mangaList, result.hasNextPage) } override fun latestUpdatesRequest(page: Int): Request { @@ -75,7 +74,7 @@ class SaikaiScan : HttpSource() { .addQueryParameter("page", page.toString()) .addQueryParameter("per_page", PER_PAGE) .addQueryParameter("relationships", "language,type,format,latestReleases.separator") - .toString() + .build() return GET(apiEndpointUrl, apiHeaders) } @@ -99,7 +98,7 @@ class SaikaiScan : HttpSource() { filters.filterIsInstance() .forEach { it.addQueryParameter(apiEndpointUrl) } - return GET(apiEndpointUrl.toString(), apiHeaders) + return GET(apiEndpointUrl.build(), apiHeaders) } override fun searchMangaParse(response: Response): MangasPage = popularMangaParse(response) @@ -118,7 +117,7 @@ class SaikaiScan : HttpSource() { .addQueryParameter("slug", storySlug) .addQueryParameter("per_page", "1") .addQueryParameter("relationships", "language,type,format,artists,status") - .toString() + .build() return GET(apiEndpointUrl, apiHeaders) } @@ -141,7 +140,7 @@ class SaikaiScan : HttpSource() { .addQueryParameter("slug", storySlug) .addQueryParameter("per_page", "1") .addQueryParameter("relationships", "releases") - .toString() + .build() return GET(apiEndpointUrl, apiHeaders) } @@ -169,7 +168,7 @@ class SaikaiScan : HttpSource() { val apiEndpointUrl = "$API_URL/api/releases/$releaseId".toHttpUrl().newBuilder() .addQueryParameter("relationships", "releaseImages") - .toString() + .build() return GET(apiEndpointUrl, apiHeaders) } @@ -177,7 +176,7 @@ class SaikaiScan : HttpSource() { override fun pageListParse(response: Response): List { val result = response.parseAs() - return result.data!!.releaseImages.mapIndexed { i, obj -> + return result.data?.releaseImages.orEmpty().mapIndexed { i, obj -> Page(i, "", "$IMAGE_SERVER_URL/${obj.image}") } } @@ -295,7 +294,7 @@ class SaikaiScan : HttpSource() { private const val COMIC_FORMAT_ID = "2" private const val PER_PAGE = "12" - private const val API_URL = "https://api.saikai.com.br" - const val IMAGE_SERVER_URL = "https://s3-alpha.saikai.com.br" + private const val API_URL = "https://api.saikaiscans.net" + const val IMAGE_SERVER_URL = "https://s3-alpha.saikaiscans.net" } } diff --git a/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScanDto.kt b/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScanDto.kt index bb9f25c40..ab48b86e4 100644 --- a/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScanDto.kt +++ b/src/pt/saikaiscan/src/eu/kanade/tachiyomi/extension/pt/saikaiscan/SaikaiScanDto.kt @@ -12,7 +12,11 @@ import java.util.Locale data class SaikaiScanResultDto( val data: T? = null, val meta: SaikaiScanMetaDto? = null, -) +) { + + val hasNextPage: Boolean + get() = meta !== null && meta.currentPage < meta.lastPage +} typealias SaikaiScanPaginatedStoriesDto = SaikaiScanResultDto> typealias SaikaiScanReleaseResultDto = SaikaiScanResultDto