From 314cb965e32f7fbeeca877b8573472cb931563a0 Mon Sep 17 00:00:00 2001 From: Riztard Lanthorn Date: Fri, 8 Jan 2021 20:35:32 +0700 Subject: [PATCH] WPComics add headers (#5355) some source like mangasum need it to load chapter images --- src/all/wpcomics/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/all/wpcomics/WPComics.kt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/all/wpcomics/build.gradle b/src/all/wpcomics/build.gradle index ac8a4e9d4..22249ca31 100644 --- a/src/all/wpcomics/build.gradle +++ b/src/all/wpcomics/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'WP-Comics' pkgNameSuffix = 'all.wpcomics' extClass = '.WPComicsFactory' - extVersionCode = 16 + extVersionCode = 17 libVersion = '1.2' } diff --git a/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComics.kt b/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComics.kt index 1975c1526..244b39080 100644 --- a/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComics.kt +++ b/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComics.kt @@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.ParsedHttpSource +import okhttp3.Headers import okhttp3.HttpUrl import okhttp3.OkHttpClient import okhttp3.Request @@ -28,6 +29,10 @@ abstract class WPComics( override val client: OkHttpClient = network.cloudflareClient + override fun headersBuilder(): Headers.Builder = Headers.Builder() + .add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0") + .add("Referer", baseUrl) + private fun List.doesInclude(thisWord: String): Boolean = this.any { it.contains(thisWord, ignoreCase = true) } // Popular