Hardcode snet extension URL and version
This commit is contained in:
parent
8032bd4bb9
commit
a54eaf5371
@ -36,6 +36,7 @@ public class Const {
|
|||||||
// Versions
|
// Versions
|
||||||
public static final int UPDATE_SERVICE_VER = 1;
|
public static final int UPDATE_SERVICE_VER = 1;
|
||||||
public static final int MIN_MODULE_VER = 1500;
|
public static final int MIN_MODULE_VER = 1500;
|
||||||
|
public static final int SNET_EXT_VER = 12;
|
||||||
|
|
||||||
/* A list of apps that should not be shown as hide-able */
|
/* A list of apps that should not be shown as hide-able */
|
||||||
public static final List<String> HIDE_BLACKLIST = Arrays.asList(
|
public static final List<String> HIDE_BLACKLIST = Arrays.asList(
|
||||||
@ -79,6 +80,7 @@ public class Const {
|
|||||||
public static final String TWITTER_URL = "https://twitter.com/topjohnwu";
|
public static final String TWITTER_URL = "https://twitter.com/topjohnwu";
|
||||||
public static final String XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382";
|
public static final String XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382";
|
||||||
public static final String SOURCE_CODE_URL = "https://github.com/topjohnwu/Magisk";
|
public static final String SOURCE_CODE_URL = "https://github.com/topjohnwu/Magisk";
|
||||||
|
public static final String SNET_URL = "https://raw.githubusercontent.com/topjohnwu/magisk_files/b66b1a914978e5f4c4bbfd74a59f4ad371bac107/snet.apk";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,8 +47,6 @@ public class Data {
|
|||||||
public static String managerLink;
|
public static String managerLink;
|
||||||
public static String managerNoteLink;
|
public static String managerNoteLink;
|
||||||
public static String uninstallerLink;
|
public static String uninstallerLink;
|
||||||
public static int snetVersionCode;
|
|
||||||
public static String snetLink;
|
|
||||||
|
|
||||||
// Install flags
|
// Install flags
|
||||||
public static boolean keepVerity = false;
|
public static boolean keepVerity = false;
|
||||||
|
@ -2,6 +2,7 @@ package com.topjohnwu.magisk.asyncs;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
|
||||||
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.Data;
|
import com.topjohnwu.magisk.Data;
|
||||||
import com.topjohnwu.magisk.utils.ISafetyNetHelper;
|
import com.topjohnwu.magisk.utils.ISafetyNetHelper;
|
||||||
import com.topjohnwu.magisk.utils.Topic;
|
import com.topjohnwu.magisk.utils.Topic;
|
||||||
@ -32,7 +33,7 @@ public class CheckSafetyNet extends ParallelTask<Void, Void, Void> {
|
|||||||
private void dlSnet() throws Exception {
|
private void dlSnet() throws Exception {
|
||||||
Shell.sh("rm -rf " + dexPath.getParent()).exec();
|
Shell.sh("rm -rf " + dexPath.getParent()).exec();
|
||||||
dexPath.getParentFile().mkdir();
|
dexPath.getParentFile().mkdir();
|
||||||
HttpURLConnection conn = WebService.mustRequest(Data.snetLink);
|
HttpURLConnection conn = WebService.mustRequest(Const.Url.SNET_URL);
|
||||||
try (
|
try (
|
||||||
OutputStream out = new BufferedOutputStream(new FileOutputStream(dexPath));
|
OutputStream out = new BufferedOutputStream(new FileOutputStream(dexPath));
|
||||||
InputStream in = new BufferedInputStream(conn.getInputStream())) {
|
InputStream in = new BufferedInputStream(conn.getInputStream())) {
|
||||||
@ -51,7 +52,7 @@ public class CheckSafetyNet extends ParallelTask<Void, Void, Void> {
|
|||||||
.invoke(null, ISafetyNetHelper.class, dexPath.getPath(), getActivity(),
|
.invoke(null, ISafetyNetHelper.class, dexPath.getPath(), getActivity(),
|
||||||
(ISafetyNetHelper.Callback) code ->
|
(ISafetyNetHelper.Callback) code ->
|
||||||
Topic.publish(false, Topic.SNET_CHECK_DONE, code));
|
Topic.publish(false, Topic.SNET_CHECK_DONE, code));
|
||||||
if (helper.getVersion() < Data.snetVersionCode) {
|
if (helper.getVersion() < Const.SNET_EXT_VER) {
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,10 +90,6 @@ public class CheckUpdates {
|
|||||||
JSONObject uninstaller = getJson(json, "uninstaller");
|
JSONObject uninstaller = getJson(json, "uninstaller");
|
||||||
Data.uninstallerLink = getString(uninstaller, "link", null);
|
Data.uninstallerLink = getString(uninstaller, "link", null);
|
||||||
|
|
||||||
JSONObject snet = getJson(json, "snet");
|
|
||||||
Data.snetVersionCode = getInt(snet, "versionCode", -1);
|
|
||||||
Data.snetLink = getString(snet, "link", null);
|
|
||||||
|
|
||||||
if (cb != null) {
|
if (cb != null) {
|
||||||
if (BuildConfig.VERSION_CODE < Data.remoteManagerVersionCode) {
|
if (BuildConfig.VERSION_CODE < Data.remoteManagerVersionCode) {
|
||||||
Notifications.managerUpdate();
|
Notifications.managerUpdate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user