|
|
@ -10,7 +10,6 @@ import android.text.TextUtils |
|
|
|
import android.webkit.* |
|
|
|
import android.webkit.* |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.App |
|
|
|
import java.lang.ref.WeakReference |
|
|
|
import java.lang.ref.WeakReference |
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AjaxWebView { |
|
|
|
class AjaxWebView { |
|
|
@ -99,7 +98,6 @@ class AjaxWebView { |
|
|
|
var cookieStore: CookieStore? = null |
|
|
|
var cookieStore: CookieStore? = null |
|
|
|
var sourceRegex: String? = null |
|
|
|
var sourceRegex: String? = null |
|
|
|
var javaScript: String? = null |
|
|
|
var javaScript: String? = null |
|
|
|
private var audioSuffixList: List<String>? = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val userAgent: String? |
|
|
|
val userAgent: String? |
|
|
|
get() = this.headerMap?.get("User-Agent") |
|
|
|
get() = this.headerMap?.get("User-Agent") |
|
|
@ -122,16 +120,6 @@ class AjaxWebView { |
|
|
|
javaScript = null |
|
|
|
javaScript = null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getAudioSuffixList(): List<String>? { |
|
|
|
|
|
|
|
if (audioSuffixList == null) { |
|
|
|
|
|
|
|
audioSuffixList = if (isSniff) { |
|
|
|
|
|
|
|
sourceRegex?.split("\\|\\|".toRegex()) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Collections.emptyList() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return audioSuffixList |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class HtmlWebViewClient( |
|
|
|
class HtmlWebViewClient( |
|
|
@ -186,12 +174,10 @@ class AjaxWebView { |
|
|
|
) : WebViewClient() { |
|
|
|
) : WebViewClient() { |
|
|
|
|
|
|
|
|
|
|
|
override fun onLoadResource(view: WebView, url: String) { |
|
|
|
override fun onLoadResource(view: WebView, url: String) { |
|
|
|
val suffixList = params.getAudioSuffixList() |
|
|
|
params.sourceRegex?.let { |
|
|
|
for (suffix in suffixList!!) { |
|
|
|
if (url.matches(it.toRegex())) { |
|
|
|
if (!TextUtils.isEmpty(suffix) && url.contains(suffix)) { |
|
|
|
|
|
|
|
handler.obtainMessage(MSG_SUCCESS, url) |
|
|
|
handler.obtainMessage(MSG_SUCCESS, url) |
|
|
|
.sendToTarget() |
|
|
|
.sendToTarget() |
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|