Apparently Github is sensitive...

This commit is contained in:
d8ahazard
2016-09-08 15:47:10 -05:00
parent e3866eeb29
commit 214649ec20
4 changed files with 66 additions and 13 deletions
@@ -5,13 +5,14 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.magisk.utils.WebRequest;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Repo {
@@ -32,6 +33,7 @@ public class Repo {
private Context appContext;
private boolean mIsInstalled,mCanUpdate;
public Repo(String manifestString, Context context) {
appContext = context;
ParseProps(manifestString);
@@ -45,6 +47,7 @@ public class Repo {
this.mName = name;
this.mBaseUrl = url;
this.lastUpdate = updated.toString();
this.fetch();
}
@@ -60,10 +63,11 @@ public class Repo {
}
public void fetch() {
WebRequest webreq = new WebRequest();
// Construct initial url for contents
Log.d("Magisk", "Repo: Fetch called, Manifest string is: " + mBaseUrl + "/contents?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65");
String repoString = webreq.makeWebServiceCall(mBaseUrl + "/contents?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65", WebRequest.GET);
Log.d("Magisk", "Repo: Fetch called, Manifest string is: " + mBaseUrl + "/contents?access_token=" + Utils.procFile(appContext.getString(R.string.some_string),appContext));
String repoString = webreq.makeWebServiceCall(mBaseUrl + "/contents?access_token=" + Utils.procFile(appContext.getString(R.string.some_string),appContext), WebRequest.GET);
try {
JSONArray repoArray = new JSONArray(repoString);
for (int f = 0; f < repoArray.length(); f++) {
@@ -81,7 +85,7 @@ public class Repo {
e.printStackTrace();
}
Log.d("Magisk", "Repo: Inner fetch: " + mManifestUrl + "?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65");
Log.d("Magisk", "Repo: Inner fetch: " + mManifestUrl + "?access_token=" + Utils.procFile(appContext.getString(R.string.some_string),appContext));
WebRequest propReq = new WebRequest();
String manifestString = propReq.makeWebServiceCall(mManifestUrl,WebRequest.GET,true);
Log.d("Magisk","Repo: parseprops called from fetch for string " + manifestString);
@@ -176,6 +180,13 @@ public class Repo {
}
}
public String getStringProperty(String mValue) {
switch (mValue) {
case "author":
@@ -3,11 +3,12 @@ package com.topjohnwu.magisk.module;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Build;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.magisk.utils.WebRequest;
import org.json.JSONArray;
@@ -23,7 +24,7 @@ import java.util.Map;
public class RepoHelper {
private String[] result;
private static String url = "https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65";
private static String url = "https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=";
private static List<Repo> repos = new ArrayList<Repo>();
private static final String TAG_ID = "id";
private static final String TAG_NAME = "name";
@@ -103,7 +104,8 @@ public class RepoHelper {
WebRequest webreq = new WebRequest();
// Making a request to url and getting response
String jsonStr = webreq.makeWebServiceCall(url, WebRequest.GET);
String token = activityContext.getString(R.string.some_string);
String jsonStr = webreq.makeWebServiceCall(url + Utils.procFile(token,activityContext), WebRequest.GET);
Log.d("Magisk", "doInBackground Running, String: " + jsonStr + " Url: " + url);
if(jsonStr != null && !jsonStr.isEmpty()) {