fix remanga blocking tachi (#5491)
This commit is contained in:
parent
82ddd18046
commit
bb884dfee1
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Remanga'
|
||||
pkgNameSuffix = 'ru.remanga'
|
||||
extClass = '.Remanga'
|
||||
extVersionCode = 12
|
||||
extVersionCode = 13
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ import java.io.ByteArrayOutputStream
|
|||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import kotlin.math.absoluteValue
|
||||
import kotlin.random.Random
|
||||
|
||||
class Remanga : ConfigurableSource, HttpSource() {
|
||||
override val name = "Remanga"
|
||||
|
@ -69,10 +71,11 @@ class Remanga : ConfigurableSource, HttpSource() {
|
|||
|
||||
private var token: String = ""
|
||||
|
||||
override fun headersBuilder() = Headers.Builder().apply {
|
||||
add("User-Agent", "Tachiyomi" + System.getProperty("http.agent"))
|
||||
add("Referer", baseUrl)
|
||||
}
|
||||
protected open val userAgentRandomizer = " ${Random.nextInt().absoluteValue}"
|
||||
|
||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/78.0$userAgentRandomizer")
|
||||
.add("Referer", "https://www.google.com")
|
||||
|
||||
private val preferences: SharedPreferences by lazy {
|
||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||
|
@ -332,10 +335,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
|||
override fun imageUrlParse(response: Response): String = throw NotImplementedError("Unused")
|
||||
|
||||
private fun combineImage(pages: List<String>): String {
|
||||
val refererHeaders = Headers.Builder().apply {
|
||||
add("User-Agent", "Tachiyomi" + System.getProperty("http.agent"))
|
||||
add("Referer", "https://img.remanga.org")
|
||||
}.build()
|
||||
val refererHeaders = headersBuilder().build()
|
||||
val s = client.newCall(GET(pages[0], refererHeaders)).execute().body()!!.bytes()
|
||||
val b = BitmapFactory.decodeByteArray(s, 0, s.size)
|
||||
|
||||
|
@ -357,10 +357,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
|||
}
|
||||
|
||||
override fun imageRequest(page: Page): Request {
|
||||
val refererHeaders = Headers.Builder().apply {
|
||||
add("User-Agent", "Tachiyomi" + System.getProperty("http.agent"))
|
||||
add("Referer", "https://img.remanga.org")
|
||||
}.build()
|
||||
val refererHeaders = headersBuilder().build()
|
||||
return GET(page.imageUrl!!, refererHeaders)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue