This commit is contained in:
arrase 2016-11-27 19:19:44 +01:00
parent f153600dd1
commit 5d3b171e21
1 changed files with 7 additions and 4 deletions

View File

@ -118,6 +118,9 @@ public class BackupUtils {
}
public void restoreZipBackup(File backup) {
int port;
Cursor service;
String backupName = backup.getName();
String hsDir = backupName.substring(0, backupName.lastIndexOf('.'));
String configFilePath = mHSBasePath + "/" + hsDir + "/" + configFileName;
@ -149,15 +152,12 @@ public class BackupUtils {
try {
JSONObject savedValues = new JSONObject(jString);
ContentValues fields = new ContentValues();
int port = savedValues.getInt(HSContentProvider.HiddenService.PORT);
fields.put(
HSContentProvider.HiddenService.NAME,
savedValues.getString(HSContentProvider.HiddenService.NAME)
);
fields.put(HSContentProvider.HiddenService.PORT, port);
fields.put(
HSContentProvider.HiddenService.ONION_PORT,
savedValues.getInt(HSContentProvider.HiddenService.ONION_PORT)
@ -173,7 +173,10 @@ public class BackupUtils {
savedValues.getInt(HSContentProvider.HiddenService.CREATED_BY_USER)
);
Cursor service = mResolver.query(
port = savedValues.getInt(HSContentProvider.HiddenService.PORT);
fields.put(HSContentProvider.HiddenService.PORT, port);
service = mResolver.query(
HSContentProvider.CONTENT_URI,
HSContentProvider.PROJECTION,
HSContentProvider.HiddenService.PORT + "=" + port,