diff --git a/lib-multisrc/peachscan/AndroidManifest.xml b/lib-multisrc/peachscan/AndroidManifest.xml new file mode 100644 index 000000000..3b94fcf34 --- /dev/null +++ b/lib-multisrc/peachscan/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/lib-multisrc/peachscan/build.gradle.kts b/lib-multisrc/peachscan/build.gradle.kts index f0079f29b..bbd402a53 100644 --- a/lib-multisrc/peachscan/build.gradle.kts +++ b/lib-multisrc/peachscan/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("lib-multisrc") } -baseVersionCode = 7 +baseVersionCode = 8 dependencies { compileOnly("com.github.tachiyomiorg:image-decoder:e08e9be535") diff --git a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt index bcfe4bd62..30d93ef66 100644 --- a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt +++ b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt @@ -8,6 +8,7 @@ import android.graphics.Canvas import android.graphics.Rect import android.util.Base64 import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -28,6 +29,7 @@ import okhttp3.ResponseBody.Companion.toResponseBody import org.jsoup.Jsoup import org.jsoup.nodes.Document import org.jsoup.nodes.Element +import rx.Observable import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy @@ -82,6 +84,18 @@ abstract class PeachScan( override fun latestUpdatesNextPageSelector() = null + override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable { + if (query.startsWith(URL_SEARCH_PREFIX)) { + val manga = SManga.create().apply { url = "/${query.substringAfter(URL_SEARCH_PREFIX)}/" } + return client.newCall(mangaDetailsRequest(manga)) + .asObservableSuccess() + .map { + MangasPage(listOf(mangaDetailsParse(it).apply { url = manga.url }), false) + } + } + return super.fetchSearchManga(page, query, filters) + } + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { val url = baseUrl.toHttpUrl().newBuilder().apply { addPathSegments("auto-complete/") @@ -261,4 +275,8 @@ abstract class PeachScan( memInfo.totalMem < 3L * 1024 * 1024 * 1024 } + + companion object { + const val URL_SEARCH_PREFIX = "slug:" + } } diff --git a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScanUrlActivity.kt b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScanUrlActivity.kt new file mode 100644 index 000000000..6278c81c1 --- /dev/null +++ b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScanUrlActivity.kt @@ -0,0 +1,42 @@ +package eu.kanade.tachiyomi.multisrc.peachscan + +import android.app.Activity +import android.content.ActivityNotFoundException +import android.content.Intent +import android.os.Bundle +import android.util.Log +import kotlin.system.exitProcess + +class PeachScanUrlActivity : Activity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val pathSegments = intent?.data?.pathSegments + + if (pathSegments != null && pathSegments.size >= 1) { + val mainIntent = Intent().apply { + action = "eu.kanade.tachiyomi.SEARCH" + putExtra("query", "${slug(pathSegments)}") + putExtra("filter", packageName) + } + try { + startActivity(mainIntent) + } catch (e: ActivityNotFoundException) { + Log.e("PeachScanUrlActivity", e.toString()) + } + } else { + Log.e("PeachScanUrlActivity", "could not parse uri from intent $intent") + } + + finish() + exitProcess(0) + } + + private fun slug(pathSegments: MutableList): String? { + return if (pathSegments.size >= 1) { + val slug = pathSegments[0] + "${PeachScan.URL_SEARCH_PREFIX}$slug" + } else { + null + } + } +} diff --git a/src/pt/randomscan/build.gradle b/src/pt/randomscan/build.gradle index cc9c8eb5e..0eea2d98f 100644 --- a/src/pt/randomscan/build.gradle +++ b/src/pt/randomscan/build.gradle @@ -2,8 +2,8 @@ ext { extName = 'Lura Toon' extClass = '.LuraToon' themePkg = 'peachscan' - baseUrl = 'https://luratoon.com' - overrideVersionCode = 41 + baseUrl = 'https://lura-toons.com' + overrideVersionCode = 42 } apply from: "$rootDir/common.gradle"