[ImmortalUpdates] Fix images being inverted by mistake (#15082)
* [ImmortalUpdates] Fix images being inverted by mistake * whoops * use HttpUrl.Builder.fragment * oops bleh
This commit is contained in:
parent
c3f56aa521
commit
8f3170f80a
|
@ -26,9 +26,11 @@ class ImmortalUpdates : Madara("Immortal Updates", "https://immortalupdates.com"
|
|||
override val client = super.client.newBuilder().addInterceptor { chain ->
|
||||
val response = chain.proceed(chain.request())
|
||||
|
||||
val args = response.request.url.queryParameter("iu_descramble")
|
||||
?.split(",")
|
||||
?: return@addInterceptor response
|
||||
if (response.request.url.fragment?.contains(DESCRAMBLE) != true) {
|
||||
return@addInterceptor response
|
||||
}
|
||||
val fragment = response.request.url.fragment!!
|
||||
val args = fragment.substringAfter("$DESCRAMBLE=").split(",")
|
||||
|
||||
val image = unscrambleImage(response.body!!.byteStream(), args)
|
||||
val body = image.toResponseBody("image/jpeg".toMediaTypeOrNull())
|
||||
|
@ -56,8 +58,9 @@ class ImmortalUpdates : Madara("Immortal Updates", "https://immortalupdates.com"
|
|||
val page = pageList.firstOrNull { it.imageUrl!!.contains(filenameFragment, ignoreCase = true) }
|
||||
?: return@forEach
|
||||
val newPageUrl = page.imageUrl!!.toHttpUrl().newBuilder()
|
||||
.addQueryParameter("iu_descramble", args)
|
||||
.build().toString()
|
||||
.fragment("$DESCRAMBLE=$args")
|
||||
.build()
|
||||
.toString()
|
||||
pageList[page.index] = Page(page.index, document.location(), newPageUrl)
|
||||
}
|
||||
pageList.remove(unscramblingCallsPage)
|
||||
|
@ -121,19 +124,21 @@ class ImmortalUpdates : Madara("Immortal Updates", "https://immortalupdates.com"
|
|||
}
|
||||
}
|
||||
|
||||
val invertingPaint = Paint().apply {
|
||||
colorFilter = ColorMatrixColorFilter(
|
||||
ColorMatrix(
|
||||
floatArrayOf(
|
||||
-1.0f, 0.0f, 0.0f, 0.0f, 255.0f,
|
||||
0.0f, -1.0f, 0.0f, 0.0f, 255.0f,
|
||||
0.0f, 0.0f, -1.0f, 0.0f, 255.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f
|
||||
if (isBackgroundBlack) {
|
||||
val invertingPaint = Paint().apply {
|
||||
colorFilter = ColorMatrixColorFilter(
|
||||
ColorMatrix(
|
||||
floatArrayOf(
|
||||
-1.0f, 0.0f, 0.0f, 0.0f, 255.0f,
|
||||
0.0f, -1.0f, 0.0f, 0.0f, 255.0f,
|
||||
0.0f, 0.0f, -1.0f, 0.0f, 255.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.0f
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
canvas.drawBitmap(result, 0f, 0f, invertingPaint)
|
||||
}
|
||||
canvas.drawBitmap(result, 0f, 0f, invertingPaint)
|
||||
|
||||
val output = ByteArrayOutputStream()
|
||||
result.compress(Bitmap.CompressFormat.JPEG, 90, output)
|
||||
|
@ -198,4 +203,8 @@ class ImmortalUpdates : Madara("Immortal Updates", "https://immortalupdates.com"
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val DESCRAMBLE = "descramble"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ class MadaraGenerator : ThemeSourceGenerator {
|
|||
SingleLang("Ichirin No Hana Yuri", "https://ichirinnohanayuriscan.com", "pt-BR", isNsfw = true, overrideVersionCode = 4),
|
||||
SingleLang("Ikifeng", "https://ikifeng.com", "es", isNsfw = true),
|
||||
SingleLang("Illusion Scan", "https://illusionscan.com", "pt-BR", isNsfw = true),
|
||||
SingleLang("Immortal Updates", "https://immortalupdates.com", "en", overrideVersionCode = 3),
|
||||
SingleLang("Immortal Updates", "https://immortalupdates.com", "en", overrideVersionCode = 4),
|
||||
SingleLang("Império Scans", "https://imperioscans.com.br", "pt-BR", className = "ImperioScans", overrideVersionCode = 1),
|
||||
SingleLang("Inazu Manga", "https://inazumanga.com", "id", isNsfw = true),
|
||||
SingleLang("InfraFandub", "https://infrafandub.xyz", "es"),
|
||||
|
|
Loading…
Reference in New Issue