Skip to content

Commit

Permalink
Merge pull request #4 from simo8102/patch-3
Browse files Browse the repository at this point in the history
简单粗暴的修复荣耀版不会自动执行脚本的问题
  • Loading branch information
luoxingran authored Apr 22, 2024
2 parents 0d01e5f + 420b4de commit 973fc77
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions app/src/main/java/com/raincat/dolby_beta/hook/ProxyHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.os.Bundle;


import com.raincat.dolby_beta.helper.ExtraHelper;
import com.raincat.dolby_beta.helper.ScriptHelper;
import com.raincat.dolby_beta.helper.SettingHelper;
Expand Down Expand Up @@ -42,7 +43,6 @@ public class ProxyHook {
private String fieldSSLSocketFactory;
private String fieldHttpUrl = "url";
private String fieldProxy = "proxy";

private final List<String> whiteUrlList = Arrays.asList("song/enhance/player/url", "song/enhance/download/url","/package");

public ProxyHook(Context context, boolean isPlayProcess) {
Expand Down Expand Up @@ -107,21 +107,17 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
});
}

if (!isPlayProcess)
findAndHookMethod("com.netease.cloudmusic.activity.LoadingActivity", context.getClassLoader(), "onCreate", Bundle.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) {
ExtraHelper.setExtraDate(ExtraHelper.SCRIPT_STATUS, "0");
if (SettingHelper.getInstance().getSetting(SettingHelper.proxy_master_key)) {
ScriptHelper.initScript(context, false);
if (SettingHelper.getInstance().getSetting(SettingHelper.proxy_server_key)) {
ScriptHelper.startHttpProxyMode(context);
} else {
ScriptHelper.startScript();
}
}
if (!isPlayProcess) {
ExtraHelper.setExtraDate(ExtraHelper.SCRIPT_STATUS, "0");
if (SettingHelper.getInstance().getSetting(SettingHelper.proxy_master_key)) {
ScriptHelper.initScript(context, false);
if (SettingHelper.getInstance().getSetting(SettingHelper.proxy_server_key)) {
ScriptHelper.startHttpProxyMode(context);
} else {
ScriptHelper.startScript();
}
});
}
}
}

/**
Expand Down Expand Up @@ -152,4 +148,4 @@ private void setProxy(Context context, Object client) throws Exception {
sslSocketFactoryField.set(client, objectSSLSocketFactory);
}
}
}
}

0 comments on commit 973fc77

Please sign in to comment.