[RU]Remanga optional rateLimit (#15990)
This commit is contained in:
parent
2bb5c59135
commit
97ff9735db
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'Remanga'
|
extName = 'Remanga'
|
||||||
pkgNameSuffix = 'ru.remanga'
|
pkgNameSuffix = 'ru.remanga'
|
||||||
extClass = '.Remanga'
|
extClass = '.Remanga'
|
||||||
extVersionCode = 69
|
extVersionCode = 70
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -156,11 +156,14 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
response
|
response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val loadLimit = if (!preferences.getBoolean(bLoad_PREF, false)) 1 else 3
|
||||||
|
|
||||||
override val client: OkHttpClient =
|
override val client: OkHttpClient =
|
||||||
network.cloudflareClient.newBuilder()
|
network.cloudflareClient.newBuilder()
|
||||||
.rateLimitHost("https://img3.reimg.org".toHttpUrl(), 2)
|
.rateLimitHost("https://img3.reimg.org".toHttpUrl(), loadLimit, 2)
|
||||||
.rateLimitHost("https://img5.reimg.org".toHttpUrl(), 2)
|
.rateLimitHost("https://img5.reimg.org".toHttpUrl(), loadLimit, 2)
|
||||||
.rateLimitHost(exManga.toHttpUrl(), 2)
|
.rateLimitHost(exManga.toHttpUrl(), 3)
|
||||||
.addInterceptor { imageContentTypeIntercept(it) }
|
.addInterceptor { imageContentTypeIntercept(it) }
|
||||||
.addInterceptor { authIntercept(it) }
|
.addInterceptor { authIntercept(it) }
|
||||||
.addNetworkInterceptor { chain ->
|
.addNetworkInterceptor { chain ->
|
||||||
|
@ -868,6 +871,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val domainPref = ListPreference(screen.context).apply {
|
val domainPref = ListPreference(screen.context).apply {
|
||||||
key = DOMAIN_PREF
|
key = DOMAIN_PREF
|
||||||
title = "Выбор домена"
|
title = "Выбор домена"
|
||||||
|
@ -927,6 +931,20 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
summary = "Скрывает мангу находящуюся в закладках пользователя на сайте."
|
summary = "Скрывает мангу находящуюся в закладках пользователя на сайте."
|
||||||
setDefaultValue(false)
|
setDefaultValue(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val boostLoad = androidx.preference.CheckBoxPreference(screen.context).apply {
|
||||||
|
key = bLoad_PREF
|
||||||
|
title = "Ускорить скачивание глав"
|
||||||
|
summary = "Увеличивает количество скачиваемых страниц в секунду, но Remanga быстрее ограничит скорость скачивания."
|
||||||
|
setDefaultValue(false)
|
||||||
|
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val warning = "Для применения настройки необходимо перезапустить приложение с полной остановкой."
|
||||||
|
Toast.makeText(screen.context, warning, Toast.LENGTH_LONG).show()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
screen.addPreference(userAgentSystem)
|
screen.addPreference(userAgentSystem)
|
||||||
screen.addPreference(domainPref)
|
screen.addPreference(domainPref)
|
||||||
screen.addPreference(titleLanguagePref)
|
screen.addPreference(titleLanguagePref)
|
||||||
|
@ -934,6 +952,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
screen.addPreference(exChapterShow)
|
screen.addPreference(exChapterShow)
|
||||||
screen.addPreference(domainExPref)
|
screen.addPreference(domainExPref)
|
||||||
screen.addPreference(bookmarksHide)
|
screen.addPreference(bookmarksHide)
|
||||||
|
screen.addPreference(boostLoad)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val json: Json by injectLazy()
|
private val json: Json by injectLazy()
|
||||||
|
@ -946,6 +965,8 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
private const val userAgent_PREF = "UAgent"
|
private const val userAgent_PREF = "UAgent"
|
||||||
|
|
||||||
|
private const val bLoad_PREF = "boostLoad_PREF"
|
||||||
|
|
||||||
private const val DOMAIN_PREF = "REMangaDomain"
|
private const val DOMAIN_PREF = "REMangaDomain"
|
||||||
|
|
||||||
private const val exDOMAIN_PREF = "EXMangaDomain"
|
private const val exDOMAIN_PREF = "EXMangaDomain"
|
||||||
|
|
Loading…
Reference in New Issue