mirror of
https://github.com/feather-wallet/feather.git
synced 2025-04-24 05:08:12 +00:00
macos: fix Tor startup
This commit is contained in:
parent
dff4752e82
commit
7992d7be9b
5 changed files with 25 additions and 7 deletions
|
@ -28,6 +28,9 @@ option(DONATE_BEG "Prompt donation window every once in a while" OFF)
|
|||
option(WITH_SCANNER "Enable webcam QR scanner" ON)
|
||||
option(STACK_TRACE "Dump stack trace on crash (Linux only)" OFF)
|
||||
|
||||
# internal configuration options
|
||||
option(TOR_INSTALLED "Is Tor installed on the filesystem?" OFF)
|
||||
|
||||
# Plugins
|
||||
option(WITH_PLUGIN_HOME "Include Home tab plugin" ON)
|
||||
option(WITH_PLUGIN_TICKERS "Include Tickers Home plugin" ON)
|
||||
|
|
|
@ -298,7 +298,7 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
|
|||
*mingw32)
|
||||
case "$OPTIONS" in
|
||||
installer)
|
||||
CMAKEVARS+=" -DPLATFORM_INSTALLER=On -DTOR_DIR=Off -DTOR_VERSION=Off"
|
||||
CMAKEVARS+=" -DPLATFORM_INSTALLER=On -DTOR_INSTALLED=On -DTOR_DIR=Off -DTOR_VERSION=Off"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
@ -318,7 +318,7 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
|
|||
CMAKEVARS+=" -DNO_AES=On" # Raspberry Pi
|
||||
;;
|
||||
*darwin*)
|
||||
CMAKEVARS+=" -DTOR_DIR=Off -DTOR_VERSION=Off"
|
||||
CMAKEVARS+=" -DTOR_DIR=Off -DTOR_VERSION=Off -DTOR_INSTALLED=On"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -410,6 +410,7 @@ export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
|
|||
mkdir -p Feather.app/Contents/bin
|
||||
cp -a /feather/contrib/depends/${HOST}/Tor/libevent-2.1.7.dylib Feather.app/Contents/bin
|
||||
cp -a /feather/contrib/depends/${HOST}/Tor/tor Feather.app/Contents/bin
|
||||
chmod +x Feather.app/Contents/bin/tor
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -217,6 +217,10 @@ if(PLATFORM_INSTALLER)
|
|||
target_compile_definitions(feather PRIVATE PLATFORM_INSTALLER=1)
|
||||
endif()
|
||||
|
||||
if(TOR_INSTALLED)
|
||||
target_compile_definitions(feather PRIVATE TOR_INSTALLED=1)
|
||||
endif()
|
||||
|
||||
if(STACK_TRACE)
|
||||
target_compile_definitions(feather PRIVATE STACK_TRACE=1)
|
||||
endif()
|
||||
|
|
|
@ -20,10 +20,16 @@ TorManager::TorManager(QObject *parent)
|
|||
connect(m_checkConnectionTimer, &QTimer::timeout, this, &TorManager::checkConnection);
|
||||
|
||||
this->torDir = Config::defaultConfigDir().filePath("tor");
|
||||
#if defined(PLATFORM_INSTALLER)
|
||||
#if defined(TOR_INSTALLED)
|
||||
// When installed, use directory relative to application path.
|
||||
this->torDir = QDir(Utils::applicationPath()).filePath("tor");
|
||||
#endif
|
||||
if (QString(FEATHER_TARGET_TRIPLET) == "arm64-apple-darwin" || QString(FEATHER_TARGET_TRIPLET) == "x86_64-apple-darwin") {
|
||||
QString featherBinaryPath = QCoreApplication::applicationDirPath();
|
||||
QDir appBinaryDir(featherBinaryPath);
|
||||
appBinaryDir.cd("..");
|
||||
this->torDir = appBinaryDir.filePath("bin");
|
||||
}
|
||||
|
||||
this->torDataPath = Config::defaultConfigDir().filePath("tor/data");
|
||||
|
||||
|
@ -187,11 +193,15 @@ bool TorManager::unpackBins() {
|
|||
|
||||
this->torPath = QDir(this->torDir).filePath(torBin);
|
||||
|
||||
#if defined(PLATFORM_INSTALLER)
|
||||
#if defined(TOR_INSTALLED)
|
||||
// We don't need to unpack if Tor was installed using the installer
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if (QString(FEATHER_TARGET_TRIPLET) == "arm64-apple-darwin" || QString(FEATHER_TARGET_TRIPLET) == "x86_64-apple-darwin") {
|
||||
return true;
|
||||
}
|
||||
|
||||
SemanticVersion embeddedVersion = SemanticVersion::fromString(QString(TOR_VERSION));
|
||||
SemanticVersion filesystemVersion = this->getVersion(torPath);
|
||||
qDebug() << QString("Tor versions: embedded %1, filesystem %2").arg(embeddedVersion.toString(), filesystemVersion.toString());
|
||||
|
@ -256,7 +266,7 @@ bool TorManager::shouldStartTorDaemon() {
|
|||
}
|
||||
|
||||
// Don't start a Tor daemon if we don't have one
|
||||
#if !defined(HAS_TOR_BIN) && !defined(PLATFORM_INSTALLER)
|
||||
#if !defined(HAS_TOR_BIN) && !defined(TOR_INSTALLED)
|
||||
qWarning() << "Feather built without embedded Tor. Assuming --use-local-tor";
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -44,7 +44,7 @@ NetworkProxyWidget::NetworkProxyWidget(QWidget *parent)
|
|||
|
||||
// [Tor settings]
|
||||
// [Let Feather start and manage a Tor daemon]
|
||||
#if !defined(HAS_TOR_BIN) && !defined(PLATFORM_INSTALLER)
|
||||
#if !defined(HAS_TOR_BIN) && !defined(TOR_INSTALLED)
|
||||
ui->checkBox_torManaged->setChecked(false);
|
||||
ui->checkBox_torManaged->setEnabled(false);
|
||||
ui->checkBox_torManaged->setToolTip("Feather was bundled without Tor");
|
||||
|
@ -69,7 +69,7 @@ NetworkProxyWidget::NetworkProxyWidget(QWidget *parent)
|
|||
|
||||
// [Show Tor logs]
|
||||
ui->frame_torShowLogs->setVisible(!conf()->get(Config::useLocalTor).toBool());
|
||||
#if !defined(HAS_TOR_BIN) && !defined(PLATFORM_INSTALLER)
|
||||
#if !defined(HAS_TOR_BIN) && !defined(TOR_INSTALLED)
|
||||
ui->frame_torShowLogs->setVisible(false);
|
||||
#endif
|
||||
connect(ui->btn_torShowLogs, &QPushButton::clicked, [this]{
|
||||
|
|
Loading…
Reference in a new issue