MangaDex: Group Blocking improvements (#10481)
* Replace "Abandoned" with "Cancelled" was replaced in the Api few months back as well * Refactor externalURL filtering to use pages attr * Add mangahot to list of external linked groups * Refactor group blocking - Block external linked groups separately This block is now only done in Latest section (uses /chapter) since filtering them out in /manga/ID/feed is done by `createChapter` helper already - No default UUIDs set in groupBlock setting - external linked groups and their UUIDs arent exposed to Users * Increment mangadex.extversioncode * Remove unneeded empty string check for ch.attr.externalUrl Co-authored-by: Mitchell Syer <Mitchellptbo@gmail.com> Co-authored-by: Mitchell Syer <Mitchellptbo@gmail.com>
This commit is contained in:
parent
89a9433851
commit
60751ea39a
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'MangaDex'
|
extName = 'MangaDex'
|
||||||
pkgNameSuffix = 'all.mangadex'
|
pkgNameSuffix = 'all.mangadex'
|
||||||
extClass = '.MangaDexFactory'
|
extClass = '.MangaDexFactory'
|
||||||
extVersionCode = 151
|
extVersionCode = 152
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,13 @@ object MDConstants {
|
||||||
return "${originalLanguagePref}_$dexLang"
|
return "${originalLanguagePref}_$dexLang"
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val blockedGroupsPref = "blockedGroups"
|
|
||||||
private const val groupMangaPlus = "4f1de6a2-f0c5-4ac5-bce5-02c7dbb67deb"
|
private const val groupMangaPlus = "4f1de6a2-f0c5-4ac5-bce5-02c7dbb67deb"
|
||||||
private const val groupComikey = "8d8ecf83-8d42-4f8c-add8-60963f9f28d9"
|
private const val groupComikey = "8d8ecf83-8d42-4f8c-add8-60963f9f28d9"
|
||||||
private const val groupBilibili = "06a9fecb-b608-4f19-b93c-7caab06b7f44"
|
private const val groupBilibili = "06a9fecb-b608-4f19-b93c-7caab06b7f44"
|
||||||
private const val groupAzuki = "5fed0576-8b94-4f9a-b6a7-08eecd69800d"
|
private const val groupAzuki = "5fed0576-8b94-4f9a-b6a7-08eecd69800d"
|
||||||
const val blockedGroupsPrefDefaults = "$groupMangaPlus, $groupComikey, $groupBilibili, $groupAzuki"
|
private const val groupMangaHot = "319c1b10-cbd0-4f55-a46e-c4ee17e65139"
|
||||||
|
val defaultBlockedGroups = setOf(groupMangaPlus, groupComikey, groupBilibili, groupAzuki, groupMangaHot)
|
||||||
|
private const val blockedGroupsPref = "blockedGroups"
|
||||||
fun getBlockedGroupsPrefKey(dexLang: String): String {
|
fun getBlockedGroupsPrefKey(dexLang: String): String {
|
||||||
return "${blockedGroupsPref}_$dexLang"
|
return "${blockedGroupsPref}_$dexLang"
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,9 +174,11 @@ abstract class MangaDex(override val lang: String, val dexLang: String) :
|
||||||
MDConstants.getContentRatingPrefKey(dexLang),
|
MDConstants.getContentRatingPrefKey(dexLang),
|
||||||
MDConstants.contentRatingPrefDefaults
|
MDConstants.contentRatingPrefDefaults
|
||||||
)?.forEach { addQueryParameter("contentRating[]", it) }
|
)?.forEach { addQueryParameter("contentRating[]", it) }
|
||||||
|
MDConstants.defaultBlockedGroups.forEach {
|
||||||
|
addQueryParameter("excludedGroups[]", it)
|
||||||
|
}
|
||||||
preferences.getString(
|
preferences.getString(
|
||||||
MDConstants.getBlockedGroupsPrefKey(dexLang),
|
MDConstants.getBlockedGroupsPrefKey(dexLang), ""
|
||||||
MDConstants.blockedGroupsPrefDefaults
|
|
||||||
)?.split(",")?.sorted()?.forEach { if (it.isNotEmpty()) addQueryParameter("excludedGroups[]", it.trim()) }
|
)?.split(",")?.sorted()?.forEach { if (it.isNotEmpty()) addQueryParameter("excludedGroups[]", it.trim()) }
|
||||||
preferences.getString(
|
preferences.getString(
|
||||||
MDConstants.getBlockedUploaderPrefKey(dexLang),
|
MDConstants.getBlockedUploaderPrefKey(dexLang),
|
||||||
|
@ -335,8 +337,7 @@ abstract class MangaDex(override val lang: String, val dexLang: String) :
|
||||||
addQueryParameter("contentRating[]", "erotica")
|
addQueryParameter("contentRating[]", "erotica")
|
||||||
addQueryParameter("contentRating[]", "pornographic")
|
addQueryParameter("contentRating[]", "pornographic")
|
||||||
preferences.getString(
|
preferences.getString(
|
||||||
MDConstants.getBlockedGroupsPrefKey(dexLang),
|
MDConstants.getBlockedGroupsPrefKey(dexLang), ""
|
||||||
MDConstants.blockedGroupsPrefDefaults
|
|
||||||
)?.split(",")?.sorted()?.forEach { if (it.isNotEmpty()) addQueryParameter("excludedGroups[]", it.trim()) }
|
)?.split(",")?.sorted()?.forEach { if (it.isNotEmpty()) addQueryParameter("excludedGroups[]", it.trim()) }
|
||||||
preferences.getString(
|
preferences.getString(
|
||||||
MDConstants.getBlockedUploaderPrefKey(dexLang),
|
MDConstants.getBlockedUploaderPrefKey(dexLang),
|
||||||
|
@ -523,7 +524,6 @@ abstract class MangaDex(override val lang: String, val dexLang: String) :
|
||||||
title = "Block Groups by UUID"
|
title = "Block Groups by UUID"
|
||||||
summary = "Chapters from blocked groups will not show up in Latest or Manga feed.\n" +
|
summary = "Chapters from blocked groups will not show up in Latest or Manga feed.\n" +
|
||||||
"Enter as a Comma-separated list of group UUIDs"
|
"Enter as a Comma-separated list of group UUIDs"
|
||||||
setDefaultValue(MDConstants.blockedGroupsPrefDefaults)
|
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
val groupsBlocked = newValue.toString()
|
val groupsBlocked = newValue.toString()
|
||||||
.split(",")
|
.split(",")
|
||||||
|
|
|
@ -68,7 +68,7 @@ class MangaDexFilters {
|
||||||
Status("Ongoing"),
|
Status("Ongoing"),
|
||||||
Status("Completed"),
|
Status("Completed"),
|
||||||
Status("Hiatus"),
|
Status("Hiatus"),
|
||||||
Status("Abandoned"),
|
Status("Cancelled"),
|
||||||
)
|
)
|
||||||
|
|
||||||
private class ContentRating(name: String) : Filter.CheckBox(name)
|
private class ContentRating(name: String) : Filter.CheckBox(name)
|
||||||
|
|
|
@ -112,8 +112,6 @@ class MangaDexHelper() {
|
||||||
val USE_CACHE = CacheControl.Builder()
|
val USE_CACHE = CacheControl.Builder()
|
||||||
.maxStale(Integer.MAX_VALUE, TimeUnit.SECONDS)
|
.maxStale(Integer.MAX_VALUE, TimeUnit.SECONDS)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
private const val BILIBILI_URL = "bilibilicomics.com"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the token map to see if the md@home host is still valid
|
// Check the token map to see if the md@home host is still valid
|
||||||
|
@ -328,17 +326,7 @@ class MangaDexHelper() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!attr.externalUrl.isNullOrEmpty() && !attr.externalUrl.contains(BILIBILI_URL)) {
|
if (attr.externalUrl != null && attr.pages == 0) {
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bilibili special check. If it's a Bilibili chapter and the
|
|
||||||
// publishAt date is < now, it can be read on MD.
|
|
||||||
if (
|
|
||||||
!attr.externalUrl.isNullOrEmpty() &&
|
|
||||||
attr.externalUrl.contains(BILIBILI_URL) &&
|
|
||||||
parseDate(attr.publishAt) >= Date().time
|
|
||||||
) {
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ data class ChapterAttributesDto(
|
||||||
val title: String?,
|
val title: String?,
|
||||||
val volume: String?,
|
val volume: String?,
|
||||||
val chapter: String?,
|
val chapter: String?,
|
||||||
|
val pages: Int,
|
||||||
val publishAt: String,
|
val publishAt: String,
|
||||||
val externalUrl: String?,
|
val externalUrl: String?,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue