forked from Public/monero-gui
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c092de97f2 | ||
|
|
c84a8fb07d | ||
|
|
63b4566475 | ||
|
|
3699dc9f2e | ||
|
|
eee48ce74c | ||
|
|
9072f89a4e | ||
|
|
c9e461dcb6 | ||
|
|
55b548f31c | ||
|
|
b739cdd52a | ||
|
|
94a27b964a | ||
|
|
c7df74dab7 | ||
|
|
bf9b04b126 |
@@ -384,13 +384,22 @@ if (noexecheap_SUPPORTED)
|
|||||||
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecheap")
|
set(LD_SECURITY_FLAGS "${LD_SECURITY_FLAGS} -Wl,-z,noexecheap")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(STATIC)
|
||||||
|
if(MINGW)
|
||||||
|
add_linker_flag_if_supported(-static STATIC_FLAGS)
|
||||||
|
else()
|
||||||
|
add_linker_flag_if_supported(-static-libgcc STATIC_FLAGS)
|
||||||
|
add_linker_flag_if_supported(-static-libstdc++ STATIC_FLAGS)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
message(STATUS "Using C security hardening flags: ${C_SECURITY_FLAGS}")
|
message(STATUS "Using C security hardening flags: ${C_SECURITY_FLAGS}")
|
||||||
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
|
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
|
||||||
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
|
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_SECURITY_FLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_SECURITY_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_SECURITY_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_SECURITY_FLAGS}")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS}")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${STATIC_FLAGS}")
|
||||||
|
|
||||||
if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
|
if (HIDAPI_FOUND OR LibUSB_COMPILE_TEST_PASSED)
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
|||||||
31
README.md
31
README.md
@@ -84,7 +84,7 @@ Packaging for your favorite distribution would be a welcome contribution!
|
|||||||
|
|
||||||
- For Debian distributions (Debian, Ubuntu, Mint, Tails...)
|
- For Debian distributions (Debian, Ubuntu, Mint, Tails...)
|
||||||
|
|
||||||
`sudo apt install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev`
|
`sudo apt install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev libprotobuf-dev protobuf-compiler`
|
||||||
|
|
||||||
- For Gentoo
|
- For Gentoo
|
||||||
|
|
||||||
@@ -144,26 +144,12 @@ The executable can be found in the build/release/bin folder.
|
|||||||
|
|
||||||
3. Install [monero](https://github.com/monero-project/monero) dependencies:
|
3. Install [monero](https://github.com/monero-project/monero) dependencies:
|
||||||
|
|
||||||
`brew install boost`
|
`brew install boost hidapi zmq libpgm miniupnpc ldns expat libunwind-headers protobuf`
|
||||||
|
|
||||||
`brew install openssl` - to install openssl headers
|
|
||||||
|
|
||||||
`brew install pkgconfig`
|
|
||||||
|
|
||||||
`brew install cmake`
|
|
||||||
|
|
||||||
`brew install zeromq`
|
|
||||||
|
|
||||||
*Note*: If cmake can not find zmq.hpp file on OS X, installing `zmq.hpp` from https://github.com/zeromq/cppzmq to `/usr/local/include` should fix that error.
|
|
||||||
|
|
||||||
4. Install Qt:
|
4. Install Qt:
|
||||||
|
|
||||||
`brew install qt5` (or download QT 5.9.7+ from [qt.io](https://www.qt.io/download-open-source/))
|
`brew install qt5` (or download QT 5.9.7+ from [qt.io](https://www.qt.io/download-open-source/))
|
||||||
|
|
||||||
If you have an older version of Qt installed via homebrew, you can force it to use 5.x like so:
|
|
||||||
|
|
||||||
`brew link --force --overwrite qt5`
|
|
||||||
|
|
||||||
5. Add the Qt bin directory to your path
|
5. Add the Qt bin directory to your path
|
||||||
|
|
||||||
- Example for Qt: `export PATH=$PATH:$HOME/Qt/5.9.7/clang_64/bin`
|
- Example for Qt: `export PATH=$PATH:$HOME/Qt/5.9.7/clang_64/bin`
|
||||||
@@ -183,19 +169,6 @@ The executable can be found in the build/release/bin folder.
|
|||||||
|
|
||||||
The executable can be found in the `build/release/bin` folder.
|
The executable can be found in the `build/release/bin` folder.
|
||||||
|
|
||||||
**Note:** Workaround for "ERROR: Xcode not set up properly"
|
|
||||||
|
|
||||||
Edit `$HOME/Qt/5.9.7/clang_64/mkspecs/features/mac/default_pre.prf`
|
|
||||||
|
|
||||||
replace
|
|
||||||
`isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))`
|
|
||||||
|
|
||||||
with
|
|
||||||
`isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))`
|
|
||||||
|
|
||||||
More info: http://stackoverflow.com/a/35098040/1683164
|
|
||||||
|
|
||||||
|
|
||||||
### On Windows:
|
### On Windows:
|
||||||
|
|
||||||
The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not officially supported anymore.
|
The Monero GUI on Windows is 64 bits only; 32-bit Windows GUI builds are not officially supported anymore.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ if [ ! -d $MONERO_DIR/src ]; then
|
|||||||
fi
|
fi
|
||||||
git submodule update --remote
|
git submodule update --remote
|
||||||
git -C $MONERO_DIR fetch
|
git -C $MONERO_DIR fetch
|
||||||
git -C $MONERO_DIR checkout v0.15.0.1
|
git -C $MONERO_DIR checkout v0.15.0.5
|
||||||
|
|
||||||
# get monero core tag
|
# get monero core tag
|
||||||
pushd $MONERO_DIR
|
pushd $MONERO_DIR
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ AppName=Monero GUI Wallet
|
|||||||
|
|
||||||
AppVersion={#GuiVersion}
|
AppVersion={#GuiVersion}
|
||||||
VersionInfoVersion={#GuiVersion}
|
VersionInfoVersion={#GuiVersion}
|
||||||
DefaultDirName={pf}\Monero GUI Wallet
|
DefaultDirName={commonpf}\Monero GUI Wallet
|
||||||
DefaultGroupName=Monero GUI Wallet
|
DefaultGroupName=Monero GUI Wallet
|
||||||
UninstallDisplayIcon={app}\monero-wallet-gui.exe
|
UninstallDisplayIcon={app}\monero-wallet-gui.exe
|
||||||
PrivilegesRequired=admin
|
PrivilegesRequired=admin
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ INCLUDEPATH += $$WALLET_ROOT/include \
|
|||||||
$$PWD/src/libwalletqt \
|
$$PWD/src/libwalletqt \
|
||||||
$$PWD/src/QR-Code-generator \
|
$$PWD/src/QR-Code-generator \
|
||||||
$$PWD/src \
|
$$PWD/src \
|
||||||
$$WALLET_ROOT/src
|
$$WALLET_ROOT/src \
|
||||||
|
$$WALLET_ROOT/external/easylogging++ \
|
||||||
|
$$WALLET_ROOT/contrib/epee/include
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/main/filter.h \
|
src/main/filter.h \
|
||||||
@@ -372,11 +374,18 @@ macx {
|
|||||||
# LIBS+= -Wl,-Bstatic
|
# LIBS+= -Wl,-Bstatic
|
||||||
# }
|
# }
|
||||||
|
|
||||||
OPENSSL_LIBRARY_DIRS = $$system(brew --prefix openssl, lines, EXIT_CODE)
|
OPENSSL_DIR = $$system(brew --prefix openssl, lines, EXIT_CODE)
|
||||||
|
!equals(EXIT_CODE, 0) {
|
||||||
|
OPENSSL_DIR = /usr/local/ssl
|
||||||
|
}
|
||||||
|
OPENSSL_LIBRARY_DIR = $$OPENSSL_DIR/lib
|
||||||
|
INCLUDEPATH += $$OPENSSL_DIR/include
|
||||||
|
|
||||||
|
BOOST_DIR = $$system(brew --prefix boost, lines, EXIT_CODE)
|
||||||
equals(EXIT_CODE, 0) {
|
equals(EXIT_CODE, 0) {
|
||||||
OPENSSL_LIBRARY_DIRS = $$OPENSSL_LIBRARY_DIRS/lib
|
INCLUDEPATH += $$BOOST_DIR/include
|
||||||
} else {
|
} else {
|
||||||
OPENSSL_LIBRARY_DIRS = /usr/local/ssl/lib
|
INCLUDEPATH += /usr/local/include
|
||||||
}
|
}
|
||||||
|
|
||||||
QT += macextras
|
QT += macextras
|
||||||
@@ -386,7 +395,7 @@ macx {
|
|||||||
LIBS+= -Wl,-bind_at_load
|
LIBS+= -Wl,-bind_at_load
|
||||||
LIBS+= \
|
LIBS+= \
|
||||||
-L/usr/local/lib \
|
-L/usr/local/lib \
|
||||||
-L$$OPENSSL_LIBRARY_DIRS \
|
-L$$OPENSSL_LIBRARY_DIR \
|
||||||
-L/usr/local/opt/boost/lib \
|
-L/usr/local/opt/boost/lib \
|
||||||
-lboost_serialization \
|
-lboost_serialization \
|
||||||
-lboost_thread-mt \
|
-lboost_thread-mt \
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ file(GLOB_RECURSE SRC_HEADERS *.h)
|
|||||||
target_include_directories(monero-gui PUBLIC
|
target_include_directories(monero-gui PUBLIC
|
||||||
${CMAKE_SOURCE_DIR}/monero/include
|
${CMAKE_SOURCE_DIR}/monero/include
|
||||||
${CMAKE_SOURCE_DIR}/monero/src
|
${CMAKE_SOURCE_DIR}/monero/src
|
||||||
|
${CMAKE_SOURCE_DIR}/monero/external/easylogging++
|
||||||
|
${CMAKE_SOURCE_DIR}/monero/contrib/epee/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/daemon
|
${CMAKE_CURRENT_SOURCE_DIR}/daemon
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libwalletqt
|
${CMAKE_CURRENT_SOURCE_DIR}/libwalletqt
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
@@ -437,8 +436,7 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
engine.rootContext()->setContextProperty("builtWithScanner", builtWithScanner);
|
engine.rootContext()->setContextProperty("builtWithScanner", builtWithScanner);
|
||||||
|
|
||||||
QNetworkAccessManager *manager = new QNetworkAccessManager();
|
Prices prices;
|
||||||
Prices prices(manager);
|
|
||||||
engine.rootContext()->setContextProperty("Prices", &prices);
|
engine.rootContext()->setContextProperty("Prices", &prices);
|
||||||
|
|
||||||
// Load main window (context properties needs to be defined obove this line)
|
// Load main window (context properties needs to be defined obove this line)
|
||||||
|
|||||||
@@ -26,85 +26,85 @@
|
|||||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
|
// TODO: wallet_merged - epee library triggers the warnings
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||||
|
#pragma GCC diagnostic ignored "-Wreorder"
|
||||||
|
#include <net/http_client.h>
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "prices.h"
|
#include "prices.h"
|
||||||
|
|
||||||
|
Prices::Prices(QObject *parent)
|
||||||
Prices::Prices(QNetworkAccessManager *networkAccessManager, QObject *parent)
|
: QObject(parent)
|
||||||
: QObject(parent) {
|
, m_scheduler(this)
|
||||||
this->m_networkAccessManager = networkAccessManager;
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Prices::getJSON(const QString url) {
|
void Prices::getJSON(const QString url) const
|
||||||
|
{
|
||||||
qDebug() << QString("Fetching: %1").arg(url);
|
qDebug() << QString("Fetching: %1").arg(url);
|
||||||
QNetworkRequest request;
|
|
||||||
request.setUrl(QUrl(url));
|
|
||||||
request.setRawHeader("User-Agent", randomUserAgent().toUtf8());
|
|
||||||
request.setRawHeader("Content-Type", "application/json");
|
|
||||||
|
|
||||||
m_reply = this->m_networkAccessManager->get(request);
|
m_scheduler.run([this, url] {
|
||||||
|
epee::net_utils::http::http_simple_client http_client;
|
||||||
|
|
||||||
connect(m_reply, SIGNAL(finished()), this, SLOT(gotJSON()));
|
const QUrl urlParsed(url);
|
||||||
|
http_client.set_server(urlParsed.host().toStdString(), urlParsed.scheme() == "https" ? "443" : "80", {});
|
||||||
|
|
||||||
|
const QString uri = (urlParsed.hasQuery() ? urlParsed.path() + "?" + urlParsed.query() : urlParsed.path());
|
||||||
|
const epee::net_utils::http::http_response_info* pri = NULL;
|
||||||
|
constexpr std::chrono::milliseconds timeout = std::chrono::seconds(15);
|
||||||
|
|
||||||
|
const bool result = http_client.invoke(
|
||||||
|
uri.toStdString(),
|
||||||
|
"GET",
|
||||||
|
{},
|
||||||
|
timeout,
|
||||||
|
std::addressof(pri),
|
||||||
|
{
|
||||||
|
{"Content-Type", "application/json; charset=utf-8"},
|
||||||
|
{"User-Agent", randomUserAgent().toStdString()}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
this->gotError("unknown error");
|
||||||
|
}
|
||||||
|
else if (!pri)
|
||||||
|
{
|
||||||
|
this->gotError("internal error (null response ptr)");
|
||||||
|
}
|
||||||
|
else if (pri->m_response_code != 200)
|
||||||
|
{
|
||||||
|
this->gotError(QString("response code: %1").arg(pri->m_response_code));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson({&pri->m_body[0], static_cast<int>(pri->m_body.size())});
|
||||||
|
if (doc.isEmpty())
|
||||||
|
{
|
||||||
|
this->gotError("bad JSON");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Insert source url for later reference
|
||||||
|
QJsonObject docobj = doc.object();
|
||||||
|
docobj["_url"] = url;
|
||||||
|
doc.setObject(docobj);
|
||||||
|
|
||||||
|
QVariantMap vMap = doc.object().toVariantMap();
|
||||||
|
emit priceJsonReceived(vMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Prices::gotJSON() {
|
void Prices::gotError(const QString &message) const
|
||||||
// Check connectivity
|
{
|
||||||
if (!m_reply || m_reply->error() != QNetworkReply::NoError){
|
|
||||||
this->gotError("Problem with reply from server. Check connectivity.");
|
|
||||||
m_reply->deleteLater();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check json header
|
|
||||||
QList<QByteArray> headerList = m_reply->rawHeaderList();
|
|
||||||
QByteArray headerJson = m_reply->rawHeader("Content-Type");
|
|
||||||
if(headerJson.length() <= 15){
|
|
||||||
this->gotError("Bad Content-Type");
|
|
||||||
m_reply->deleteLater();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString headerJsonStr = QTextCodec::codecForMib(106)->toUnicode(headerJson);
|
|
||||||
int _contentType = headerList.indexOf("Content-Type");
|
|
||||||
if (_contentType < 0 || !headerJsonStr.startsWith("application/json")){
|
|
||||||
this->gotError("Bad Content-Type");
|
|
||||||
m_reply->deleteLater();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check valid json document
|
|
||||||
QByteArray data = m_reply->readAll();
|
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(data);
|
|
||||||
QString jsonString = doc.toJson(QJsonDocument::Indented);
|
|
||||||
if (jsonString.isEmpty()){
|
|
||||||
this->gotError("Bad JSON");
|
|
||||||
m_reply->deleteLater();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert source url for later reference
|
|
||||||
QUrl url = m_reply->url();
|
|
||||||
QJsonObject docobj = doc.object();
|
|
||||||
docobj["_url"] = url.toString();
|
|
||||||
doc.setObject(docobj);
|
|
||||||
|
|
||||||
qDebug() << QString("Fetched: %1").arg(url.toString());
|
|
||||||
|
|
||||||
// Emit signal
|
|
||||||
QVariantMap vMap = doc.object().toVariantMap();
|
|
||||||
emit priceJsonReceived(vMap);
|
|
||||||
|
|
||||||
m_reply->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Prices::gotError() {
|
|
||||||
this->gotError("Unknown error");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Prices::gotError(const QString &message) {
|
|
||||||
qCritical() << "[Fiat API] Error:" << message;
|
qCritical() << "[Fiat API] Error:" << message;
|
||||||
emit priceJsonError(message);
|
emit priceJsonError(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,28 +3,27 @@
|
|||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkReply>
|
#include "FutureScheduler.h"
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
class Prices : public QObject
|
class Prices : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Prices(QNetworkAccessManager *networkAccessManager, QObject *parent = nullptr);
|
Prices(QObject *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public:
|
||||||
Q_INVOKABLE void getJSON(const QString url);
|
Q_INVOKABLE void getJSON(const QString url) const;
|
||||||
void gotJSON();
|
|
||||||
void gotError();
|
|
||||||
void gotError(const QString &message);
|
|
||||||
signals:
|
|
||||||
void priceJsonReceived(QVariantMap document);
|
|
||||||
void priceJsonError(QString message);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable QPointer<QNetworkReply> m_reply;
|
void gotError(const QString &message) const;
|
||||||
QNetworkAccessManager *m_networkAccessManager;
|
|
||||||
|
signals:
|
||||||
|
void priceJsonReceived(QVariantMap document) const;
|
||||||
|
void priceJsonError(QString message) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
mutable FutureScheduler m_scheduler;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PRICES_H
|
#endif // PRICES_H
|
||||||
|
|||||||
Reference in New Issue
Block a user