[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 ->
|
override val client = super.client.newBuilder().addInterceptor { chain ->
|
||||||
val response = chain.proceed(chain.request())
|
val response = chain.proceed(chain.request())
|
||||||
|
|
||||||
val args = response.request.url.queryParameter("iu_descramble")
|
if (response.request.url.fragment?.contains(DESCRAMBLE) != true) {
|
||||||
?.split(",")
|
return@addInterceptor response
|
||||||
?: return@addInterceptor response
|
}
|
||||||
|
val fragment = response.request.url.fragment!!
|
||||||
|
val args = fragment.substringAfter("$DESCRAMBLE=").split(",")
|
||||||
|
|
||||||
val image = unscrambleImage(response.body!!.byteStream(), args)
|
val image = unscrambleImage(response.body!!.byteStream(), args)
|
||||||
val body = image.toResponseBody("image/jpeg".toMediaTypeOrNull())
|
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) }
|
val page = pageList.firstOrNull { it.imageUrl!!.contains(filenameFragment, ignoreCase = true) }
|
||||||
?: return@forEach
|
?: return@forEach
|
||||||
val newPageUrl = page.imageUrl!!.toHttpUrl().newBuilder()
|
val newPageUrl = page.imageUrl!!.toHttpUrl().newBuilder()
|
||||||
.addQueryParameter("iu_descramble", args)
|
.fragment("$DESCRAMBLE=$args")
|
||||||
.build().toString()
|
.build()
|
||||||
|
.toString()
|
||||||
pageList[page.index] = Page(page.index, document.location(), newPageUrl)
|
pageList[page.index] = Page(page.index, document.location(), newPageUrl)
|
||||||
}
|
}
|
||||||
pageList.remove(unscramblingCallsPage)
|
pageList.remove(unscramblingCallsPage)
|
||||||
|
@ -121,19 +124,21 @@ class ImmortalUpdates : Madara("Immortal Updates", "https://immortalupdates.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val invertingPaint = Paint().apply {
|
if (isBackgroundBlack) {
|
||||||
colorFilter = ColorMatrixColorFilter(
|
val invertingPaint = Paint().apply {
|
||||||
ColorMatrix(
|
colorFilter = ColorMatrixColorFilter(
|
||||||
floatArrayOf(
|
ColorMatrix(
|
||||||
-1.0f, 0.0f, 0.0f, 0.0f, 255.0f,
|
floatArrayOf(
|
||||||
0.0f, -1.0f, 0.0f, 0.0f, 255.0f,
|
-1.0f, 0.0f, 0.0f, 0.0f, 255.0f,
|
||||||
0.0f, 0.0f, -1.0f, 0.0f, 255.0f,
|
0.0f, -1.0f, 0.0f, 0.0f, 255.0f,
|
||||||
0.0f, 0.0f, 0.0f, 1.0f, 0.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()
|
val output = ByteArrayOutputStream()
|
||||||
result.compress(Bitmap.CompressFormat.JPEG, 90, output)
|
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("Ichirin No Hana Yuri", "https://ichirinnohanayuriscan.com", "pt-BR", isNsfw = true, overrideVersionCode = 4),
|
||||||
SingleLang("Ikifeng", "https://ikifeng.com", "es", isNsfw = true),
|
SingleLang("Ikifeng", "https://ikifeng.com", "es", isNsfw = true),
|
||||||
SingleLang("Illusion Scan", "https://illusionscan.com", "pt-BR", 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("Império Scans", "https://imperioscans.com.br", "pt-BR", className = "ImperioScans", overrideVersionCode = 1),
|
||||||
SingleLang("Inazu Manga", "https://inazumanga.com", "id", isNsfw = true),
|
SingleLang("Inazu Manga", "https://inazumanga.com", "id", isNsfw = true),
|
||||||
SingleLang("InfraFandub", "https://infrafandub.xyz", "es"),
|
SingleLang("InfraFandub", "https://infrafandub.xyz", "es"),
|
||||||
|
|
Loading…
Reference in New Issue