Fixes for Issues #1,#2,#3 and additionally fixes CMakeLists allow non guix builds.

This commit is contained in:
twiddle 2024-09-11 16:13:09 -04:00
parent f4d27d56d4
commit a530b1ca81
5 changed files with 24 additions and 10 deletions

View file

@ -16,12 +16,12 @@ set(COPYRIGHT_YEAR "2024")
set(COPYRIGHT_HOLDERS "The Monero Project")
# Configurable options
option(STATIC "Link libraries statically, requires static Qt" ON)
option(STATIC "Link libraries statically, requires static Qt" OFF)
option(SELF_CONTAINED "Disable when building Feather for packages" OFF)
option(TOR_DIR "Directory containing Tor binaries to embed inside Feather" OFF)
option(CHECK_UPDATES "Enable checking for application updates" ON)
option(PLATFORM_INSTALLER "Built-in updater fetches installer (windows-only)" OFF)
option(USE_DEVICE_TREZOR "Trezor support compilation" ON)
option(USE_DEVICE_TREZOR "Trezor support compilation" OFF)
option(DONATE_BEG "Prompt donation window every once in a while" OFF)
option(WITH_SCANNER "Enable webcam QR scanner" OFF)
option(STACK_TRACE "Dump stack trace on crash (Linux only)" OFF)

View file

@ -302,7 +302,7 @@ if (WITH_SCANNER)
endif()
if (WITH_PLUGIN_ATOMIC)
#FIND_PACKAGE(LibArchive REQUIRED)
FIND_PACKAGE(LibArchive REQUIRED)
INCLUDE_DIRECTORIES(${LibArchive_INCLUDE_DIR})
target_link_libraries(feather PRIVATE ${LibArchive_LIBRARIES})
endif()

View file

@ -136,7 +136,6 @@ void AtomicConfigDialog::extract() {
if (r == ARCHIVE_EOF)
break;
savePath = Config::defaultConfigDir().absolutePath().toStdString().append("/").append(archive_entry_pathname(entry));
qDebug() << savePath;
archive_entry_set_pathname(entry, savePath.c_str());
r = archive_write_header(ext, entry);
copy_data(a, ext);

View file

@ -114,7 +114,6 @@ void AtomicSwap::runSwap(QStringList arguments){
qDebug() << "process started";
}
AtomicSwap::~AtomicSwap() {
delete ui;
for (const auto& proc : *procList){
proc->kill();
}

View file

@ -132,6 +132,7 @@ void AtomicWidget::showAtomicConfigureDialog() {
void AtomicWidget::runSwap(const QString& seller, const QString& btcChange, const QString& xmrReceive) {
qDebug() << "starting swap";
clean();
QStringList arguments;
arguments << "--data-base-dir";
arguments << Config::defaultConfigDir().absolutePath();
@ -173,6 +174,7 @@ void AtomicWidget::list(const QString& rendezvous) {
QStringList arguments;
arguments << "--data-base-dir";
arguments << Config::defaultConfigDir().absolutePath();
arguments << "--debug";
if (constants::networkType==NetworkType::STAGENET){
arguments << "--testnet";
}
@ -184,6 +186,7 @@ void AtomicWidget::list(const QString& rendezvous) {
}
arguments << "--rendezvous-point";
arguments << rendezvous;
qDebug() << "rendezvous point: " + rendezvous;
auto *swap = new QProcess();
procList->append(QSharedPointer<QProcess>(swap));
swap->setReadChannel(QProcess::StandardError);
@ -196,13 +199,14 @@ void AtomicWidget::list(const QString& rendezvous) {
for(const auto& line : lines){
qDebug() << line;
if(line.contains("status")){
parsedLine = QJsonDocument::fromJson(line.toLocal8Bit(), &parseError );
if (parsedLine["fields"]["status"].toString().contains("Online")){
bool skip = false;
auto entry = new OfferEntry(parsedLine["fields"]["price"].toString().split( ' ')[0].toDouble(),parsedLine["fields"]["min_quantity"].toString().split(' ')[0].toDouble(),parsedLine["fields"]["max_quantity"].toString().split(' ')[0].toDouble(), parsedLine["fields"]["address"].toString());
for(const auto& post : *offerList){
if(std::equal(entry->address.begin(), entry->address.end(),post->address.begin(),post->address.end()))
if(entry->max == 0 || std::equal(entry->address.begin(), entry->address.end(),post->address.begin(),post->address.end()))
skip = true;
}
if (!skip) {
@ -210,6 +214,9 @@ void AtomicWidget::list(const QString& rendezvous) {
offerList->append(QSharedPointer<OfferEntry>(entry));
}
}
} else if (line.contains("GLIBC_")){
QMessageBox::critical(this, "GLIBC outdated", "Upgrade your GLIBC to at least 2.32 to use this tool");
clean();
}
}
swap->close();
@ -233,18 +240,27 @@ AtomicWidget::~AtomicWidget() {
void AtomicWidget::clean() {
for (const auto& proc : *procList){
proc->kill();
proc->kill();
}
auto cleanWallet = new QProcess;
auto cleanSwap = new QProcess;
if(conf()->get(Config::operatingSystem)=="WINDOWS"){
(new QProcess)->start("tskill", QStringList{"monero-wallet-rpc"});
(cleanWallet)->start("tskill", QStringList{"monero-wallet-rpc"});
(cleanWallet)->start("tskill", QStringList{"swap"});
}else {
if (constants::networkType==NetworkType::STAGENET){
(new QProcess)->start("pkill", QStringList{"-f", Config::defaultConfigDir().absolutePath() +"/testnet/monero/monero-wallet-rpc"});
(cleanWallet)->start("pkill", QStringList{"-f", Config::defaultConfigDir().absolutePath() +"/testnet/monero/monero-wallet-rpc"});
(cleanSwap)->start("pkill", QStringList{"-f", Config::defaultConfigDir().absolutePath() +
"/*"});
} else {
(new QProcess)->start("pkill", QStringList{"-f", Config::defaultConfigDir().absolutePath() +
(cleanWallet)->start("pkill", QStringList{"-f", Config::defaultConfigDir().absolutePath() +
"/mainnet/monero/monero-wallet-rpc"});
(cleanSwap)->start("pkill", QStringList{"-f", Config::defaultConfigDir().absolutePath() +
"/*"});
}
}
cleanWallet->waitForFinished();
cleanSwap->waitForFinished();
}