Skip to content

Commit

Permalink
yf
Browse files Browse the repository at this point in the history
  • Loading branch information
memory971027 committed Jun 6, 2024
1 parent 258ab9b commit b8886da
Show file tree
Hide file tree
Showing 28 changed files with 992 additions and 230 deletions.
3 changes: 1 addition & 2 deletions app/src/main/java/com/raincat/dolby_beta/Hook.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
//一起听
if (SettingHelper.getInstance().isEnable(SettingHelper.listen_key)) {
new ListentogetherHook(context, versionCode);

new ListentogetherHook(context,versionCode);
}
//不变灰
new GrayHook(context);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class HookerDispatcher implements IHookerDispatcher {
@Override
public void dispatch(XC_LoadPackage.LoadPackageParam lpparam) {
new Hook(lpparam);
new Hooklite(lpparam);
new HookOther(lpparam);
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/raincat/dolby_beta/MainHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import com.raincat.dolby_beta.helper.ScriptHelper;

import net.androidwing.hotxposed.HotXposed;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
Expand All @@ -26,7 +24,9 @@ public void handleLoadPackage(final LoadPackageParam lpparam) throws Exception {
// HotXposed.hook(HookerDispatcher.class, lpparam);
new Hook(lpparam);
}else if (!TextUtils.isEmpty(lpparam.packageName) && lpparam.packageName.equals("com.netease.cloudmusic.lite")) {
new Hooklite(lpparam);
new HookOther(lpparam);
}else if (!TextUtils.isEmpty(lpparam.packageName) && lpparam.packageName.equals("com.hihonor.cloudmusic")) {
new HookOther(lpparam);
}
}

Expand Down
14 changes: 10 additions & 4 deletions app/src/main/java/com/raincat/dolby_beta/helper/ClassHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import android.content.SharedPreferences;
import android.net.Uri;


import com.annimon.stream.Stream;

import com.raincat.dolby_beta.utils.Tools;
import org.jf.dexlib2.DexFileFactory;
import org.jf.dexlib2.dexbacked.DexBackedClassDef;
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
Expand Down Expand Up @@ -134,8 +136,12 @@ public static String getCookie(Context context) {
Pattern pattern;
if (versionCode < 154)
pattern = Pattern.compile("^com\\.netease\\.cloudmusic\\.[a-z]\\.[a-z]\\.[a-z]\\.[a-z]$");
else
else if (versionCode < 8008050)
pattern = Pattern.compile("^com\\.netease\\.cloudmusic\\.network\\.[a-z]\\.[a-z]\\.[a-z]$");
else
pattern = Pattern.compile("^com\\.netease\\.cloudmusic\\.network\\.cookie\\.store\\.[a-zA-Z0-9]{1,25}$");


List<String> list = getFilteredClasses(pattern, null);

try {
Expand All @@ -149,7 +155,7 @@ public static String getCookie(Context context) {
.findFirst()
.get();

if (versionCode >= 154) {
if (versionCode >= 154) {
clazz = Stream.of(list)
.map(ClassHelper::getClassByXposed)
.filter(c -> Modifier.isPublic(c.getModifiers()))
Expand All @@ -166,11 +172,11 @@ public static String getCookie(Context context) {
}

Object cookieString = null;
if (versionCode >= 154) {
if (versionCode >= 154) {
//获取静态cookie方法
Method cookieMethod = XposedHelpers.findMethodsByExactParameters(clazz, clazz)[0];
Object cookie = XposedHelpers.callStaticMethod(clazz, cookieMethod.getName());
for (Method method : XposedHelpers.findMethodsByExactParameters(abstractClazz, String.class)) {
for (Method method : XposedHelpers.findMethodsByExactParameters(abstractClazz, String.class)) {
if (method.getTypeParameters().length == 0 && method.getModifiers() == Modifier.PUBLIC) {
cookieString = XposedHelpers.callMethod(cookie, method.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public static void startHttpProxyMode(final Context context) {
}

public static void startScript() {
String script = String.format("export ENABLE_FLAC=%s&&export MIN_BR=%s&&libnode.so app.js -a 127.0.0.1 -o %s -p %s",
String script = String.format("export ENABLE_FLAC=%s&&export MIN_BR=%s&&export QQ_COOKIE=\"%s\"&&export MIGU_COOKIE=\"%s\"&&libnode.so app.js -a 127.0.0.1 -o %s -p %s",
SettingHelper.getInstance().getSetting(SettingHelper.proxy_flac_key), SettingHelper.getInstance().getSetting(SettingHelper.proxy_priority_key) ? "256000" : "96000",
SettingHelper.getInstance().getProxyOriginal(), SettingHelper.getInstance().getProxyPort() + ":" + (SettingHelper.getInstance().getProxyPort() + 1));
SettingHelper.getInstance().getQqCookie(),SettingHelper.getInstance().getMiguCookie(),SettingHelper.getInstance().getProxyOriginal(), SettingHelper.getInstance().getProxyPort() + ":" + (SettingHelper.getInstance().getProxyPort() + 1));

String[] START_PROXY = new String[]{"node=$(ps -ef |grep \"libnode.so app.js\" |grep -v grep)",
"if [ ! \"$node\" ]; then",
Expand Down
111 changes: 107 additions & 4 deletions app/src/main/java/com/raincat/dolby_beta/helper/SettingHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
public class SettingHelper {
public static final String refresh_setting = "β_refresh_setting";
public static final String proxy_setting = "β_proxy_setting";
public static final String background_setting = "β_background_setting";
public static final String beauty_setting = "β_beauty_setting";
public static final String sidebar_setting = "β_sidebar_setting";
public static final String proxy_configuration_setting = "β_proxy_configuration_setting";

public static final String master_key = "β_master_key";
public static final String master_title = "总开关";
Expand All @@ -40,7 +42,7 @@ public class SettingHelper {

public static final String listen_key = "β_listen_key";
public static final String listen_title = "解锁一起听蒙面查看权限";
public static final String listen_sub = "开启后可直接查看对方信息,无需对方解除蒙面(暂时只支持8.6.0-8.7.90)";
public static final String listen_sub = "开启后可直接查看对方信息,无需对方解除蒙面";

public static final String fix_comment_key = "β_fix_comment_key";
public static final String fix_comment_title = "修复评论区加载失败";
Expand Down Expand Up @@ -72,6 +74,13 @@ public class SettingHelper {
public static final String proxy_key = "β_proxy_key";
public static final String proxy_title = "音源代理设置";

public static final String background_key = "β_background_key";
public static final String background_title = "播放界面背景设置";

public static final String proxy_configuration_key = "β_proxy_configuration_key";
public static final String proxy_configuration_title = "代理参数配置";
public static final String proxy_configuration_sub = "在此填入对于代理服务器与相关脚本参数";

public static final String proxy_master_key = "β_proxy_master_key";
public static final String proxy_master_title = "代理开关";

Expand All @@ -95,13 +104,25 @@ public class SettingHelper {
public static final String http_proxy_title = "代理服务器";
public static final String http_proxy_default = "127.0.0.1";

public static final String kuwo_cookie_key = "β_kuwo_cookie_key";
public static final String kuwo_cookie_title = "酷我Cookie";
public static final String kuwo_cookie_default = "Hm_Iuvt_cdb524f42f0ce19b169b8072123a4727=CQXkhzXjGD6MFQrPTBxEpSmZXF78wP8e; Secret=1d0d220792feb563f97fdb0de2b7ebad69f781cdcdbe51d1203a3be9d3e92f5e04b00a24";

public static final String qq_cookie_key = "β_qq_cookie_key";
public static final String qq_cookie_title = "QQCookie";
public static final String qq_cookie_default = "uin=<your_uin>; qm_keyst=<your_qm_keyst>";

public static final String migu_cookie_key = "β_migu_cookie_key";
public static final String migu_cookie_title = "咪咕Cookie";
public static final String migu_cookie_default = "<your_aversionid>";

public static final String proxy_port_key = "β_proxy_port_key";
public static final String proxy_port_title = "代理端口(1~65535)";
public static final int proxy_port_default = 23338;

public static final String proxy_original_key = "β_proxy_original_key";
public static final String proxy_original_title = "代理源(空格隔开)";
public static final String proxy_original_default = "kuwo pyncmd";
public static final String proxy_original_default = "pyncmd kuwo";

public static final String proxy_cover_key = "β_proxy_cover_key";
public static final String proxy_cover_title = "重新释放脚本";
Expand Down Expand Up @@ -133,13 +154,24 @@ public class SettingHelper {
public static final String beauty_rotation_key = "β_beauty_rotation_key";
public static final String beauty_rotation_title = "播放页专辑图片停止转动";

public static final String beauty_background_key = "β_beauty_background_key";
public static final String beauty_background_title = "自定义播放界面背景";

public static final String beauty_comment_hot_key = "β_beauty_comment_hot_key";
public static final String beauty_comment_hot_title = "评论区优先显示“最热”内容";

public static final String beauty_sidebar_hide_key = "β_beauty_sidebar_hide_key";
public static final String beauty_sidebar_hide_title = "精简侧边栏";
public static final String beauty_sidebar_hide_sub = "部分Item需配合“设置”->“侧边栏管理”开关生效";

public static final String background_url_key = "β_background_url_key";
public static final String background_url_title = "图片URL(请自行上传至图床)";
public static final String background_url_default = "";

public static final String background_blur_key = "β_background_blur_key";
public static final String background_blur_title = "高斯模糊度(默认透明无模糊)";
public static final int background_blur_default = 0 ;

private static SettingHelper instance;

private SharedPreferences sharedPreferences;
Expand Down Expand Up @@ -171,7 +203,7 @@ public void refreshSetting(Context context) {
settingMap.put(listen_key, sharedPreferences.getBoolean(listen_key, false));
settingMap.put(fix_comment_key, sharedPreferences.getBoolean(fix_comment_key, false));
settingMap.put(update_key, sharedPreferences.getBoolean(update_key, true));
settingMap.put(sign_key, sharedPreferences.getBoolean(sign_key, true));
settingMap.put(sign_key, sharedPreferences.getBoolean(sign_key, false));
settingMap.put(sign_song_key, sharedPreferences.getBoolean(sign_song_key, false));

settingMap.put(proxy_master_key, sharedPreferences.getBoolean(proxy_master_key, true));
Expand All @@ -188,9 +220,12 @@ public void refreshSetting(Context context) {
settingMap.put(beauty_rotation_key, sharedPreferences.getBoolean(beauty_rotation_key, false));
settingMap.put(beauty_black_hide_key, sharedPreferences.getBoolean(beauty_black_hide_key, false));
settingMap.put(beauty_comment_hot_key, sharedPreferences.getBoolean(beauty_comment_hot_key, false));
settingMap.put(beauty_background_key, sharedPreferences.getBoolean(beauty_background_key, false));


}

public void setSetting(String key, boolean value) {
public void setSetting(String key, boolean value) {
settingMap.put(key, value);
sharedPreferences.edit().putBoolean(key, value).apply();
}
Expand All @@ -203,6 +238,38 @@ public boolean isEnable(String key) {
return settingMap.get(master_key) && settingMap.get(key);
}

private void deleteSetting(String key) {
if (sharedPreferences.contains(key)) {
sharedPreferences.edit().remove(key).apply();
}
}

public void resetSetting() {
deleteSetting(master_key);
deleteSetting(dex_key);
deleteSetting(warn_key);
deleteSetting(black_key);
deleteSetting(listen_key);
deleteSetting(fix_comment_key);
deleteSetting(update_key);
deleteSetting(sign_key);
deleteSetting(sign_song_key);
deleteSetting(proxy_master_key);
deleteSetting(proxy_server_key);
deleteSetting(proxy_priority_key);
deleteSetting(proxy_flac_key);
deleteSetting(proxy_gray_key);
deleteSetting(beauty_night_mode_key);
deleteSetting(beauty_tab_hide_key);
deleteSetting(beauty_bubble_hide_key);
deleteSetting(beauty_banner_hide_key);
deleteSetting(beauty_ksong_hide_key);
deleteSetting(beauty_rotation_key);
deleteSetting(beauty_black_hide_key);
deleteSetting(beauty_comment_hot_key);
deleteSetting(beauty_background_key);
}

public HashMap<String, Boolean> getSidebarSetting(LinkedHashMap<String, String> map) {
if (sidebarSettingMap == null) {
sidebarSettingMap = new HashMap<>();
Expand Down Expand Up @@ -271,4 +338,40 @@ public void setHttpProxy(String http) {
public String getHttpProxy() {
return sharedPreferences.getString(SettingHelper.http_proxy_key, SettingHelper.http_proxy_default);
}
public String getKuwoCookie() {
return sharedPreferences.getString(SettingHelper.kuwo_cookie_key, SettingHelper.kuwo_cookie_default);
}
public void setKuwoCookie(String cookie) {
if (!TextUtils.isEmpty(cookie))
sharedPreferences.edit().putString(SettingHelper.kuwo_cookie_key, cookie).apply();
}
public String getQqCookie() {
return sharedPreferences.getString(SettingHelper.qq_cookie_key, SettingHelper.qq_cookie_default);
}
public void setQqCookie(String cookie) {
if (!TextUtils.isEmpty(cookie))
sharedPreferences.edit().putString(SettingHelper.qq_cookie_key, cookie).apply();
}
public String getMiguCookie() {
return sharedPreferences.getString(SettingHelper.migu_cookie_key, SettingHelper.migu_cookie_default);
}
public void setMiguCookie(String cookie) {
if (!TextUtils.isEmpty(cookie))
sharedPreferences.edit().putString(SettingHelper.migu_cookie_key, cookie).apply();
}
public String getPictureUrl() {
return sharedPreferences.getString(SettingHelper.background_url_key, SettingHelper.background_url_default);
}
public void setPictureUrl(String url) {
if (!TextUtils.isEmpty(url))
sharedPreferences.edit().putString(SettingHelper.background_url_key, url).apply();
}
public int getBackgroundBlur() {
return sharedPreferences.getInt(SettingHelper.background_blur_key, SettingHelper.background_blur_default);
}

public void setBackgroundBlur(String blur) {
if (!TextUtils.isEmpty(blur))
sharedPreferences.edit().putInt(SettingHelper.background_blur_key, Integer.parseInt(blur)).apply();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
//加了一个反营销版权保护的URL,暂时作用未知
if (urlObj.toString().contains("appcustomconfig/get")
//去广告
|| (SettingHelper.getInstance().isEnable(SettingHelper.black_key) && !urlObj.toString().contains("music.126.net") && (urlObj.toString().contains("resource-exposure/config") || urlObj.toString().contains("api/ad") || urlObj.toString().endsWith(".jpg") || urlObj.toString().endsWith(".mp4")))
|| (SettingHelper.getInstance().isEnable(SettingHelper.black_key) && !urlObj.toString().contains("music.126.net") && (urlObj.toString().contains("resource-exposure/config") || urlObj.toString().contains("api/ad") || urlObj.toString().endsWith(".jpg") || urlObj.toString().endsWith(".mp4") || urlObj.toString().contains("ad/get")|| urlObj.toString().contains("ad/loading")))
//去升级
|| (SettingHelper.getInstance().isEnable(SettingHelper.update_key) && (urlObj.toString().contains("android/version") || urlObj.toString().contains("android/upgrade")))) {
Field url = urlObj.getClass().getDeclaredField(urlFieldString);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
package com.raincat.dolby_beta.hook;

import android.content.Context;
import android.content.SharedPreferences;


import com.raincat.dolby_beta.helper.ExtraHelper;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;




import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import static de.robv.android.xposed.XposedHelpers.findClass;


public class ListentogetherHook {
public ListentogetherHook(Context context, int versionCode) {

private final SharedPreferences listening;

public ListentogetherHook(Context context,int versionCode) {
//旧版写法
if (versionCode > 8007090) {
findAndHookMethod(findClass("com.netease.cloudmusic.module.listentogether.f2", context.getClassLoader()),
"v", XC_MethodReplacement.returnConstant(true));
Expand Down Expand Up @@ -44,5 +56,17 @@ public ListentogetherHook(Context context, int versionCode) {
findAndHookMethod(findClass("com.netease.cloudmusic.module.listentogether.x", context.getClassLoader()),
"m1", XC_MethodReplacement.returnConstant(true));
}
//新版写法
listening = context.getSharedPreferences("LISTEN_TOGETHER", Context.MODE_MULTI_PROCESS);
XposedBridge.hookAllMethods(findClass("com.netease.cloudmusic.activity.PlayerActivity", context.getClassLoader()), "onCreate", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
findAndHookMethod(findClass("com.netease.cloudmusic.module.listentogether.meta.RoomInfo", context.getClassLoader()),
"getUnlockedIdentity", XC_MethodReplacement.returnConstant(true));
listening.edit().putBoolean("match_unlock_status" + ExtraHelper.USER_ID, true).apply();
}
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,25 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
}
});
}
if (SettingHelper.getInstance().isEnable(SettingHelper.beauty_background_key))
if (versionCode >= 123) {
XposedHelpers.findAndHookMethod(XposedHelpers.findClass("com.netease.cloudmusic.ui.PlayerBackgroundImage", context.getClassLoader()), "setBlurCover",String.class,String.class,int.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
param.args[0]= SettingHelper.getInstance().getPictureUrl();
param.args[2]= SettingHelper.getInstance().getBackgroundBlur();
}
});
} else {
XposedHelpers.findAndHookMethod(XposedHelpers.findClass("com.netease.cloudmusic.ui.r", context.getClassLoader()), "a",String.class,String.class,int.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
param.args[0]= SettingHelper.getInstance().getPictureUrl();
param.args[2]= SettingHelper.getInstance().getBackgroundBlur();
}
});
}
}
}
Loading

0 comments on commit b8886da

Please sign in to comment.