
* lib-randomua * NHentai: Random mobile ua * Madara random UA overhaul * MangaThemesia random UA overhaul * MangaHub random UA overhaul * build errors and warnings * remove preference from Constellar * change to singleton object * network.client * fix copy paste and chapter deep link * exit early * use data class and enum options * missing import * suggested changes Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * re-add empty check to filters * convert to interceptor * update comment Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> * update error message * initialize client by lazy * dont check on excluded Filters Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * newlines * move preference helper function into lib * move preference helper function into lib x2 * move check to lib too * move defaultRandomUserAgentType to constructor * rename the interceptor * organize the interceptor and preference stuff in different files * hide custom ua setting when random ua is enabled * English Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * catch specific exception Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> * setVisible() fresh stuff * setVisible() fresh stuff * change summary * workaround * Update error message Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> * Update comment Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> --------- Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>
43 lines
1.2 KiB
Kotlin
43 lines
1.2 KiB
Kotlin
package eu.kanade.tachiyomi.extension.pt.fleurblanche
|
|
|
|
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
|
import okhttp3.Interceptor
|
|
import okhttp3.OkHttpClient
|
|
import okhttp3.Response
|
|
import java.io.IOException
|
|
import java.text.SimpleDateFormat
|
|
import java.util.Locale
|
|
import java.util.concurrent.TimeUnit
|
|
|
|
class FleurBlanche : Madara(
|
|
"Fleur Blanche",
|
|
"https://fbsquads.com",
|
|
"pt-BR",
|
|
SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")),
|
|
) {
|
|
|
|
override val client: OkHttpClient = super.client.newBuilder()
|
|
.addInterceptor(::authWarningIntercept)
|
|
.rateLimit(1, 2, TimeUnit.SECONDS)
|
|
.build()
|
|
|
|
override val useNewChapterEndpoint = true
|
|
|
|
private fun authWarningIntercept(chain: Interceptor.Chain): Response {
|
|
val response = chain.proceed(chain.request())
|
|
|
|
if (response.request.url.toString().contains("wp-login.php")) {
|
|
response.close()
|
|
throw IOException(NEED_LOGIN_ERROR)
|
|
}
|
|
|
|
return response
|
|
}
|
|
|
|
companion object {
|
|
private const val NEED_LOGIN_ERROR =
|
|
"É necessário realizar o login via WebView para acessar a fonte."
|
|
}
|
|
}
|