This commit is contained in:
Horis
2025-06-14 17:17:27 +08:00
parent a39d615928
commit 9600b8b558
2 changed files with 23 additions and 25 deletions
@@ -13,7 +13,6 @@ import io.legado.app.help.config.AppConfig
import io.legado.app.help.crypto.SymmetricCryptoAndroid
import io.legado.app.help.http.CookieStore
import io.legado.app.help.source.getShareScope
import io.legado.app.model.Debug
import io.legado.app.utils.GSON
import io.legado.app.utils.GSONStrict
import io.legado.app.utils.fromJsonArray
@@ -116,7 +115,7 @@ interface BaseSource : JsExtensions {
GSONStrict.fromJsonObject<Map<String, String>>(json).getOrNull()?.let { map ->
putAll(map)
} ?: GSON.fromJsonObject<Map<String, String>>(json).getOrNull()?.let { map ->
Debug.log("请求头规则 JSON 格式不规范,请改为规范格式")
log("请求头规则 JSON 格式不规范,请改为规范格式")
putAll(map)
}
} catch (e: Exception) {
@@ -39,7 +39,6 @@ import io.legado.app.help.http.postForm
import io.legado.app.help.http.postJson
import io.legado.app.help.http.postMultipart
import io.legado.app.help.source.getShareScope
import io.legado.app.model.Debug
import io.legado.app.utils.EncoderUtils
import io.legado.app.utils.GSON
import io.legado.app.utils.GSONStrict
@@ -225,32 +224,32 @@ class AnalyzeUrl(
if (urlOption == null) {
urlOption = GSON.fromJsonObject<UrlOption>(urlOptionStr).getOrNull()
if (urlOption != null) {
Debug.log("链接参数 JSON 格式不规范,请改为规范格式")
log("链接参数 JSON 格式不规范,请改为规范格式")
}
}
urlOption?.let { option ->
option.getMethod()?.let {
if (it.equals("POST", true)) method = RequestMethod.POST
}
option.getHeaderMap()?.forEach { entry ->
headerMap[entry.key.toString()] = entry.value.toString()
}
option.getBody()?.let {
body = it
}
type = option.getType()
charset = option.getCharset()
retry = option.getRetry()
useWebView = option.useWebView()
webJs = option.getWebJs()
option.getJs()?.let { jsStr ->
evalJS(jsStr, url)?.toString()?.let {
url = it
}
}
serverID = option.getServerID()
webViewDelayTime = max(0, option.getWebViewDelayTime() ?: 0)
option.getMethod()?.let {
if (it.equals("POST", true)) method = RequestMethod.POST
}
option.getHeaderMap()?.forEach { entry ->
headerMap[entry.key.toString()] = entry.value.toString()
}
option.getBody()?.let {
body = it
}
type = option.getType()
charset = option.getCharset()
retry = option.getRetry()
useWebView = option.useWebView()
webJs = option.getWebJs()
option.getJs()?.let { jsStr ->
evalJS(jsStr, url)?.toString()?.let {
url = it
}
}
serverID = option.getServerID()
webViewDelayTime = max(0, option.getWebViewDelayTime() ?: 0)
}
}
urlNoQuery = url
when (method) {