1
0
Fork 1

I2P Support [2]

This commit is contained in:
R4SAS 2022-09-26 14:18:31 +02:00 committed by Arne
parent dc38bf8927
commit 4ab6ddf9d1
3 changed files with 13 additions and 6 deletions

View file

@ -43,7 +43,7 @@ public class ProviderService extends AsyncTask<String, Object, Boolean> {
boolean isError = false;
try {
Log.d(Config.LOGTAG, "ProviderService: Updating provider list from " + Config.PROVIDER_URL);
final InputStream is = HttpConnectionManager.open(Config.PROVIDER_URL, false);
final InputStream is = HttpConnectionManager.open(Config.PROVIDER_URL, false, false);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = reader.readLine()) != null) {

View file

@ -31,6 +31,7 @@ import me.drakeet.support.toast.ToastCompat;
public class UpdateService extends AsyncTask<String, Object, UpdateService.Wrapper> {
private boolean mUseTor;
private boolean mUseI2P;
private Context context;
private String store;
private NotificationService getNotificationService;
@ -39,6 +40,7 @@ public class UpdateService extends AsyncTask<String, Object, UpdateService.Wrapp
this.context = context;
this.store = Store;
this.mUseTor = mXmppConnectionService.useTorToConnect();
this.mUseI2P = mXmppConnectionService.useI2PToConnect();
this.getNotificationService = mXmppConnectionService.getNotificationService();
}
@ -67,8 +69,10 @@ public class UpdateService extends AsyncTask<String, Object, UpdateService.Wrapp
HttpsURLConnection connection = null;
try {
URL url = new URL(Config.UPDATE_URL);
if (mUseTor) {
connection = (HttpsURLConnection) url.openConnection(getProxy());
if (mUseTor && !mUseI2P) {
connection = (HttpsURLConnection) url.openConnection(getProxy(false));
} else if (mUseI2P) {
connection = (HttpsURLConnection) url.openConnection(getProxy(true));
} else {
connection = (HttpsURLConnection) url.openConnection();
}

View file

@ -288,6 +288,7 @@ public class UpdaterActivity extends XmppActivity {
private PowerManager.WakeLock mWakeLock;
private long startTime = 0;
private boolean mUseTor;
private boolean mUseI2P;
DownloadTask(Context context) {
this.context = context;
@ -307,6 +308,7 @@ public class UpdaterActivity extends XmppActivity {
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, getClass().getName());
mWakeLock.acquire();
mUseTor = xmppConnectionService != null && xmppConnectionService.useTorToConnect();
mUseI2P = xmppConnectionService != null && xmppConnectionService.useI2PToConnect();
}
mProgressDialog.show();
}
@ -342,9 +344,10 @@ public class UpdaterActivity extends XmppActivity {
Log.d(Config.LOGTAG, "AppUpdater: download update from url: " + sUrl[0] + " to file name: " + file.toString());
URL url = new URL(sUrl[0]);
if (mUseTor) {
connection = (HttpsURLConnection) url.openConnection(getProxy());
if (mUseTor && !mUseI2P) {
connection = (HttpsURLConnection) url.openConnection(getProxy(false));
} else if (mUseI2P) {
connection = (HttpsURLConnection) url.openConnection(getProxy(true));
} else {
connection = (HttpsURLConnection) url.openConnection();
}