From 0d2056cabff6b29abb22ec51dde2e7cc6e128b99 Mon Sep 17 00:00:00 2001 From: bapeey <90949336+bapeey@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:20:50 -0500 Subject: [PATCH] SlimeRead: Update API url (#1334) Update apiurl --- src/pt/slimeread/build.gradle | 2 +- .../extension/pt/slimeread/SlimeRead.kt | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pt/slimeread/build.gradle b/src/pt/slimeread/build.gradle index e3cd92b4c..5e45872f8 100644 --- a/src/pt/slimeread/build.gradle +++ b/src/pt/slimeread/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'SlimeRead' extClass = '.SlimeRead' - extVersionCode = 2 + extVersionCode = 3 isNsfw = true } diff --git a/src/pt/slimeread/src/eu/kanade/tachiyomi/extension/pt/slimeread/SlimeRead.kt b/src/pt/slimeread/src/eu/kanade/tachiyomi/extension/pt/slimeread/SlimeRead.kt index 8e6105a5a..f3a44f2ac 100644 --- a/src/pt/slimeread/src/eu/kanade/tachiyomi/extension/pt/slimeread/SlimeRead.kt +++ b/src/pt/slimeread/src/eu/kanade/tachiyomi/extension/pt/slimeread/SlimeRead.kt @@ -30,6 +30,8 @@ class SlimeRead : HttpSource() { override val baseUrl = "https://slimeread.com" + private val apiUrl = "https://free.slimeread.com:8443" + override val lang = "pt-BR" override val supportsLatest = true @@ -37,7 +39,7 @@ class SlimeRead : HttpSource() { override val client by lazy { network.client.newBuilder() .rateLimitHost(baseUrl.toHttpUrl(), 2) - .rateLimitHost(API_URL.toHttpUrl(), 1) + .rateLimitHost(apiUrl.toHttpUrl(), 1) .build() } @@ -46,7 +48,7 @@ class SlimeRead : HttpSource() { private val json: Json by injectLazy() // ============================== Popular =============================== - override fun popularMangaRequest(page: Int) = GET("$API_URL/ranking/semana?nsfw=false", headers) + override fun popularMangaRequest(page: Int) = GET("$apiUrl/ranking/semana?nsfw=false", headers) override fun popularMangaParse(response: Response): MangasPage { val items = response.parseAs>() @@ -55,7 +57,7 @@ class SlimeRead : HttpSource() { } // =============================== Latest =============================== - override fun latestUpdatesRequest(page: Int) = GET("$API_URL/books?page=$page", headers) + override fun latestUpdatesRequest(page: Int) = GET("$apiUrl/books?page=$page", headers) override fun latestUpdatesParse(response: Response): MangasPage { val dto = response.parseAs() @@ -68,7 +70,7 @@ class SlimeRead : HttpSource() { override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable { return if (query.startsWith(PREFIX_SEARCH)) { // URL intent handler val id = query.removePrefix(PREFIX_SEARCH) - client.newCall(GET("$API_URL/book/$id", headers)) + client.newCall(GET("$apiUrl/book/$id", headers)) .asObservableSuccess() .map(::searchMangaByIdParse) } else { @@ -86,7 +88,7 @@ class SlimeRead : HttpSource() { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { val params = SlimeReadFilters.getSearchParameters(filters) - val url = "$API_URL/book_search".toHttpUrl().newBuilder() + val url = "$apiUrl/book_search".toHttpUrl().newBuilder() .addIfNotBlank("query", query) .addIfNotBlank("genre[]", params.genre) .addIfNotBlank("status", params.status) @@ -105,7 +107,7 @@ class SlimeRead : HttpSource() { // =========================== Manga Details ============================ override fun getMangaUrl(manga: SManga) = baseUrl + manga.url.replace("/book/", "/manga/") - override fun mangaDetailsRequest(manga: SManga) = GET(API_URL + manga.url, headers) + override fun mangaDetailsRequest(manga: SManga) = GET(apiUrl + manga.url, headers) override fun mangaDetailsParse(response: Response) = SManga.create().apply { val info = response.parseAs() @@ -124,7 +126,7 @@ class SlimeRead : HttpSource() { // ============================== Chapters ============================== override fun chapterListRequest(manga: SManga) = - GET("$API_URL/book_cap_units_all?manga_id=${manga.url.substringAfterLast("/")}", headers) + GET("$apiUrl/book_cap_units_all?manga_id=${manga.url.substringAfterLast("/")}", headers) override fun chapterListParse(response: Response): List { val items = response.parseAs>() @@ -157,7 +159,7 @@ class SlimeRead : HttpSource() { } // =============================== Pages ================================ - override fun pageListRequest(chapter: SChapter) = GET(API_URL + chapter.url, headers) + override fun pageListRequest(chapter: SChapter) = GET(apiUrl + chapter.url, headers) override fun pageListParse(response: Response): List { val pages = response.parseAs>().flatMap { it.pages } @@ -183,7 +185,5 @@ class SlimeRead : HttpSource() { companion object { const val PREFIX_SEARCH = "id:" - - private const val API_URL = "https://ai3.slimeread.com:8443" } }