pull/197/head
FongMi 2 years ago
parent aa4edab234
commit 696a8bb8dd
  1. 6
      app/build.gradle
  2. BIN
      app/libs/quickjs.aar
  3. BIN
      app/src/arm64_v8a/assets/go_proxy_video
  4. BIN
      app/src/armeabi_v7a/assets/go_proxy_video
  5. 38
      app/src/main/java/com/fongmi/android/tv/ui/custom/CustomWebView.java
  6. BIN
      app/src/x86/assets/go_proxy_video

@ -11,7 +11,7 @@ android {
minSdk 21
targetSdk 28
versionCode 212
versionName "20231220"
versionName "20231222"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
@ -32,6 +32,10 @@ android {
python {
dimension "api"
}
x86 {
dimension "abi"
ndk { abiFilters "x86" }
}
armeabi_v7a {
dimension "abi"
ndk { abiFilters "armeabi-v7a" }

Binary file not shown.

@ -1,9 +1,12 @@
package com.fongmi.android.tv.ui.custom;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceRequest;
@ -30,6 +33,7 @@ public class CustomWebView extends WebView {
private WebResourceResponse empty;
private ParseCallback callback;
private AlertDialog dialog;
private Runnable timer;
private String from;
private String key;
@ -82,13 +86,19 @@ public class CustomWebView extends WebView {
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
String url = request.getUrl().toString();
String host = request.getUrl().getHost();
if (TextUtils.isEmpty(host)) return empty;
if (ApiConfig.get().getAds().contains(host)) return empty;
if (TextUtils.isEmpty(host) || ApiConfig.get().getAds().contains(host)) return empty;
if (host.equals("challenges.cloudflare.com")) App.post(() -> showDialog());
Map<String, String> headers = request.getRequestHeaders();
if (isVideoFormat(headers, url)) post(headers, url);
return super.shouldInterceptRequest(view, request);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
if (dialog != null) hideDialog();
}
@Override
@SuppressLint("WebViewClientOnReceivedSslError")
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
@ -119,12 +129,15 @@ public class CustomWebView extends WebView {
onParseSuccess(headers, url);
}
public void stop(boolean error) {
stopLoading();
loadUrl("about:blank");
App.removeCallbacks(timer);
if (error) onParseError();
else callback = null;
private void showDialog() {
if (dialog != null) return;
if (getParent() != null) ((ViewGroup) getParent()).removeView(this);
dialog = new AlertDialog.Builder(App.activity()).setView(this).show();
}
private void hideDialog() {
if (dialog != null) dialog.dismiss();
dialog = null;
}
private void onParseSuccess(Map<String, String> headers, String url) {
@ -137,4 +150,13 @@ public class CustomWebView extends WebView {
if (callback != null) callback.onParseError();
callback = null;
}
public void stop(boolean error) {
hideDialog();
stopLoading();
loadUrl("about:blank");
App.removeCallbacks(timer);
if (error) onParseError();
else callback = null;
}
}

Binary file not shown.
Loading…
Cancel
Save