[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] bug fix and refactor



commit f79d2d9005e3f8be3b9bd0db805e04fcb9c01a8c
Author: arrase <arrase@xxxxxxxxx>
Date:   Wed Nov 23 21:20:50 2016 +0100

    bug fix and refactor
---
 .../main/java/org/torproject/android/OrbotMainActivity.java  |  4 ++--
 .../main/java/org/torproject/android/backup/BackupUtils.java | 12 ++++++------
 .../torproject/android/ui/hs/dialogs/HSActionsDialog.java    |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index e0fdbb0..1ea9b6e 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -649,14 +649,14 @@ public class OrbotMainActivity extends AppCompatActivity
 							BackupUtils hsutils = new BackupUtils(getApplicationContext());
 							if(keyZipPath != null && keyZipPath.length() > 0)
 							{
-								hsutils.restoreOnionBackup(hsPort, keyZipPath);
+								hsutils.restoreZipBackup(hsPort, keyZipPath);
 								requestTorRereadConfig();
 							}
 
                             /* TODO
 							if(doBackup)
 							{
-								backupPath = hsutils.createOnionBackup(hsPort);
+								backupPath = hsutils.createZipBackup(hsPort);
 							}
 							*/
 							onion.close();
diff --git a/app/src/main/java/org/torproject/android/backup/BackupUtils.java b/app/src/main/java/org/torproject/android/backup/BackupUtils.java
index 5d77d17..e05532f 100644
--- a/app/src/main/java/org/torproject/android/backup/BackupUtils.java
+++ b/app/src/main/java/org/torproject/android/backup/BackupUtils.java
@@ -9,16 +9,16 @@ import org.torproject.android.storage.ExternalStorage;
 import java.io.File;
 
 public class BackupUtils {
-    private static File mHSBasePath;
+    private File mHSBasePath;
 
     public BackupUtils(Context context) {
         mHSBasePath = context.getDir(
-                TorServiceConstants.DIRECTORY_TOR_DATA + "/" + TorServiceConstants.HIDDEN_SERVICES_DIR,
+                TorServiceConstants.DIRECTORY_TOR_DATA,
                 Application.MODE_PRIVATE
         );
     }
 
-    public String createOnionBackup(Integer port) {
+    public String createZipBackup(Integer port) {
 
         ExternalStorage storage = new ExternalStorage();
         String storage_path = storage.createBackupDir();
@@ -28,8 +28,8 @@ public class BackupUtils {
 
         String zip_path = storage_path + "/hs" + port + ".zip";
         String files[] = {
-                mHSBasePath + "/hs" + port + "/hostname",
-                mHSBasePath + "/hs" + port + "/private_key"
+                mHSBasePath + "/" + TorServiceConstants.HIDDEN_SERVICES_DIR + "/hs" + port + "/hostname",
+                mHSBasePath + "/" + TorServiceConstants.HIDDEN_SERVICES_DIR + "/hs" + port + "/private_key"
         };
 
         ZipIt zip = new ZipIt(files, zip_path);
@@ -41,7 +41,7 @@ public class BackupUtils {
         return zip_path;
     }
 
-    public void restoreOnionBackup(Integer port, String path) {
+    public void restoreZipBackup(Integer port, String path) {
         ZipIt zip = new ZipIt(null, path);
         zip.unzip(mHSBasePath + "/hs" + port);
     }
diff --git a/app/src/main/java/org/torproject/android/ui/hs/dialogs/HSActionsDialog.java b/app/src/main/java/org/torproject/android/ui/hs/dialogs/HSActionsDialog.java
index f432a01..4631543 100644
--- a/app/src/main/java/org/torproject/android/ui/hs/dialogs/HSActionsDialog.java
+++ b/app/src/main/java/org/torproject/android/ui/hs/dialogs/HSActionsDialog.java
@@ -50,7 +50,7 @@ public class HSActionsDialog extends DialogFragment {
                 }
 
                 BackupUtils hsutils = new BackupUtils(mContext);
-                String backupPath = hsutils.createOnionBackup(Integer.parseInt(arguments.getString("port")));
+                String backupPath = hsutils.createZipBackup(Integer.parseInt(arguments.getString("port")));
 
                 if (backupPath == null || backupPath.length() < 1) {
                     Toast.makeText(mContext, R.string.error, Toast.LENGTH_LONG).show();



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits