导航菜单

页面标题

页面副标题

xDrip+ v04633772025.07.16 - Template.java 源代码

正在查看: xDrip+ v04633772025.07.16 应用的 Template.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.eveningoutpost.dexdrip.cgm.webfollow;

import com.eveningoutpost.dexdrip.models.JoH;
import com.eveningoutpost.dexdrip.models.UserError;
import com.eveningoutpost.dexdrip.utils.DexCollectionType;
import com.google.common.primitives.Bytes;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class Template {
    private static final String TAG = "WebFollow" + Template.class.getSimpleName();

    private static byte[] getData() {
        if (getUrl() == null) {
            return null;
        }
        OkHttpClient okHttpClient = new OkHttpClient();
        Request build = new Request.Builder().url(getUrl()).build();
        String str = TAG;
        UserError.Log.d(str, "T REQUEST URL: " + build.url());
        try {
            Response execute = okHttpClient.newCall(build).execute();
            if (execute.code() == 410) {
                UserError.Log.d(str, "Shutdown requested");
                DexCollectionType.setDexCollectionType(DexCollectionType.Disabled);
            }
            if (execute.isSuccessful()) {
                return execute.body().bytes();
            }
            StringBuilder sb = new StringBuilder();
            sb.append("Got script failure response code: ");
            sb.append(execute.code());
            sb.append("\n");
            sb.append(execute.body() != null ? execute.body().string() : "");
            throw new RuntimeException(sb.toString());
        } catch (IOException e) {
            UserError.Log.e(TAG, "Exception getting template: " + e);
            e.printStackTrace();
            return null;
        }
    }

    public static MContext get() {
        byte[] data;
        try {
            data = getData();
        } catch (Exception e) {
            UserError.Log.e(TAG, "Exception in get() " + e);
        }
        if (data == null) {
            return null;
        }
        int indexOf = Bytes.indexOf(data, new byte[4]);
        byte[] splitBytes = JoH.splitBytes(data, 0, indexOf);
        if (Verify.verify(splitBytes, JoH.splitBytes(data, indexOf + 4, (data.length - splitBytes.length) - 8))) {
            return MContext.fromJson(new String(splitBytes, StandardCharsets.UTF_8));
        }
        UserError.Log.e(TAG, "Invalid verification");
        return null;
    }

    private static String getUrl() {
        String str = Cpref.get("CK");
        if (JoH.emptyString(str)) {
            return null;
        }
        if (str.contains(".")) {
            return str;
        }
        return "https://community-script." + str + ".net/v2";
    }
}