Skip to content

Commit

Permalink
Merge pull request nining377#222 from luoxingran/master
Browse files Browse the repository at this point in the history
配适网易云音乐8.7.01,修复部分BUG
  • Loading branch information
nining377 authored Mar 25, 2022
2 parents 341567c + 02178a9 commit 8e551aa
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 11 deletions.
Binary file modified app/src/main/assets/UnblockNeteaseMusic.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/java/com/raincat/dolby_beta/Hook.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
final String processName = Tools.getCurrentProcessName(context);
if (processName.equals(PACKAGE_NAME)) {
//设置
new SettingHook(context);
new SettingHook(context, versionCode);
//总开关
if (!SettingHelper.getInstance().getSetting(SettingHelper.master_key))
return;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/raincat/dolby_beta/Hooklite.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
final String processName = Tools.getCurrentProcessName(context);
if (processName.equals(PACKAGE_NAME)) {
//设置
new SettingHook(context);
new SettingHook(context, versionCode);
//总开关
if (!SettingHelper.getInstance().getSetting(SettingHelper.master_key))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void initScript(Context context, boolean cover) {
FileHelper.unzipFile(modulePath, getScriptPath(context), bit, "libnative-lib.so");
FileHelper.unzipFile(modulePath, getScriptPath(context), bit, "libnode.so");
FileHelper.unzipFile(modulePath, getScriptPath(context), "assets", "node");
Command auth = new Command(0, "cd " + getScriptPath(context), "chmod 770 *");
Command auth = new Command(0, "cd " + getScriptPath(context), "chmod 0777 *");
Tools.shell(context, auth);
ExtraHelper.setExtraDate(ExtraHelper.APP_VERSION, BuildConfig.VERSION_CODE);
}
Expand Down
45 changes: 43 additions & 2 deletions app/src/main/java/com/raincat/dolby_beta/hook/BlackHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,45 @@

public class BlackHook {
public BlackHook(Context context, int versionCode) {
if (versionCode < 138) {
if (versionCode > 8002000) {
findAndHookMethod(findClass("com.netease.cloudmusic.meta.virtual.UserPrivilege", context.getClassLoader()),
"fromJson", JSONObject.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
JSONObject object = (JSONObject) param.args[0];
if (object.optInt("code") == 200 && !object.isNull("data") && !object.getJSONObject("data").isNull("userId") &&
object.getJSONObject("data").optLong("userId") == Long.parseLong(ExtraHelper.getExtraDate(ExtraHelper.USER_ID))) {
Gson gson = new Gson();
UserPrivilegeBean userPrivilegeBean = gson.fromJson(object.toString(), UserPrivilegeBean.class);
userPrivilegeBean.getData().getAssociator().setExpireTime(System.currentTimeMillis() + 31536000000L);
userPrivilegeBean.getData().getAssociator().setVipCode(100);
userPrivilegeBean.getData().getMusicPackage().setExpireTime(System.currentTimeMillis() + 31536000000L);
userPrivilegeBean.getData().setRedVipAnnualCount(1);
userPrivilegeBean.getData().setRedVipLevel(9);
object = new JSONObject(gson.toJson(userPrivilegeBean));
param.args[0] = object;
}
}
});
//VIP,音乐包
findAndHookMethod(findClass("com.cmbridge.b", context.getClassLoader()),
"isBlackVip", XC_MethodReplacement.returnConstant(0));//新版VIP
findAndHookMethod(findClass("com.netease.cloudmusic.meta.virtual.UserPrivilege", context.getClassLoader()),
"isWhateverMusicPackage", XC_MethodReplacement.returnConstant(true));//音乐包


//主题
findAndHookMethod(findClass("com.netease.cloudmusic.theme.core.ThemeInfo", context.getClassLoader()),
"getPoints", XC_MethodReplacement.returnConstant(0));
findAndHookMethod(findClass("com.netease.cloudmusic.theme.core.ThemeInfo", context.getClassLoader()),
"getPrice", XC_MethodReplacement.returnConstant("免费"));
findAndHookMethod(findClass("com.netease.cloudmusic.theme.core.ThemeInfo", context.getClassLoader()),
"isVip", XC_MethodReplacement.returnConstant(false));
findAndHookMethod(findClass("com.netease.cloudmusic.theme.core.ThemeInfo", context.getClassLoader()),
"isDigitalAlbum", XC_MethodReplacement.returnConstant(false));
}
else if (versionCode < 138) {
XposedBridge.hookAllMethods(findClass("com.netease.cloudmusic.meta.Profile", context.getClassLoader()), "setUserPoint", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Expand Down Expand Up @@ -63,7 +101,6 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
userPrivilegeBean.getData().getAssociator().setExpireTime(System.currentTimeMillis() + 31536000000L);
userPrivilegeBean.getData().getAssociator().setVipCode(100);
userPrivilegeBean.getData().getMusicPackage().setExpireTime(System.currentTimeMillis() + 31536000000L);
userPrivilegeBean.getData().getMusicPackage().setVipCode(220);
userPrivilegeBean.getData().setRedVipAnnualCount(1);
userPrivilegeBean.getData().setRedVipLevel(9);
object = new JSONObject(gson.toJson(userPrivilegeBean));
Expand All @@ -72,6 +109,10 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
});


findAndHookMethod(findClass("com.netease.cloudmusic.meta.virtual.UserPrivilege", context.getClassLoader()),
"isWhateverMusicPackage", XC_MethodReplacement.returnConstant(true));//音乐包

//主题
findAndHookMethod(findClass("com.netease.cloudmusic.theme.core.ThemeInfo", context.getClassLoader()),
"getPoints", XC_MethodReplacement.returnConstant(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (imageView.getContentDescription().toString().contains("音街")
|| imageView.getContentDescription().toString().contains("铃声")) {
imageView.setVisibility(View.GONE);
if (imageView.getParent() != null) {
View parent = (View) imageView.getParent();
parent.setVisibility(View.GONE);
}
if (imageView.getParent() != null) {
View Parent = (View) imageView.getParent();
Parent.getLayoutParams().width=0;
Parent.getLayoutParams().height=0;
}
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/com/raincat/dolby_beta/hook/SettingHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,23 @@
* </pre>
*/
public class SettingHook {
private String SettingActivity;
private String switchViewName = "";
private TextView titleView, subView;
private LinearLayout dialogRoot, dialogProxyRoot, dialogBeautyRoot, dialogSidebarRoot;

private BroadcastReceiver broadcastReceiver;

public SettingHook(Context context) {
public SettingHook(Context context,int versionCode) {
//一切的前提,没这个页面连设置都进不去
Class<?> settingActivityClass = findClassIfExists("com.netease.cloudmusic.activity.SettingActivity", context.getClassLoader());
if(versionCode>=8007000)
{
SettingActivity="com.netease.cloudmusic.music.biz.setting.activity.SettingActivity";
}else
{
SettingActivity="com.netease.cloudmusic.activity.SettingActivity";
}
Class<?> settingActivityClass = findClassIfExists(SettingActivity, context.getClassLoader());
Field[] allFields = settingActivityClass.getDeclaredFields();
for (Field field : allFields) {
if (field.getType().getName().contains("Switch")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public static LinkedHashMap<String, String> getSidebarEnum() {
enumMap.put("TICKET", "云村有票");
enumMap.put("NEARBY", "附近的人");
enumMap.put("STORE", "商城");
enumMap.put("BEAT", "Beat交易平台");
enumMap.put("GAME", "游戏专区");
enumMap.put("COLOR_RING", "口袋彩铃");
enumMap.put("SETTING", "设置");
Expand All @@ -83,6 +84,7 @@ public static LinkedHashMap<String, String> getSidebarEnum() {
enumMap.put("DISCOUNT_COUPON", "优惠券");
enumMap.put("RED_PACKET", "音乐红包");
enumMap.put("PROFIT", "赞赏收入");
enumMap.put("DYNAMIC_ITEM", "第三方隐私协议");
enumMap.put("FEEDBACK_HELP", "帮助与反馈");
enumMap.put("SHARE_APP", "分享网易云音乐");
enumMap.put("ABOUT", "关于");
Expand Down

0 comments on commit 8e551aa

Please sign in to comment.