2022-04-19 21:55:36 +00:00
|
|
|
package eu.kanade.tachiyomi.extension.pt.fleurblanche
|
|
|
|
|
|
|
|
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
2022-06-05 21:51:18 +00:00
|
|
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
2022-04-19 21:55:36 +00:00
|
|
|
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",
|
2022-08-06 21:31:55 +00:00
|
|
|
"https://fbsquads.com",
|
2022-04-19 21:55:36 +00:00
|
|
|
"pt-BR",
|
2023-02-11 19:21:03 +00:00
|
|
|
SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")),
|
2022-04-19 21:55:36 +00:00
|
|
|
) {
|
|
|
|
|
|
|
|
override val client: OkHttpClient = super.client.newBuilder()
|
|
|
|
.addInterceptor(::authWarningIntercept)
|
2022-06-05 21:51:18 +00:00
|
|
|
.rateLimit(1, 2, TimeUnit.SECONDS)
|
2022-04-19 21:55:36 +00:00
|
|
|
.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."
|
|
|
|
}
|
|
|
|
}
|