MangaDex: Remove wildcard deeplinking (#10688)

* move more regexes into companion object

* Remove wildcard domain intent

too many issues. Might as well have the extension only support
mangadex.org links

* Increment mangadex.extVersionCode
This commit is contained in:
nicki 2022-02-05 04:43:01 +05:30 committed by GitHub
parent b1f6d28cc1
commit a60274e18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -14,7 +14,6 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:host="*.mangadex.org" />
<data android:host="mangadex.org" /> <data android:host="mangadex.org" />
<data <data

View File

@ -6,7 +6,7 @@ ext {
extName = 'MangaDex' extName = 'MangaDex'
pkgNameSuffix = 'all.mangadex' pkgNameSuffix = 'all.mangadex'
extClass = '.MangaDexFactory' extClass = '.MangaDexFactory'
extVersionCode = 154 extVersionCode = 155
isNsfw = true isNsfw = true
} }

View File

@ -109,6 +109,10 @@ class MangaDexHelper() {
.build() .build()
val markdownLinksRegex = "\\[([^]]+)\\]\\(([^)]+)\\)".toRegex() val markdownLinksRegex = "\\[([^]]+)\\]\\(([^)]+)\\)".toRegex()
val titleSpecialCharactersRegex = "[^a-z0-9]+".toRegex()
val trailingHyphenRegex = "-+$".toRegex()
} }
// 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
@ -349,8 +353,8 @@ class MangaDexHelper() {
fun titleToSlug(title: String) = title.trim() fun titleToSlug(title: String) = title.trim()
.toLowerCase(Locale.US) .toLowerCase(Locale.US)
.replace("[^a-z0-9]+".toRegex(), "-") .replace(titleSpecialCharactersRegex, "-")
.replace("-+$".toRegex(), "") .replace(trailingHyphenRegex, "")
.split("-") .split("-")
.reduce { accumulator, element -> .reduce { accumulator, element ->
val currentSlug = "$accumulator-$element" val currentSlug = "$accumulator-$element"