From 95fa2facb942c9a5c877a12c2e745c8b2699a95b Mon Sep 17 00:00:00 2001 From: mobi2002 <48650614+mobi2002@users.noreply.github.com> Date: Thu, 29 Dec 2022 01:33:04 +0500 Subject: [PATCH] MangaHub: fix random user agent (#14710) * MangaHub: fix random user agent * update comment * REMOVED_SOURCES.md --- .github/workflows/issue_moderator.yml | 2 +- REMOVED_SOURCES.md | 1 - .../java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt | 6 +++--- .../kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/issue_moderator.yml b/.github/workflows/issue_moderator.yml index 2278ba01e..0c5be064a 100644 --- a/.github/workflows/issue_moderator.yml +++ b/.github/workflows/issue_moderator.yml @@ -37,7 +37,7 @@ jobs: }, { "type": "both", - "regex": ".*(mangago|mangafox|hq\\s*dragon|manga\\s*host|supermangas|superhentais|union\\s*mangas|yes\\s*mangas|manhuascan|manhwahot|leitor\\.?net|manga\\s*livre|tsuki\\s*mangas|manga\\s*yabu|mangas\\.in|mangas\\.pw|hentaikai|toptoon\\+?|cocomanga|hitomi\\.la|copymanga|neox|1manga\\.co|mangafox\\.fun|mangahere\\.onl|manga\\s*hub|mangakakalot\\.fun|manganel(?!o)|mangaonline\\.fun|mangapanda\\.onl|mangareader\\.site|mangatoday|manga\\.town|onemanga\\.info|koushoku).*", + "regex": ".*(mangago|mangafox|hq\\s*dragon|manga\\s*host|supermangas|superhentais|union\\s*mangas|yes\\s*mangas|manhuascan|manhwahot|leitor\\.?net|manga\\s*livre|tsuki\\s*mangas|manga\\s*yabu|mangas\\.in|mangas\\.pw|hentaikai|toptoon\\+?|cocomanga|hitomi\\.la|copymanga|neox|1manga\\.co|mangafox\\.fun|mangahere\\.onl|mangakakalot\\.fun|manganel(?!o)|mangaonline\\.fun|mangatoday|manga\\.town|onemanga\\.info|koushoku).*", "ignoreCase": true, "message": "{match} will not be added back as it is too difficult to maintain. Read #3475 for more information." }, diff --git a/REMOVED_SOURCES.md b/REMOVED_SOURCES.md index 601917ea4..a47b2128a 100644 --- a/REMOVED_SOURCES.md +++ b/REMOVED_SOURCES.md @@ -11,7 +11,6 @@ - Mangá Host https://github.com/tachiyomiorg/tachiyomi-extensions/pull/7065 - Mangá Livre and Leitor.net https://github.com/tachiyomiorg/tachiyomi-extensions/pull/8679 - mangago.me https://github.com/tachiyomiorg/tachiyomi-extensions/issues/988 -- MangaHub https://github.com/tachiyomiorg/tachiyomi-extensions/pull/13174 - MangaYabu! https://github.com/tachiyomiorg/tachiyomi-extensions/pull/9336 - ManhuaScan https://github.com/tachiyomiorg/tachiyomi-extensions/pull/7129 - ManhwaHot https://github.com/tachiyomiorg/tachiyomi-extensions/pull/7129 diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt index d545fdf75..6dabcb168 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHub.kt @@ -61,9 +61,9 @@ abstract class MangaHub( val uaResponse = chain.proceed(GET(UA_DB_URL)) if (uaResponse.isSuccessful) { - // only using chrome, apparently they refuse to load(403) if not chrome - val chromeUserAgentString = json.decodeFromString>(uaResponse.body!!.string()) - .filter { it.contains("chrome", ignoreCase = true) } + // only using desktop chromium-based browsers, apparently they refuse to load(403) if not chrome(ium) + val uaList = json.decodeFromString>>(uaResponse.body!!.string()) + val chromeUserAgentString = uaList["desktop"]!!.filter { it.contains("chrome", ignoreCase = true) } userAgent = chromeUserAgentString.random() checkedUa = true } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt index 4d7460a82..1f08b95ca 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangahub/MangaHubGenerator.kt @@ -9,7 +9,7 @@ class MangaHubGenerator : ThemeSourceGenerator { override val themeClass = "MangaHub" - override val baseVersionCode: Int = 11 + override val baseVersionCode: Int = 12 override val sources = listOf( // SingleLang("1Manga.co", "https://1manga.co", "en", isNsfw = true, className = "OneMangaCo"),