bug fix
This commit is contained in:
parent
0a6d623cf7
commit
9ffb0b3915
|
@ -597,7 +597,12 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
|
|
||||||
if (onionHostname == null || onionHostname.length() < 1) {
|
if (onionHostname == null || onionHostname.length() < 1) {
|
||||||
|
|
||||||
requestTorRereadConfig();
|
if (hsKeyPath != null) {
|
||||||
|
BackupUtils hsutils = new BackupUtils(getApplicationContext());
|
||||||
|
hsutils.restoreKeyBackup(hsPort, hsKeyPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
startTor();
|
||||||
|
|
||||||
new Thread() {
|
new Thread() {
|
||||||
|
|
||||||
|
@ -631,12 +636,6 @@ public class OrbotMainActivity extends AppCompatActivity
|
||||||
|
|
||||||
nResult.putExtra("hs_host", hostname);
|
nResult.putExtra("hs_host", hostname);
|
||||||
|
|
||||||
if (hsKeyPath != null) {
|
|
||||||
BackupUtils hsutils = new BackupUtils(getApplicationContext());
|
|
||||||
hsutils.restoreKeyBackup(hsPort, hsKeyPath);
|
|
||||||
requestTorRereadConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (backupToPackage != null && backupToPackage.length() > 0) {
|
if (backupToPackage != null && backupToPackage.length() > 0) {
|
||||||
String servicePath = getFilesDir() + "/" + TorServiceConstants.HIDDEN_SERVICES_DIR + "/hs" + hsPort;
|
String servicePath = getFilesDir() + "/" + TorServiceConstants.HIDDEN_SERVICES_DIR + "/hs" + hsPort;
|
||||||
File hidden_service_key = new File(servicePath, "private_key");
|
File hidden_service_key = new File(servicePath, "private_key");
|
||||||
|
|
|
@ -211,12 +211,16 @@ public class BackupUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreKeyBackup(int hsPort, Uri hsKeyPath) {
|
public void restoreKeyBackup(int hsPort, Uri hsKeyPath) {
|
||||||
String keyFilePath = mHSBasePath + "/hs" + hsPort + "/private_key";
|
|
||||||
|
File serviceDir = new File(mHSBasePath, "hs" + hsPort);
|
||||||
|
|
||||||
|
if (!serviceDir.isDirectory())
|
||||||
|
serviceDir.mkdirs();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ParcelFileDescriptor mInputPFD = mContext.getContentResolver().openFileDescriptor(hsKeyPath, "r");
|
ParcelFileDescriptor mInputPFD = mContext.getContentResolver().openFileDescriptor(hsKeyPath, "r");
|
||||||
InputStream fileStream = new FileInputStream(mInputPFD.getFileDescriptor());
|
InputStream fileStream = new FileInputStream(mInputPFD.getFileDescriptor());
|
||||||
OutputStream file = new FileOutputStream(keyFilePath);
|
OutputStream file = new FileOutputStream(serviceDir.getAbsolutePath() + "/private_key");
|
||||||
|
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int length;
|
int length;
|
||||||
|
|
Loading…
Reference in New Issue