bug fix
This commit is contained in:
parent
6b3fc6183e
commit
67d999b831
|
@ -106,7 +106,17 @@ public class HSContentProvider extends ContentProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
||||||
return 0;
|
SQLiteDatabase db = mServerDB.getWritableDatabase();
|
||||||
|
|
||||||
|
String where = selection;
|
||||||
|
if (uriMatcher.match(uri) == ONION_ID) {
|
||||||
|
where = "_id=" + uri.getLastPathSegment();
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer rows = db.update(HSDatabase.HS_DATA_TABLE_NAME, values, where, null);
|
||||||
|
mContext.getContentResolver().notifyChange(CONTENT_URI, null);
|
||||||
|
|
||||||
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class HiddenService implements BaseColumns {
|
public static final class HiddenService implements BaseColumns {
|
||||||
|
|
|
@ -773,29 +773,28 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
Integer HSLocalPort = hidden_services.getInt(hidden_services.getColumnIndex(HiddenService.PORT));
|
Integer HSLocalPort = hidden_services.getInt(hidden_services.getColumnIndex(HiddenService.PORT));
|
||||||
|
|
||||||
// Update only new domains
|
// Update only new domains
|
||||||
if(!"".equals(HSDomain))
|
if(HSDomain == null || HSDomain.length() < 1) {
|
||||||
continue;
|
String hsDirPath = new File(appCacheHome,"hs" + HSLocalPort).getCanonicalPath();
|
||||||
|
File file = new File(hsDirPath, "hostname");
|
||||||
|
|
||||||
String hsDirPath = new File(appCacheHome,"hs" + HSLocalPort).getCanonicalPath();
|
if (file.exists())
|
||||||
File file = new File(hsDirPath, "hostname");
|
{
|
||||||
|
ContentValues fields = new ContentValues();
|
||||||
|
|
||||||
if (file.exists())
|
try {
|
||||||
{
|
String onionHostname = Utils.readString(new FileInputStream(file)).trim();
|
||||||
ContentValues fields = new ContentValues();
|
fields.put("domain", onionHostname);
|
||||||
|
mCR.update(CONTENT_URI, fields, "port=" + HSLocalPort , null);
|
||||||
try {
|
} catch (FileNotFoundException e) {
|
||||||
String onionHostname = Utils.readString(new FileInputStream(file)).trim();
|
logException("unable to read onion hostname file",e);
|
||||||
fields.put("domain", onionHostname);
|
showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), HS_NOTIFY_ID, R.drawable.ic_stat_notifyerr);
|
||||||
mCR.update(CONTENT_URI, fields, "port=" + HSLocalPort , null);
|
}
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
logException("unable to read onion hostname file",e);
|
|
||||||
showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), HS_NOTIFY_ID, R.drawable.ic_stat_notifyerr);
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), HS_NOTIFY_ID, R.drawable.ic_stat_notifyerr);
|
||||||
showToolbarNotification(getString(R.string.unable_to_read_hidden_service_name), HS_NOTIFY_ID, R.drawable.ic_stat_notifyerr);
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue