TMO / LectorManga: Move to factory (fix http 530) (#4393)
* damn * shouldn't newBuilder() create a new instance? * 1 second is enough * remove lazy Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> * imports --------- Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>
@ -1,5 +0,0 @@
|
||||
plugins {
|
||||
id("lib-multisrc")
|
||||
}
|
||||
|
||||
baseVersionCode = 6
|
@ -1,10 +0,0 @@
|
||||
ext {
|
||||
extName = 'LectorManga'
|
||||
extClass = '.LectorManga'
|
||||
themePkg = 'lectortmo'
|
||||
baseUrl = 'https://lectormanga.com'
|
||||
overrideVersionCode = 34
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 21 KiB |
@ -3,7 +3,7 @@
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name="eu.kanade.tachiyomi.multisrc.lectortmo.LectorTmoUrlActivity"
|
||||
android:name="eu.kanade.tachiyomi.extension.es.lectortmo.LectorTmoUrlActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true"
|
||||
android:theme="@android:style/Theme.NoDisplay">
|
||||
@ -12,10 +12,10 @@
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data
|
||||
android:host="${SOURCEHOST}"
|
||||
android:pathPattern="/library/..*/..*/..*"
|
||||
android:scheme="${SOURCESCHEME}" />
|
||||
<data android:scheme="https"/>
|
||||
<data android:host="lectormanga.com"/>
|
||||
<data android:host="visortmo.com"/>
|
||||
<data android:pathPattern="/library/..*/..*/..*"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
8
src/es/lectortmo/build.gradle
Normal file
@ -0,0 +1,8 @@
|
||||
ext {
|
||||
extName = 'TuMangaOnline / LectorManga'
|
||||
extClass = '.LectorTmoFactory'
|
||||
extVersionCode = 1
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@ -1,4 +1,4 @@
|
||||
package eu.kanade.tachiyomi.multisrc.lectortmo
|
||||
package eu.kanade.tachiyomi.extension.es.lectortmo
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Application
|
||||
@ -42,6 +42,7 @@ abstract class LectorTmo(
|
||||
override val name: String,
|
||||
override val baseUrl: String,
|
||||
override val lang: String,
|
||||
private val rateLimitClient: OkHttpClient,
|
||||
) : ParsedHttpSource(), ConfigurableSource {
|
||||
|
||||
private val preferences: SharedPreferences by lazy {
|
||||
@ -91,7 +92,7 @@ abstract class LectorTmo(
|
||||
}
|
||||
|
||||
private val ignoreSslClient: OkHttpClient by lazy {
|
||||
network.cloudflareClient.newBuilder()
|
||||
rateLimitClient.newBuilder()
|
||||
.ignoreAllSSLErrors()
|
||||
.followRedirects(false)
|
||||
.rateLimit(
|
||||
@ -103,7 +104,7 @@ abstract class LectorTmo(
|
||||
|
||||
private var lastCFDomain: String = ""
|
||||
override val client: OkHttpClient by lazy {
|
||||
network.cloudflareClient.newBuilder()
|
||||
rateLimitClient.newBuilder()
|
||||
.addInterceptor { chain ->
|
||||
val request = chain.request()
|
||||
val url = request.url
|
||||
@ -244,6 +245,8 @@ abstract class LectorTmo(
|
||||
return super.getMangaUrl(manga)
|
||||
}
|
||||
|
||||
override fun mangaDetailsRequest(manga: SManga) = GET(baseUrl + manga.url, tmoHeaders)
|
||||
|
||||
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
|
||||
title = document.select("h2.element-subtitle").text()
|
||||
document.select("h5.card-title").let {
|
||||
@ -271,6 +274,8 @@ abstract class LectorTmo(
|
||||
return super.getChapterUrl(chapter)
|
||||
}
|
||||
|
||||
override fun chapterListRequest(manga: SManga) = mangaDetailsRequest(manga)
|
||||
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val document = response.asJsoup()
|
||||
|
@ -1,7 +1,9 @@
|
||||
package eu.kanade.tachiyomi.extension.es.lectormanga
|
||||
package eu.kanade.tachiyomi.extension.es.lectortmo
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.lectortmo.LectorTmo
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||
import eu.kanade.tachiyomi.source.SourceFactory
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
@ -9,9 +11,26 @@ import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
class LectorManga : LectorTmo("LectorManga", "https://lectormanga.com", "es") {
|
||||
class LectorTmoFactory : SourceFactory {
|
||||
|
||||
override fun createSources() = listOf(
|
||||
LectorManga(),
|
||||
TuMangaOnline(),
|
||||
)
|
||||
}
|
||||
|
||||
val rateLimitClient = Injekt.get<NetworkHelper>().cloudflareClient.newBuilder()
|
||||
.rateLimit(1, 1)
|
||||
.build()
|
||||
|
||||
class TuMangaOnline : LectorTmo("TuMangaOnline", "https://visortmo.com", "es", rateLimitClient) {
|
||||
override val id = 4146344224513899730
|
||||
}
|
||||
|
||||
class LectorManga : LectorTmo("LectorManga", "https://lectormanga.com", "es", rateLimitClient) {
|
||||
override val id = 7925520943983324764
|
||||
|
||||
override fun popularMangaSelector() = ".col-6 .card"
|
@ -1,4 +1,4 @@
|
||||
package eu.kanade.tachiyomi.multisrc.lectortmo
|
||||
package eu.kanade.tachiyomi.extension.es.lectortmo
|
||||
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
|
@ -1,4 +1,4 @@
|
||||
package eu.kanade.tachiyomi.multisrc.lectortmo
|
||||
package eu.kanade.tachiyomi.extension.es.lectortmo
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.ActivityNotFoundException
|
||||
@ -19,7 +19,7 @@ class LectorTmoUrlActivity : Activity() {
|
||||
|
||||
val mainIntent = Intent().apply {
|
||||
action = "eu.kanade.tachiyomi.SEARCH"
|
||||
putExtra("query", "${LectorTmo.PREFIX_SLUG_SEARCH}$type/$id/$slug")
|
||||
putExtra("query", "slug:$type/$id/$slug")
|
||||
putExtra("filter", packageName)
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
ext {
|
||||
extName = 'TuMangaOnline'
|
||||
extClass = '.TuMangaOnline'
|
||||
themePkg = 'lectortmo'
|
||||
baseUrl = 'https://visortmo.com'
|
||||
overrideVersionCode = 49
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
@ -1,8 +0,0 @@
|
||||
package eu.kanade.tachiyomi.extension.es.tumangaonline
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.lectortmo.LectorTmo
|
||||
|
||||
class TuMangaOnline : LectorTmo("TuMangaOnline", "https://visortmo.com", "es") {
|
||||
|
||||
override val id = 4146344224513899730
|
||||
}
|