mirror of
https://git.wownero.com/wowlet/wowlet.git
synced 2024-08-15 01:03:14 +00:00
Merge pull request 'Xmrig: add support for TLS. Tor default off. Save username/password in wallet cache.' (#85) from dsc/feather:xmrig-tab-2 into master
Reviewed-on: https://git.wownero.com/feather/feather/pulls/85
This commit is contained in:
commit
5d8700370b
9 changed files with 185 additions and 99 deletions
|
@ -12,7 +12,6 @@
|
|||
#include "mainwindow.h"
|
||||
#include "widgets/ccswidget.h"
|
||||
#include "widgets/redditwidget.h"
|
||||
#include "widgets/xmrigwidget.h"
|
||||
#include "dialog/txconfdialog.h"
|
||||
#include "dialog/debuginfodialog.h"
|
||||
#include "dialog/walletinfodialog.h"
|
||||
|
@ -168,11 +167,13 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
|
|||
connect(m_ctx->nodes, &Nodes::WSNodeExhausted, this, &MainWindow::showWSNodeExhaustedMessage);
|
||||
|
||||
// XMRig
|
||||
connect(m_ctx, &AppContext::XMRigDownloads, ui->xmrigWidget, &XMRigWidget::onDownloads);
|
||||
connect(m_ctx, &AppContext::walletClosed, ui->xmrigWidget, &XMRigWidget::onStopClicked);
|
||||
connect(m_ctx, &AppContext::walletClosed, ui->xmrigWidget, &XMRigWidget::onClearClicked);
|
||||
connect(ui->xmrigWidget, &XMRigWidget::miningStarted, [=]{ m_ctx->setWindowTitle(true); });
|
||||
connect(ui->xmrigWidget, &XMRigWidget::miningEnded, [=]{ m_ctx->setWindowTitle(false); });
|
||||
m_xmrig = new XMRigWidget(m_ctx, this);
|
||||
ui->xmrRigLayout->addWidget(m_xmrig);
|
||||
connect(m_ctx, &AppContext::walletOpened, m_xmrig, &XMRigWidget::onWalletOpened);
|
||||
connect(m_ctx, &AppContext::XMRigDownloads, m_xmrig, &XMRigWidget::onDownloads);
|
||||
connect(m_ctx, &AppContext::walletClosed, m_xmrig, &XMRigWidget::onWalletClosed);
|
||||
connect(m_xmrig, &XMRigWidget::miningStarted, [=]{ m_ctx->setWindowTitle(true); });
|
||||
connect(m_xmrig, &XMRigWidget::miningEnded, [=]{ m_ctx->setWindowTitle(false); });
|
||||
|
||||
// CCS/Reddit widget
|
||||
m_ccsWidget = new CCSWidget(this);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "widgets/ccswidget.h"
|
||||
#include "widgets/redditwidget.h"
|
||||
#include "widgets/tickerwidget.h"
|
||||
#include "widgets/xmrigwidget.h"
|
||||
#include "utils/networking.h"
|
||||
#include "appcontext.h"
|
||||
#include "utils/config.h"
|
||||
|
@ -144,6 +145,7 @@ private:
|
|||
SignVerifyDialog *m_windowSignVerify = nullptr;
|
||||
RestoreDialog *m_restoreDialog = nullptr;
|
||||
AboutDialog *m_aboutDialog = nullptr;
|
||||
XMRigWidget *m_xmrig = nullptr;
|
||||
|
||||
bool m_windowSpawned = false;
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@
|
|||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="XMRigWidget" name="xmrigWidget" native="true"/>
|
||||
<layout class="QGridLayout" name="xmrRigLayout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -305,7 +305,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>894</width>
|
||||
<height>30</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
@ -655,12 +655,6 @@
|
|||
<header>calcwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>XMRigWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/xmrigwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="assets.qrc"/>
|
||||
|
|
|
@ -35,7 +35,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
|||
{Config::autoOpenWalletPath,{QS("autoOpenWalletPath"), ""}},
|
||||
{Config::walletPath,{QS("walletPath"), ""}},
|
||||
{Config::xmrigPath,{QS("xmrigPath"), ""}},
|
||||
{Config::xmrigPool,{QS("xmrigPool"), "pool.xmr.pt:5555"}},
|
||||
{Config::xmrigPool,{QS("xmrigPool"), "pool.xmr.pt:9000"}},
|
||||
{Config::nodes,{QS("nodes"), "{}"}},
|
||||
{Config::websocketEnabled,{QS("websocketEnabled"), true}},
|
||||
{Config::nodeSource,{QS("nodeSource"), 0}},
|
||||
|
|
|
@ -33,7 +33,11 @@ void XMRig::terminate() {
|
|||
m_process.terminate();
|
||||
}
|
||||
|
||||
void XMRig::start(unsigned int threads, const QString &pool_name, const QString &receiving_address, bool tor) {
|
||||
void XMRig::start(unsigned int threads,
|
||||
const QString &pool_name,
|
||||
const QString &username,
|
||||
const QString &password,
|
||||
bool tor, bool tls) {
|
||||
auto state = m_process.state();
|
||||
if (state == QProcess::ProcessState::Running || state == QProcess::ProcessState::Starting) {
|
||||
emit error("Can't start XMRig, already running or starting");
|
||||
|
@ -54,12 +58,14 @@ void XMRig::start(unsigned int threads, const QString &pool_name, const QString
|
|||
QStringList arguments;
|
||||
arguments << "-o" << pool_name;
|
||||
arguments << "-a" << "rx/0";
|
||||
arguments << "-u" << receiving_address;
|
||||
arguments << "-p" << "featherwallet";
|
||||
arguments << "-u" << username;
|
||||
arguments << "-p" << password;
|
||||
arguments << "--no-color";
|
||||
arguments << "-t" << QString::number(threads);
|
||||
if(tor)
|
||||
arguments << "-x" << QString("%1:%2").arg(Tor::torHost).arg(Tor::torPort);
|
||||
if(tls)
|
||||
arguments << "--tls";
|
||||
|
||||
QString cmd = QString("%1 %2").arg(path, arguments.join(" "));
|
||||
emit output(cmd.toUtf8());
|
||||
|
|
|
@ -22,7 +22,7 @@ Q_OBJECT
|
|||
public:
|
||||
explicit XMRig(QObject *parent = nullptr);
|
||||
|
||||
void start(unsigned int threads, const QString &pool_name, const QString &receiving_address, bool tor = false);
|
||||
void start(unsigned int threads, const QString &pool_name, const QString &username, const QString &password, bool tor = false, bool tls = true);
|
||||
void stop();
|
||||
void terminate();
|
||||
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
#include "ui_xmrigwidget.h"
|
||||
#include "utils/utils.h"
|
||||
|
||||
XMRigWidget::XMRigWidget(QWidget *parent) :
|
||||
XMRigWidget::XMRigWidget(AppContext *ctx, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::XMRigWidget),
|
||||
m_ctx(ctx),
|
||||
m_model(new QStandardItemModel(this)),
|
||||
m_contextMenu(new QMenu(this))
|
||||
{
|
||||
|
@ -56,8 +57,10 @@ XMRigWidget::XMRigWidget(QWidget *parent) :
|
|||
// defaults
|
||||
ui->btn_stop->setEnabled(false);
|
||||
ui->check_autoscroll->setChecked(true);
|
||||
ui->relayTor->setChecked(true);
|
||||
ui->relayTor->setChecked(false);
|
||||
ui->check_tls->setChecked(true);
|
||||
ui->label_status->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
|
||||
// XMRig binary
|
||||
auto path = config()->get(Config::xmrigPath).toString();
|
||||
ui->lineEdit_path->setText(path);
|
||||
|
@ -79,6 +82,40 @@ XMRigWidget::XMRigWidget(QWidget *parent) :
|
|||
else
|
||||
ui->console->appendPlainText(QString("XMRig path set to %1").arg(path));
|
||||
ui->console->appendPlainText("Ready to mine.");
|
||||
|
||||
// username/password
|
||||
connect(ui->lineEdit_password, &QLineEdit::editingFinished, [=]() {
|
||||
m_ctx->currentWallet->setCacheAttribute("feather.xmrig_password", ui->lineEdit_password->text());
|
||||
m_ctx->currentWallet->store();
|
||||
});
|
||||
|
||||
connect(ui->lineEdit_address, &QLineEdit::editingFinished, [=]() {
|
||||
m_ctx->currentWallet->setCacheAttribute("feather.xmrig_username", ui->lineEdit_address->text());
|
||||
m_ctx->currentWallet->store();
|
||||
});
|
||||
}
|
||||
|
||||
void XMRigWidget::onWalletClosed() {
|
||||
this->onStopClicked();
|
||||
this->onClearClicked();
|
||||
ui->lineEdit_password->setText("");
|
||||
ui->lineEdit_address->setText("");
|
||||
}
|
||||
|
||||
void XMRigWidget::onWalletOpened(){
|
||||
// Xmrig username
|
||||
auto username = m_ctx->currentWallet->getCacheAttribute("feather.xmrig_username");
|
||||
if(!username.isEmpty())
|
||||
ui->lineEdit_address->setText(username);
|
||||
|
||||
// Xmrig passwd
|
||||
auto password = m_ctx->currentWallet->getCacheAttribute("feather.xmrig_password");
|
||||
if(!password.isEmpty()) {
|
||||
ui->lineEdit_password->setText(password);
|
||||
} else {
|
||||
ui->lineEdit_password->setText("featherwallet");
|
||||
m_ctx->currentWallet->setCacheAttribute("feather.xmrig_password", ui->lineEdit_password->text());
|
||||
}
|
||||
}
|
||||
|
||||
void XMRigWidget::onThreadsValueChanged(int threads) {
|
||||
|
@ -104,13 +141,22 @@ void XMRigWidget::onClearClicked() {
|
|||
|
||||
void XMRigWidget::onStartClicked() {
|
||||
auto pool_name = config()->get(Config::xmrigPool).toString();
|
||||
auto addy = ui->lineEdit_address->text();
|
||||
if(addy.isEmpty()) {
|
||||
|
||||
// fix error in config
|
||||
if(!m_pools.contains(pool_name)) {
|
||||
pool_name = m_pools.at(0);
|
||||
config()->set(Config::xmrigPool, pool_name);
|
||||
}
|
||||
|
||||
auto username = m_ctx->currentWallet->getCacheAttribute("feather.xmrig_username");
|
||||
auto password = m_ctx->currentWallet->getCacheAttribute("feather.xmrig_password");
|
||||
|
||||
if(username.isEmpty()) {
|
||||
Utils::showMessageBox("Error", "Please specify a receiving address on the Settings screen", true);
|
||||
return;
|
||||
}
|
||||
|
||||
m_rig->start(m_threads, pool_name, addy, ui->relayTor->isChecked());
|
||||
m_rig->start(m_threads, pool_name, username, password, ui->relayTor->isChecked(), ui->check_tls->isChecked());
|
||||
ui->btn_start->setEnabled(false);
|
||||
ui->btn_stop->setEnabled(true);
|
||||
emit miningStarted();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "utils/xmrig.h"
|
||||
#include "utils/config.h"
|
||||
#include "appcontext.h"
|
||||
|
||||
namespace Ui {
|
||||
class XMRigWidget;
|
||||
|
@ -20,11 +21,13 @@ class XMRigWidget : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit XMRigWidget(QWidget *parent = nullptr);
|
||||
explicit XMRigWidget(AppContext *ctx, QWidget *parent = nullptr);
|
||||
~XMRigWidget();
|
||||
QStandardItemModel *model();
|
||||
|
||||
public slots:
|
||||
void onWalletClosed();
|
||||
void onWalletOpened();
|
||||
void onStartClicked();
|
||||
void onStopClicked();
|
||||
void onClearClicked();
|
||||
|
@ -46,12 +49,13 @@ signals:
|
|||
private:
|
||||
void showContextMenu(const QPoint &pos);
|
||||
|
||||
AppContext *m_ctx;
|
||||
Ui::XMRigWidget *ui;
|
||||
QStandardItemModel *m_model;
|
||||
QMenu *m_contextMenu;
|
||||
unsigned int m_threads;
|
||||
QStringList m_urls;
|
||||
QStringList m_pools{"pool.xmr.pt:5555", "pool.supportxmr.com:3333", "mine.xmrpool.net:3333", "xmrpool.eu:5555", "xmr-eu1.nanopool.org:14444", "pool.minexmr.com:4444", "monerohash.com:2222"};
|
||||
QStringList m_pools{"pool.xmr.pt:9000", "pool.supportxmr.com:9000", "mine.xmrpool.net:443", "xmrpool.eu:9999", "xmr-eu1.nanopool.org:14433", "pool.minexmr.com:6666", "us-west.minexmr.com:6666", "monerohash.com:9999"};
|
||||
XMRig *m_rig;
|
||||
};
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
<attribute name="title">
|
||||
<string>Settings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
|
@ -151,6 +151,111 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Pool</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QComboBox" name="combo_pools">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="check_tls">
|
||||
<property name="text">
|
||||
<string>TLS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="relayTor">
|
||||
<property name="text">
|
||||
<string>Tor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_threads">
|
||||
<property name="text">
|
||||
<string>Threads: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QSlider" name="threadSlider">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Pool worker name (optional)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_password"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
|
@ -161,78 +266,6 @@
|
|||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_address"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_threads">
|
||||
<property name="text">
|
||||
<string>Threads: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QSlider" name="threadSlider">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Pool</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QComboBox" name="combo_pools">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="relayTor">
|
||||
<property name="text">
|
||||
<string>Relay over Tor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Loading…
Reference in a new issue