Skip to content

Commit

Permalink
Hardcode snet extension URL and version
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Dec 8, 2018
1 parent 8032bd4 commit a54eaf5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/src/full/java/com/topjohnwu/magisk/Const.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class Const {
// Versions
public static final int UPDATE_SERVICE_VER = 1;
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 */
public static final List<String> HIDE_BLACKLIST = Arrays.asList(
Expand Down Expand Up @@ -79,6 +80,7 @@ public static class Url {
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 SOURCE_CODE_URL = "https://github.com/topjohnwu/Magisk";
public static final String SNET_URL = "https://raw.githubusercontent.com/topjohnwu/magisk_files/b66b1a914978e5f4c4bbfd74a59f4ad371bac107/snet.apk";
}


Expand Down
2 changes: 0 additions & 2 deletions app/src/full/java/com/topjohnwu/magisk/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public class Data {
public static String managerLink;
public static String managerNoteLink;
public static String uninstallerLink;
public static int snetVersionCode;
public static String snetLink;

// Install flags
public static boolean keepVerity = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;

import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.utils.ISafetyNetHelper;
import com.topjohnwu.magisk.utils.Topic;
Expand Down Expand Up @@ -32,7 +33,7 @@ public CheckSafetyNet(Activity activity) {
private void dlSnet() throws Exception {
Shell.sh("rm -rf " + dexPath.getParent()).exec();
dexPath.getParentFile().mkdir();
HttpURLConnection conn = WebService.mustRequest(Data.snetLink);
HttpURLConnection conn = WebService.mustRequest(Const.Url.SNET_URL);
try (
OutputStream out = new BufferedOutputStream(new FileOutputStream(dexPath));
InputStream in = new BufferedInputStream(conn.getInputStream())) {
Expand All @@ -51,7 +52,7 @@ private void dyload() throws Exception {
.invoke(null, ISafetyNetHelper.class, dexPath.getPath(), getActivity(),
(ISafetyNetHelper.Callback) code ->
Topic.publish(false, Topic.SNET_CHECK_DONE, code));
if (helper.getVersion() < Data.snetVersionCode) {
if (helper.getVersion() < Const.SNET_EXT_VER) {
throw new Exception();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ public void onResponse(JSONObject json) {
JSONObject uninstaller = getJson(json, "uninstaller");
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 (BuildConfig.VERSION_CODE < Data.remoteManagerVersionCode) {
Notifications.managerUpdate();
Expand Down

0 comments on commit a54eaf5

Please sign in to comment.