Picacomic: Fix json decoding error of non-ASCII chars (#19434) (#19515)

* Picacomic: Fix json decoding error of non-ASCII chars (#19434)

Caused by #19400

* bump version code to 4

* replace decodeToString with toString
This commit is contained in:
源文雨 2024-01-02 05:03:16 +08:00 committed by GitHub
parent 66019f2511
commit 7e4d35b066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Picacomic' extName = 'Picacomic'
pkgNameSuffix = 'zh.picacomic' pkgNameSuffix = 'zh.picacomic'
extClass = '.Picacomic' extClass = '.Picacomic'
extVersionCode = 3 extVersionCode = 4
isNsfw = true isNsfw = true
} }

View File

@ -30,6 +30,7 @@ import org.json.JSONObject
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.net.URLEncoder import java.net.URLEncoder
import java.nio.charset.Charset
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
import java.util.Locale import java.util.Locale
@ -100,7 +101,7 @@ class Picacomic : HttpSource(), ConfigurableSource {
) )
} }
val payload = parts[1]?.let { JSONObject(String(Base64.decode(it, Base64.DEFAULT))) } val payload = parts[1]?.let { JSONObject(Base64.decode(it, Base64.DEFAULT).toString(Charsets.UTF_8)) }
val exp = payload?.getLong("exp")?.let { val exp = payload?.getLong("exp")?.let {
Date(it * 1000) Date(it * 1000)