Fix GManga Latest page error and crashing on older devices (#5540)
* Revert "Update Gmanga.kt (#5497)"
This reverts commit e3d01c9844
.
* Fix app crashing for users with Android API 7 and below
* Fix latest page not working due to some items having no thumbnail
Co-authored-by: ellpatron <ell.patron91@gmail.com>
This commit is contained in:
parent
c803443809
commit
04db6981aa
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'GMANGA'
|
extName = 'GMANGA'
|
||||||
pkgNameSuffix = 'ar.gmanga'
|
pkgNameSuffix = 'ar.gmanga'
|
||||||
extClass = '.Gmanga'
|
extClass = '.Gmanga'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
containsNsfw = false
|
containsNsfw = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,8 +101,11 @@ class Gmanga : ConfigurableSource, HttpSource() {
|
||||||
SManga.create().apply {
|
SManga.create().apply {
|
||||||
url = "/mangas/${it["id"].asString}"
|
url = "/mangas/${it["id"].asString}"
|
||||||
title = it["title"].asString
|
title = it["title"].asString
|
||||||
val thumbnail = "medium_${it["cover"].asString.substringBeforeLast(".")}.webp"
|
|
||||||
thumbnail_url = "https://media.$domain/uploads/manga/cover/${it["id"].asString}/$thumbnail"
|
thumbnail_url = it["cover"].nullString?.let { coverFileName ->
|
||||||
|
val thumbnail = "medium_${coverFileName.substringBeforeLast(".")}.webp"
|
||||||
|
"https://media.$domain/uploads/manga/cover/${it["id"].asString}/$thumbnail"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
|
@ -110,7 +113,7 @@ class Gmanga : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int): Request {
|
override fun latestUpdatesRequest(page: Int): Request {
|
||||||
return GET("$baseUrl/releases", headers)
|
return GET("$baseUrl/mangas/latest", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun mangaDetailsParse(response: Response): SManga {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package eu.kanade.tachiyomi.extension.ar.gmanga
|
package eu.kanade.tachiyomi.extension.ar.gmanga
|
||||||
|
|
||||||
import android.annotation.TargetApi
|
import android.util.Base64
|
||||||
import android.os.Build
|
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import java.util.Base64
|
|
||||||
import javax.crypto.Cipher
|
import javax.crypto.Cipher
|
||||||
import javax.crypto.spec.IvParameterSpec
|
import javax.crypto.spec.IvParameterSpec
|
||||||
import javax.crypto.spec.SecretKeySpec
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
@ -36,14 +34,12 @@ private fun String.sha256(): String {
|
||||||
.fold("", { str, it -> str + "%02x".format(it) })
|
.fold("", { str, it -> str + "%02x".format(it) })
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.O)
|
|
||||||
private fun String.aesDecrypt(secretKey: ByteArray, ivString: String): String {
|
private fun String.aesDecrypt(secretKey: ByteArray, ivString: String): String {
|
||||||
val decoder = Base64.getDecoder()
|
|
||||||
val c = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
val c = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
||||||
val sk = SecretKeySpec(secretKey, "AES")
|
val sk = SecretKeySpec(secretKey, "AES")
|
||||||
val iv = IvParameterSpec(decoder.decode(ivString.toByteArray(Charsets.UTF_8)))
|
val iv = IvParameterSpec(Base64.decode(ivString.toByteArray(Charsets.UTF_8), Base64.DEFAULT))
|
||||||
c.init(Cipher.DECRYPT_MODE, sk, iv)
|
c.init(Cipher.DECRYPT_MODE, sk, iv)
|
||||||
|
|
||||||
val byteStr = decoder.decode(this.toByteArray(Charsets.UTF_8))
|
val byteStr = Base64.decode(this.toByteArray(Charsets.UTF_8), Base64.DEFAULT)
|
||||||
return String(c.doFinal(byteStr))
|
return String(c.doFinal(byteStr))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue