From f2321f698b5502f1b6b63e256b0c6767aa4136f8 Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Tue, 4 Apr 2023 23:39:27 +0800 Subject: [PATCH] Remove date logic checks based on vanilla version (#15951) * Remove date logic checks based on vanilla version * SixMH: baseUrl for CI --- multisrc/overrides/sinmh/gufengmh/src/Gufengmh.kt | 2 +- .../eu/kanade/tachiyomi/multisrc/sinmh/SinMH.kt | 4 +--- .../tachiyomi/multisrc/sinmh/SinMHGenerator.kt | 4 ++-- src/zh/baozimanhua/CHANGELOG.md | 4 ++++ src/zh/baozimanhua/build.gradle | 2 +- .../tachiyomi/extension/zh/baozimanhua/Baozi.kt | 3 --- src/zh/roumanwu/build.gradle | 2 +- .../extension/zh/roumanwu/RoumanwuDto.kt | 13 +------------ src/zh/sixmh/build.gradle | 2 +- .../kanade/tachiyomi/extension/zh/sixmh/SixMH.kt | 14 +++++++++----- src/zh/terrahistoricus/build.gradle | 2 +- .../zh/terrahistoricus/TerraHistoricusDto.kt | 15 +-------------- 12 files changed, 23 insertions(+), 44 deletions(-) diff --git a/multisrc/overrides/sinmh/gufengmh/src/Gufengmh.kt b/multisrc/overrides/sinmh/gufengmh/src/Gufengmh.kt index ee9548db9..0866925d7 100644 --- a/multisrc/overrides/sinmh/gufengmh/src/Gufengmh.kt +++ b/multisrc/overrides/sinmh/gufengmh/src/Gufengmh.kt @@ -9,7 +9,7 @@ import org.jsoup.nodes.Document import rx.Observable import rx.Single -class Gufengmh : SinMH("古风漫画网", "https://www.123gf.com") { +class Gufengmh : SinMH("古风漫画网", "https://www.gufengmh.com") { override fun mangaDetailsParse(document: Document): SManga = super.mangaDetailsParse(document).apply { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMH.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMH.kt index acd6745c5..aa7e2e1b3 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMH.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMH.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.multisrc.sinmh -import eu.kanade.tachiyomi.AppInfo import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Filter @@ -166,7 +165,7 @@ abstract class SinMH( val list = document.select(sectionSelector).sectionsDescending().flatMap { section -> section.select(itemSelector).map { chapterFromElement(it) }.sortedDescending() } - if (isNewDateLogic && list.isNotEmpty()) { + if (list.isNotEmpty()) { val date = document.selectFirst(dateSelector)!!.textNodes().last().text() list[0].date_upload = DATE_FORMAT.parse(date)?.time ?: 0L } @@ -267,7 +266,6 @@ abstract class SinMH( companion object { private val DATE_FORMAT by lazy { SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) } - private val isNewDateLogic = AppInfo.getVersionCode() >= 81 private val sortNames = arrayOf("按发布排序", "按发布排序(逆序)", "按更新排序", "按更新排序(逆序)", "按点击排序", "按点击排序(逆序)") private val sortKeys = arrayOf("post/", "-post/", "update/", "-update/", "click/", "-click/") } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMHGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMHGenerator.kt index e82a1722d..133a2782b 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMHGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/sinmh/SinMHGenerator.kt @@ -6,11 +6,11 @@ import generator.ThemeSourceGenerator class SinMHGenerator : ThemeSourceGenerator { override val themeClass = "SinMH" override val themePkg = "sinmh" - override val baseVersionCode = 8 + override val baseVersionCode = 9 override val sources = listOf( SingleLang( name = "Gufeng Manhua", - baseUrl = "https://www.123gf.com", + baseUrl = "https://www.gufengmh.com", lang = "zh", className = "Gufengmh", sourceName = "古风漫画网", diff --git a/src/zh/baozimanhua/CHANGELOG.md b/src/zh/baozimanhua/CHANGELOG.md index 27ca28b91..7d0a406ca 100644 --- a/src/zh/baozimanhua/CHANGELOG.md +++ b/src/zh/baozimanhua/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.3.19 (2023-04-03) + +- 设置章节日期时不再错误地检查应用版本 + ## 1.3.18 (2023-01-12) - 修复繁体站点章节列表错乱的问题 diff --git a/src/zh/baozimanhua/build.gradle b/src/zh/baozimanhua/build.gradle index 95165866c..ebf6dbcb7 100644 --- a/src/zh/baozimanhua/build.gradle +++ b/src/zh/baozimanhua/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Baozi Manhua' pkgNameSuffix = 'zh.baozimanhua' extClass = '.Baozi' - extVersionCode = 18 + extVersionCode = 19 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt index d3325fa4a..ac27cb5d8 100644 --- a/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt +++ b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt @@ -5,7 +5,6 @@ import android.content.SharedPreferences import androidx.preference.ListPreference import androidx.preference.PreferenceScreen import com.github.stevenyomi.baozibanner.BaoziBanner -import eu.kanade.tachiyomi.AppInfo import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.network.interceptor.rateLimit @@ -77,7 +76,6 @@ class Baozi : ParsedHttpSource(), ConfigurableSource { } } } - if (!isNewDateLogic) return@apply val date = document.select("em").text() if (date.contains('年')) { this[0].date_upload = date.removePrefix("(").removeSuffix(" 更新)") @@ -282,6 +280,5 @@ class Baozi : ParsedHttpSource(), ConfigurableSource { private const val CHAPTER_ORDER_AGGRESSIVE = "2" private val DATE_FORMAT by lazy { SimpleDateFormat("yyyy年MM月dd日", Locale.ENGLISH) } - private val isNewDateLogic = AppInfo.getVersionCode() >= 81 } } diff --git a/src/zh/roumanwu/build.gradle b/src/zh/roumanwu/build.gradle index 942ab2a88..2fe3e0a41 100644 --- a/src/zh/roumanwu/build.gradle +++ b/src/zh/roumanwu/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Roumanwu' pkgNameSuffix = 'zh.roumanwu' extClass = '.Roumanwu' - extVersionCode = 3 + extVersionCode = 4 isNsfw = true } diff --git a/src/zh/roumanwu/src/eu/kanade/tachiyomi/extension/zh/roumanwu/RoumanwuDto.kt b/src/zh/roumanwu/src/eu/kanade/tachiyomi/extension/zh/roumanwu/RoumanwuDto.kt index e6393e63f..4e7140b43 100644 --- a/src/zh/roumanwu/src/eu/kanade/tachiyomi/extension/zh/roumanwu/RoumanwuDto.kt +++ b/src/zh/roumanwu/src/eu/kanade/tachiyomi/extension/zh/roumanwu/RoumanwuDto.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.extension.zh.roumanwu -import eu.kanade.tachiyomi.AppInfo import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter @@ -46,7 +45,7 @@ data class Book( name = it } }.apply { - if (isNewDateLogic && !updatedAt.isNullOrBlank()) { + if (!updatedAt.isNullOrBlank()) { this[lastIndex].date_upload = DATE_FORMAT.parse(updatedAt)?.time ?: 0L } } @@ -57,16 +56,6 @@ data class Book( companion object { private val DATE_FORMAT = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH) - private val isNewDateLogic = run { - val commitCount = AppInfo.getVersionName().substringAfter('-', "") - if (commitCount.isNotEmpty()) { - // Preview - commitCount.toInt() >= 4442 - } else { - // Stable - AppInfo.getVersionCode() >= 81 - } - } } } diff --git a/src/zh/sixmh/build.gradle b/src/zh/sixmh/build.gradle index abcecae44..3514b5dfb 100644 --- a/src/zh/sixmh/build.gradle +++ b/src/zh/sixmh/build.gradle @@ -6,7 +6,7 @@ ext { extName = '6Manhua / Qixi Manhua' pkgNameSuffix = 'zh.sixmh' extClass = '.SixMH' - extVersionCode = 7 + extVersionCode = 8 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/sixmh/src/eu/kanade/tachiyomi/extension/zh/sixmh/SixMH.kt b/src/zh/sixmh/src/eu/kanade/tachiyomi/extension/zh/sixmh/SixMH.kt index e007fa836..0fb551939 100644 --- a/src/zh/sixmh/src/eu/kanade/tachiyomi/extension/zh/sixmh/SixMH.kt +++ b/src/zh/sixmh/src/eu/kanade/tachiyomi/extension/zh/sixmh/SixMH.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.extension.zh.sixmh import android.app.Application import androidx.preference.ListPreference import androidx.preference.PreferenceScreen -import eu.kanade.tachiyomi.AppInfo import eu.kanade.tachiyomi.lib.unpacker.Unpacker import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST @@ -37,9 +36,15 @@ class SixMH : HttpSource(), ConfigurableSource { override val lang = "zh" override val supportsLatest = true + private val isCi = System.getenv("CI") == "true" + override val baseUrl get() = when { + isCi -> MIRRORS.zip(MIRROR_NAMES) { domain, name -> "http://www.$domain#$name" }.joinToString() + else -> _baseUrl + } + private val mirrorIndex: Int private val pcUrl: String - override val baseUrl: String + private val _baseUrl: String init { val preferences = Injekt.get().getSharedPreferences("source_$id", 0x0000) @@ -53,7 +58,7 @@ class SixMH : HttpSource(), ConfigurableSource { mirrorIndex = index pcUrl = "http://www.$domain" - baseUrl = "http://$domain" + _baseUrl = "http://$domain" } private val json: Json by injectLazy() @@ -164,7 +169,7 @@ class SixMH : HttpSource(), ConfigurableSource { } } - if (isNewDateLogic && list.isNotEmpty()) { + if (list.isNotEmpty()) { document.selectFirst(".cy_zhangjie_top font")?.run { list[0].date_upload = dateFormat.parse(ownText())?.time ?: 0 } @@ -211,7 +216,6 @@ class SixMH : HttpSource(), ConfigurableSource { val MIRRORS get() = arrayOf("6mh67.com", "qiximh3.com") val MIRROR_NAMES get() = arrayOf("6漫画", "七夕漫画") - private val isNewDateLogic = AppInfo.getVersionCode() >= 81 private val dateFormat by lazy { SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH) } } } diff --git a/src/zh/terrahistoricus/build.gradle b/src/zh/terrahistoricus/build.gradle index 622f088ed..70fa5b634 100644 --- a/src/zh/terrahistoricus/build.gradle +++ b/src/zh/terrahistoricus/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Terra Historicus' pkgNameSuffix = 'zh.terrahistoricus' extClass = '.TerraHistoricus' - extVersionCode = 2 + extVersionCode = 3 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/terrahistoricus/src/eu/kanade/tachiyomi/extension/zh/terrahistoricus/TerraHistoricusDto.kt b/src/zh/terrahistoricus/src/eu/kanade/tachiyomi/extension/zh/terrahistoricus/TerraHistoricusDto.kt index 8e4ed7552..7b18968e9 100644 --- a/src/zh/terrahistoricus/src/eu/kanade/tachiyomi/extension/zh/terrahistoricus/TerraHistoricusDto.kt +++ b/src/zh/terrahistoricus/src/eu/kanade/tachiyomi/extension/zh/terrahistoricus/TerraHistoricusDto.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.extension.zh.terrahistoricus -import eu.kanade.tachiyomi.AppInfo import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import kotlinx.serialization.Serializable @@ -57,23 +56,11 @@ data class THComic( } } }.apply { - if (isNewDateLogic) { - this[0].date_upload = (updateTime ?: 0L) * 1000 - } + this[0].date_upload = (updateTime ?: 0L) * 1000 } companion object { private val EPISODE_TYPES = arrayOf("", "正篇", "番外", "贺图", "公告") - private val isNewDateLogic = run { - val commitCount = AppInfo.getVersionName().substringAfter('-', "") - if (commitCount.isNotEmpty()) { - // Preview - commitCount.toInt() >= 4442 - } else { - // Stable - AppInfo.getVersionCode() >= 81 - } - } } }