Fix ali qrcode

This commit is contained in:
FongMi 2022-12-26 11:24:18 +08:00
parent f9c933c130
commit a1311f3cb5
5 changed files with 11 additions and 5 deletions

View File

@ -295,7 +295,9 @@ public class Ali {
}
private void getQRCode() {
Data data = Data.objectFrom(OkHttpUtil.string("https://easy-token.cooluc.com/qr"));
HashMap<String, String> headers = new HashMap<>();
headers.put("User-Agent", Misc.CHROME);
Data data = Data.objectFrom(OkHttpUtil.string("https://easy-token.cooluc.com/qr", headers));
if (data != null) Init.run(() -> showCode(data));
service = Executors.newScheduledThreadPool(1);
if (data != null) service.scheduleAtFixedRate(() -> {

View File

@ -3,6 +3,7 @@ package com.github.catvod.utils;
import android.net.Uri;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
@ -24,7 +25,7 @@ import java.util.Locale;
public class Misc {
public static final String CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36";
public static final String CHROME = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36";
public static boolean isVip(String url) {
List<String> hosts = Arrays.asList("iqiyi.com", "v.qq.com", "youku.com", "le.com", "tudou.com", "mgtv.com", "sohu.com", "acfun.cn", "bilibili.com", "baofeng.com", "pptv.com");
@ -166,7 +167,8 @@ public class Misc {
try {
ViewGroup group = Init.getActivity().getWindow().getDecorView().findViewById(android.R.id.content);
group.addView(view, params);
} catch (Exception ignored) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -174,7 +176,8 @@ public class Misc {
try {
ViewGroup group = Init.getActivity().getWindow().getDecorView().findViewById(android.R.id.content);
group.removeView(view);
} catch (Exception ignored) {
} catch (Exception e) {
e.printStackTrace();
}
}

View File

@ -37,6 +37,7 @@ public class QRCode {
hints.put(EncodeHintType.MARGIN, margin);
return createBitmap(new MultiFormatWriter().encode(contents, BarcodeFormat.QR_CODE, Misc.dp2px(size), Misc.dp2px(size), hints));
} catch (Exception e) {
e.printStackTrace();
return null;
}
}

Binary file not shown.

View File

@ -1 +1 @@
7c3920492e1d3a8d6e67caec97c7f975
e3b236416ca6f34b41aeca2c83809837