mirror of
https://github.com/gedoor/legado.git
synced 2024-09-01 09:34:25 +08:00
优化
This commit is contained in:
parent
0b00a5dd00
commit
c380b113c6
@ -129,15 +129,16 @@ class HttpReadAloudService : BaseReadAloudService(),
|
||||
headerMapF = httpTts.getHeaderMap(true)
|
||||
)
|
||||
var response = analyzeUrl.getResponseAwait()
|
||||
httpTts.loginCheckJs?.let { checkJs ->
|
||||
if (checkJs.isNotBlank()) {
|
||||
response = analyzeUrl.evalJS(checkJs, response) as Response
|
||||
}
|
||||
httpTts.loginCheckJs?.takeIf { checkJs ->
|
||||
checkJs.isNotBlank()
|
||||
}?.let { checkJs ->
|
||||
response = analyzeUrl.evalJS(checkJs, response) as Response
|
||||
}
|
||||
val contentTypeRegex = httpTts.contentType
|
||||
if (!contentTypeRegex.isNullOrBlank()) {
|
||||
httpTts.contentType?.takeIf { ct ->
|
||||
ct.isNotBlank()
|
||||
}?.let { ct ->
|
||||
response.headers["Content-Type"]?.let { contentType ->
|
||||
if (!contentType.matches(contentTypeRegex.toRegex())) {
|
||||
if (!contentType.matches(ct.toRegex())) {
|
||||
throw NoStackTraceException(response.body!!.string())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user