mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 11:39:25 +00:00
Fix issues mentioned by tobtoht
This commit is contained in:
parent
4b5800f0e5
commit
e705f433bc
19 changed files with 128 additions and 98 deletions
|
@ -21,11 +21,11 @@ cmake_policy(SET CMP0074 NEW)
|
||||||
option(STATIC "Link libraries statically, requires static Qt" OFF)
|
option(STATIC "Link libraries statically, requires static Qt" OFF)
|
||||||
option(SELF_CONTAINED "Disable when building Feather for packages" OFF)
|
option(SELF_CONTAINED "Disable when building Feather for packages" OFF)
|
||||||
option(TOR_DIR "Directory containing Tor binaries to embed inside Feather" OFF)
|
option(TOR_DIR "Directory containing Tor binaries to embed inside Feather" OFF)
|
||||||
option(CHECK_UPDATES "Enable checking for application updates" ON)
|
option(CHECK_UPDATES "Enable checking for application updates" OFF)
|
||||||
option(PLATFORM_INSTALLER "Built-in updater fetches installer (windows-only)" OFF)
|
option(PLATFORM_INSTALLER "Built-in updater fetches installer (windows-only)" OFF)
|
||||||
option(USE_DEVICE_TREZOR "Trezor support compilation" OFF)
|
option(USE_DEVICE_TREZOR "Trezor support compilation" ON)
|
||||||
option(DONATE_BEG "Prompt donation window every once in a while" OFF)
|
option(DONATE_BEG "Prompt donation window every once in a while" OFF)
|
||||||
option(WITH_SCANNER "Enable webcam QR scanner" OFF)
|
option(WITH_SCANNER "Enable webcam QR scanner" ON)
|
||||||
option(STACK_TRACE "Dump stack trace on crash (Linux only)" OFF)
|
option(STACK_TRACE "Dump stack trace on crash (Linux only)" OFF)
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
|
|
|
@ -5,15 +5,7 @@ $(package)_file_name=$(package)-$($(package)_version).tar.xz
|
||||||
$(package)_sha256_hash=f887755c434a736a609cbd28d87ddbfbe9d6a3bb5b703c22c02f6af80a802735
|
$(package)_sha256_hash=f887755c434a736a609cbd28d87ddbfbe9d6a3bb5b703c22c02f6af80a802735
|
||||||
|
|
||||||
define $(package)_config_cmds
|
define $(package)_config_cmds
|
||||||
CC="$($(package)_cc)" \
|
$($(package)_autoconf)
|
||||||
CXX="$($(package)_cxx)" \
|
|
||||||
AR="$($(package)_ar)" \
|
|
||||||
RANLIB="$($(package)_ranlib)" \
|
|
||||||
LIBTOOL="$($(package)_libtool)" \
|
|
||||||
LDLAGS="$($(package)_ldflags)" \
|
|
||||||
CFLAGS="-fPIE" \
|
|
||||||
CXXFLAGS="-fPIE" \
|
|
||||||
./configure --host=$(host) --enable-static --prefix=$(host_prefix) --without-iconv
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define $(package)_build_cmds
|
define $(package)_build_cmds
|
||||||
|
|
|
@ -18,3 +18,4 @@ qt_mingw32_packages := qt
|
||||||
|
|
||||||
tor_linux_packages := libevent tor_linux
|
tor_linux_packages := libevent tor_linux
|
||||||
tor_darwin_packages := tor_darwin
|
tor_darwin_packages := tor_darwin
|
||||||
|
tor_mingw32_packages := tor_mingw32
|
||||||
|
|
|
@ -304,8 +304,6 @@ chain for " target " development."))
|
||||||
python-minimal
|
python-minimal
|
||||||
;; Git
|
;; Git
|
||||||
git-minimal
|
git-minimal
|
||||||
;; Libarchive
|
|
||||||
libarchive
|
|
||||||
;; Xcb
|
;; Xcb
|
||||||
xcb-util
|
xcb-util
|
||||||
xcb-util-cursor
|
xcb-util-cursor
|
||||||
|
|
0
external/feather-docs
vendored
0
external/feather-docs
vendored
1
external/feather-docs
vendored
Submodule
1
external/feather-docs
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit c816c53f3a8a65fe0e823faa064bc11f025fd0de
|
|
@ -36,7 +36,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isPluginEnabled(const QString &id) {
|
bool isPluginEnabled(const QString &id) {
|
||||||
if (!pluginMap.contains(id) or (QString::compare(id,"atomic")==0 && constants::networkType==NetworkType::TESTNET)) {
|
if (!pluginMap.contains(id) || (QString::compare(id,"atomic")==0 && constants::networkType==NetworkType::TESTNET)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,18 +5,30 @@
|
||||||
#include "ui_AtomicConfigDialog.h"
|
#include "ui_AtomicConfigDialog.h"
|
||||||
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QDir>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include "utils/config.h"
|
||||||
|
#include "utils/Networking.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <zip.h>
|
#include <zip.h>
|
||||||
|
#define OS 1 // "WINDOWS"
|
||||||
#else
|
#else
|
||||||
#include <archive.h>
|
#include <archive.h>
|
||||||
#include <archive_entry.h>
|
#include <archive_entry.h>
|
||||||
|
#ifdef Q_PROCESSOR_X86_64
|
||||||
|
#define ARCH 1 // "x86_64"
|
||||||
|
#elifdef Q_PROCESSOR_ARM_V7
|
||||||
|
#define ARCH 2 // "armv7")
|
||||||
|
#else
|
||||||
|
#define ARCH 3 // "assumes aarch64 or unsupported"
|
||||||
|
#endif
|
||||||
|
#ifdef Q_OS_DARWIN
|
||||||
|
#define OS 2 // "MAC"
|
||||||
|
#else
|
||||||
|
#define OS 3 // "LINUX"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <QFileDialog>
|
|
||||||
|
|
||||||
#include "utils/config.h"
|
|
||||||
#include "utils/Networking.h"
|
|
||||||
|
|
||||||
AtomicConfigDialog::AtomicConfigDialog(QWidget *parent)
|
AtomicConfigDialog::AtomicConfigDialog(QWidget *parent)
|
||||||
: WindowModalDialog(parent)
|
: WindowModalDialog(parent)
|
||||||
|
@ -40,7 +52,7 @@ AtomicConfigDialog::AtomicConfigDialog(QWidget *parent)
|
||||||
QString path = QFileDialog::getOpenFileName(this, "Select swap binary file",
|
QString path = QFileDialog::getOpenFileName(this, "Select swap binary file",
|
||||||
Config::defaultConfigDir().absolutePath(),
|
Config::defaultConfigDir().absolutePath(),
|
||||||
"Binary Executable (*)");
|
"Binary Executable (*)");
|
||||||
Config::instance()->set(Config::swapPath, path);
|
saveSwapPath(path);
|
||||||
if(path.isEmpty()){
|
if(path.isEmpty()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -53,21 +65,50 @@ AtomicConfigDialog::AtomicConfigDialog(QWidget *parent)
|
||||||
this->adjustSize();
|
this->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AtomicConfigDialog::getPath() {
|
||||||
|
QFile* pathFile = new QFile(Config::defaultConfigDir().absolutePath() +"/swapPath.conf");
|
||||||
|
pathFile->open(QIODevice::ReadOnly);
|
||||||
|
QString toolPath = pathFile->readAll();
|
||||||
|
pathFile->close();
|
||||||
|
return toolPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AtomicConfigDialog::saveSwapPath(QString path) {
|
||||||
|
QFile* pathFile = new QFile(Config::defaultConfigDir().absolutePath() +"/swapPath.conf");
|
||||||
|
pathFile->open(QIODevice::WriteOnly);
|
||||||
|
pathFile->resize(0);
|
||||||
|
pathFile->write(path.toStdString().c_str());
|
||||||
|
pathFile->close();
|
||||||
|
}
|
||||||
void AtomicConfigDialog::downloadBinary() {
|
void AtomicConfigDialog::downloadBinary() {
|
||||||
auto* network = new Networking(this);
|
auto* network = new Networking(this);
|
||||||
download = new QTemporaryFile(this);
|
download = new QTemporaryFile(this);
|
||||||
download->open();
|
download->open();
|
||||||
tempFile = download->fileName();
|
tempFile = download->fileName();
|
||||||
QString url;
|
QString url;
|
||||||
auto operatingSystem = Config::instance()->get(Config::operatingSystem).toString().toStdString();
|
QString swapVersion = "0.13.4";
|
||||||
QString firstPart = "https://github.com/comit-network/xmr-btc-swap/releases/download/" + conf()->get(Config::swapVersion).toString();
|
QString firstPart = "https://github.com/UnstoppableSwap/core/releases/download/" + swapVersion;
|
||||||
if(strcmp("WIN",operatingSystem.c_str()) == 0) {
|
if(OS == 1) {
|
||||||
// HARD CODED DOWNload URL CHANGE IF PROBLEMS
|
// HARD CODED DOWNload URL CHANGE IF PROBLEMS
|
||||||
url = QString(firstPart+"/swap_"+conf()->get(Config::swapVersion).toString()+"_Windows_x86_64.zip");
|
url = QString(firstPart+"/swap_"+ swapVersion + "_Windows_x86_64.zip");
|
||||||
} else if (strcmp("LINUX",operatingSystem.c_str())==0){
|
} else if (OS == 3){
|
||||||
url = QString(firstPart+"/swap_"+conf()->get(Config::swapVersion).toString()+"_Linux_x86_64.tar");
|
if (ARCH == 1) {
|
||||||
|
url = QString(firstPart+"/swap_"+ swapVersion + "_Linux_x86_64.tar");
|
||||||
|
} else if (ARCH == 2) {
|
||||||
|
url = QString(firstPart+"/swap_"+ swapVersion + "_Linux_armv7.tar");
|
||||||
|
} else {
|
||||||
|
qDebug() << "Unsupported architecture";
|
||||||
|
throw std::runtime_error("Unsupported architecture");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
url = QString(firstPart + "/swap_" + conf()->get(Config::swapVersion).toString() + "_Darwin_x86_64.tar");
|
if (ARCH == 1) {
|
||||||
|
url = QString(firstPart + "/swap_"+ swapVersion + "_Darwin_x86_64.tar");
|
||||||
|
} else if (ARCH == 3) {
|
||||||
|
url = QString(firstPart + "/swap_"+ swapVersion + "_Darwin_aarch64.tar");
|
||||||
|
} else {
|
||||||
|
qDebug() << "Unsupported architecture";
|
||||||
|
throw std::runtime_error("Unsupported architecture");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
archive = network->get(this, url);
|
archive = network->get(this, url);
|
||||||
|
@ -88,7 +129,7 @@ void AtomicConfigDialog::extract() {
|
||||||
archive->deleteLater();
|
archive->deleteLater();
|
||||||
|
|
||||||
auto swapPath = Config::defaultConfigDir().absolutePath();
|
auto swapPath = Config::defaultConfigDir().absolutePath();
|
||||||
swapPath.append("/swapTool");
|
swapPath.append("/swap");
|
||||||
QFile binaryFile(swapPath);
|
QFile binaryFile(swapPath);
|
||||||
binaryFile.open(QIODevice::WriteOnly);
|
binaryFile.open(QIODevice::WriteOnly);
|
||||||
//auto operatingSystem = conf()->get(Config::operatingSystem).toString().toStdString();
|
//auto operatingSystem = conf()->get(Config::operatingSystem).toString().toStdString();
|
||||||
|
@ -116,7 +157,7 @@ void AtomicConfigDialog::extract() {
|
||||||
zip_fclose(f);
|
zip_fclose(f);
|
||||||
//And close the archive
|
//And close the archive
|
||||||
zip_close(z);
|
zip_close(z);
|
||||||
conf()->set(Config::swapPath,swapPath);
|
saveSwapPath(swapPath+".exe");
|
||||||
#else
|
#else
|
||||||
//} else {
|
//} else {
|
||||||
|
|
||||||
|
@ -147,7 +188,7 @@ void AtomicConfigDialog::extract() {
|
||||||
|
|
||||||
archive_write_close(ext);
|
archive_write_close(ext);
|
||||||
archive_write_free(ext);
|
archive_write_free(ext);
|
||||||
conf()->set(Config::swapPath, QString(savePath.c_str()));
|
saveSwapPath(swapPath);
|
||||||
#endif
|
#endif
|
||||||
//}
|
//}
|
||||||
qDebug() << "Finished";
|
qDebug() << "Finished";
|
||||||
|
|
|
@ -23,6 +23,7 @@ Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AtomicConfigDialog(QWidget *parent = nullptr);
|
explicit AtomicConfigDialog(QWidget *parent = nullptr);
|
||||||
~AtomicConfigDialog() override;
|
~AtomicConfigDialog() override;
|
||||||
|
static QString getPath();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void extract();
|
void extract();
|
||||||
|
@ -30,14 +31,11 @@ public slots:
|
||||||
private:
|
private:
|
||||||
void downloadBinary();
|
void downloadBinary();
|
||||||
int copy_data(struct archive *ar, struct archive *aw);
|
int copy_data(struct archive *ar, struct archive *aw);
|
||||||
|
void saveSwapPath(QString path);
|
||||||
QScopedPointer<Ui::AtomicConfigDialog> ui;
|
QScopedPointer<Ui::AtomicConfigDialog> ui;
|
||||||
|
QNetworkReply* archive = nullptr;
|
||||||
QNetworkReply* archive;
|
|
||||||
QString tempFile;
|
QString tempFile;
|
||||||
QTemporaryFile* download;
|
QTemporaryFile* download = nullptr;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
// Created by dev on 7/8/24.
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef FEATHER_ATOMICFUNDDIALOG_H
|
#ifndef FEATHER_ATOMICFUNDDIALOG_H
|
||||||
#define FEATHER_ATOMICFUNDDIALOG_H
|
#define FEATHER_ATOMICFUNDDIALOG_H
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
// Created by dev on 7/29/24.
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
||||||
//
|
|
||||||
|
|
||||||
// You may need to build the project (run Qt uic code generator) to get "ui_AtomicRecoverDialog.h" resolved
|
// You may need to build the project (run Qt uic code generator) to get "ui_AtomicRecoverDialog.h" resolved
|
||||||
|
|
||||||
|
@ -40,11 +39,11 @@ AtomicRecoverDialog::AtomicRecoverDialog(QWidget *parent) :
|
||||||
QDateTime timestamp = QDateTime::fromString(entry[1],"dd.MM.yyyy.hh.mm.ss");
|
QDateTime timestamp = QDateTime::fromString(entry[1],"dd.MM.yyyy.hh.mm.ss");
|
||||||
qint64 difference = timestamp.secsTo(QDateTime::currentDateTime());
|
qint64 difference = timestamp.secsTo(QDateTime::currentDateTime());
|
||||||
|
|
||||||
if (difference < 86400) {
|
if (difference < 86400) { // 86400 is number of seconds in a day (if a swap is older it is punished)
|
||||||
rowData.clear();
|
rowData.clear();
|
||||||
rowData << new QStandardItem(id);
|
rowData << new QStandardItem(id);
|
||||||
rowData << new QStandardItem(timestamp.toString("MM-dd-yyyy hh:mm"));
|
rowData << new QStandardItem(timestamp.toString("MM-dd-yyyy hh:mm"));
|
||||||
if (difference > 43200){
|
if (difference > 43200){ // 43200 is number of seconds in 12 hours
|
||||||
rowData << new QStandardItem("Refundable");
|
rowData << new QStandardItem("Refundable");
|
||||||
} else
|
} else
|
||||||
rowData << new QStandardItem("Recoverable/Pending Refund Timelock");
|
rowData << new QStandardItem("Recoverable/Pending Refund Timelock");
|
||||||
|
@ -73,7 +72,7 @@ AtomicRecoverDialog::AtomicRecoverDialog(QWidget *parent) :
|
||||||
arguments << "--swap-id";
|
arguments << "--swap-id";
|
||||||
auto row = ui->swap_history->selectionModel()->selectedRows().at(0);
|
auto row = ui->swap_history->selectionModel()->selectedRows().at(0);
|
||||||
arguments << row.sibling(row.row(),0).data().toString();
|
arguments << row.sibling(row.row(),0).data().toString();
|
||||||
if(conf()->get(Config::proxy).toInt() != Config::Proxy::None) {
|
if(conf()->get(Config::proxy).toInt() == Config::Proxy::Tor) {
|
||||||
arguments << "--tor-socks5-port";
|
arguments << "--tor-socks5-port";
|
||||||
arguments << conf()->get(Config::socks5Port).toString();
|
arguments << conf()->get(Config::socks5Port).toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
// Created by dev on 7/29/24.
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef FEATHER_ATOMICRECOVERDIALOG_H
|
#ifndef FEATHER_ATOMICRECOVERDIALOG_H
|
||||||
#define FEATHER_ATOMICRECOVERDIALOG_H
|
#define FEATHER_ATOMICRECOVERDIALOG_H
|
||||||
|
@ -25,8 +24,8 @@ public:
|
||||||
private slots:
|
private slots:
|
||||||
void updateBtn(const QModelIndex &index);
|
void updateBtn(const QModelIndex &index);
|
||||||
private:
|
private:
|
||||||
Ui::AtomicRecoverDialog *ui;
|
Ui::AtomicRecoverDialog *ui = nullptr;
|
||||||
AtomicSwap *swapDialog;
|
AtomicSwap *swapDialog = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
// Created by dev on 6/11/24.
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
||||||
//
|
|
||||||
|
|
||||||
// You may need to build the project (run Qt uic code generator) to get "ui_AtomicSwap.h" resolved
|
// You may need to build the project (run Qt uic code generator) to get "ui_AtomicSwap.h" resolved
|
||||||
|
|
||||||
|
@ -8,11 +7,17 @@
|
||||||
|
|
||||||
#include <QJsonParseError>
|
#include <QJsonParseError>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include "AtomicConfigDialog.h"
|
||||||
#include "ui_AtomicSwap.h"
|
#include "ui_AtomicSwap.h"
|
||||||
#include "AtomicWidget.h"
|
#include "AtomicWidget.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "networktype.h"
|
#include "networktype.h"
|
||||||
|
#ifdef QT_OS_WIN
|
||||||
|
#define WINDOWS 1
|
||||||
|
#else
|
||||||
|
#define WINDOWS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
AtomicSwap::AtomicSwap(QWidget *parent) :
|
AtomicSwap::AtomicSwap(QWidget *parent) :
|
||||||
WindowModalDialog(parent), ui(new Ui::AtomicSwap), fundDialog( new AtomicFundDialog(this)), procList(new QList<QSharedPointer<QProcess>>()) {
|
WindowModalDialog(parent), ui(new Ui::AtomicSwap), fundDialog( new AtomicFundDialog(this)), procList(new QList<QSharedPointer<QProcess>>()) {
|
||||||
|
@ -38,6 +43,13 @@ void AtomicSwap::runSwap(QStringList arguments){
|
||||||
QJsonParseError err;
|
QJsonParseError err;
|
||||||
const QByteArray& rawline = swap->readLine();
|
const QByteArray& rawline = swap->readLine();
|
||||||
QJsonDocument line = QJsonDocument::fromJson(rawline, &err);
|
QJsonDocument line = QJsonDocument::fromJson(rawline, &err);
|
||||||
|
if (err.error != QJsonParseError::NoError) {
|
||||||
|
qDebug()<<err.errorString();
|
||||||
|
QMessageBox::critical(this, "Swap Binary output error", "The swap binary did not output proper json.\nThe binary may be corrupted, throwing an unhandled error, or been overwritten.\nError string: " +err.errorString());
|
||||||
|
swap->close();
|
||||||
|
this->close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
qDebug() << rawline;
|
qDebug() << rawline;
|
||||||
bool check;
|
bool check;
|
||||||
QString message = line["fields"]["message"].toString();
|
QString message = line["fields"]["message"].toString();
|
||||||
|
@ -99,8 +111,7 @@ void AtomicSwap::runSwap(QStringList arguments){
|
||||||
QString err = line["fields"]["err"].toString().split("\n")[0].split(":")[1];
|
QString err = line["fields"]["err"].toString().split("\n")[0].split(":")[1];
|
||||||
QMessageBox::warning(this, "Cancel and Refund", "Time lock hasn't expired yet so cancel failed. Try again in " + err + "blocks");
|
QMessageBox::warning(this, "Cancel and Refund", "Time lock hasn't expired yet so cancel failed. Try again in " + err + "blocks");
|
||||||
} else if (QString latest_version = line["fields"]["latest_version"].toString(); !latest_version.isEmpty()){
|
} else if (QString latest_version = line["fields"]["latest_version"].toString(); !latest_version.isEmpty()){
|
||||||
QMessageBox::warning(this, "Outdated swap version","A newer version of COMIT xmr-btc swap tool is available, delete current binary and re auto install to upgrade");
|
QMessageBox::warning(this, "Outdated swap version","A newer version of COMIT xmr-btc swap tool is available");
|
||||||
conf()->set(Config::swapVersion,latest_version);
|
|
||||||
} else if (message.startsWith("Acquiring swap lock") && QString::compare("Resume",line["span"]["method_name"].toString())==0){
|
} else if (message.startsWith("Acquiring swap lock") && QString::compare("Resume",line["span"]["method_name"].toString())==0){
|
||||||
updateStatus("Beginning resumption of previous swap");
|
updateStatus("Beginning resumption of previous swap");
|
||||||
this->show();
|
this->show();
|
||||||
|
@ -110,14 +121,14 @@ void AtomicSwap::runSwap(QStringList arguments){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
swap->start(conf()->get(Config::swapPath).toString(),arguments);
|
swap->start(AtomicConfigDialog::getPath(),arguments);
|
||||||
qDebug() << "process started";
|
qDebug() << "process started";
|
||||||
}
|
}
|
||||||
AtomicSwap::~AtomicSwap() {
|
AtomicSwap::~AtomicSwap() {
|
||||||
for (const auto& proc : *procList){
|
for (const auto& proc : *procList){
|
||||||
proc->kill();
|
proc->kill();
|
||||||
}
|
}
|
||||||
if(conf()->get(Config::operatingSystem)=="WINDOWS"){
|
if(WINDOWS){
|
||||||
(new QProcess)->start("tskill", QStringList{"monero-wallet-rpc"});
|
(new QProcess)->start("tskill", QStringList{"monero-wallet-rpc"});
|
||||||
}else {
|
}else {
|
||||||
if (constants::networkType==NetworkType::STAGENET){
|
if (constants::networkType==NetworkType::STAGENET){
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
// Created by dev on 6/11/24.
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef FEATHER_ATOMICSWAP_H
|
#ifndef FEATHER_ATOMICSWAP_H
|
||||||
#define FEATHER_ATOMICSWAP_H
|
#define FEATHER_ATOMICSWAP_H
|
||||||
|
@ -32,11 +31,11 @@ public slots:
|
||||||
signals:
|
signals:
|
||||||
void cleanProcs();
|
void cleanProcs();
|
||||||
private:
|
private:
|
||||||
Ui::AtomicSwap *ui;
|
Ui::AtomicSwap *ui = nullptr;
|
||||||
QString id;
|
QString id;
|
||||||
QString min;
|
QString min;
|
||||||
AtomicFundDialog* fundDialog;
|
AtomicFundDialog* fundDialog;
|
||||||
QList<QSharedPointer<QProcess>>* procList;
|
QList<QSharedPointer<QProcess>>* procList = nullptr;
|
||||||
int btc_confs;
|
int btc_confs;
|
||||||
void cancel();
|
void cancel();
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,19 @@
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QJsonParseError>
|
#include <QJsonParseError>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
|
||||||
#include "AtomicConfigDialog.h"
|
#include "AtomicConfigDialog.h"
|
||||||
#include "OfferModel.h"
|
#include "OfferModel.h"
|
||||||
#include "utils/AppData.h"
|
#include "utils/AppData.h"
|
||||||
#include "utils/ColorScheme.h"
|
#include "utils/ColorScheme.h"
|
||||||
#include "utils/WebsocketNotifier.h"
|
#include "utils/WebsocketNotifier.h"
|
||||||
#include "AtomicFundDialog.h"
|
#include "AtomicFundDialog.h"
|
||||||
|
#include "WalletManager.h"
|
||||||
|
|
||||||
|
#ifdef QT_OS_WIN
|
||||||
|
#define WINDOWS 1
|
||||||
|
#else
|
||||||
|
#define WINDOWS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
AtomicWidget::AtomicWidget(QWidget *parent)
|
AtomicWidget::AtomicWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
@ -76,14 +82,12 @@ AtomicWidget::AtomicWidget(QWidget *parent)
|
||||||
QMessageBox::warning(this, "Warning", "XMR receive address is required to start swap");
|
QMessageBox::warning(this, "Warning", "XMR receive address is required to start swap");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QRegularExpression xmrMain("^[48][0-9AB][1-9A-HJ-NP-Za-km-z]{93}");
|
|
||||||
QRegularExpression xmrStage("^[57][0-9AB][1-9A-HJ-NP-Za-km-z]{93}");
|
|
||||||
if (constants::networkType==NetworkType::STAGENET){
|
if (constants::networkType==NetworkType::STAGENET){
|
||||||
if(!btcChange.isEmpty() && !btcTest.match(btcChange).hasMatch()){
|
if(!btcChange.isEmpty() && !btcTest.match(btcChange).hasMatch()){
|
||||||
QMessageBox::warning(this, "Warning","BTC change address is wrong, not a bech32 segwit address, or on wrong network");
|
QMessageBox::warning(this, "Warning","BTC change address is wrong, not a bech32 segwit address, or on wrong network");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!xmrStage.match(xmrReceive).hasMatch()){
|
if(WalletManager::addressValid(xmrReceive,NetworkType::STAGENET)){
|
||||||
QMessageBox::warning(this, "Warning","XMR receive address is improperly formated or on wrong network");
|
QMessageBox::warning(this, "Warning","XMR receive address is improperly formated or on wrong network");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +96,7 @@ AtomicWidget::AtomicWidget(QWidget *parent)
|
||||||
QMessageBox::warning(this, "Warning","BTC change address is wrong, not a bech32 segwit address,or on wrong network");
|
QMessageBox::warning(this, "Warning","BTC change address is wrong, not a bech32 segwit address,or on wrong network");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!xmrMain.match(xmrReceive).hasMatch()){
|
if(WalletManager::addressValid(xmrReceive,NetworkType::MAINNET)){
|
||||||
QMessageBox::warning(this, "Warning","XMR receive address is improperly formated or on wrong network");
|
QMessageBox::warning(this, "Warning","XMR receive address is improperly formated or on wrong network");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +168,7 @@ void AtomicWidget::runSwap(const QString& seller, const QString& btcChange, cons
|
||||||
*/
|
*/
|
||||||
arguments << "--seller";
|
arguments << "--seller";
|
||||||
arguments << seller;
|
arguments << seller;
|
||||||
if(conf()->get(Config::proxy).toInt() != Config::Proxy::None) {
|
if(conf()->get(Config::proxy).toInt() == Config::Proxy::Tor) {
|
||||||
arguments << "--tor-socks5-port";
|
arguments << "--tor-socks5-port";
|
||||||
arguments << conf()->get(Config::socks5Port).toString();
|
arguments << conf()->get(Config::socks5Port).toString();
|
||||||
}
|
}
|
||||||
|
@ -183,7 +187,7 @@ void AtomicWidget::list(const QString& rendezvous) {
|
||||||
arguments << "-j";
|
arguments << "-j";
|
||||||
arguments << "list-sellers";
|
arguments << "list-sellers";
|
||||||
//Temporary fix till comit xmr btc updates libp2p to work with modern rendezvous points
|
//Temporary fix till comit xmr btc updates libp2p to work with modern rendezvous points
|
||||||
if(!ui->btn_clearnet->isChecked() && conf()->get(Config::proxy).toInt() != Config::Proxy::None) {
|
if(!ui->btn_clearnet->isChecked() && conf()->get(Config::proxy).toInt() == Config::Proxy::Tor) {
|
||||||
arguments << "--tor-socks5-port";
|
arguments << "--tor-socks5-port";
|
||||||
arguments << conf()->get(Config::socks5Port).toString();
|
arguments << conf()->get(Config::socks5Port).toString();
|
||||||
} else if (ui->btn_clearnet->isChecked()) {
|
} else if (ui->btn_clearnet->isChecked()) {
|
||||||
|
@ -229,7 +233,7 @@ void AtomicWidget::list(const QString& rendezvous) {
|
||||||
o_model->updateOffers(*offerList);
|
o_model->updateOffers(*offerList);
|
||||||
return list;
|
return list;
|
||||||
});
|
});
|
||||||
swap->start(conf()->get(Config::swapPath).toString(), arguments);
|
swap->start(AtomicConfigDialog::getPath(), arguments);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,7 +254,7 @@ void AtomicWidget::clean() {
|
||||||
}
|
}
|
||||||
auto cleanWallet = new QProcess;
|
auto cleanWallet = new QProcess;
|
||||||
auto cleanSwap = new QProcess;
|
auto cleanSwap = new QProcess;
|
||||||
if(conf()->get(Config::operatingSystem)=="WINDOWS"){
|
if(WINDOWS){
|
||||||
(cleanWallet)->start("tskill", QStringList{"monero-wallet-rpc"});
|
(cleanWallet)->start("tskill", QStringList{"monero-wallet-rpc"});
|
||||||
(cleanWallet)->start("tskill", QStringList{"swap"});
|
(cleanWallet)->start("tskill", QStringList{"swap"});
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -41,13 +41,13 @@ private:
|
||||||
QScopedPointer<Ui::AtomicWidget> ui;
|
QScopedPointer<Ui::AtomicWidget> ui;
|
||||||
bool m_comboBoxInit = false;
|
bool m_comboBoxInit = false;
|
||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
OfferModel *o_model;
|
OfferModel *o_model = nullptr;
|
||||||
QList<QSharedPointer<OfferEntry>> *offerList;
|
QList<QSharedPointer<OfferEntry>> *offerList = nullptr;
|
||||||
AtomicSwap *swapDialog;
|
AtomicSwap *swapDialog = nullptr;
|
||||||
AtomicFundDialog *fundDialog;
|
AtomicFundDialog *fundDialog = nullptr;
|
||||||
AtomicRecoverDialog *recoverDialog;
|
AtomicRecoverDialog *recoverDialog = nullptr;
|
||||||
|
|
||||||
QList<QSharedPointer<QProcess>> *procList;
|
QList<QSharedPointer<QProcess>> *procList = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FEATHER_ATOMICWIDGET_H
|
#endif // FEATHER_ATOMICWIDGET_H
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
// Created by dev on 5/23/24.
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef FEATHER_OFFER_H
|
#ifndef FEATHER_OFFER_H
|
||||||
#define FEATHER_OFFER_H
|
#define FEATHER_OFFER_H
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
// Created by dev on 5/23/24.
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
||||||
//
|
|
||||||
|
|
||||||
#include "OfferModel.h"
|
#include "OfferModel.h"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
// Created by dev on 5/23/24.
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef FEATHER_OFFERMODEL_H
|
#ifndef FEATHER_OFFERMODEL_H
|
||||||
#define FEATHER_OFFERMODEL_H
|
#define FEATHER_OFFERMODEL_H
|
||||||
|
|
|
@ -12,13 +12,7 @@
|
||||||
#include "utils/os/tails.h"
|
#include "utils/os/tails.h"
|
||||||
|
|
||||||
#define QS QStringLiteral
|
#define QS QStringLiteral
|
||||||
#if defined(Q_OS_WIN64)
|
|
||||||
#define OS "WINDOWS"
|
|
||||||
#elif defined(Q_OS_DARWIN)
|
|
||||||
#define OS "MAC"
|
|
||||||
#else
|
|
||||||
#define OS "LINUX"
|
|
||||||
#endif
|
|
||||||
struct ConfigDirective
|
struct ConfigDirective
|
||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -150,10 +144,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
||||||
{Config::rendezVous, {QS("rendezVous"), QStringList{"/dns4/atomicswaps.majesticbank.at/tcp/8888/p2p/12D3KooWKJUwP45K7fLbwGY1VM5V3U7LseU8EwJiAozUFrq5ihoF",
|
{Config::rendezVous, {QS("rendezVous"), QStringList{"/dns4/atomicswaps.majesticbank.at/tcp/8888/p2p/12D3KooWKJUwP45K7fLbwGY1VM5V3U7LseU8EwJiAozUFrq5ihoF",
|
||||||
"/dns4/discover.unstoppableswap.net/tcp/8888/p2p/12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE",
|
"/dns4/discover.unstoppableswap.net/tcp/8888/p2p/12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE",
|
||||||
"/dns4/eratosthen.es/tcp/7798/p2p/12D3KooWAh7EXXa2ZyegzLGdjvj1W4G3EXrTGrf6trraoT1MEobs"}}},
|
"/dns4/eratosthen.es/tcp/7798/p2p/12D3KooWAh7EXXa2ZyegzLGdjvj1W4G3EXrTGrf6trraoT1MEobs"}}},
|
||||||
{Config::swapPath, {QS("swapPath"), ""}},
|
|
||||||
{Config::operatingSystem, {QS("operatingSystem"), OS}},
|
|
||||||
{Config::pendingSwap, {QS("pendingSwap"), QStringList{}}},
|
{Config::pendingSwap, {QS("pendingSwap"), QStringList{}}},
|
||||||
{Config::swapVersion, {QS("swapVersion"), "0.13.4"}},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue