Install bdboot.txt in Android

DHT now works on android as bdboot.txt is bundled as android asset
Update Android documentation as DHT works on Android after this commit
This commit is contained in:
Gioacchino Mazzurco 2018-01-29 13:26:43 +01:00
parent 2d8493fe02
commit fa71ed25ba
3 changed files with 38 additions and 6 deletions

View File

@ -84,11 +84,6 @@ CONFIG+=no_retroshare_gui CONFIG+=no_retroshare_nogui CONFIG+=no_retroshare_plug
WARNING: SQLCipher is not supported yet on RetroShare for Android. This poses a
major security concern, we are working to fix this ASAP.
WARNING: DHT is not supported yet on RetroShare for Android. So don't be
surprised if you are not able to connect to dynamic IP trusted nodes after not
using the app for a relatively long time. Once this happens getting a fresh
certificate link from your friends should work around the issue.
TIP: Some versions of QtCreator try to find the Android SDK in
+/opt/android/sdk+. A workaround to this is to make a symbolic link there
pointing to your SDK installation path, like

View File

@ -46,6 +46,12 @@ unix {
INSTALLS += data_files
}
android-* {
# see https://community.kde.org/Necessitas/Assets
bdboot.files=bitdht/bdboot.txt
bdboot.path=/assets/values
INSTALLS += bdboot
}
#################### Cross compilation for windows under Linux ####################

View File

@ -35,6 +35,11 @@
#include "util/rswin.h"
#endif
#ifdef __ANDROID__
# include <QFile> // To install bdboot.txt
# include <QString> // for String::fromStdString(...)
#endif
#include "util/argstream.h"
#include "util/rsdebug.h"
#include "util/rsdir.h"
@ -1042,7 +1047,32 @@ int RsServer::StartupRetroShare()
uint64_t tmp_size ;
if (!RsDirUtil::checkFile(bootstrapfile,tmp_size,true))
{
std::cerr << "DHT bootstrap file not in ConfigDir: " << bootstrapfile << std::endl;
std::cerr << "DHT bootstrap file not in ConfigDir: " << bootstrapfile
<< std::endl;
#ifdef __ANDROID__
QFile bdbootRF("assets:/values/bdboot.txt");
if(!bdbootRF.open(QIODevice::ReadOnly | QIODevice::Text))
std::cerr << __PRETTY_FUNCTION__
<< " bdbootRF(assets:/values/bdboot.txt).open(...) fail: "
<< bdbootRF.errorString().toStdString() << std::endl;
else
{
QFile bdbootCF(QString::fromStdString(bootstrapfile));
if(!bdbootCF.open(QIODevice::WriteOnly | QIODevice::Text))
std::cerr << __PRETTY_FUNCTION__ << " bdbootCF("
<< bootstrapfile << ").open(...) fail: "
<< bdbootRF.errorString().toStdString() << std::endl;
else
{
bdbootCF.write(bdbootRF.readAll());
bdbootCF.close();
std::cerr << "Installed DHT bootstrap file not in ConfigDir: "
<< bootstrapfile << std::endl;
}
bdbootRF.close();
}
#else
std::string installfile = rsAccounts->PathDataDirectory();
installfile += "/";
installfile += BITDHT_BOOTSTRAP_FILENAME;
@ -1064,6 +1094,7 @@ int RsServer::StartupRetroShare()
{
std::cerr << "No Installation DHT bootstrap file to copy" << std::endl;
}
#endif // def __ANDROID__
}
/* construct the rest of the stack, important to build them in the correct order! */