[ConstellarScans] Move Paint into descrambleImage to prevent CI failure (#15042)

* [ConstellarScans] Move invertingPaint into descrambleImage to prevent CI failure

* bump version

* Revert "bump version"

This reverts commit 9bc23e426b78c03225e56998d64ea8520bab4d49.
This commit is contained in:
beerpsi 2023-01-20 22:49:09 +07:00 committed by GitHub
parent 3e89b9ceda
commit 2c306a4da4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,6 +99,18 @@ class ConstellarScans : MangaThemesia("Constellar Scans", "https://constellarsca
private fun descrambleImage(image: InputStream, key: String): ByteArray {
val bitmap = BitmapFactory.decodeStream(image)
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
)
)
)
}
val result = Bitmap.createBitmap(bitmap.width, bitmap.height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(result)
@ -128,26 +140,12 @@ class ConstellarScans : MangaThemesia("Constellar Scans", "https://constellarsca
}
private fun md5sum(input: String): String {
val digest = MessageDigest.getInstance("MD5")
digest.update(input.toByteArray())
return digest.digest()
val md = MessageDigest.getInstance("MD5")
return md.digest(input.toByteArray())
.asUByteArray()
.joinToString("") { it.toString(16).padStart(2, '0') }
}
private 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
)
)
)
}
private val encodedUploadsPath = "$baseUrl/wp-content/uploads/encoded"
companion object {