修复webView跳转url问题
This commit is contained in:
@@ -360,7 +360,7 @@ class AnalyzeUrl(
|
|||||||
if (this.useWebView && useWebView) {
|
if (this.useWebView && useWebView) {
|
||||||
strResponse = when (method) {
|
strResponse = when (method) {
|
||||||
RequestMethod.POST -> {
|
RequestMethod.POST -> {
|
||||||
val body = getProxyClient(proxy).newCallStrResponse(retry) {
|
val res = getProxyClient(proxy).newCallStrResponse(retry) {
|
||||||
addHeaders(headerMap)
|
addHeaders(headerMap)
|
||||||
url(urlNoQuery)
|
url(urlNoQuery)
|
||||||
if (fieldMap.isNotEmpty() || body.isNullOrBlank()) {
|
if (fieldMap.isNotEmpty() || body.isNullOrBlank()) {
|
||||||
@@ -368,10 +368,10 @@ class AnalyzeUrl(
|
|||||||
} else {
|
} else {
|
||||||
postJson(body)
|
postJson(body)
|
||||||
}
|
}
|
||||||
}.body
|
}
|
||||||
BackstageWebView(
|
BackstageWebView(
|
||||||
url = url,
|
url = res.url,
|
||||||
html = body,
|
html = res.body,
|
||||||
tag = source?.getKey(),
|
tag = source?.getKey(),
|
||||||
javaScript = webJs ?: jsStr,
|
javaScript = webJs ?: jsStr,
|
||||||
sourceRegex = sourceRegex,
|
sourceRegex = sourceRegex,
|
||||||
@@ -462,17 +462,18 @@ class AnalyzeUrl(
|
|||||||
* 访问网站,返回ByteArray
|
* 访问网站,返回ByteArray
|
||||||
*/
|
*/
|
||||||
suspend fun getByteArrayAwait(): ByteArray {
|
suspend fun getByteArrayAwait(): ByteArray {
|
||||||
|
@Suppress("RegExpRedundantEscape")
|
||||||
val dataUriRegex = Regex("data:[\\w/\\-\\.]+;base64,(.*)")
|
val dataUriRegex = Regex("data:[\\w/\\-\\.]+;base64,(.*)")
|
||||||
val dataUriFindResult = dataUriRegex.find(urlNoQuery)
|
val dataUriFindResult = dataUriRegex.find(urlNoQuery)
|
||||||
val concurrentRecord = fetchStart()
|
val concurrentRecord = fetchStart()
|
||||||
setCookie(source?.getKey())
|
setCookie(source?.getKey())
|
||||||
@Suppress("BlockingMethodInNonBlockingContext")
|
@Suppress("BlockingMethodInNonBlockingContext")
|
||||||
if (dataUriFindResult != null){
|
if (dataUriFindResult != null) {
|
||||||
val dataUriBase64 = dataUriFindResult.groupValues?.get(1)
|
val dataUriBase64 = dataUriFindResult.groupValues[1]
|
||||||
val byteArray = Base64.decode(dataUriBase64, Base64.DEFAULT)
|
val byteArray = Base64.decode(dataUriBase64, Base64.DEFAULT)
|
||||||
fetchEnd(concurrentRecord)
|
fetchEnd(concurrentRecord)
|
||||||
return byteArray
|
return byteArray
|
||||||
}else {
|
} else {
|
||||||
val byteArray = getProxyClient(proxy).newCallResponseBody(retry) {
|
val byteArray = getProxyClient(proxy).newCallResponseBody(retry) {
|
||||||
addHeaders(headerMap)
|
addHeaders(headerMap)
|
||||||
when (method) {
|
when (method) {
|
||||||
|
|||||||
Reference in New Issue
Block a user