mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-29 20:28:53 +01:00
Compare commits
24
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c4f99c85d | ||
|
|
c0323ee329 | ||
|
|
40493475ba | ||
|
|
4098e8c0e5 | ||
|
|
ca234008b9 | ||
|
|
2ebb41a371 | ||
|
|
6cf4299f78 | ||
|
|
df0459da69 | ||
|
|
46accb1077 | ||
|
|
7a91ba5a84 | ||
|
|
f83ceb2a96 | ||
|
|
d332121d7c | ||
|
|
d151b47895 | ||
|
|
caa8731410 | ||
|
|
dc3ee66e3b | ||
|
|
289f9ab1d2 | ||
|
|
73747e05a7 | ||
|
|
3051ce5118 | ||
|
|
fb32fa2fd2 | ||
|
|
b3eab6085f | ||
|
|
835aecb79d | ||
|
|
6cba5d0487 | ||
|
|
50b78cee51 | ||
|
|
1b6f648a0b |
+73
-72
@@ -4,10 +4,10 @@ project(wowlet)
|
||||
message(STATUS "Initiating compile using CMake ${CMAKE_VERSION}")
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
set(VERSION_MAJOR "3")
|
||||
set(VERSION_MAJOR "4")
|
||||
set(VERSION_MINOR "0")
|
||||
set(VERSION_REVISION "0")
|
||||
set(VERSION "beta-4")
|
||||
set(VERSION "beta-7")
|
||||
|
||||
option(FETCH_DEPS "Download dependencies if they are not found" ON)
|
||||
option(OPENVR "Include OpenVR support")
|
||||
@@ -16,7 +16,6 @@ option(ANDROID_DEBUG "View the Android app on desktop")
|
||||
option(TOR_BIN "Path to Tor binary to embed inside WOWlet")
|
||||
option(STATIC "Link libraries statically, requires static Qt")
|
||||
option(USE_DEVICE_TREZOR "Trezor support compilation")
|
||||
option(DONATE_BEG "Prompt donation window every once in a while" ON)
|
||||
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake")
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
@@ -26,11 +25,16 @@ include(FindCcache)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
set(WOWNERO_HEAD "f611d5c9e32bc62f1735f6571b0bdb95cc020531")
|
||||
set(WOWNERO_HEAD "a21819cc22587e16af00e2c3d8f70156c11310a0")
|
||||
set(BUILD_GUI_DEPS ON)
|
||||
set(BUILD_64 ON CACHE BOOL "Build 64-bit binaries")
|
||||
set(INSTALL_VENDORED_LIBUNBOUND ${STATIC})
|
||||
set(USE_SINGLE_BUILDDIR ON)
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(LINUX_ACTIVATION ON)
|
||||
else()
|
||||
set(LINUX_ACTIVATION OFF)
|
||||
endif()
|
||||
|
||||
# Are we in debug mode?
|
||||
set(_CMAKE_BUILD_TYPE "")
|
||||
@@ -85,16 +89,6 @@ function (add_linker_flag_if_supported flag var)
|
||||
endfunction()
|
||||
|
||||
find_package(Git)
|
||||
#if(GIT_FOUND)
|
||||
# message(STATUS "Initializing submodules")
|
||||
# execute_process(COMMAND git "submodule" "update" "--init" "--recursive")
|
||||
# execute_process(COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wownero OUTPUT_VARIABLE _WOWNERO_HEAD OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# if(NOT _WOWNERO_HEAD STREQUAL WOWNERO_HEAD)
|
||||
# message(FATAL_ERROR "[submodule] Wownero HEAD was at ${_WOWNERO_HEAD} but should be at ${WOWNERO_HEAD}")
|
||||
# else()
|
||||
# message(STATUS "[submodule] Wownero HEAD @ ${WOWNERO_HEAD}")
|
||||
# endif()
|
||||
#endif()
|
||||
|
||||
add_subdirectory(wownero)
|
||||
get_directory_property(ARCH_WIDTH DIRECTORY "wownero" DEFINITION ARCH_WIDTH)
|
||||
@@ -122,26 +116,14 @@ message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}")
|
||||
# HIDApi
|
||||
set(HIDAPI_FOUND OFF)
|
||||
|
||||
# Unbound
|
||||
find_package(Unbound REQUIRED)
|
||||
|
||||
# QrEncode
|
||||
find_package(QREncode REQUIRED)
|
||||
|
||||
# Tevador 14 word Monero seed
|
||||
find_package(monero-seed CONFIG)
|
||||
if(NOT monero-seed_FOUND)
|
||||
if(FETCH_DEPS)
|
||||
FetchContent_Declare(monero-seed
|
||||
GIT_REPOSITORY https://git.wownero.com/wowlet/monero-seed.git)
|
||||
FetchContent_GetProperties(monero-seed)
|
||||
if(NOT monero-seed_POPULATED)
|
||||
message(STATUS "Fetching monero-seed")
|
||||
FetchContent_Populate(monero-seed)
|
||||
add_subdirectory(${monero-seed_SOURCE_DIR} ${monero-seed_BINARY_DIR})
|
||||
endif()
|
||||
add_library(monero-seed::monero-seed ALIAS monero-seed)
|
||||
else()
|
||||
message(FATAL_ERROR "monero-seed was not installed and fetching deps is disabled")
|
||||
endif()
|
||||
endif()
|
||||
# Tevador 14 word seed (https://git.wownero.com/wowlet/wownero-seed)
|
||||
find_package(wownero-seed CONFIG REQUIRED)
|
||||
|
||||
# Boost
|
||||
if(DEBUG)
|
||||
@@ -153,16 +135,12 @@ endif()
|
||||
if(MINGW)
|
||||
set(Boost_THREADAPI win32)
|
||||
endif()
|
||||
find_package(Boost 1.58 REQUIRED COMPONENTS
|
||||
system
|
||||
filesystem
|
||||
thread
|
||||
date_time
|
||||
chrono
|
||||
regex
|
||||
serialization
|
||||
program_options
|
||||
locale)
|
||||
set(_BOOST_COMPONENTS system filesystem thread date_time chrono regex serialization program_options locale)
|
||||
if(APPLE)
|
||||
# atomic is only present/needed on Apple
|
||||
list(APPEND _BOOST_COMPONENTS atomic)
|
||||
endif()
|
||||
find_package(Boost 1.58 REQUIRED COMPONENTS ${_BOOST_COMPONENTS})
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
@@ -197,33 +175,58 @@ if(UNIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# To build WOWlet with embedded (and static) Tor, pass CMake -DTOR_BIN=/path/to/tor
|
||||
if(TOR_BIN)
|
||||
if(APPLE)
|
||||
execute_process(COMMAND bash -c "touch ${CMAKE_CURRENT_SOURCE_DIR}/src/tor/libevent-2.1.7.dylib")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND bash -c "${TOR_BIN} --version --quiet" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE out RESULT_VARIABLE ret)
|
||||
if (ret EQUAL "0")
|
||||
set(TOR_VERSION "${out}")
|
||||
endif()
|
||||
message(STATUS "${TOR_VERSION}")
|
||||
configure_file("cmake/config-wowlet.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-wowlet.h")
|
||||
|
||||
# on the buildbot Tor is baked into the image
|
||||
# To build WOWlet with embedded & static Tor, pass CMake -DTOR_BIN=/path/to/tor_executable
|
||||
# The CMake below will copy the Tor binary into src/assets/exec
|
||||
#
|
||||
# For release:
|
||||
# ## Linux / Window
|
||||
# on the buildbot(s) Tor is baked into the image
|
||||
# - linux: See `Dockerfile`
|
||||
# - windows: See `Dockerfile.windows`
|
||||
# - macos: taken from Tor Browser official release
|
||||
if(REPRODUCIBLE) # Always copy Tor when doing a reproducible build to prevent old versions from getting included
|
||||
set(TOR_COPY_CMD "cp ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor")
|
||||
#
|
||||
# ## MacOS:
|
||||
# we assume the following files are already present in src/assets/exec:
|
||||
# - tor
|
||||
# - libevent-2.1.7.dylib
|
||||
# so copy them beforehand and set TOR_BIN to something random.
|
||||
|
||||
# MacOS, check if required files are present
|
||||
if(APPLE)
|
||||
foreach(fn libevent-2.1.7.dylib tor)
|
||||
set(tor_path "${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/${fn}")
|
||||
if (EXISTS "${tor_path}")
|
||||
message(STATUS "Tor found: ${tor_path}")
|
||||
else()
|
||||
message(FATAL_ERROR "TOR_BIN is set, so the following file needs to be present: '${tor_path}'")
|
||||
endif()
|
||||
set(TOR_BIN "${tor_path}")
|
||||
endforeach()
|
||||
else()
|
||||
set(TOR_COPY_CMD "cp -u ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor")
|
||||
if(NOT EXISTS "${TOR_BIN}")
|
||||
message(FATAL_ERROR "TOR_BIN is set, but file does not exist: '${TOR_BIN}'")
|
||||
endif()
|
||||
|
||||
# copy the Tor executable over
|
||||
set(TOR_COPY_CMD "cp ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor")
|
||||
message(STATUS "Tor cmd: ${TOR_COPY_CMD}")
|
||||
|
||||
execute_process(COMMAND bash -c "${TOR_COPY_CMD}" RESULT_VARIABLE ret)
|
||||
if(ret EQUAL "1")
|
||||
message(FATAL_ERROR "Tor copy failure: ${TOR_COPY_CMD}")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
message(STATUS "${TOR_COPY_CMD}")
|
||||
execute_process(COMMAND bash -c "${TOR_COPY_CMD}" RESULT_VARIABLE ret)
|
||||
if(ret EQUAL "1")
|
||||
message(FATAL_ERROR "Tor copy failure: ${TOR_COPY_CMD}")
|
||||
|
||||
# get Tor version while we're at it
|
||||
if(NOT TOR_VERSION)
|
||||
execute_process(COMMAND bash -c "${TOR_BIN} --version --quiet | head -n1" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE out RESULT_VARIABLE ret)
|
||||
if (ret EQUAL "0")
|
||||
set(TOR_VERSION "${out}")
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "Tor version: ${TOR_VERSION}")
|
||||
configure_file("cmake/config-wowlet.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-wowlet.h")
|
||||
|
||||
message(STATUS "Embedding Tor binary at ${TOR_BIN}")
|
||||
else()
|
||||
@@ -231,6 +234,8 @@ else()
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
find_package(Iconv REQUIRED)
|
||||
|
||||
string(REGEX MATCH "^[^/]:/[^/]*" msys2_install_path "${CMAKE_C_COMPILER}")
|
||||
message(STATUS "MSYS location: ${msys2_install_path}")
|
||||
set(CMAKE_INCLUDE_PATH "${msys2_install_path}/mingw${ARCH_WIDTH}/include")
|
||||
@@ -278,16 +283,7 @@ if(APPLE)
|
||||
if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0")
|
||||
endif()
|
||||
|
||||
if (APPLE AND NOT IOS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -std=c++11 -DGTEST_HAS_TR1_TUPLE=0")
|
||||
endif()
|
||||
|
||||
# warnings
|
||||
@@ -359,6 +355,11 @@ if(STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LINUX_ACTIVATION)
|
||||
find_package(Cairo REQUIRED)
|
||||
find_package(Xfixes REQUIRED)
|
||||
endif()
|
||||
|
||||
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
|
||||
# is fixed in the code (Issue #847), force compiler to be conservative.
|
||||
add_c_flag_if_supported(-fno-strict-aliasing C_SECURITY_FLAGS)
|
||||
|
||||
+43
-20
@@ -17,7 +17,6 @@ RUN wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz && \
|
||||
cd openssl-1.1.1i && \
|
||||
./config no-shared no-dso --prefix=/usr/local/openssl && \
|
||||
make -j$THREADS && \
|
||||
make test && \
|
||||
make -j$THREADS install_sw && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
@@ -66,10 +65,10 @@ RUN git clone -b tor-0.4.5.5-rc --depth 1 https://git.torproject.org/tor.git &&
|
||||
rm -rf $(pwd) && \
|
||||
strip -s -D /usr/local/tor/bin/tor
|
||||
|
||||
FROM ubuntu:16.04
|
||||
FROM ubuntu:18.04
|
||||
|
||||
ARG THREADS=1
|
||||
ARG QT_VERSION=5.15.2
|
||||
ARG QT_VERSION=v5.15.2
|
||||
|
||||
ENV CFLAGS="-fPIC"
|
||||
ENV CPPFLAGS="-fPIC"
|
||||
@@ -95,7 +94,7 @@ RUN apt-get update && \
|
||||
# libusb
|
||||
libudev-dev \
|
||||
# fontconfig
|
||||
autopoint gettext gperf libpng12-dev \
|
||||
autopoint gettext gperf libpng-dev \
|
||||
# libxcb
|
||||
libpthread-stubs0-dev \
|
||||
# xorgproto
|
||||
@@ -161,7 +160,7 @@ RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-
|
||||
cd libxcb-util && \
|
||||
git reset --hard acf790d7752f36e450d476ad79807d4012ec863b && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
@@ -172,7 +171,7 @@ RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-
|
||||
cd libxcb-image && \
|
||||
git reset --hard d882052fb2ce439c6483fce944ba8f16f7294639 && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
@@ -183,7 +182,7 @@ RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-
|
||||
cd libxcb-keysyms && \
|
||||
git reset --hard 0e51ee5570a6a80bdf98770b975dfe8a57f4eeb1 && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
@@ -194,7 +193,7 @@ RUN git clone -b 0.3.9 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-
|
||||
cd libxcb-render-util && \
|
||||
git reset --hard 0317caf63de532fd7a0493ed6afa871a67253747 && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
@@ -205,7 +204,7 @@ RUN git clone -b 0.4.1 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb-
|
||||
cd libxcb-wm && \
|
||||
git reset --hard 24eb17df2e1245885e72c9d4bbb0a0f69f0700f2 && \
|
||||
git submodule init && \
|
||||
git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \
|
||||
git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \
|
||||
./autogen.sh --enable-shared --disable-static && \
|
||||
make -j$THREADS && \
|
||||
@@ -278,22 +277,46 @@ RUN wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz && \
|
||||
cd openssl-1.1.1i && \
|
||||
./config no-shared no-dso --prefix=/usr/local/openssl && \
|
||||
make -j$THREADS && \
|
||||
make test && \
|
||||
make -j$THREADS install_sw && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN wget https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.bz2 && \
|
||||
echo "a247a7f6bbb21cf2ca81ea4cbb916bfb9717ca523631675f99b3d4a5678dcd16 expat-2.4.8.tar.bz2" | sha256sum -c && \
|
||||
tar -xf expat-2.4.8.tar.bz2 && \
|
||||
rm expat-2.4.8.tar.bz2 && \
|
||||
cd expat-2.4.8 && \
|
||||
./configure --enable-static --disable-shared --prefix=/usr/local/expat/ && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN wget https://www.nlnetlabs.nl/downloads/unbound/unbound-1.16.2.tar.gz && \
|
||||
echo "2e32f283820c24c51ca1dd8afecfdb747c7385a137abe865c99db4b257403581 unbound-1.16.2.tar.gz" | sha256sum -c && \
|
||||
tar -xzf unbound-1.16.2.tar.gz && \
|
||||
rm unbound-1.16.2.tar.gz && \
|
||||
cd unbound-1.16.2 && \
|
||||
./configure --disable-shared --enable-static --without-pyunbound --with-libexpat=/usr/local/expat/ --with-ssl=/usr/local/openssl/ --with-libevent=no --without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only --with-pic && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN rm /usr/lib/x86_64-linux-gnu/libX11.a && \
|
||||
rm /usr/lib/x86_64-linux-gnu/libXext.a && \
|
||||
rm /usr/lib/x86_64-linux-gnu/libX11-xcb.a && \
|
||||
git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 && \
|
||||
cd qt5 && \
|
||||
git clone git://code.qt.io/qt/qtbase.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtdeclarative.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtgraphicaleffects.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtimageformats.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtmultimedia.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtquickcontrols.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtquickcontrols2.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtsvg.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qttools.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qttranslations.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtx11extras.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtxmlpatterns.git -b ${QT_VERSION} --depth 1 && \
|
||||
git clone git://code.qt.io/qt/qtwebsockets.git -b ${QT_VERSION} --depth 1 && \
|
||||
sed -ri s/\(Libs:.*\)/\\1\ -lexpat/ /usr/local/lib/pkgconfig/fontconfig.pc && \
|
||||
sed -ri s/\(Libs:.*\)/\\1\ -lz/ /usr/local/lib/pkgconfig/freetype2.pc && \
|
||||
@@ -301,18 +324,14 @@ RUN rm /usr/lib/x86_64-linux-gnu/libX11.a && \
|
||||
sed -i s/\\/usr\\/X11R6\\/lib64/\\/usr\\/local\\/lib/ qtbase/mkspecs/linux-g++-64/qmake.conf && \
|
||||
OPENSSL_LIBS="-lssl -lcrypto -lpthread -ldl" \
|
||||
./configure --prefix=/usr -platform linux-g++-64 -opensource -confirm-license -release -static -no-avx \
|
||||
-no-opengl -qpa xcb --xcb -xcb-xlib -feature-xlib -openssl-linked -I /usr/local/openssl/include \
|
||||
-L /usr/local/openssl/lib -system-freetype -fontconfig -glib \
|
||||
-no-dbus -no-sql-sqlite -no-use-gold-linker -no-kms \
|
||||
-opengl desktop -qpa xcb -xcb -xcb-xlib -feature-xlib -system-freetype -fontconfig -glib \
|
||||
-no-dbus -no-feature-qml-worker-script -no-linuxfb -no-openssl -no-sql-sqlite -no-kms -no-use-gold-linker \
|
||||
-qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \
|
||||
-skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d \
|
||||
-skip qtdoc -skip qtquickcontrols -skip qtquickcontrols2 -skip qtspeech -skip qtgamepad \
|
||||
-skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing -optimize-size \
|
||||
-skip qtdoc -skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing \
|
||||
-skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools \
|
||||
-skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebview \
|
||||
-skip qtwinextras -skip qtx11extras -skip gamepad -skip serialbus -skip location -skip webengine \
|
||||
-skip qtdeclarative \
|
||||
-no-feature-cups -no-feature-ftp -no-feature-pdf -no-feature-animation \
|
||||
-nomake examples -nomake tests -nomake tools && \
|
||||
make -j$THREADS && \
|
||||
make -j$THREADS install && \
|
||||
@@ -392,9 +411,9 @@ RUN git clone -b v4.0.2 --depth 1 https://github.com/fukuchi/libqrencode.git &&
|
||||
make -j$THREADS install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git clone https://git.wownero.com/wowlet/monero-seed.git && \
|
||||
cd monero-seed && \
|
||||
git reset --hard 4674ef09b6faa6fe602ab5ae0b9ca8e1fd7d5e1b && \
|
||||
RUN git clone https://git.wownero.com/wowlet/wownero-seed.git && \
|
||||
cd wownero-seed && \
|
||||
git reset --hard ef6910b6bb3b61757c36e2e5db0927d75f1731c8 && \
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild && \
|
||||
make -Cbuild -j$THREADS && \
|
||||
make -Cbuild install && \
|
||||
@@ -414,3 +433,7 @@ RUN mkdir linuxdeployqt && \
|
||||
chmod +x linuxdeployqt-7-x86_64.AppImage && \
|
||||
./linuxdeployqt-7-x86_64.AppImage --appimage-extract && \
|
||||
rm linuxdeployqt-7-x86_64.AppImage
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -o Dpkg::Options::="--force-confold" install -q -y --force-yes libcairo2-dev libxinerama-dev
|
||||
RUN git config --global --add safe.directory /wowlet
|
||||
@@ -237,7 +237,6 @@ CMD set -ex \
|
||||
-DUSE_SINGLE_BUILDDIR=ON \
|
||||
-DMANUAL_SUBMODULES=1 \
|
||||
-DUSE_SINGLE_BUILDDIR=ON \
|
||||
-DQML=ON \
|
||||
-DANDROID=ON \
|
||||
../../.. \
|
||||
&& PATH=${HOST_PATH} make generate_translations_header \
|
||||
|
||||
+10
-7
@@ -1,11 +1,12 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ARG THREADS=1
|
||||
ARG QT_VERSION=5.15.2
|
||||
ARG QT_VERSION=v5.15.2
|
||||
ENV SOURCE_DATE_EPOCH=1397818193
|
||||
|
||||
ENV OPENSSL_ROOT_DIR=/usr/local/openssl/
|
||||
ENV TOR_BIN=/usr/local/tor/bin/tor.exe
|
||||
ENV TOR_VERSION='tor-0.4.5.7'
|
||||
|
||||
RUN apt update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y curl nano wget zip automake build-essential cmake gcc-mingw-w64 g++-mingw-w64 gettext git libtool pkg-config \
|
||||
@@ -15,9 +16,9 @@ RUN apt update && \
|
||||
RUN update-alternatives --set x86_64-w64-mingw32-g++ $(which x86_64-w64-mingw32-g++-posix) && \
|
||||
update-alternatives --set x86_64-w64-mingw32-gcc $(which x86_64-w64-mingw32-gcc-posix)
|
||||
|
||||
RUN git clone -b v0.17.1.9 --depth 1 https://github.com/monero-project/monero && \
|
||||
RUN git clone -b v0.18.2.0 --depth 1 https://github.com/monero-project/monero && \
|
||||
cd monero && \
|
||||
git reset --hard 8fef32e45c80aec41f25be9d1d8fb75adc883c64 && \
|
||||
git reset --hard 99be9a044f3854f339548e2d99c539c18d7b1b01 && \
|
||||
cp -a contrib/depends / && \
|
||||
cd .. && \
|
||||
rm -rf monero
|
||||
@@ -95,7 +96,7 @@ RUN git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
# libpng -> libqrencode
|
||||
RUN git clone -b libpng16 --depth 1 https://github.com/glennrp/libpng.git && \
|
||||
RUN git clone -b libpng16 https://github.com/glennrp/libpng.git && \
|
||||
cd libpng && \
|
||||
git reset --hard a37d4836519517bdce6cb9d956092321eca3e73b && \
|
||||
CPPFLAGS="-I/depends/x86_64-w64-mingw32/include" LDFLAGS="-L/depends/x86_64-w64-mingw32/lib" \
|
||||
@@ -174,9 +175,9 @@ RUN git clone -b tor-0.4.5.7 --depth 1 https://git.torproject.org/tor.git && \
|
||||
rm -rf $(pwd) && \
|
||||
strip -s -D /usr/local/tor/bin/tor.exe
|
||||
|
||||
RUN git clone https://git.wownero.com/wowlet/monero-seed.git && \
|
||||
cd monero-seed && \
|
||||
git reset --hard 4674ef09b6faa6fe602ab5ae0b9ca8e1fd7d5e1b && \
|
||||
RUN git clone https://git.wownero.com/wowlet/wownero-seed.git && \
|
||||
cd wownero-seed && \
|
||||
git reset --hard ef6910b6bb3b61757c36e2e5db0927d75f1731c8 && \
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/depends/x86_64-w64-mingw32 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/depends/x86_64-w64-mingw32/share/toolchain.cmake -Bbuild && \
|
||||
@@ -184,3 +185,5 @@ RUN git clone https://git.wownero.com/wowlet/monero-seed.git && \
|
||||
make -Cbuild install && \
|
||||
rm -rf $(pwd)
|
||||
|
||||
RUN git config --global --add safe.directory /wowlet
|
||||
RUN git config --global --add safe.directory /wowlet/wownero
|
||||
|
||||
@@ -30,8 +30,6 @@ CMAKEFLAGS = \
|
||||
-DBUILD_64=On \
|
||||
-DBUILD_TESTS=Off \
|
||||
-DOPENVR=Off \
|
||||
-DQML=Off \
|
||||
-DXMRIG=Off \
|
||||
-DTOR_BIN=Off \
|
||||
-DCMAKE_CXX_STANDARD=11 \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=On \
|
||||
@@ -43,6 +41,7 @@ CMAKEFLAGS = \
|
||||
|
||||
release-static: CMAKEFLAGS += -DBUILD_TAG="linux-x64"
|
||||
release-static: CMAKEFLAGS += -DXMRIG=OFF
|
||||
release-static: CMAKEFLAGS += -DARCH=x86-64
|
||||
release-static: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF)
|
||||
release-static: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release
|
||||
release-static: CMAKEFLAGS += -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH},OFF)
|
||||
@@ -56,7 +55,7 @@ depends:
|
||||
|
||||
windows:
|
||||
mkdir -p build/$(target)/release
|
||||
cd build/$(target)/release && cmake -D STATIC=ON -DZLIB_ROOT=/usr/x86_64-w64-mingw32/ -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH},OFF) -DTOR_VERSION=$(or ${TOR_VERSION}, OFF) -DOPENVR=ON -DQML=ON -DWITH_SCANNER=ON -DTOR_BIN=$(or ${TOR_BIN},OFF) -D DEV_MODE=$(or ${DEV_MODE},OFF) -D BUILD_TAG=$(tag) -D CMAKE_BUILD_TYPE=Debug -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake ../../.. && $(MAKE)
|
||||
cd build/$(target)/release && cmake -D STATIC=ON -DZLIB_ROOT=/usr/x86_64-w64-mingw32/ -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH},OFF) -DTOR_VERSION=$(or ${TOR_VERSION}, OFF) -DOPENVR=ON -DWITH_SCANNER=ON -DTOR_BIN=$(or ${TOR_BIN},OFF) -D DEV_MODE=$(or ${DEV_MODE},OFF) -D BUILD_TAG=$(tag) -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake ../../.. && $(MAKE)
|
||||
|
||||
|
||||
windows-mxe-release: CMAKEFLAGS += -DBUILD_TAG="win-x64"
|
||||
@@ -75,10 +74,27 @@ windows-mxe-debug:
|
||||
cmake -Bbuild $(CMAKEFLAGS)
|
||||
$(MAKE) -Cbuild
|
||||
|
||||
mac: CMAKEFLAGS += -DSTATIC=Off
|
||||
mac: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF)
|
||||
mac: CMAKEFLAGS += -DBUILD_TAG="mac-x64"
|
||||
mac: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release
|
||||
mac:
|
||||
cmake -Bbuild $(CMAKEFLAGS)
|
||||
$(MAKE) -Cbuild
|
||||
$(MAKE) -Cbuild deploy
|
||||
|
||||
# used for release, covers both intel and M1
|
||||
# 1) assumes a *static* BOOST has been compiled at BOOST_ROOT, see docs/BUILDING.md
|
||||
# 2) assumes a *static* Tor and libevent at src/assets/exec, see docs/BUILDING.md
|
||||
mac-release: CMAKEFLAGS += -DARCH=default
|
||||
mac-release: CMAKEFLAGS += -DCMAKE_OSX_ARCHITECTURES="x86_64"
|
||||
mac-release: CMAKEFLAGS += -DSTATIC=Off
|
||||
mac-release: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF)
|
||||
mac-release: CMAKEFLAGS += -DTOR_BIN="foo"
|
||||
mac-release: CMAKEFLAGS += -DBUILD_TAG="mac-x64"
|
||||
mac-release: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release
|
||||
mac-release: CMAKEFLAGS += -DBoost_USE_STATIC_RUNTIME=ON
|
||||
mac-release: CMAKEFLAGS += -DBoost_USE_STATIC_LIBS=ON
|
||||
mac-release: CMAKEFLAGS += -DBOOST_ROOT=/Users/${USER}/build/boost
|
||||
mac-release:
|
||||
cmake -Bbuild $(CMAKEFLAGS)
|
||||
$(MAKE) -Cbuild
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
[](https://ci.wownero.com/wowlet/wowlet)
|
||||
|
||||
# WOWlet- a free Wownero desktop wallet
|
||||
|
||||
WOWlet is a free, open-source Wownero client for Linux, Mac OS, and Windows.
|
||||
|
||||
WOWlet is a free, open-source Wownero client for Linux with ports for Mac OS and Windows.
|
||||

|
||||
|
||||
## Development resources
|
||||
|
||||
* Git: [git.wownero.com/wowlet/wowlet](https://git.wownero.com/wowlet/wowlet)
|
||||
* IRC: `#wownero` on Freenode
|
||||
* IRC: `#wownero-dev` on [OFTC](https://oftc.net/)
|
||||
* [Building WOWlet from source](https://git.wownero.com/wowlet/wowlet/src/branch/master/docs/BUILDING.md)
|
||||
* [Working on WOWlet](https://git.wownero.com/wowlet/wowlet/src/branch/master/docs/HACKING.md)
|
||||
|
||||
Copyright (c) 2020-2021 The Monero Project.
|
||||
|
||||
+3
-7
@@ -7,7 +7,7 @@ if(APPLE OR (WIN32 AND NOT STATIC))
|
||||
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
|
||||
add_custom_command(TARGET deploy
|
||||
POST_BUILD
|
||||
COMMAND "${MACDEPLOYQT_EXECUTABLE}" "$<TARGET_FILE_DIR:wowlet>/../.." -always-overwrite
|
||||
COMMAND "${MACDEPLOYQT_EXECUTABLE}" "$<TARGET_FILE_DIR:wowlet>/../.." -always-overwrite -qmldir="${CMAKE_SOURCE_DIR}"
|
||||
COMMENT "Running macdeployqt..."
|
||||
)
|
||||
|
||||
@@ -17,12 +17,8 @@ if(APPLE OR (WIN32 AND NOT STATIC))
|
||||
add_custom_command(TARGET deploy
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${_qt_svg_dylib} $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/
|
||||
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/libqsvg.dylib
|
||||
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/libqsvg.dylib
|
||||
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/libqsvg.dylib
|
||||
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $<TARGET_FILE_DIR:wowlet>/../PlugIns/imageformats/libqsvg.dylib
|
||||
COMMENT "Copying libqsvg.dylib, running install_name_tool"
|
||||
COMMENT "Copying libqsvg.dylib"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# - Try to find Cairo
|
||||
# Once done, this will define
|
||||
#
|
||||
# CAIRO_FOUND - system has Cairo
|
||||
# CAIRO_INCLUDE_DIRS - the Cairo include directories
|
||||
# CAIRO_LIBRARIES - link these to use Cairo
|
||||
#
|
||||
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
|
||||
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, 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.
|
||||
|
||||
FIND_PACKAGE(PkgConfig)
|
||||
PKG_CHECK_MODULES(PC_CAIRO cairo) # FIXME: After we require CMake 2.8.2 we can pass QUIET to this call.
|
||||
|
||||
FIND_PATH(CAIRO_INCLUDE_DIRS
|
||||
NAMES cairo.h
|
||||
HINTS ${PC_CAIRO_INCLUDEDIR}
|
||||
${PC_CAIRO_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES cairo
|
||||
)
|
||||
|
||||
FIND_LIBRARY(CAIRO_LIBRARIES
|
||||
NAMES cairo
|
||||
HINTS ${PC_CAIRO_LIBDIR}
|
||||
${PC_CAIRO_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
IF (CAIRO_INCLUDE_DIRS)
|
||||
IF (EXISTS "${CAIRO_INCLUDE_DIRS}/cairo-version.h")
|
||||
FILE(READ "${CAIRO_INCLUDE_DIRS}/cairo-version.h" CAIRO_VERSION_CONTENT)
|
||||
|
||||
STRING(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
|
||||
SET(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
|
||||
STRING(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
|
||||
SET(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}")
|
||||
|
||||
STRING(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
|
||||
SET(CAIRO_VERSION_MICRO "${CMAKE_MATCH_1}")
|
||||
|
||||
SET(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_MICRO}")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
# FIXME: Should not be needed anymore once we start depending on CMake 2.8.3
|
||||
SET(VERSION_OK TRUE)
|
||||
IF (Cairo_FIND_VERSION)
|
||||
IF (Cairo_FIND_VERSION_EXACT)
|
||||
IF ("${Cairo_FIND_VERSION}" VERSION_EQUAL "${CAIRO_VERSION}")
|
||||
# FIXME: Use IF (NOT ...) with CMake 2.8.2+ to get rid of the ELSE block
|
||||
ELSE ()
|
||||
SET(VERSION_OK FALSE)
|
||||
ENDIF ()
|
||||
ELSE ()
|
||||
IF ("${Cairo_FIND_VERSION}" VERSION_GREATER "${CAIRO_VERSION}")
|
||||
SET(VERSION_OK FALSE)
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cairo DEFAULT_MSG CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES VERSION_OK)
|
||||
@@ -0,0 +1,26 @@
|
||||
# - Find XFixes
|
||||
# Find the XFixes libraries
|
||||
#
|
||||
# This module defines the following variables:
|
||||
# XFIXES_FOUND - 1 if XFIXES_INCLUDE_DIR & XFIXES_LIBRARY are found, 0 otherwise
|
||||
# XFIXES_INCLUDE_DIR - where to find Xlib.h, etc.
|
||||
# XFIXES_LIBRARY - the X11 library
|
||||
#
|
||||
|
||||
find_path( XFIXES_INCLUDE_DIR
|
||||
NAMES X11/extensions/Xfixes.h
|
||||
PATH_SUFFIXES X11/extensions
|
||||
DOC "The XFixes include directory" )
|
||||
|
||||
find_library( XFIXES_LIBRARY
|
||||
NAMES Xfixes
|
||||
PATHS /usr/lib /lib
|
||||
DOC "The XFixes library" )
|
||||
|
||||
if( XFIXES_INCLUDE_DIR AND XFIXES_LIBRARY )
|
||||
set( XFIXES_FOUND 1 )
|
||||
else()
|
||||
set( XFIXES_FOUND 0 )
|
||||
endif()
|
||||
|
||||
mark_as_advanced( XFIXES_INCLUDE_DIR XFIXES_LIBRARY )
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
unset SOURCE_DATE_EPOCH
|
||||
|
||||
APPDIR="$PWD/wowlet.AppDir"
|
||||
|
||||
mkdir -p "$APPDIR"
|
||||
mkdir -p "$APPDIR/usr/share/applications/"
|
||||
mkdir -p "$APPDIR/usr/bin"
|
||||
|
||||
cp "$PWD/src/assets/org.wowlet.wowlet.desktop" "$APPDIR/usr/share/applications/org.wowlet.wowlet.desktop"
|
||||
cp "$PWD/src/assets/images/appicons/64x64.png" "$APPDIR/wowlet.png"
|
||||
cp "$PWD/build/bin/wowlet" "$APPDIR/usr/bin/wowlet"
|
||||
|
||||
LD_LIBRARY_PATH=/usr/local/lib /linuxdeployqt/squashfs-root/AppRun wowlet.AppDir/usr/share/applications/org.wowlet.wowlet.desktop -bundle-non-qt-libs
|
||||
|
||||
find wowlet.AppDir/ -exec touch -h -a -m -t 202101010100.00 {} \;
|
||||
|
||||
# Manually create AppImage (reproducibly)
|
||||
|
||||
# download runtime
|
||||
wget -nc https://github.com/AppImage/AppImageKit/releases/download/12/runtime-x86_64
|
||||
echo "24da8e0e149b7211cbfb00a545189a1101cb18d1f27d4cfc1895837d2c30bc30 runtime-x86_64" | sha256sum -c
|
||||
|
||||
mksquashfs wowlet.AppDir wowlet.squashfs -info -root-owned -no-xattrs -noappend -fstime 0
|
||||
# mksquashfs writes a timestamp to the header
|
||||
printf '\x00\x00\x00\x00' | dd conv=notrunc of=wowlet.squashfs bs=1 seek=$((0x8))
|
||||
|
||||
rm -f wowlet.AppImage
|
||||
cat runtime-x86_64 >> wowlet.AppImage
|
||||
cat wowlet.squashfs >> wowlet.AppImage
|
||||
chmod a+x wowlet.AppImage
|
||||
+121
-53
@@ -1,40 +1,37 @@
|
||||
## Buildbot builds
|
||||
# Building WOWlet
|
||||
|
||||
The docker build bins can be found here: https://build.wownero.org/files/
|
||||
|
||||
## Docker static builds
|
||||
|
||||
Static builds via Docker are done in 3 steps:
|
||||
Building for Linux and Windows via Docker is done in 3 steps:
|
||||
|
||||
1. Cloning this repository (+submodules)
|
||||
2. Creating a base Docker image
|
||||
3. Using the base image to compile a build
|
||||
|
||||
### Linux (reproducible)
|
||||
**important:** you only have to do step 2 (base docker image) once.
|
||||
|
||||
The docker image for reproducible Linux static builds uses Ubuntu 16.04 and compiles the required libraries statically
|
||||
so that the resulting `wowlet` binary is static. For more information, check the Dockerfile: `Dockerfile`.
|
||||
For Mac OS, scroll down.
|
||||
|
||||
#### 1. Clone
|
||||
# Linux
|
||||
|
||||
For more information, check the Dockerfile: `Dockerfile`.
|
||||
|
||||
### 1. Clone
|
||||
|
||||
```bash
|
||||
git clone --branch master --recursive https://git.wownero.com/wowlet/wowlet.git
|
||||
cd wowlet
|
||||
```
|
||||
|
||||
Replace `master` with the desired version tag (e.g. `beta-4`) to build the release binary.
|
||||
Replace `master` with the desired version tag (e.g. `v3.1.0`) to build the release binary.
|
||||
|
||||
#### 2. Base image
|
||||
### 2. Base image
|
||||
|
||||
```bash
|
||||
docker build --tag wowlet:linux --build-arg THREADS=6 .
|
||||
```
|
||||
|
||||
Building the base image takes a while. You only need to build the base image once.
|
||||
Building the base image takes a while. **You only need to build the base image once.**
|
||||
|
||||
#### 3. Build
|
||||
|
||||
##### Standalone binary
|
||||
### 3. Build
|
||||
|
||||
```bash
|
||||
docker run --rm -it -v $PWD:/wowlet -w /wowlet wowlet:linux sh -c 'make release-static -j6'
|
||||
@@ -44,35 +41,26 @@ If you're re-running a build make sure to `rm -rf build/` first.
|
||||
|
||||
The resulting binary can be found in `build/bin/wowlet`.
|
||||
|
||||
##### AppImage
|
||||
# Windows
|
||||
|
||||
First create the standalone binary using the Docker command in the previous step.
|
||||
|
||||
```bash
|
||||
docker run --rm -it -v $PWD:/wowlet -w /wowlet wowlet:linux contrib/build-appimage.sh
|
||||
```
|
||||
|
||||
### Windows (reproducible)
|
||||
|
||||
#### 1. Clone
|
||||
### 1. Clone
|
||||
|
||||
```bash
|
||||
git clone --branch master --recursive https://git.wownero.com/wowlet/wowlet.git
|
||||
cd wowlet
|
||||
```
|
||||
|
||||
Replace `master` with the desired version tag (e.g. `beta-4`) to build the release binary.
|
||||
|
||||
#### 2. Base image
|
||||
Replace `master` with the desired version tag (e.g. `v3.1.0`) to build the release binary.
|
||||
|
||||
### 2. Base image
|
||||
|
||||
```bash
|
||||
docker build -f Dockerfile.windows --tag wowlet:win --build-arg THREADS=6 .
|
||||
```
|
||||
|
||||
Building the base image takes a while. You only need to build the base image once.
|
||||
Building the base image takes a while. **You only need to build the base image once.**
|
||||
|
||||
#### 3. Build
|
||||
### 3. Build
|
||||
|
||||
```bash
|
||||
docker run --rm -it -v $PWD:/wowlet -w /wowlet wowlet:win sh -c 'make windows root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j6'
|
||||
@@ -82,42 +70,122 @@ If you're re-running a build make sure to `rm -rf build/` first.
|
||||
|
||||
The resulting binary can be found in `build/x86_64-w64-mingw32/release/bin/wowlet.exe`.
|
||||
|
||||
## macOS
|
||||
# Mac OS
|
||||
|
||||
For MacOS it's easiest to leverage [brew](https://brew.sh) to install the required dependencies.
|
||||
## method 1 (easiest)
|
||||
|
||||
### 1. Get homebrew
|
||||
|
||||
Get [brew](https://brew.sh) to install the required dependencies.
|
||||
|
||||
```bash
|
||||
HOMEBREW_OPTFLAGS="-march=core2" HOMEBREW_OPTIMIZATION_LEVEL="O0" \
|
||||
brew install boost zmq openssl libpgm miniupnpc libsodium expat libunwind-headers protobuf libgcrypt qrencode ccache cmake pkgconfig git
|
||||
```
|
||||
|
||||
Clone the repository.
|
||||
### 2. Compile WOWlet
|
||||
|
||||
```bash
|
||||
git clone --recursive https://git.wownero.com/wowlet/wowlet.git
|
||||
```
|
||||
Download Qt5.15.1 from here:
|
||||
https://download.qt.io/archive/qt/5.15/5.15.1/single/
|
||||
and build Qt 5.15.1:
|
||||
|
||||
Qt build on Mac OS:
|
||||
|
||||
```bash
|
||||
cd ~/Downloads/qt-everywhere-src-5.15.1
|
||||
./configure -prefix $PWD/qtbase -release -nomake examples -nomake tests -skip qtwebchannel -skip qtpurchasing -skip webengine -skip qtwebview
|
||||
make -j 4
|
||||
CMAKE_PREFIX_PATH=/usr/local/opt/qt5/ make -j4 mac
|
||||
```
|
||||
|
||||
Build WOWlet:
|
||||
The resulting Mac OS application can be found `build/bin/wowlet.app` and will **not** have Tor embedded.
|
||||
|
||||
```bash
|
||||
CMAKE_PREFIX_PATH=/Users/$username/Downloads/qt-everywhere-src-5.15.1/qtbase/ make mac-release
|
||||
```
|
||||
|
||||
Install and start tor service for ticker/forums:
|
||||
Since WOWlet needs Tor, install it, start it, and start at Mac OS boot:
|
||||
```bash
|
||||
brew install tor
|
||||
brew services start tor
|
||||
```
|
||||
|
||||
The resulting Mac OS application can be found `build/bin/wowlet.app` and will **not** have Tor embedded.
|
||||
## method 2 (advanced, intel/m1 release binaries)
|
||||
|
||||
This assumes you have homebrew installed with the packages defined in the previous step ("Get homebrew").
|
||||
|
||||
### 1. Get Qt
|
||||
|
||||
Install Qt `5.15.2` from [the open-source Qt installer](https://www.qt.io/download).
|
||||
|
||||
### 2. Get static Boost
|
||||
|
||||
We'll install boost under `/Users/$USER/build/boost/`
|
||||
|
||||
```bash
|
||||
mkdir -p "/Users/$USER/build/boost"
|
||||
|
||||
wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz && \
|
||||
echo "9995e192e68528793755692917f9eb6422f3052a53c5e13ba278a228af6c7acf boost_1_73_0.tar.gz" | sha256sum -c && \
|
||||
tar -xzf boost_1_73_0.tar.gz && \
|
||||
rm boost_1_73_0.tar.gz && \
|
||||
cd boost_1_73_0
|
||||
|
||||
./bootstrap.sh --without-icu
|
||||
./b2 --disable-icu --with-atomic --with-system --with-filesystem --with-thread \
|
||||
--with-date_time --with-chrono --with-regex --with-serialization \
|
||||
--with-program_options --with-locale variant=release link=static \
|
||||
runtime-link=static cxxflags='-std=c++11' install -a --prefix="/Users/$USER/build/boost/"
|
||||
```
|
||||
|
||||
### 3. Get static Tor
|
||||
|
||||
1. Download the official Tor Browser `.dmg`
|
||||
2. Steal `tor.real` and `libevent-2.1.7.dylib` from the `.dmg`
|
||||
3. Place them both in `src/assets/exec/`
|
||||
- `src/assets/exec/tor`
|
||||
- `src/assets/exec/libevent-2.1.7.dylib`
|
||||
|
||||
### 4. Get static Tor
|
||||
|
||||
```bash
|
||||
CMAKE_PREFIX_PATH=/Users/dsc/Qt5.15.2/5.15.2/clang_64 TOR_BIN="foo" make -j10 mac-release
|
||||
```
|
||||
|
||||
Resulting *static* Mac OS package: `build/bin/wowlet.app`
|
||||
|
||||
## method 3 (from source, WIP, does not work yet)
|
||||
|
||||
Download Qt `https://download.qt.io/archive/qt/5.15/5.15.3/single/`, unpack it somewhere.
|
||||
|
||||
Patch Qt 5.15.3 source.
|
||||
|
||||
- Context: [#1](https://github.com/microsoft/vcpkg/pull/21056) [#2](https://code.qt.io/cgit/qt/qtbase.git/diff/?id=dece6f5840463ae2ddf927d65eb1b3680e34a547)
|
||||
|
||||
```
|
||||
diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
|
||||
index 5d4b6d6a71..cc7193d8b7 100644
|
||||
--- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
|
||||
+++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <qpa/qplatformgraphicsbuffer.h>
|
||||
#include <private/qcore_mac_p.h>
|
||||
|
||||
+#include <CoreGraphics/CGColorSpace.h>
|
||||
#include <IOSurface/IOSurface.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
```
|
||||
|
||||
Build Qt:
|
||||
|
||||
```bash
|
||||
./configure -prefix $PWD/qtbase -release -opensource -confirm-license -ccache \
|
||||
-no-dbus -no-sql-sqlite -no-use-gold-linker -no-kms \
|
||||
-qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \
|
||||
-skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d \
|
||||
-skip qtdoc -skip qtquickcontrols -skip qtquickcontrols2 -skip qtspeech -skip qtgamepad \
|
||||
-skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing -optimize-size \
|
||||
-skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools \
|
||||
-skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebview \
|
||||
-skip qtwinextras -skip qtx11extras -skip gamepad -skip serialbus -skip location -skip webengine -skip qtdeclarative \
|
||||
-no-feature-cups -no-feature-ftp -no-feature-pdf -no-feature-animation -nomake examples -nomake tests -nomake tools
|
||||
|
||||
./configure -prefix $PWD/qtbase -release -nomake examples -nomake tests -skip qtwebchannel -skip qtpurchasing -skip webengine -skip qtwebview
|
||||
make -j 4
|
||||
```
|
||||
|
||||
Problem: QtQuick does not seem to be compiled, `Qt5QuickConfig.cmake` missing.
|
||||
|
||||
Build:
|
||||
|
||||
```bash
|
||||
CMAKE_PREFIX_PATH=/Users/$USER/Downloads/qt-everywhere-src-5.15.3/qtbase/ make -j4 mac
|
||||
```
|
||||
|
||||
+9
-16
@@ -22,6 +22,8 @@ by running this command: `pandoc wowlet.1.md -s -t man -o wowlet.1 && gzip wowle
|
||||
|
||||
## Requirements
|
||||
|
||||
(Possibly out-of-date)
|
||||
|
||||
### Ubuntu/Debian
|
||||
|
||||
```bash
|
||||
@@ -40,29 +42,20 @@ protobuf libgcrypt qrencode ccache cmake pkgconfig git
|
||||
|
||||
## CMake
|
||||
|
||||
After installing Qt you might have a folder called `/home/$user/Qt/`. You need to pass this to CMake
|
||||
After installing Qt you might have a folder called `/home/$USER/Qt/`. You need to pass this to CMake
|
||||
via the `CMAKE_PREFIX_PATH` definition.
|
||||
|
||||
```
|
||||
-DCMAKE_PREFIX_PATH=/home/$user/QtNew/5.15.0/gcc_64
|
||||
-DCMAKE_PREFIX_PATH=/home/$USER/QtFooBar/5.15.0/gcc_64
|
||||
```
|
||||
|
||||
There are some Wownero/WOWlet related options/definitions that you may pass:
|
||||
There are some Wownero/WOWlet related options/definitions that you may pass, see also `CMakeLists.txt`.
|
||||
|
||||
- `-DXMRIG=OFF` - disable XMRig feature
|
||||
- `-DTOR_BIN=/path/to/tor` - Embed a Tor executable inside WOWlet
|
||||
- `-DDONATE_BEG=OFF` - disable the dreaded donate requests
|
||||
At a bare minimum, recommended:
|
||||
|
||||
And:
|
||||
`-DMANUAL_SUBMODULES=1 -DUSE_DEVICE_TREZOR=OFF -DUSE_SINGLE_BUILDDIR=ON -DDEV_MODE=ON`
|
||||
|
||||
```
|
||||
-DMANUAL_SUBMODULES=1
|
||||
-DUSE_DEVICE_TREZOR=OFF
|
||||
-DUSE_SINGLE_BUILDDIR=ON
|
||||
-DDEV_MODE=ON
|
||||
```
|
||||
|
||||
If you have OpenSSL installed in a custom location, try:
|
||||
If you have OpenSSL installed at a custom location, try:
|
||||
|
||||
```
|
||||
-DOPENSSL_INCLUDE_DIR=/usr/local/lib/openssl-1.1.1g/include
|
||||
@@ -85,7 +78,7 @@ Enable debugging symbols:
|
||||
## Wowlet
|
||||
|
||||
It's best to install Tor locally as a service and start `wowlet` with `--use-local-tor`, this
|
||||
prevents the child process from starting up and saves time.
|
||||
prevents the child process from starting up each time you launch WOWlet and thus saves time.
|
||||
|
||||
#### Ubuntu/Debian
|
||||
|
||||
|
||||
+72
-30
@@ -2,14 +2,9 @@ set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
# pthread
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if(QML)
|
||||
# PNG
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
endif()
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
|
||||
# Compile these source files (.h/.cpp)
|
||||
file(GLOB SOURCE_FILES
|
||||
@@ -67,7 +62,6 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-deprecated-declarations
|
||||
add_subdirectory(libwalletqt)
|
||||
add_subdirectory(model)
|
||||
add_subdirectory(utils)
|
||||
add_subdirectory(openpgp)
|
||||
|
||||
if(WITH_SCANNER)
|
||||
add_subdirectory(QR-Code-scanner)
|
||||
@@ -145,7 +139,9 @@ target_include_directories(wowlet PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tor
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qrcode
|
||||
${X11_INCLUDE_DIR}
|
||||
${QRENCODE_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${Iconv_INCLUDE_DIRS}
|
||||
${OPENSSL_INCLUDE_DIR}
|
||||
${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
@@ -156,12 +152,15 @@ target_include_directories(wowlet PUBLIC
|
||||
${Qt5WebSockets_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(OPENVR)
|
||||
target_include_directories(wowlet PUBLIC ${CMAKE_SOURCE_DIR}/contrib/)
|
||||
if(LINUX_ACTIVATION)
|
||||
target_include_directories(wowlet PUBLIC
|
||||
${CAIRO_INCLUDE_DIRS}
|
||||
${XFIXES_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(DONATE_BEG)
|
||||
target_compile_definitions(wowlet PRIVATE DONATE_BEG=1)
|
||||
if(OPENVR)
|
||||
target_include_directories(wowlet PUBLIC ${CMAKE_SOURCE_DIR}/contrib/)
|
||||
endif()
|
||||
|
||||
if(TOR_BIN)
|
||||
@@ -189,8 +188,8 @@ if(STATIC)
|
||||
target_compile_definitions(wowlet PRIVATE STATIC=1)
|
||||
endif()
|
||||
|
||||
if(STATIC)
|
||||
target_compile_definitions(wowlet PRIVATE STATIC=1)
|
||||
if(LINUX_ACTIVATION)
|
||||
target_compile_definitions(wowlet PRIVATE LINUX_ACTIVATION=1)
|
||||
endif()
|
||||
|
||||
if("$ENV{DRONE}" STREQUAL "true")
|
||||
@@ -226,9 +225,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
|
||||
if(UNIX AND NOT APPLE)
|
||||
# https://stackoverflow.com/questions/57766620/cmake-add-library-doesnt-initialize-static-global-variable
|
||||
# so that contrib/monero-seed/src/gf_elem.cpp properly initializes. A better solution is welcome.
|
||||
target_link_libraries(wowlet PUBLIC -Wl,--whole-archive monero-seed::monero-seed -Wl,--no-whole-archive)
|
||||
target_link_libraries(wowlet PUBLIC -Wl,--whole-archive wownero-seed::wownero-seed -Wl,--no-whole-archive)
|
||||
else()
|
||||
target_link_libraries(wowlet PUBLIC monero-seed::monero-seed)
|
||||
target_link_libraries(wowlet PUBLIC wownero-seed::wownero-seed)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
@@ -246,6 +245,8 @@ target_link_libraries(wowlet PUBLIC
|
||||
${Boost_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
${CMAKE_DL_LIBS}
|
||||
${Iconv_LIBRARIES}
|
||||
/usr/local/lib/libunbound.a
|
||||
${EXTRA_LIBRARIES})
|
||||
|
||||
# Link Qt libraries
|
||||
@@ -293,12 +294,19 @@ endif()
|
||||
|
||||
# Link random other stuff
|
||||
target_link_libraries(wowlet PUBLIC
|
||||
${ICU_LIBRARIES}
|
||||
openpgp
|
||||
Threads::Threads
|
||||
${QRENCODE_LIBRARY}
|
||||
)
|
||||
|
||||
# Link Cairo and Xfixes
|
||||
if(LINUX_ACTIVATION)
|
||||
target_link_libraries(wowlet PUBLIC
|
||||
${CAIRO_LIBRARIES}
|
||||
${XFIXES_LIBRARY}
|
||||
${X11_Xinerama_LIB}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Link scanner
|
||||
if(WITH_SCANNER)
|
||||
target_link_libraries(wowlet PUBLIC qrdecoder qrscanner)
|
||||
@@ -361,15 +369,49 @@ install(TARGETS wowlet
|
||||
)
|
||||
|
||||
|
||||
message(STATUS "=============================================")
|
||||
message(STATUS "VERSION_MAJOR: ${VERSION_MAJOR}")
|
||||
message(STATUS "VERSION_MINOR: ${VERSION_MINOR}")
|
||||
message(STATUS "VERSION_REVISION: ${VERSION_REVISION}")
|
||||
message(STATUS "STATIC: ${STATIC}")
|
||||
message(STATUS "VERSION: ${VERSION}")
|
||||
message(STATUS "Include Valve's OpenVR library: ${OPENVR}")
|
||||
message(STATUS "This build is for Android: ${ANDROID}")
|
||||
message(STATUS "This build is for testing the Android app on desktop: ${ANDROID_DEBUG}")
|
||||
message(STATUS "TOR_BIN: ${TOR_BIN}")
|
||||
message(STATUS "DONATE_BEG: ${DONATE_BEG}")
|
||||
message(STATUS "=============================================")
|
||||
message(STATUS "\n====================================== SUMMARY")
|
||||
if(GIT_FOUND)
|
||||
execute_process(COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wownero OUTPUT_VARIABLE _WOWNERO_HEAD OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT _WOWNERO_HEAD STREQUAL WOWNERO_HEAD)
|
||||
message(STATUS "[+] WOWNERO HEAD: ${_WOWNERO_HEAD} ... while CMake requested ${WOWNERO_HEAD}")
|
||||
else()
|
||||
message(STATUS "[+] WOWNERO HEAD: ${WOWNERO_HEAD}")
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "[+] VERSION: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}-${VERSION}")
|
||||
message(STATUS "[+] STATIC: ${STATIC}")
|
||||
message(STATUS "[+] Include Valve's OpenVR library: ${OPENVR}")
|
||||
message(STATUS "[+] This build is for Android: ${ANDROID}")
|
||||
message(STATUS "[+] This build is for testing the Android app on desktop: ${ANDROID_DEBUG}")
|
||||
message(STATUS "[+] TOR_BIN: ${TOR_BIN}")
|
||||
message(STATUS "[+] LINUX_ACTIVATION: ${LINUX_ACTIVATION}")
|
||||
|
||||
message(STATUS "[+] OpenSSL")
|
||||
message(STATUS " - version: ${OPENSSL_VERSION}")
|
||||
message(STATUS " - dirs: ${OPENSSL_INCLUDE_DIR}")
|
||||
message(STATUS " - libs: ${OPENSSL_LIBRARIES} ${OPENSSL_SSL_LIBRARIES}")
|
||||
|
||||
if(CAIRO_FOUND)
|
||||
message(STATUS "[+] Cairo")
|
||||
message(STATUS " - version: ${CAIRO_VERSION}")
|
||||
message(STATUS " - dirs: ${CAIRO_INCLUDE_DIRS}")
|
||||
message(STATUS " - libs: ${CAIRO_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if(XFIXES_FOUND)
|
||||
message(STATUS "[+] Xfixes")
|
||||
message(STATUS " - dirs: ${XFIXES_INCLUDE_DIR}")
|
||||
message(STATUS " - libs: ${XFIXES_LIBRARY}")
|
||||
endif()
|
||||
|
||||
message(STATUS "[+] Boost")
|
||||
message(STATUS " - version: ${Boost_VERSION}")
|
||||
message(STATUS " - dirs: ${Boost_INCLUDE_DIRS}")
|
||||
message(STATUS " - libs: ${Boost_LIBRARIES}")
|
||||
|
||||
if(Iconv_FOUND)
|
||||
message(STATUS "[+] Iconv")
|
||||
message(STATUS " - version: ${Iconv_VERSION}")
|
||||
message(STATUS " - libs: ${Iconv_LIBRARIES}")
|
||||
message(STATUS " - dirs: ${Iconv_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
+9
-32
@@ -334,6 +334,7 @@ void AppContext::onPreferredFiatCurrencyChanged(const QString &symbol) {
|
||||
auto *model = this->currentWallet->transactionHistoryModel();
|
||||
if(model != nullptr) {
|
||||
model->preferredFiatSymbol = symbol;
|
||||
this->currentWallet->transactionHistoryModel()->transactionHistory()->calcFiatInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,6 +380,13 @@ void AppContext::onWalletOpened(Wallet *wallet) {
|
||||
connect(this->currentWallet, &Wallet::heightRefreshed, this, &AppContext::onHeightRefreshed);
|
||||
connect(this->currentWallet, &Wallet::transactionCreated, this, &AppContext::onTransactionCreated);
|
||||
|
||||
this->currentWallet->historyModel(); // load historyModel
|
||||
auto *txHistory = this->currentWallet->history();
|
||||
txHistory->refresh(this->currentWallet->currentSubaddressAccount());
|
||||
|
||||
connect(AppContext::prices, &Prices::fiatPricesUpdated, txHistory, &TransactionHistory::calcFiatInfo);
|
||||
connect(AppContext::prices, &Prices::cryptoPricesUpdated, txHistory, &TransactionHistory::calcFiatInfo);
|
||||
|
||||
emit walletOpened(wallet);
|
||||
|
||||
connect(this->currentWallet, &Wallet::connectionStatusChanged, [this]{
|
||||
@@ -387,10 +395,6 @@ void AppContext::onWalletOpened(Wallet *wallet) {
|
||||
this->nodes->connectToNode();
|
||||
this->updateBalance();
|
||||
|
||||
#ifdef DONATE_BEG
|
||||
this->donateBeg();
|
||||
#endif
|
||||
|
||||
// force trigger preferredFiat signal for history model
|
||||
this->onPreferredFiatCurrencyChanged(config()->get(Config::preferredFiatCurrency).toString());
|
||||
this->setWindowTitle();
|
||||
@@ -656,7 +660,7 @@ void AppContext::createWallet(WowletSeed seed, const QString &path, const QStrin
|
||||
wallet = this->walletManager->createDeterministicWalletFromSpendKey(path, password, seed.language, this->networkType, seed.spendKey, seed.restoreHeight, this->kdfRounds);
|
||||
wallet->setCacheAttribute("wowlet.seed", seed.mnemonic.join(" "));
|
||||
}
|
||||
if (seed.seedType == SeedType::MONERO) {
|
||||
if (seed.seedType == SeedType::WOWNERO) {
|
||||
wallet = this->walletManager->recoveryWallet(path, password, seed.mnemonic.join(" "), "", this->networkType, seed.restoreHeight, this->kdfRounds);
|
||||
}
|
||||
|
||||
@@ -778,21 +782,6 @@ void AppContext::onOpenAliasResolve(const QString &openAlias) {
|
||||
emit openAliasResolveError(msg);
|
||||
}
|
||||
|
||||
void AppContext::donateBeg() {
|
||||
if(this->currentWallet == nullptr) return;
|
||||
if(this->networkType != NetworkType::Type::MAINNET) return;
|
||||
if(this->currentWallet->viewOnly()) return;
|
||||
|
||||
auto donationCounter = config()->get(Config::donateBeg).toInt();
|
||||
if(donationCounter == -1)
|
||||
return; // previously donated
|
||||
|
||||
donationCounter += 1;
|
||||
if (donationCounter % m_donationBoundary == 0)
|
||||
emit donationNag();
|
||||
config()->set(Config::donateBeg, donationCounter);
|
||||
}
|
||||
|
||||
AppContext::~AppContext() {}
|
||||
|
||||
// ############################################## LIBWALLET QT #########################################################
|
||||
@@ -867,12 +856,6 @@ void AppContext::onHeightRefreshed(quint64 walletHeight, quint64 daemonHeight, q
|
||||
}
|
||||
|
||||
void AppContext::onTransactionCreated(PendingTransaction *tx, const QVector<QString> &address) {
|
||||
for (auto &addr : address) {
|
||||
if (addr == this->donationAddress) {
|
||||
this->donationSending = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Let UI know that the transaction was constructed
|
||||
emit endTransaction();
|
||||
|
||||
@@ -962,12 +945,6 @@ void AppContext::onTransactionCommitted(bool status, PendingTransaction *tx, con
|
||||
this->updateBalance();
|
||||
|
||||
emit transactionCommitted(status, tx, txid);
|
||||
|
||||
// this tx was a donation to WOWlet, stop our nagging
|
||||
if(this->donationSending) {
|
||||
this->donationSending = false;
|
||||
config()->set(Config::donateBeg, -1);
|
||||
}
|
||||
}
|
||||
|
||||
void AppContext::storeWallet() {
|
||||
|
||||
@@ -51,7 +51,6 @@ public:
|
||||
// Donation config
|
||||
const QString donationAddress = "Wo3MWeKwtA918DU4c69hVSNgejdWFCRCuWjShRY66mJkU2Hv58eygJWDJS1MNa2Ge5M1WjUkGHuLqHkweDxwZZU42d16v94mP";
|
||||
const int donationAmount = 25; // euro
|
||||
bool donationSending = false;
|
||||
|
||||
QCommandLineParser *cmdargs;
|
||||
|
||||
@@ -129,7 +128,6 @@ public:
|
||||
Q_INVOKABLE void initTor();
|
||||
Q_INVOKABLE void initWS();
|
||||
void initRestoreHeights();
|
||||
void donateBeg();
|
||||
void refreshModels();
|
||||
void setWindowTitle(bool mining = false);
|
||||
|
||||
|
||||
@@ -232,6 +232,9 @@
|
||||
<file alias="mining/bottom_center_console.png">assets/images/mining/bottom_center_console.png</file>
|
||||
<file alias="mining/intel.png">assets/images/mining/intel.png</file>
|
||||
<file alias="mining/amd.png">assets/images/mining/amd.png</file>
|
||||
<file alias="mining/overlay.png">assets/images/mining/overlay.png</file>
|
||||
<file alias="mining/mining_gradient.png">assets/images/mining/mining_gradient.png</file>
|
||||
<file alias="mining/bg1.gif">assets/images/mining/bg1.gif</file>
|
||||
<file alias="mining/lowerleft_circle.png">assets/images/mining/lowerleft_circle.png</file>
|
||||
<file alias="mining/lowerleft.png">assets/images/mining/lowerleft.png</file>
|
||||
<file alias="mining/lower_repeat.png">assets/images/mining/lower_repeat.png</file>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 440 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
+27
-5
@@ -1,13 +1,35 @@
|
||||
{
|
||||
"mainnet": {
|
||||
"tor": [
|
||||
"a2b6ain7ozgpxhzxkhl7vrnphrlvn4cqvibyhpcvyfbbgare6bm5m2yd.onion:18081"
|
||||
"v2admi6gbeprxnk6i2oscizhgy4v5ixu6iezkhj5udiwbfjjs2w7dnid.onion:34568",
|
||||
"awbibkoaa67jhuaqes4n2243gd6vtidjzqj2djukrubp2eudrmxr5mid.onion:34568",
|
||||
"7ftpbpp6rbgqi5kjmhyin46essnh3eqb3m3rhfi7r2fr33iwkeuer3yd.onion:34568",
|
||||
"j7rf2jcccizcp47y5moehguyuqdpg4lusk642sw4nayuruitqaqbc7ad.onion:34568",
|
||||
"aje53o5z5twne5q2ljw44zkahhsuhjtwaxuburxddbf7n4pfsj4rj6qd.onion:34568",
|
||||
"nepc4lxndsooj2akn7ofrj3ooqc25242obchcag6tw3f2mxrms2uuvyd.onion:34568",
|
||||
"666l2ajxqjgj5lskvbokvworjysgvqag4oitokjuy7wz6juisul4jqad.onion:34568",
|
||||
"ty7ppqozzodz75audgvkprekiiqsovbyrkfdjwadrkbe3etyzloatxad.onion:34568",
|
||||
"ewynwpnprbgqllv2syn3drjdrqkw7ehoeg73znelm6mevvmpddexsoqd.onion:34568",
|
||||
"mqkiqwmhhpqtzlrf26stv7jvtaudbyzkbg3lttkmvvvauzgtxm62tgyd.onion:34568",
|
||||
"zao3w6isidntdbnyee5ufs7fyzmv7wzchpw32i3uo5eldjwmo4bxg2qd.onion:34568"
|
||||
],
|
||||
"clearnet": [
|
||||
"wownero.fyi:34568",
|
||||
"wow.pwned.systems:34568",
|
||||
"de1.wownodes.com:34568",
|
||||
"global.wownodes.com:34568"
|
||||
"global.wownodes.com:34568",
|
||||
"super.fast.node.xmr.pm:34568",
|
||||
"node.wownero.club:34568",
|
||||
"node.suchwow.xyz:34568",
|
||||
"eu-west-1.wow.xmr.pm:34568",
|
||||
"eu-west-2.wow.xmr.pm:34568",
|
||||
"eu-west-3.wow.xmr.pm:34568",
|
||||
"eu-west-4.wow.xmr.pm:34568",
|
||||
"eu-west-5.wow.xmr.pm:34568",
|
||||
"eu-west-6.wow.xmr.pm:34568",
|
||||
"na-west-1.wow.xmr.pm:34568",
|
||||
"much.wow.such.money:34568",
|
||||
"very.wow.such.money:34568",
|
||||
"169.119.33.174:34568",
|
||||
"wow.bot.tips:34568",
|
||||
"idontwanttogototoronto.wow.fail:34568"
|
||||
]
|
||||
},
|
||||
"stagenet": {
|
||||
|
||||
@@ -32,6 +32,10 @@ ContactsWidget::ContactsWidget(QWidget *parent) :
|
||||
this->newContact();
|
||||
});
|
||||
|
||||
connect(ui->btn_addContact, &QPushButton::pressed, [this]{
|
||||
this->newContact();
|
||||
});
|
||||
|
||||
connect(ui->contacts, &QTreeView::customContextMenuRequested, [=](const QPoint & point){
|
||||
QModelIndex index = ui->contacts->indexAt(point);
|
||||
if (index.isValid()) {
|
||||
|
||||
+33
-12
@@ -6,17 +6,14 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>589</width>
|
||||
<height>416</height>
|
||||
<width>310</width>
|
||||
<height>283</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@@ -29,14 +26,38 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="search">
|
||||
<property name="placeholderText">
|
||||
<string>Search contacts...</string>
|
||||
<property name="verticalSpacing">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>9</number>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="search">
|
||||
<property name="placeholderText">
|
||||
<string>Search contacts...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_addContact">
|
||||
<property name="text">
|
||||
<string>New contact</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeView" name="contacts">
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
|
||||
@@ -32,6 +32,12 @@ TransactionInfo* TransactionHistory::transaction(const QString &id)
|
||||
return itr != m_tinfo.end() ? *itr : nullptr;
|
||||
}
|
||||
|
||||
void TransactionHistory::calcFiatInfo() {
|
||||
for(const auto &tx: m_tinfo) {
|
||||
tx->calcFiatInfo();
|
||||
}
|
||||
}
|
||||
|
||||
void TransactionHistory::refresh(quint32 accountIndex)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
|
||||
@@ -39,6 +39,9 @@ public:
|
||||
quint64 minutesToUnlock() const;
|
||||
bool locked() const;
|
||||
|
||||
public slots:
|
||||
void calcFiatInfo();
|
||||
|
||||
signals:
|
||||
void refreshStarted() const;
|
||||
void refreshFinished() const;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "libwalletqt/WalletManager.h"
|
||||
#include "Transfer.h"
|
||||
#include "Ring.h"
|
||||
#include "globals.h"
|
||||
#include "appcontext.h"
|
||||
|
||||
TransactionInfo::Direction TransactionInfo::direction() const
|
||||
{
|
||||
@@ -109,6 +111,21 @@ QDateTime TransactionInfo::timestamp() const
|
||||
return m_timestamp;
|
||||
}
|
||||
|
||||
QString TransactionInfo::currentPriceStr() const
|
||||
{
|
||||
return m_currentPriceStr;
|
||||
}
|
||||
|
||||
QString TransactionInfo::historicalRateStr() const
|
||||
{
|
||||
return m_historicalRateStr;
|
||||
}
|
||||
|
||||
QString TransactionInfo::historicalPriceStr() const
|
||||
{
|
||||
return m_historicalPriceStr;
|
||||
}
|
||||
|
||||
QString TransactionInfo::date() const
|
||||
{
|
||||
return timestamp().date().toString(Qt::ISODate);
|
||||
@@ -161,6 +178,37 @@ QString TransactionInfo::rings_formatted() const
|
||||
return rings;
|
||||
}
|
||||
|
||||
void TransactionInfo::calcFiatInfo() {
|
||||
auto const hash = this->hash();
|
||||
auto timestamp = this->timestamp().toString("yyyyMMdd");
|
||||
|
||||
if(!AppContext::prices->markets.contains("WOW"))
|
||||
return;
|
||||
|
||||
double fiat_rate = AppContext::prices->markets["WOW"].price_usd;
|
||||
double historical_fiat_rate = AppContext::txFiatHistory->get(timestamp);
|
||||
if (historical_fiat_rate == 0.0)
|
||||
return;
|
||||
|
||||
auto const preferredFiat = config()->get(Config::preferredFiatCurrency).toString();
|
||||
|
||||
if(preferredFiat != "USD") {
|
||||
historical_fiat_rate = AppContext::prices->convert(
|
||||
"USD", preferredFiat, historical_fiat_rate);
|
||||
fiat_rate = AppContext::prices->convert(
|
||||
"USD", preferredFiat, fiat_rate);
|
||||
}
|
||||
|
||||
double balance = (this->balanceDelta() / globals::cdiv);
|
||||
|
||||
m_historicalRate = historical_fiat_rate;
|
||||
m_historicalPrice = historical_fiat_rate * balance;
|
||||
m_currentPrice = fiat_rate * balance;
|
||||
m_historicalPriceStr = Utils::amountToCurrencyString(m_historicalPrice, preferredFiat, 2);
|
||||
m_historicalRateStr = Utils::amountToCurrencyString(m_historicalRate, preferredFiat, 5);
|
||||
m_currentPriceStr = Utils::amountToCurrencyString(m_currentPrice, preferredFiat, 2);
|
||||
}
|
||||
|
||||
TransactionInfo::TransactionInfo(const Monero::TransactionInfo *pimpl, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_amount(pimpl->amount())
|
||||
@@ -193,4 +241,6 @@ TransactionInfo::TransactionInfo(const Monero::TransactionInfo *pimpl, QObject *
|
||||
{
|
||||
m_subaddrIndex.insert(i);
|
||||
}
|
||||
|
||||
this->calcFiatInfo();
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@ public:
|
||||
QDateTime timestamp() const;
|
||||
QString date() const;
|
||||
QString time() const;
|
||||
QString currentPriceStr() const;
|
||||
QString historicalRateStr() const;
|
||||
QString historicalPriceStr() const;
|
||||
QString paymentId() const;
|
||||
//! only applicable for output transactions
|
||||
//! used in tx details popup
|
||||
@@ -79,6 +82,9 @@ public:
|
||||
QList<Transfer*> transfers() const;
|
||||
QString rings_formatted() const;
|
||||
|
||||
public slots:
|
||||
void calcFiatInfo();
|
||||
|
||||
private:
|
||||
explicit TransactionInfo(const Monero::TransactionInfo *pimpl, QObject *parent = nullptr);
|
||||
private:
|
||||
@@ -102,6 +108,14 @@ private:
|
||||
QDateTime m_timestamp;
|
||||
quint64 m_unlockTime;
|
||||
bool m_coinbase;
|
||||
|
||||
double m_historicalPrice = 0.0;
|
||||
double m_historicalRate = 0.0;
|
||||
double m_currentPrice = 0.0;
|
||||
|
||||
QString m_currentPriceStr = "?";
|
||||
QString m_historicalRateStr = "?";
|
||||
QString m_historicalPriceStr = "?";
|
||||
};
|
||||
|
||||
#endif // TRANSACTIONINFO_H
|
||||
|
||||
+23
-10
@@ -4,6 +4,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
#include <QDesktopWidget>
|
||||
#include <QCoreApplication>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMessageBox>
|
||||
@@ -27,6 +28,7 @@
|
||||
#include "globals.h"
|
||||
#include "config-wowlet.h"
|
||||
#include "utils/ColorScheme.h"
|
||||
#include "utils/activate_linux.h"
|
||||
|
||||
// libwalletqt
|
||||
#include "libwalletqt/AddressBook.h"
|
||||
@@ -273,15 +275,11 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
|
||||
}
|
||||
}
|
||||
|
||||
if(config()->get(Config::warnOnAlpha).toBool()) {
|
||||
QString warning = "WOWlet is currently in beta.\n\nPlease report any bugs "
|
||||
"you encounter on our Git repository, IRC freenode #wownero or on /r/Wownero.";
|
||||
QMessageBox::warning(this, "Beta Warning", warning);
|
||||
config()->set(Config::warnOnAlpha, false);
|
||||
}
|
||||
|
||||
// settings connects
|
||||
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, this, &MainWindow::onUpdateFiatBalanceWidget);
|
||||
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, this, &MainWindow::onUpdateWowWidget);
|
||||
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, this, &MainWindow::onUpdateBTCWidget);
|
||||
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, this, &MainWindow::onUpdateXMRWidget);
|
||||
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, m_ctx, &AppContext::onPreferredFiatCurrencyChanged);
|
||||
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, ui->suchWowWidget, &SuchWowWidget::onPreferredFiatCurrencyChanged);
|
||||
connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, ui->sendWidget, QOverload<>::of(&SendWidget::onPreferredFiatCurrencyChanged));
|
||||
@@ -363,6 +361,13 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
|
||||
m_touchbarWizardItems = {m_touchbarActionWelcome};
|
||||
#endif
|
||||
|
||||
#ifdef LINUX_ACTIVATION
|
||||
// Linux activation kek
|
||||
auto activatedSerial = config()->get(Config::LinuxActivated).toString();
|
||||
if(activatedSerial.isEmpty())
|
||||
LinuxActivator::start();
|
||||
#endif
|
||||
|
||||
// setup some UI
|
||||
this->initMain();
|
||||
this->initWidgets();
|
||||
@@ -1110,8 +1115,11 @@ void MainWindow::suchDonate(const QString address) {
|
||||
}
|
||||
|
||||
void MainWindow::onViewOnBlockExplorer(const QString &txid) {
|
||||
QString blockExplorerLink = Utils::blockExplorerLink(config()->get(Config::blockExplorer).toString(), m_ctx->networkType, txid);
|
||||
Utils::externalLinkWarning(this, blockExplorerLink);
|
||||
QString blockExplorerLink = Utils::blockExplorerLink(txid);
|
||||
if(!blockExplorerLink.isEmpty())
|
||||
Utils::externalLinkWarning(this, blockExplorerLink);
|
||||
else
|
||||
QMessageBox::warning(this, "Error", "Could not generate block explorer URL");
|
||||
}
|
||||
|
||||
void MainWindow::onResendTransaction(const QString &txid) {
|
||||
@@ -1408,7 +1416,12 @@ void MainWindow::onUpdateWowWidget() {
|
||||
}
|
||||
|
||||
auto wowObj = AppContext::prices->markets["WOW"];
|
||||
auto currencyText = Utils::amountToCurrencyString(wowObj.price_usd, fiatCurrency);
|
||||
|
||||
double amount = wowObj.price_usd;
|
||||
if(fiatCurrency != "USD")
|
||||
amount = AppContext::prices->convert("USD", fiatCurrency, amount);
|
||||
|
||||
auto currencyText = Utils::amountToCurrencyString(amount, fiatCurrency, 5);
|
||||
m_tickerWOW->setFiatText(currencyText);
|
||||
|
||||
auto pct24h = AppContext::prices->markets["WOW"].price_usd_change_pct_24h;
|
||||
|
||||
@@ -53,10 +53,10 @@ int TransactionHistoryModel::columnCount(const QModelIndex &parent) const {
|
||||
|
||||
// When wowlet is in QtWidgets mode, it will only use the first 5 columns,
|
||||
// the rest should be hidden, because it shows in the GUI. So by default we'll
|
||||
// use 5 as column count. When in QtQuick (QML) mode, we want to expose more columns
|
||||
// use 6 as column count. When in QtQuick (QML) mode, we want to expose more columns
|
||||
// so we can change the column count here.
|
||||
|
||||
return AppContext::isQML ? this->COUNT : 5;
|
||||
return AppContext::isQML ? this->COUNT : 7;
|
||||
}
|
||||
|
||||
QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const {
|
||||
@@ -76,7 +76,9 @@ QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const
|
||||
else if (role == Qt::TextAlignmentRole) {
|
||||
switch (index.column()) {
|
||||
case TransactionInfoRole::Amount:
|
||||
case TransactionInfoRole::FiatAmount:
|
||||
case TransactionInfoRole::HistoricalPrice:
|
||||
case TransactionInfoRole::HistoricalRate:
|
||||
case TransactionInfoRole::CurrentPrice:
|
||||
result = Qt::AlignRight;
|
||||
}
|
||||
}
|
||||
@@ -118,7 +120,6 @@ QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
else if (role == Qt::ForegroundRole) {
|
||||
switch(index.column()) {
|
||||
case TransactionInfoRole::FiatAmount:
|
||||
case TransactionInfoRole::Amount:
|
||||
{
|
||||
if (tInfo.direction() == TransactionInfo::Direction_Out) {
|
||||
@@ -170,18 +171,16 @@ QVariant TransactionHistoryModel::parseTransactionInfo(const TransactionInfo &tI
|
||||
}
|
||||
case TransactionInfoRole::TxID:
|
||||
return tInfo.hash();
|
||||
case TransactionInfoRole::FiatAmount:
|
||||
case TransactionInfoRole::HistoricalRate: {
|
||||
return tInfo.historicalRateStr();
|
||||
}
|
||||
case TransactionInfoRole::HistoricalPrice:
|
||||
{
|
||||
double usd_price = AppContext::txFiatHistory->get(tInfo.timestamp().toString("yyyyMMdd"));
|
||||
if (usd_price == 0.0)
|
||||
return QVariant("?");
|
||||
|
||||
double usd_amount = usd_price * (tInfo.balanceDelta() / globals::cdiv);
|
||||
if(this->preferredFiatSymbol != "USD")
|
||||
usd_amount = AppContext::prices->convert("USD", this->preferredFiatSymbol, usd_amount);
|
||||
double fiat_rounded = ceil(Utils::roundSignificant(usd_amount, 3) * 100.0) / 100.0;
|
||||
|
||||
return QString("%1").arg(Utils::amountToCurrencyString(fiat_rounded, this->preferredFiatSymbol));
|
||||
return tInfo.historicalPriceStr();
|
||||
}
|
||||
case TransactionInfoRole::CurrentPrice:
|
||||
{
|
||||
return tInfo.currentPriceStr();
|
||||
}
|
||||
default:
|
||||
{
|
||||
@@ -206,8 +205,12 @@ QVariant TransactionHistoryModel::headerData(int section, Qt::Orientation orient
|
||||
return QString("Amount");
|
||||
case TransactionInfoRole::TxID:
|
||||
return QString("Txid");
|
||||
case TransactionInfoRole::FiatAmount:
|
||||
return QString("Fiat");
|
||||
case TransactionInfoRole::HistoricalPrice:
|
||||
return QString("Historical price");
|
||||
case TransactionInfoRole::HistoricalRate:
|
||||
return QString("Historical rate");
|
||||
case TransactionInfoRole::CurrentPrice:
|
||||
return QString("Current price");
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ public:
|
||||
Description,
|
||||
Amount,
|
||||
TxID,
|
||||
FiatAmount,
|
||||
HistoricalPrice,
|
||||
HistoricalRate,
|
||||
CurrentPrice,
|
||||
TransactionIsOutRole,
|
||||
TransactionFailedRole,
|
||||
TransactionPendingRole,
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
file(GLOB_RECURSE SOURCES *.cpp)
|
||||
file(GLOB_RECURSE HEADERS *.h)
|
||||
|
||||
find_library(GCRYPT_LIBRARY gcrypt)
|
||||
find_library(GPG_ERROR_LIBRARY gpg-error)
|
||||
|
||||
add_library(openpgp
|
||||
${SOURCES}
|
||||
${HEADERS})
|
||||
|
||||
find_package(GCrypt)
|
||||
target_include_directories(openpgp PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/monero/contrib/epee/include
|
||||
${GCRYPT_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(openpgp
|
||||
PUBLIC
|
||||
epee
|
||||
${GCRYPT_LIBRARY}
|
||||
${GPG_ERROR_LIBRARY})
|
||||
@@ -1,107 +0,0 @@
|
||||
// Copyright (c) 2020-2021, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <gcrypt.h>
|
||||
#include <span.h>
|
||||
|
||||
namespace openpgp
|
||||
{
|
||||
|
||||
class hash
|
||||
{
|
||||
public:
|
||||
enum algorithm : uint8_t
|
||||
{
|
||||
sha256 = 8,
|
||||
};
|
||||
|
||||
hash(const hash &) = delete;
|
||||
hash &operator=(const hash &) = delete;
|
||||
|
||||
hash(uint8_t algorithm)
|
||||
: algo(algorithm)
|
||||
, consumed(0)
|
||||
{
|
||||
if (gcry_md_open(&md, algo, 0) != GPG_ERR_NO_ERROR)
|
||||
{
|
||||
throw std::runtime_error("failed to create message digest object");
|
||||
}
|
||||
}
|
||||
|
||||
~hash()
|
||||
{
|
||||
gcry_md_close(md);
|
||||
}
|
||||
|
||||
hash &operator<<(uint8_t byte)
|
||||
{
|
||||
gcry_md_putc(md, byte);
|
||||
++consumed;
|
||||
return *this;
|
||||
}
|
||||
|
||||
hash &operator<<(const epee::span<const uint8_t> &bytes)
|
||||
{
|
||||
gcry_md_write(md, &bytes[0], bytes.size());
|
||||
consumed += bytes.size();
|
||||
return *this;
|
||||
}
|
||||
|
||||
hash &operator<<(const std::vector<uint8_t> &bytes)
|
||||
{
|
||||
return *this << epee::to_span(bytes);
|
||||
}
|
||||
|
||||
std::vector<uint8_t> finish() const
|
||||
{
|
||||
std::vector<uint8_t> result(gcry_md_get_algo_dlen(algo));
|
||||
const void *digest = gcry_md_read(md, algo);
|
||||
if (digest == nullptr)
|
||||
{
|
||||
throw std::runtime_error("failed to read the digest");
|
||||
}
|
||||
memcpy(&result[0], digest, result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t consumed_bytes() const
|
||||
{
|
||||
return consumed;
|
||||
}
|
||||
|
||||
private:
|
||||
const uint8_t algo;
|
||||
gcry_md_hd_t md;
|
||||
size_t consumed;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
// Copyright (c) 2020-2021, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gcrypt.h>
|
||||
|
||||
namespace openpgp
|
||||
{
|
||||
|
||||
class mpi
|
||||
{
|
||||
public:
|
||||
mpi(const mpi &) = delete;
|
||||
mpi &operator=(const mpi &) = delete;
|
||||
|
||||
mpi(mpi &&other)
|
||||
: data(other.data)
|
||||
{
|
||||
other.data = nullptr;
|
||||
}
|
||||
|
||||
template <
|
||||
typename byte_container,
|
||||
typename = typename std::enable_if<(sizeof(typename byte_container::value_type) == 1)>::type>
|
||||
mpi(const byte_container &buffer, gcry_mpi_format format = GCRYMPI_FMT_USG)
|
||||
: mpi(&buffer[0], buffer.size(), format)
|
||||
{
|
||||
}
|
||||
|
||||
mpi(const void *buffer, size_t size, gcry_mpi_format format = GCRYMPI_FMT_USG)
|
||||
{
|
||||
if (gcry_mpi_scan(&data, format, buffer, size, nullptr) != GPG_ERR_NO_ERROR)
|
||||
{
|
||||
throw std::runtime_error("failed to read mpi from buffer");
|
||||
}
|
||||
}
|
||||
|
||||
~mpi()
|
||||
{
|
||||
gcry_mpi_release(data);
|
||||
}
|
||||
|
||||
const gcry_mpi_t &get() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
private:
|
||||
gcry_mpi_t data;
|
||||
};
|
||||
|
||||
} // namespace openpgp
|
||||
@@ -1,378 +0,0 @@
|
||||
// Copyright (c) 2020-2021, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// 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.
|
||||
|
||||
#include "openpgp.h"
|
||||
|
||||
#include <locale>
|
||||
|
||||
#include <string_coding.h>
|
||||
|
||||
#include "hash.h"
|
||||
#include "mpi.h"
|
||||
#include "packet_stream.h"
|
||||
|
||||
namespace openpgp
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
std::string::const_iterator find_next_line(std::string::const_iterator begin, const std::string::const_iterator &end)
|
||||
{
|
||||
begin = std::find(begin, end, '\n');
|
||||
return begin != end ? ++begin : end;
|
||||
}
|
||||
|
||||
std::string::const_iterator find_line_starting_with(
|
||||
std::string::const_iterator it,
|
||||
const std::string::const_iterator &end,
|
||||
const std::string &starts_with)
|
||||
{
|
||||
for (std::string::const_iterator next_line; it != end; it = next_line)
|
||||
{
|
||||
next_line = find_next_line(it, end);
|
||||
const size_t line_length = static_cast<size_t>(std::distance(it, next_line));
|
||||
if (line_length >= starts_with.size() && std::equal(starts_with.begin(), starts_with.end(), it))
|
||||
{
|
||||
return it;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
}
|
||||
|
||||
std::string::const_iterator find_empty_line(std::string::const_iterator it, const std::string::const_iterator &end)
|
||||
{
|
||||
for (; it != end && *it != '\r' && *it != '\n'; it = find_next_line(it, end))
|
||||
{
|
||||
}
|
||||
return it;
|
||||
}
|
||||
|
||||
std::string get_armored_block_contents(const std::string &text, const std::string &block_name)
|
||||
{
|
||||
static constexpr const char dashes[] = "-----";
|
||||
const std::string armor_header = dashes + block_name + dashes;
|
||||
auto block_start = find_line_starting_with(text.begin(), text.end(), armor_header);
|
||||
auto block_headers = find_next_line(block_start, text.end());
|
||||
auto block_end = find_line_starting_with(block_headers, text.end(), dashes);
|
||||
auto contents_begin = find_next_line(find_empty_line(block_headers, block_end), block_end);
|
||||
if (contents_begin == block_end)
|
||||
{
|
||||
throw std::runtime_error("armored block not found");
|
||||
}
|
||||
return std::string(contents_begin, block_end);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
public_key_rsa::public_key_rsa(s_expression expression, size_t bits)
|
||||
: m_expression(std::move(expression))
|
||||
, m_bits(bits)
|
||||
{
|
||||
}
|
||||
|
||||
const gcry_sexp_t &public_key_rsa::get() const
|
||||
{
|
||||
return m_expression.get();
|
||||
}
|
||||
|
||||
size_t public_key_rsa::bits() const
|
||||
{
|
||||
return m_bits;
|
||||
}
|
||||
|
||||
public_key_block::public_key_block(const std::string &armored)
|
||||
: public_key_block(epee::to_byte_span(epee::to_span(epee::string_encoding::base64_decode(
|
||||
strip_line_breaks(get_armored_block_contents(armored, "BEGIN PGP PUBLIC KEY BLOCK"))))))
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: Public-Key expiration, User ID and Public-Key certification, Subkey binding checks
|
||||
public_key_block::public_key_block(const epee::span<const uint8_t> buffer)
|
||||
{
|
||||
packet_stream packets(buffer);
|
||||
|
||||
const std::vector<uint8_t> *data = packets.find_first(packet_tag::type::user_id);
|
||||
if (data == nullptr)
|
||||
{
|
||||
throw std::runtime_error("user id is missing");
|
||||
}
|
||||
m_user_id.assign(data->begin(), data->end());
|
||||
|
||||
const auto append_public_key = [this](const std::vector<uint8_t> &data) {
|
||||
deserializer<std::vector<uint8_t>> serialized(data);
|
||||
|
||||
const auto version = serialized.read_big_endian<uint8_t>();
|
||||
if (version != 4)
|
||||
{
|
||||
throw std::runtime_error("unsupported public key version");
|
||||
}
|
||||
|
||||
/* const auto timestamp = */ serialized.read_big_endian<uint32_t>();
|
||||
|
||||
const auto algorithm = serialized.read_big_endian<uint8_t>();
|
||||
if (algorithm != openpgp::algorithm::rsa)
|
||||
{
|
||||
throw std::runtime_error("unsupported public key algorithm");
|
||||
}
|
||||
|
||||
{
|
||||
const mpi public_key_n = serialized.read_mpi();
|
||||
const mpi public_key_e = serialized.read_mpi();
|
||||
|
||||
emplace_back(
|
||||
s_expression("(public-key (rsa (n %m) (e %m)))", public_key_n.get(), public_key_e.get()),
|
||||
gcry_mpi_get_nbits(public_key_n.get()));
|
||||
}
|
||||
};
|
||||
|
||||
data = packets.find_first(packet_tag::type::public_key);
|
||||
if (data == nullptr)
|
||||
{
|
||||
throw std::runtime_error("public key is missing");
|
||||
}
|
||||
append_public_key(*data);
|
||||
|
||||
packets.for_each(packet_tag::type::public_subkey, append_public_key);
|
||||
}
|
||||
|
||||
std::string public_key_block::user_id() const
|
||||
{
|
||||
return m_user_id;
|
||||
}
|
||||
|
||||
// TODO: Signature expiration check
|
||||
signature_rsa::signature_rsa(
|
||||
uint8_t algorithm,
|
||||
std::pair<uint8_t, uint8_t> hash_leftmost_bytes,
|
||||
uint8_t hash_algorithm,
|
||||
const std::vector<uint8_t> &hashed_data,
|
||||
type type,
|
||||
s_expression signature,
|
||||
uint8_t version)
|
||||
: m_hash_algorithm(hash_algorithm)
|
||||
, m_hash_leftmost_bytes(hash_leftmost_bytes)
|
||||
, m_hashed_appendix(format_hashed_appendix(algorithm, hash_algorithm, hashed_data, type, version))
|
||||
, m_signature(std::move(signature))
|
||||
, m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
signature_rsa signature_rsa::from_armored(const std::string &armored_signed_message)
|
||||
{
|
||||
return from_base64(get_armored_block_contents(armored_signed_message, "BEGIN PGP SIGNATURE"));
|
||||
}
|
||||
|
||||
signature_rsa signature_rsa::from_base64(const std::string &base64)
|
||||
{
|
||||
std::string decoded = epee::string_encoding::base64_decode(strip_line_breaks(base64));
|
||||
epee::span<const uint8_t> buffer(reinterpret_cast<const uint8_t *>(&decoded[0]), decoded.size());
|
||||
return from_buffer(buffer);
|
||||
}
|
||||
|
||||
signature_rsa signature_rsa::from_buffer(const epee::span<const uint8_t> input)
|
||||
{
|
||||
packet_stream packets(input);
|
||||
|
||||
const std::vector<uint8_t> *data = packets.find_first(packet_tag::type::signature);
|
||||
if (data == nullptr)
|
||||
{
|
||||
throw std::runtime_error("signature is missing");
|
||||
}
|
||||
|
||||
deserializer<std::vector<uint8_t>> buffer(*data);
|
||||
|
||||
const auto version = buffer.read_big_endian<uint8_t>();
|
||||
if (version != 4)
|
||||
{
|
||||
throw std::runtime_error("unsupported signature version");
|
||||
}
|
||||
|
||||
const auto signature_type = static_cast<type>(buffer.read_big_endian<uint8_t>());
|
||||
|
||||
const auto algorithm = buffer.read_big_endian<uint8_t>();
|
||||
if (algorithm != openpgp::algorithm::rsa)
|
||||
{
|
||||
throw std::runtime_error("unsupported signature algorithm");
|
||||
}
|
||||
|
||||
const auto hash_algorithm = buffer.read_big_endian<uint8_t>();
|
||||
|
||||
const auto hashed_data_length = buffer.read_big_endian<uint16_t>();
|
||||
std::vector<uint8_t> hashed_data = buffer.read(hashed_data_length);
|
||||
|
||||
const auto unhashed_data_length = buffer.read_big_endian<uint16_t>();
|
||||
buffer.read_span(unhashed_data_length);
|
||||
|
||||
std::pair<uint8_t, uint8_t> hash_leftmost_bytes{buffer.read_big_endian<uint8_t>(), buffer.read_big_endian<uint8_t>()};
|
||||
|
||||
const mpi signature = buffer.read_mpi();
|
||||
|
||||
return signature_rsa(
|
||||
algorithm,
|
||||
std::move(hash_leftmost_bytes),
|
||||
hash_algorithm,
|
||||
hashed_data,
|
||||
signature_type,
|
||||
s_expression("(sig-val (rsa (s %m)))", signature.get()),
|
||||
version);
|
||||
}
|
||||
|
||||
bool signature_rsa::verify(const epee::span<const uint8_t> message, const public_key_rsa &public_key) const
|
||||
{
|
||||
const s_expression signed_data = hash_message(message, public_key.bits());
|
||||
return gcry_pk_verify(m_signature.get(), signed_data.get(), public_key.get()) == 0;
|
||||
}
|
||||
|
||||
s_expression signature_rsa::hash_message(const epee::span<const uint8_t> message, size_t public_key_bits) const
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case type::binary_document:
|
||||
return hash_bytes(message, public_key_bits);
|
||||
case type::canonical_text_document:
|
||||
{
|
||||
std::vector<uint8_t> crlf_formatted;
|
||||
crlf_formatted.reserve(message.size());
|
||||
const size_t message_size = message.size();
|
||||
for (size_t offset = 0; offset < message_size; ++offset)
|
||||
{
|
||||
const auto &character = message[offset];
|
||||
if (character == '\r')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (character == '\n')
|
||||
{
|
||||
const bool skip_last_crlf = offset + 1 == message_size;
|
||||
if (skip_last_crlf)
|
||||
{
|
||||
break;
|
||||
}
|
||||
crlf_formatted.push_back('\r');
|
||||
}
|
||||
crlf_formatted.push_back(character);
|
||||
}
|
||||
return hash_bytes(epee::to_span(crlf_formatted), public_key_bits);
|
||||
}
|
||||
default:
|
||||
throw std::runtime_error("unsupported signature type");
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> signature_rsa::hash_asn_object_id() const
|
||||
{
|
||||
size_t size;
|
||||
if (gcry_md_algo_info(m_hash_algorithm, GCRYCTL_GET_ASNOID, nullptr, &size) != GPG_ERR_NO_ERROR)
|
||||
{
|
||||
throw std::runtime_error("failed to get ASN.1 Object Identifier (OID) size");
|
||||
}
|
||||
|
||||
std::vector<uint8_t> asn_object_id(size);
|
||||
if (gcry_md_algo_info(m_hash_algorithm, GCRYCTL_GET_ASNOID, &asn_object_id[0], &size) != GPG_ERR_NO_ERROR)
|
||||
{
|
||||
throw std::runtime_error("failed to get ASN.1 Object Identifier (OID)");
|
||||
}
|
||||
|
||||
return asn_object_id;
|
||||
}
|
||||
|
||||
s_expression signature_rsa::hash_bytes(const epee::span<const uint8_t> message, size_t public_key_bits) const
|
||||
{
|
||||
const std::vector<uint8_t> plain_hash = (hash(m_hash_algorithm) << message << m_hashed_appendix).finish();
|
||||
if (plain_hash.size() < 2)
|
||||
{
|
||||
throw std::runtime_error("insufficient message hash size");
|
||||
}
|
||||
if (plain_hash[0] != m_hash_leftmost_bytes.first || plain_hash[1] != m_hash_leftmost_bytes.second)
|
||||
{
|
||||
throw std::runtime_error("signature checksum doesn't match the expected value");
|
||||
}
|
||||
|
||||
std::vector<uint8_t> asn_object_id = hash_asn_object_id();
|
||||
|
||||
const size_t public_key_bytes = bits_to_bytes(public_key_bits);
|
||||
if (public_key_bytes < plain_hash.size() + asn_object_id.size() + 11)
|
||||
{
|
||||
throw std::runtime_error("insufficient public key bit length");
|
||||
}
|
||||
|
||||
std::vector<uint8_t> emsa_pkcs1_v1_5_encoded;
|
||||
emsa_pkcs1_v1_5_encoded.reserve(public_key_bytes);
|
||||
emsa_pkcs1_v1_5_encoded.push_back(0);
|
||||
emsa_pkcs1_v1_5_encoded.push_back(1);
|
||||
const size_t ps_size = public_key_bytes - plain_hash.size() - asn_object_id.size() - 3;
|
||||
emsa_pkcs1_v1_5_encoded.insert(emsa_pkcs1_v1_5_encoded.end(), ps_size, 0xff);
|
||||
emsa_pkcs1_v1_5_encoded.push_back(0);
|
||||
emsa_pkcs1_v1_5_encoded.insert(emsa_pkcs1_v1_5_encoded.end(), asn_object_id.begin(), asn_object_id.end());
|
||||
emsa_pkcs1_v1_5_encoded.insert(emsa_pkcs1_v1_5_encoded.end(), plain_hash.begin(), plain_hash.end());
|
||||
|
||||
mpi value(emsa_pkcs1_v1_5_encoded);
|
||||
return s_expression("(data (flags raw) (value %m))", value.get());
|
||||
}
|
||||
|
||||
std::vector<uint8_t> signature_rsa::format_hashed_appendix(
|
||||
uint8_t algorithm,
|
||||
uint8_t hash_algorithm,
|
||||
const std::vector<uint8_t> &hashed_data,
|
||||
uint8_t type,
|
||||
uint8_t version)
|
||||
{
|
||||
const uint16_t hashed_data_size = static_cast<uint16_t>(hashed_data.size());
|
||||
const uint32_t hashed_pefix_size = sizeof(version) + sizeof(type) + sizeof(algorithm) + sizeof(hash_algorithm) +
|
||||
sizeof(hashed_data_size) + hashed_data.size();
|
||||
|
||||
std::vector<uint8_t> appendix;
|
||||
appendix.reserve(hashed_pefix_size + sizeof(version) + sizeof(uint8_t) + sizeof(hashed_pefix_size));
|
||||
appendix.push_back(version);
|
||||
appendix.push_back(type);
|
||||
appendix.push_back(algorithm);
|
||||
appendix.push_back(hash_algorithm);
|
||||
appendix.push_back(static_cast<uint8_t>(hashed_data_size >> 8));
|
||||
appendix.push_back(static_cast<uint8_t>(hashed_data_size));
|
||||
appendix.insert(appendix.end(), hashed_data.begin(), hashed_data.end());
|
||||
appendix.push_back(version);
|
||||
appendix.push_back(0xff);
|
||||
appendix.push_back(static_cast<uint8_t>(hashed_pefix_size >> 24));
|
||||
appendix.push_back(static_cast<uint8_t>(hashed_pefix_size >> 16));
|
||||
appendix.push_back(static_cast<uint8_t>(hashed_pefix_size >> 8));
|
||||
appendix.push_back(static_cast<uint8_t>(hashed_pefix_size));
|
||||
|
||||
return appendix;
|
||||
}
|
||||
|
||||
message_armored::message_armored(const std::string &message_armored)
|
||||
: m_message(get_armored_block_contents(message_armored, "BEGIN PGP SIGNED MESSAGE"))
|
||||
{
|
||||
}
|
||||
|
||||
message_armored::operator epee::span<const uint8_t>() const
|
||||
{
|
||||
return epee::to_byte_span(epee::to_span(m_message));
|
||||
}
|
||||
|
||||
} // namespace openpgp
|
||||
@@ -1,127 +0,0 @@
|
||||
// Copyright (c) 2020-2021, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <gcrypt.h>
|
||||
|
||||
#include <span.h>
|
||||
|
||||
#include "s_expression.h"
|
||||
|
||||
namespace openpgp
|
||||
{
|
||||
|
||||
enum algorithm : uint8_t
|
||||
{
|
||||
rsa = 1,
|
||||
};
|
||||
|
||||
class public_key_rsa
|
||||
{
|
||||
public:
|
||||
public_key_rsa(s_expression expression, size_t bits);
|
||||
|
||||
size_t bits() const;
|
||||
const gcry_sexp_t &get() const;
|
||||
|
||||
private:
|
||||
s_expression m_expression;
|
||||
size_t m_bits;
|
||||
};
|
||||
|
||||
class public_key_block : public std::vector<public_key_rsa>
|
||||
{
|
||||
public:
|
||||
public_key_block(const std::string &armored);
|
||||
public_key_block(const epee::span<const uint8_t> buffer);
|
||||
|
||||
std::string user_id() const;
|
||||
|
||||
private:
|
||||
std::string m_user_id;
|
||||
};
|
||||
|
||||
class signature_rsa
|
||||
{
|
||||
public:
|
||||
enum type : uint8_t
|
||||
{
|
||||
binary_document = 0,
|
||||
canonical_text_document = 1,
|
||||
};
|
||||
|
||||
signature_rsa(
|
||||
uint8_t algorithm,
|
||||
std::pair<uint8_t, uint8_t> hash_leftmost_bytes,
|
||||
uint8_t hash_algorithm,
|
||||
const std::vector<uint8_t> &hashed_data,
|
||||
type type,
|
||||
s_expression signature,
|
||||
uint8_t version);
|
||||
|
||||
static signature_rsa from_armored(const std::string &armored_signed_message);
|
||||
static signature_rsa from_base64(const std::string &base64);
|
||||
static signature_rsa from_buffer(const epee::span<const uint8_t> input);
|
||||
|
||||
bool verify(const epee::span<const uint8_t> message, const public_key_rsa &public_key) const;
|
||||
|
||||
private:
|
||||
s_expression hash_message(const epee::span<const uint8_t> message, size_t public_key_bits) const;
|
||||
std::vector<uint8_t> hash_asn_object_id() const;
|
||||
s_expression hash_bytes(const epee::span<const uint8_t> message, size_t public_key_bits) const;
|
||||
|
||||
static std::vector<uint8_t> format_hashed_appendix(
|
||||
uint8_t algorithm,
|
||||
uint8_t hash_algorithm,
|
||||
const std::vector<uint8_t> &hashed_data,
|
||||
uint8_t type,
|
||||
uint8_t version);
|
||||
|
||||
private:
|
||||
uint8_t m_hash_algorithm;
|
||||
std::pair<uint8_t, uint8_t> m_hash_leftmost_bytes;
|
||||
std::vector<uint8_t> m_hashed_appendix;
|
||||
s_expression m_signature;
|
||||
type m_type;
|
||||
};
|
||||
|
||||
class message_armored
|
||||
{
|
||||
public:
|
||||
message_armored(const std::string &message_armored);
|
||||
|
||||
operator epee::span<const uint8_t>() const;
|
||||
|
||||
private:
|
||||
std::string m_message;
|
||||
};
|
||||
|
||||
} // namespace openpgp
|
||||
@@ -1,88 +0,0 @@
|
||||
// Copyright (c) 2020-2021, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <span.h>
|
||||
|
||||
#include "serialization.h"
|
||||
|
||||
namespace openpgp
|
||||
{
|
||||
|
||||
class packet_stream
|
||||
{
|
||||
public:
|
||||
packet_stream(const epee::span<const uint8_t> buffer)
|
||||
: packet_stream(deserializer<epee::span<const uint8_t>>(buffer))
|
||||
{
|
||||
}
|
||||
|
||||
template <
|
||||
typename byte_container,
|
||||
typename = typename std::enable_if<(sizeof(typename byte_container::value_type) == 1)>::type>
|
||||
packet_stream(deserializer<byte_container> buffer)
|
||||
{
|
||||
while (!buffer.empty())
|
||||
{
|
||||
packet_tag tag = buffer.read_packet_tag();
|
||||
packets.push_back({std::move(tag), buffer.read(tag.length)});
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<uint8_t> *find_first(packet_tag::type type) const
|
||||
{
|
||||
for (const auto &packet : packets)
|
||||
{
|
||||
if (packet.first.packet_type == type)
|
||||
{
|
||||
return &packet.second;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename Callback>
|
||||
void for_each(packet_tag::type type, Callback &callback) const
|
||||
{
|
||||
for (const auto &packet : packets)
|
||||
{
|
||||
if (packet.first.packet_type == type)
|
||||
{
|
||||
callback(packet.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::pair<packet_tag, std::vector<uint8_t>>> packets;
|
||||
};
|
||||
|
||||
} // namespace openpgp
|
||||
@@ -1,78 +0,0 @@
|
||||
// Copyright (c) 2020-2021, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <gcrypt.h>
|
||||
|
||||
namespace openpgp
|
||||
{
|
||||
|
||||
class s_expression
|
||||
{
|
||||
public:
|
||||
s_expression(const s_expression &) = delete;
|
||||
s_expression &operator=(const s_expression &) = delete;
|
||||
|
||||
template <typename... Args>
|
||||
s_expression(Args... args)
|
||||
{
|
||||
if (gcry_sexp_build(&data, nullptr, args...) != GPG_ERR_NO_ERROR)
|
||||
{
|
||||
throw std::runtime_error("failed to build S-expression");
|
||||
}
|
||||
}
|
||||
|
||||
s_expression(s_expression &&other)
|
||||
{
|
||||
std::swap(data, other.data);
|
||||
}
|
||||
|
||||
s_expression(gcry_sexp_t data)
|
||||
: data(data)
|
||||
{
|
||||
}
|
||||
|
||||
~s_expression()
|
||||
{
|
||||
gcry_sexp_release(data);
|
||||
}
|
||||
|
||||
const gcry_sexp_t &get() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
private:
|
||||
gcry_sexp_t data = nullptr;
|
||||
};
|
||||
|
||||
} // namespace openpgp
|
||||
@@ -1,172 +0,0 @@
|
||||
// Copyright (c) 2020-2021, The Monero Project
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification, are
|
||||
// permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
// conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
// of conditions and the following disclaimer in the documentation and/or other
|
||||
// materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without specific
|
||||
// prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mpi.h"
|
||||
|
||||
namespace openpgp
|
||||
{
|
||||
|
||||
size_t bits_to_bytes(size_t bits)
|
||||
{
|
||||
constexpr const uint16_t bits_in_byte = 8;
|
||||
return (bits + bits_in_byte - 1) / bits_in_byte;
|
||||
}
|
||||
|
||||
std::string strip_line_breaks(const std::string &string)
|
||||
{
|
||||
std::string result;
|
||||
result.reserve(string.size());
|
||||
for (const auto &character : string)
|
||||
{
|
||||
if (character != '\r' && character != '\n')
|
||||
{
|
||||
result.push_back(character);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
struct packet_tag
|
||||
{
|
||||
enum type : uint8_t
|
||||
{
|
||||
signature = 2,
|
||||
public_key = 6,
|
||||
user_id = 13,
|
||||
public_subkey = 14,
|
||||
};
|
||||
|
||||
const type packet_type;
|
||||
const size_t length;
|
||||
};
|
||||
|
||||
template <
|
||||
typename byte_container,
|
||||
typename = typename std::enable_if<(sizeof(typename byte_container::value_type) == 1)>::type>
|
||||
class deserializer
|
||||
{
|
||||
public:
|
||||
deserializer(byte_container buffer)
|
||||
: buffer(std::move(buffer))
|
||||
, cursor(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return buffer.size() - cursor == 0;
|
||||
}
|
||||
|
||||
packet_tag read_packet_tag()
|
||||
{
|
||||
const auto tag = read_big_endian<uint8_t>();
|
||||
|
||||
constexpr const uint8_t format_mask = 0b11000000;
|
||||
constexpr const uint8_t format_old_tag = 0b10000000;
|
||||
if ((tag & format_mask) != format_old_tag)
|
||||
{
|
||||
throw std::runtime_error("invalid packet tag");
|
||||
}
|
||||
|
||||
const packet_tag::type packet_type = static_cast<packet_tag::type>((tag & 0b00111100) >> 2);
|
||||
const uint8_t length_type = tag & 0b00000011;
|
||||
|
||||
size_t length;
|
||||
switch (length_type)
|
||||
{
|
||||
case 0:
|
||||
length = read_big_endian<uint8_t>();
|
||||
break;
|
||||
case 1:
|
||||
length = read_big_endian<uint16_t>();
|
||||
break;
|
||||
case 2:
|
||||
length = read_big_endian<uint32_t>();
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("unsupported packet length type");
|
||||
}
|
||||
|
||||
return {packet_type, length};
|
||||
}
|
||||
|
||||
mpi read_mpi()
|
||||
{
|
||||
const size_t bit_length = read_big_endian<uint16_t>();
|
||||
return mpi(read_span(bits_to_bytes(bit_length)));
|
||||
}
|
||||
|
||||
std::vector<uint8_t> read(size_t size)
|
||||
{
|
||||
if (buffer.size() - cursor < size)
|
||||
{
|
||||
throw std::runtime_error("insufficient buffer size");
|
||||
}
|
||||
|
||||
const size_t offset = cursor;
|
||||
cursor += size;
|
||||
|
||||
return {&buffer[offset], &buffer[cursor]};
|
||||
}
|
||||
|
||||
template <typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
T read_big_endian()
|
||||
{
|
||||
if (buffer.size() - cursor < sizeof(T))
|
||||
{
|
||||
throw std::runtime_error("insufficient buffer size");
|
||||
}
|
||||
T result = 0;
|
||||
for (size_t read = 0; read < sizeof(T); ++read)
|
||||
{
|
||||
result = (result << 8) | static_cast<uint8_t>(buffer[cursor++]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
epee::span<const uint8_t> read_span(size_t size)
|
||||
{
|
||||
if (buffer.size() - cursor < size)
|
||||
{
|
||||
throw std::runtime_error("insufficient buffer size");
|
||||
}
|
||||
|
||||
const size_t offset = cursor;
|
||||
cursor += size;
|
||||
|
||||
return {reinterpret_cast<const uint8_t *>(&buffer[offset]), size};
|
||||
}
|
||||
|
||||
private:
|
||||
byte_container buffer;
|
||||
size_t cursor;
|
||||
};
|
||||
|
||||
} // namespace openpgp
|
||||
@@ -18,4 +18,5 @@ set(qrcode_SOURCES
|
||||
)
|
||||
|
||||
add_library(qrcode STATIC ${qrcode_SOURCES})
|
||||
target_include_directories(qrcode PUBLIC ${QRENCODE_INCLUDE_DIR})
|
||||
target_link_libraries(qrcode Qt5::Core Qt5::Widgets Qt5::Svg ${QRENCODE_LIBRARY})
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
|
||||
#include "settings.h"
|
||||
#include "ui_settings.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "utils/activate_linux.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
Settings::Settings(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -83,6 +86,41 @@ Settings::Settings(QWidget *parent) :
|
||||
ui->lineEdit_defaultWalletDir->setText(m_ctx->defaultWalletDir);
|
||||
});
|
||||
|
||||
#ifdef LINUX_ACTIVATION
|
||||
// Setup activation tab
|
||||
auto activatedSerial = config()->get(Config::LinuxActivated).toString();
|
||||
if(!activatedSerial.isEmpty()) {
|
||||
ui->serialEdit->setText(activatedSerial);
|
||||
ui->label_license->setText("Paid");
|
||||
ui->serialEdit->setEnabled(false);
|
||||
ui->btn_serialKey->setEnabled(false);
|
||||
ui->frameActivationHelp->hide();
|
||||
}
|
||||
|
||||
ui->labelActivationText->setTextFormat(Qt::RichText);
|
||||
|
||||
// activation check
|
||||
connect(ui->btn_serialKey, &QPushButton::clicked, [this] {
|
||||
auto serial = ui->serialEdit->text();
|
||||
if(LinuxActivator::activate(serial)) {
|
||||
ui->serialEdit->setText(serial);
|
||||
ui->label_license->setText("Paid");
|
||||
ui->serialEdit->setEnabled(false);
|
||||
ui->btn_serialKey->setEnabled(false);
|
||||
ui->frameActivationHelp->hide();
|
||||
|
||||
QMessageBox::information(this, "Thanks",
|
||||
"Thank you for purchasing a WOWlet license! The funds "
|
||||
"will go straight into our coke & hookers fund. \n\n"
|
||||
"Restart WOWlet to get rid of the watermark in the "
|
||||
"bottom right corner.");
|
||||
} else {
|
||||
QMessageBox::warning(this, "Warning", "Bad serial!");
|
||||
}
|
||||
});
|
||||
#else
|
||||
ui->tabWidget->setTabVisible(5, false);
|
||||
#endif
|
||||
this->adjustSize();
|
||||
}
|
||||
|
||||
|
||||
+128
-1
@@ -146,7 +146,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>blockchair.com</string>
|
||||
<string>kryfi.com</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
@@ -558,6 +558,133 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Activation</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QFrame" name="frameActivationHelp">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelActivationText">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Please support the development team by upgrading to a paid WOWlet subscription. </p><p>You will get access to: the dankest memes, a better built-in miner, faster startup times, and embarrassing pictures of jwinterm!</p><p>Side-note: <a href="https://forum.wownero.com/t/free-wowlet-license-keys/1294"><span style=" text-decoration: underline; color:#0000ff;">we condone the piracy of licenses</span></a></p><p>Thanks in advance.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Subscription License:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_license">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Skint</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="serialEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Serial key:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="btn_serialKey">
|
||||
<property name="text">
|
||||
<string>Submit serial key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
+60
-8
@@ -34,6 +34,55 @@ Rectangle {
|
||||
FontLoader { id: comicMonoBold; source: "qrc:/fonts/ComicMono-Bold.ttf" }
|
||||
}
|
||||
|
||||
AnimatedImage {
|
||||
//visible: mining.daemonMiningState === 0
|
||||
source: "qrc:/mining/bg1.gif"
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
anchors.bottomMargin: 92
|
||||
anchors.topMargin: 112
|
||||
}
|
||||
|
||||
Image {
|
||||
source: "qrc:/mining/overlay.png"
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
anchors.bottomMargin: 92
|
||||
anchors.topMargin: 112
|
||||
smooth: false
|
||||
}
|
||||
|
||||
Image {
|
||||
id: miningGradient
|
||||
opacity: 0.0
|
||||
source: "qrc:/mining/mining_gradient.png"
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
anchors.bottomMargin: 92
|
||||
anchors.topMargin: 112
|
||||
smooth: false
|
||||
|
||||
states: [
|
||||
State { when: mining.daemonMiningState !== 0;
|
||||
PropertyChanges { target: miningGradient; opacity: 1.0 }},
|
||||
State { when: mining.daemonMiningState === 0;
|
||||
PropertyChanges { target: miningGradient; opacity: 0.0 }}
|
||||
]
|
||||
transitions: [ Transition { NumberAnimation { property: "opacity"; duration: 750}} ]
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
@@ -343,8 +392,14 @@ Rectangle {
|
||||
id: cons
|
||||
anchors.margins: 4
|
||||
anchors.fill: parent
|
||||
text: "Miner is idle."
|
||||
font.pointSize: 12
|
||||
text: {
|
||||
if(mining.daemonMiningState === 0) {
|
||||
return "Press the pick-axe to start mining!";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
font.pointSize: 14
|
||||
font.family: comicMono.name;
|
||||
wrapMode: Text.WordWrap
|
||||
color: "white"
|
||||
@@ -436,10 +491,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Image {
|
||||
source: {
|
||||
var imgs = ["qrc:/mining/amd.png", "qrc:/mining/intel.png"];
|
||||
return imgs[Math.floor(Math.random()*imgs.length)];
|
||||
}
|
||||
source: "qrc:/mining/intel.png"
|
||||
width: 100
|
||||
height: 100
|
||||
fillMode: Image.Pad
|
||||
@@ -447,7 +499,6 @@ Rectangle {
|
||||
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,7 +615,8 @@ Rectangle {
|
||||
color: "black"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
//font.family: ComicMonoBold.name;
|
||||
font.pointSize: 14
|
||||
font.family: ComicMonoBold.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <monero_seed/monero_seed.hpp>
|
||||
#include <wownero_seed/wownero_seed.hpp>
|
||||
|
||||
#include "networktype.h"
|
||||
#include "utils/utils.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "RestoreHeightLookup.h"
|
||||
|
||||
enum SeedType {
|
||||
MONERO = 0, // 25 word seeds
|
||||
WOWNERO = 0, // 25 word seeds
|
||||
TEVADOR // 14 word seeds
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ struct WowletSeed {
|
||||
QString errorString;
|
||||
|
||||
explicit WowletSeed(RestoreHeightLookup *lookup,
|
||||
const QString &coin = "monero",
|
||||
const QString &coin = "wownero",
|
||||
const QString &language = "English",
|
||||
const QStringList &mnemonic = {})
|
||||
: lookup(lookup), coin(coin), language(language), mnemonic(mnemonic)
|
||||
@@ -36,7 +36,7 @@ struct WowletSeed {
|
||||
// Generate a new mnemonic if none was given
|
||||
if (this->mnemonic.length() == 0) {
|
||||
this->time = std::time(nullptr);
|
||||
monero_seed seed(this->time, coin.toStdString());
|
||||
wownero_seed seed(this->time, coin.toStdString());
|
||||
|
||||
std::stringstream buffer;
|
||||
buffer << seed;
|
||||
@@ -50,7 +50,7 @@ struct WowletSeed {
|
||||
}
|
||||
|
||||
if (this->mnemonic.length() == 25) {
|
||||
this->seedType = SeedType::MONERO;
|
||||
this->seedType = SeedType::WOWNERO;
|
||||
}
|
||||
else if (this->mnemonic.length() == 14) {
|
||||
this->seedType = SeedType::TEVADOR;
|
||||
@@ -61,7 +61,7 @@ struct WowletSeed {
|
||||
|
||||
if (seedType == SeedType::TEVADOR) {
|
||||
try {
|
||||
monero_seed seed(this->mnemonic.join(" ").toStdString(), coin.toStdString());
|
||||
wownero_seed seed(this->mnemonic.join(" ").toStdString(), coin.toStdString());
|
||||
|
||||
this->time = seed.date();
|
||||
this->setRestoreHeight();
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
#ifdef LINUX_ACTIVATION
|
||||
|
||||
#include <QObject>
|
||||
#include <QApplication>
|
||||
#include <QPixmap>
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
#include <QDesktopWidget>
|
||||
#include <QCoreApplication>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMessageBox>
|
||||
#include <QGroupBox>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include <thread>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
|
||||
#include <cairo.h>
|
||||
#include <cairo-xlib.h>
|
||||
|
||||
#include "activate_linux.h"
|
||||
#include "utils/config.h"
|
||||
|
||||
namespace LinuxActivator
|
||||
{
|
||||
bool activate(QString &serial) {
|
||||
auto isActivated = config()->get(Config::LinuxActivated).toString();
|
||||
if(!isActivated.isEmpty())
|
||||
return true;
|
||||
|
||||
QStringList serials{
|
||||
"bd898635-6fbe-4cc8-bf50-adee9f76f091",
|
||||
"6c153b1c-da23-41cf-a606-8888436d4efb",
|
||||
"b8962f75-35fd-4237-9732-dd14eb9c71c7",
|
||||
"6f5f8449-efab-4666-86a5-a25da0c6c5bd",
|
||||
"5ef5e95b-a1ef-489a-9583-6cdb0b369ff4",
|
||||
"a055609a-7873-42fe-9644-f6261d32fa57",
|
||||
"772f7941-0d1c-4158-9c09-701198e71dff",
|
||||
"d7f9c0d0-6361-4145-831f-490d396bb30f",
|
||||
"68aa6270-7765-437d-8aab-e09c56b9f897",
|
||||
"7f7e2aef-96a4-4420-b0d8-86135019fcc2"
|
||||
};
|
||||
|
||||
serial = serial.trimmed();
|
||||
if(serials.contains(serial)) {
|
||||
config()->set(Config::LinuxActivated, serial);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// fire & forget
|
||||
void start() {
|
||||
QRect rec = QApplication::desktop()->screenGeometry();
|
||||
std::thread([rec](){
|
||||
const short height = rec.height();
|
||||
const short width = rec.width();
|
||||
LinuxActivator::show(width, height);
|
||||
}).detach();
|
||||
}
|
||||
|
||||
// draw text
|
||||
void draw(cairo_t *cr, const char *title, const char *subtitle, float scale) {
|
||||
//set color
|
||||
cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.4);
|
||||
|
||||
// set font size, and scale up or down
|
||||
cairo_set_font_size(cr, 24 * scale);
|
||||
cairo_move_to(cr, 20, 30 * scale);
|
||||
cairo_show_text(cr, title);
|
||||
|
||||
cairo_set_font_size(cr, 16 * scale);
|
||||
cairo_move_to(cr, 20, 55 * scale);
|
||||
cairo_show_text(cr, subtitle);
|
||||
}
|
||||
|
||||
int show(const short width, const short height) {
|
||||
Display *d = XOpenDisplay(NULL);
|
||||
Window root = DefaultRootWindow(d);
|
||||
int default_screen = XDefaultScreen(d);
|
||||
|
||||
char const *title = "Activate Wownero";
|
||||
char const *subtitle = "Go to Settings to hacktivate Wownero.";
|
||||
|
||||
// default scale
|
||||
float scale = 1.0f;
|
||||
if(width >= 2560) {
|
||||
scale = 1.2f;
|
||||
} else if(width >= 3440) {
|
||||
scale = 1.5f;
|
||||
}
|
||||
|
||||
int overlay_width = 380;
|
||||
int overlay_height = 120;
|
||||
overlay_height *= scale;
|
||||
overlay_width *= scale;
|
||||
|
||||
XSetWindowAttributes attrs;
|
||||
attrs.override_redirect = 1;
|
||||
|
||||
XVisualInfo vinfo;
|
||||
int colorDepth = 32;
|
||||
|
||||
if (!XMatchVisualInfo(d, default_screen, colorDepth, TrueColor, &vinfo)) {
|
||||
printf("Activate linux: no visual found supporting 32 bit color, terminating\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// sets 32 bit color depth
|
||||
attrs.colormap = XCreateColormap(d, root, vinfo.visual, AllocNone);
|
||||
attrs.background_pixel = 0;
|
||||
attrs.border_pixel = 0;
|
||||
|
||||
Window overlay;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cairo_ctx;
|
||||
|
||||
overlay = XCreateWindow(
|
||||
d, // display
|
||||
root, // parent
|
||||
width - overlay_width, // x position
|
||||
height - overlay_height, // y position
|
||||
overlay_width, // width
|
||||
overlay_height, // height
|
||||
0, // border width
|
||||
vinfo.depth, // depth
|
||||
InputOutput, // class
|
||||
vinfo.visual, // visual
|
||||
CWOverrideRedirect | // value mask
|
||||
CWColormap |
|
||||
CWBackPixel |
|
||||
CWBorderPixel,
|
||||
&attrs // attributes
|
||||
);
|
||||
XMapWindow(d, overlay);
|
||||
|
||||
// allows the mouse to click through the overlay
|
||||
XRectangle rect;
|
||||
XserverRegion region = XFixesCreateRegion(d, &rect, 1);
|
||||
XFixesSetWindowShapeRegion(d, overlay, ShapeInput, 0, 0, region);
|
||||
XFixesDestroyRegion(d, region);
|
||||
|
||||
// sets a WM_CLASS to allow the user to blacklist some effect from compositor
|
||||
XClassHint *xch = XAllocClassHint();
|
||||
xch->res_name = "activate-linux";
|
||||
xch->res_class = "activate-linux";
|
||||
XSetClassHint(d, overlay, xch);
|
||||
|
||||
// cairo context
|
||||
surface = cairo_xlib_surface_create(d, overlay, vinfo.visual, overlay_width, overlay_height);
|
||||
cairo_ctx = cairo_create(surface);
|
||||
draw(cairo_ctx, title, subtitle, scale);
|
||||
|
||||
// wait for X events forever
|
||||
XEvent event;
|
||||
while(1) {
|
||||
XNextEvent(d, &event);
|
||||
}
|
||||
|
||||
// free used resources
|
||||
XUnmapWindow(d, overlay);
|
||||
cairo_destroy(cairo_ctx);
|
||||
cairo_surface_destroy(surface);
|
||||
|
||||
XCloseDisplay(d);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef ACTIVATE_LINUX_H
|
||||
#define ACTIVATE_LINUX_H
|
||||
|
||||
#ifdef LINUX_ACTIVATION
|
||||
#include <cairo.h>
|
||||
#include <cairo-xlib.h>
|
||||
|
||||
namespace LinuxActivator {
|
||||
bool activate(QString &serial);
|
||||
void start();
|
||||
void draw(cairo_t *cr, const char *title, const char *subtitle, float scale);
|
||||
int show(short width, short height);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ACTIVATE_LINUX_H
|
||||
@@ -21,14 +21,12 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
||||
{Config::checkForAppUpdates,{QS("checkForAppUpdates"), true}},
|
||||
{Config::warnOnStagenet,{QS("warnOnStagenet"), true}},
|
||||
{Config::warnOnTestnet,{QS("warnOnTestnet"), true}},
|
||||
{Config::warnOnAlpha,{QS("warnOnAlpha"), true}},
|
||||
{Config::homeWidget,{QS("homeWidget"), 0}},
|
||||
{Config::donateBeg,{QS("donateBeg"), 1}},
|
||||
{Config::skin,{QS("skin"), "light"}},
|
||||
{Config::openVRSkin,{QS("openVRSkin"), "default"}},
|
||||
{Config::openVRStreamerMode,{QS("openVRStreamerMode"), false}},
|
||||
{Config::preferredFiatCurrency,{QS("preferredFiatCurrency"), "USD"}},
|
||||
{Config::blockExplorer,{QS("blockExplorer"), "explore.wownero.com"}},
|
||||
{Config::blockExplorer,{QS("blockExplorer"), "kryfi.com"}},
|
||||
{Config::walletDirectory,{QS("walletDirectory"), ""}},
|
||||
{Config::autoOpenWalletPath,{QS("autoOpenWalletPath"), ""}},
|
||||
{Config::walletPath,{QS("walletPath"), ""}},
|
||||
@@ -52,7 +50,8 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
||||
{Config::redditFrontend, {QS("redditFrontend"), "old.reddit.com"}},
|
||||
{Config::showHistorySyncNotice, {QS("showHistorySyncNotice"), true}},
|
||||
{Config::ignoreUpdateWarning, {QS("ignoreUpdateWarning"), ""}},
|
||||
{Config::suchWowTipAmount, {QS("suchWowTipAmount"), 0.75}}
|
||||
{Config::suchWowTipAmount, {QS("suchWowTipAmount"), 0.75}},
|
||||
{Config::LinuxActivated, {QS("linuxActivated"), ""}}
|
||||
};
|
||||
|
||||
|
||||
|
||||
+2
-3
@@ -23,9 +23,7 @@ public:
|
||||
checkForAppUpdates,
|
||||
warnOnStagenet,
|
||||
warnOnTestnet,
|
||||
warnOnAlpha,
|
||||
homeWidget,
|
||||
donateBeg,
|
||||
autoOpenWalletPath,
|
||||
skin,
|
||||
openVRSkin,
|
||||
@@ -54,7 +52,8 @@ public:
|
||||
redditFrontend,
|
||||
showHistorySyncNotice,
|
||||
ignoreUpdateWarning,
|
||||
suchWowTipAmount
|
||||
suchWowTipAmount,
|
||||
LinuxActivated
|
||||
};
|
||||
|
||||
~Config() override;
|
||||
|
||||
+22
-5
@@ -238,8 +238,13 @@ QString Utils::copyFromClipboard() {
|
||||
return clipboard->text();
|
||||
}
|
||||
|
||||
QString Utils::blockExplorerLink(const QString &blockExplorer, NetworkType::Type nettype, const QString &txid) {
|
||||
return QString("https://explore.wownero.com/tx/%1").arg(txid);
|
||||
QString Utils::blockExplorerLink(const QString &txid) {
|
||||
auto explorer = config()->get(Config::blockExplorer).toString();
|
||||
if(explorer.startsWith("kryfi.com")) {
|
||||
return QString("https://kryfi.com/explorer/wownero/tx/%1").arg(txid);
|
||||
} else {
|
||||
return QString("https://explore.wownero.com/tx/%1").arg(txid);
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem *Utils::qStandardItem(const QString& text) {
|
||||
@@ -413,14 +418,14 @@ double Utils::roundUp(double value, int decimal_places) {
|
||||
return std::ceil(value * multiplier) / multiplier;
|
||||
}
|
||||
|
||||
QString Utils::amountToCurrencyString(double amount, const QString ¤cyCode) {
|
||||
QString Utils::amountToCurrencyString(double amount, const QString ¤cyCode, int precision) {
|
||||
QLocale locale = getCurrencyLocale(currencyCode);
|
||||
|
||||
// \xC2\xA0 = UTF-8 non-breaking space, it looks off.
|
||||
if (currencyCode == "USD")
|
||||
return locale.toCurrencyString(amount, "$").remove("\xC2\xA0");
|
||||
return locale.toCurrencyString(amount, "$", precision).remove("\xC2\xA0");
|
||||
|
||||
return locale.toCurrencyString(amount).remove("\xC2\xA0");
|
||||
return locale.toCurrencyString(amount, nullptr, precision).remove("\xC2\xA0");
|
||||
}
|
||||
|
||||
int Utils::maxLength(const QVector<QString> &array) {
|
||||
@@ -434,6 +439,18 @@ int Utils::maxLength(const QVector<QString> &array) {
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
unsigned int Utils::countAlphaNum(const QByteArray &line) {
|
||||
QRegularExpression re("([a-zA-Z0-9])");
|
||||
QRegularExpressionMatchIterator iterator = re.globalMatch(line);
|
||||
|
||||
int count = 0;
|
||||
while (iterator.hasNext()){
|
||||
QRegularExpressionMatch match = iterator.next();
|
||||
count += 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
bool Utils::versionOutdated(const QString ¤t_version, const QString &newest_version) {
|
||||
// True when major or minor version changed
|
||||
auto cver = current_version.split('.');
|
||||
|
||||
+4
-3
@@ -12,7 +12,7 @@
|
||||
#include <QtAndroid>
|
||||
#endif
|
||||
|
||||
#include <monero_seed/monero_seed.hpp>
|
||||
#include <wownero_seed/wownero_seed.hpp>
|
||||
|
||||
#include "networktype.h"
|
||||
#include "libwalletqt/Wallet.h"
|
||||
@@ -64,18 +64,19 @@ public:
|
||||
static QStandardItem *qStandardItem(const QString &text, QFont &font);
|
||||
static void copyToClipboard(const QString &string);
|
||||
static QString copyFromClipboard();
|
||||
static QString blockExplorerLink(const QString &blockExplorer, NetworkType::Type nettype, const QString &txid);
|
||||
static QString blockExplorerLink(const QString &txid);
|
||||
static QString getUnixAccountName();
|
||||
static QString xdgDesktopEntry();
|
||||
static bool xdgDesktopEntryWrite(const QString &path);
|
||||
static void xdgRefreshApplications();
|
||||
static bool xdgDesktopEntryRegister();
|
||||
static unsigned int countAlphaNum(const QByteArray &line);
|
||||
static bool pixmapWrite(const QString &path, const QPixmap &pixmap);
|
||||
static QFont relativeFont(int delta);
|
||||
static double roundSignificant(double N, double n);
|
||||
static QString formatBytes(quint64 bytes);
|
||||
static QLocale getCurrencyLocale(const QString ¤cyCode);
|
||||
static QString amountToCurrencyString(double amount, const QString ¤cyCode);
|
||||
static QString amountToCurrencyString(double amount, const QString ¤cyCode, int precision = 2);
|
||||
static int maxLength(const QVector<QString> &array);
|
||||
static double roundUp(double value, int decimal_places);
|
||||
static QMap<QString, QLocale> localeCache;
|
||||
|
||||
+12
-1
@@ -50,7 +50,7 @@ bool XmRig::start(const QString &path, int threads) {
|
||||
}
|
||||
|
||||
if(path.isEmpty()) {
|
||||
emit error("wownerod path seems to be empty.");
|
||||
emit error("wownerod path seems to be empty. Go to the mining settings tab and point towards the wownerod executable!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,13 @@ bool XmRig::start(const QString &path, int threads) {
|
||||
|
||||
auto privateSpendKey = m_ctx->currentWallet->getSecretSpendKey();
|
||||
QStringList arguments;
|
||||
|
||||
// dont exit when binding fails - we dont need
|
||||
// to bind to any ports when we just want to mine
|
||||
arguments << "--no-zmq";
|
||||
arguments << "--rpc-ignore-ipv4";
|
||||
arguments << "--p2p-ignore-ipv4";
|
||||
|
||||
arguments << "--mining-threads" << QString::number(threads);
|
||||
arguments << "--start-mining" << m_ctx->currentWallet->address(0, 0);
|
||||
arguments << "--spendkey" << privateSpendKey;
|
||||
@@ -114,6 +121,10 @@ void XmRig::onHandleProcessOutput() {
|
||||
auto lower = line.toLower();
|
||||
if(lower.isEmpty() || lower.startsWith("status")) continue;
|
||||
|
||||
// skip ascii/ansi art
|
||||
unsigned int printable_chars_pct = 100 * Utils::countAlphaNum(lower) / lower.length();
|
||||
if(printable_chars_pct < 60) continue;
|
||||
|
||||
if(lower.startsWith("the daemon will start synchronizing")) {
|
||||
changeDaemonState(DaemonMiningState::startup);
|
||||
} else if(lower.startsWith("synchronization started")) {
|
||||
|
||||
@@ -42,9 +42,6 @@ NodeWidget::NodeWidget(QWidget *parent)
|
||||
ui->customView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->wsView, &QTreeView::customContextMenuRequested, this, &NodeWidget::onShowWSContextMenu);
|
||||
connect(ui->customView, &QTreeView::customContextMenuRequested, this, &NodeWidget::onShowCustomContextMenu);
|
||||
|
||||
connect(ui->customView, &QTreeView::doubleClicked, this, &NodeWidget::onContextConnect);
|
||||
connect(ui->wsView, &QTreeView::doubleClicked, this, &NodeWidget::onContextConnect);
|
||||
}
|
||||
|
||||
void NodeWidget::onShowWSContextMenu(const QPoint &pos) {
|
||||
|
||||
@@ -362,12 +362,12 @@ void XMRigWidget::showContextWownerodMenu(const QPoint &pos) {
|
||||
QModelIndex index = ui->tableWownerod->indexAt(pos);
|
||||
if (!index.isValid())
|
||||
return;
|
||||
m_contextMenuRig->exec(ui->tableWownerod->viewport()->mapToGlobal(pos));
|
||||
m_contextMenuWownerod->exec(ui->tableWownerod->viewport()->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void XMRigWidget::wownerodLinkClicked() {
|
||||
QModelIndex index = ui->tableRig->currentIndex();
|
||||
auto download_link = m_urlsRig.at(index.row());
|
||||
QModelIndex index = ui->tableWownerod->currentIndex();
|
||||
auto download_link = m_urlsWownerod.at(index.row());
|
||||
Utils::externalLinkWarning(this, download_link);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <QPlainTextEdit>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <monero_seed/wordlist.hpp> // tevador 14 word
|
||||
#include <wownero_seed/wordlist.hpp> // tevador 14 word
|
||||
#include "utils/WowletSeed.h"
|
||||
|
||||
RestorePage::RestorePage(AppContext *ctx, QWidget *parent) :
|
||||
|
||||
+1
-1
Submodule wownero updated: ff5182f7f2...a21819cc22
Reference in New Issue
Block a user