From d94533d7fea87fff8d2f45c2c995d85a725e87fb Mon Sep 17 00:00:00 2001 From: npq7721 Date: Tue, 27 Aug 2024 12:57:11 -0700 Subject: [PATCH] fixed mac crash during wallet starting up (#399) --- .github/workflows/build.yaml | 4 ++-- src/qt/assetsdialog.cpp | 3 ++- src/qt/uploaddownload.cpp | 16 +++++++++------- src/qt/uploaddownload.h | 10 +++++----- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ddf1781f2..ee1dd274a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -351,12 +351,12 @@ jobs: run: | echo "building with 8 threads" export FALLBACK_DOWNLOAD_PATH=https://pool.nowput.org/depends/ - make -C depends -j8 HOST=x86_64-apple-darwin20.6.0 + make -C depends -j8 HOST=x86_64-apple-darwin21.6.0 - name: Configure run: | ./autogen.sh - ./configure --prefix=`pwd`/depends/x86_64-apple-darwin20.6.0 + ./configure --prefix=`pwd`/depends/x86_64-apple-darwin21.6.0 - name: Build Binaries run: | diff --git a/src/qt/assetsdialog.cpp b/src/qt/assetsdialog.cpp index c076d7d96..2c02bc543 100644 --- a/src/qt/assetsdialog.cpp +++ b/src/qt/assetsdialog.cpp @@ -346,7 +346,8 @@ void AssetsDialog::displayImage(const std::string& cid) { ui->referenceDisplay->setToolTip(QString::fromStdString(cid)); ui->referenceDisplay->setOpenExternalLinks(false); } else { - std::string displayUrl = "" + cid + ""; + std::string ipfsGatewayUrl = gArgs.GetArg("-ipfsgateway", DEFAULT_IPFS_GATEWAY_URL); + std::string displayUrl = "" + cid + ""; ui->referenceDisplay->setText(QString::fromStdString(displayUrl)); ui->referenceDisplay->setToolTip(""); ui->referenceDisplay->setOpenExternalLinks(true); diff --git a/src/qt/uploaddownload.cpp b/src/qt/uploaddownload.cpp index fa6030f06..154a8b0d0 100644 --- a/src/qt/uploaddownload.cpp +++ b/src/qt/uploaddownload.cpp @@ -1,6 +1,6 @@ -// -// Created by tri on 8/8/24. -// +// Copyright (c) 2024 The Raptoreum developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include @@ -93,13 +93,14 @@ void graceful_disconnect(beast::ssl_stream& stream) { void download(const std::string cid, std::string& response_data) { std::string getTarget = GET_URI + cid; + std::string ipfsServiceHost = gArgs.GetArg("-ipfsservice", DEFAULT_IPFS_SERVICE_URL); try { net::io_context ioc; ssl::context ctx = setup_ssl_context(); - beast::ssl_stream stream = create_and_connect_ssl_stream(ioc, IPFS_SERVICE_HOST, "443", ctx); + beast::ssl_stream stream = create_and_connect_ssl_stream(ioc, ipfsServiceHost, "443", ctx); http::request req{http::verb::get, getTarget, 11}; - req.set(http::field::host, IPFS_SERVICE_HOST); + req.set(http::field::host, ipfsServiceHost); req.set(http::field::user_agent, BOOST_BEAST_VERSION_STRING); response_data = write_response(stream, req); @@ -114,7 +115,8 @@ void upload(const std::string& file_path, std::string& response_data) { try { net::io_context ioc; ssl::context ctx = setup_ssl_context(); - beast::ssl_stream stream = create_and_connect_ssl_stream(ioc, IPFS_SERVICE_HOST, "443", ctx); + std::string ipfsServiceHost = gArgs.GetArg("-ipfsservice", DEFAULT_IPFS_SERVICE_URL); + beast::ssl_stream stream = create_and_connect_ssl_stream(ioc, ipfsServiceHost, "443", ctx); // Generate a boundary for the multipart form data std::string boundary = generate_boundary(); @@ -138,7 +140,7 @@ void upload(const std::string& file_path, std::string& response_data) { std::string body_str = body.str(); http::request req{http::verb::post, UPLOAD_URI, 11}; - req.set(http::field::host, IPFS_SERVICE_HOST); + req.set(http::field::host, ipfsServiceHost); req.set(http::field::user_agent, BOOST_BEAST_VERSION_STRING); req.set(http::field::content_type, "multipart/form-data; boundary=" + boundary); req.set(http::field::content_length, std::to_string(body_str.size())); diff --git a/src/qt/uploaddownload.h b/src/qt/uploaddownload.h index 399043eef..656bdf0ab 100644 --- a/src/qt/uploaddownload.h +++ b/src/qt/uploaddownload.h @@ -1,6 +1,6 @@ -// -// Created by tri on 8/8/24. -// +// Copyright (c) 2024 The Raptoreum developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef RAPTOREUM_UPLOAD_DOWNLOAD_H #define RAPTOREUM_UPLOAD_DOWNLOAD_H @@ -14,8 +14,8 @@ static std::string GET_URI = "/get/"; static std::string UPLOAD_URI = "/upload"; -static std::string IPFS_SERVICE_HOST = gArgs.GetArg("-ipfsservice", "ipfsm.raptoreum.com"); -static std::string IPFS_GATEWAY_URL = gArgs.GetArg("-ipfsgateway", "https://ipfsweb.raptoreum.com/ipfs/"); +static std::string DEFAULT_IPFS_SERVICE_URL = "ipfsm.raptoreum.com"; +static std::string DEFAULT_IPFS_GATEWAY_URL = "https://ipfsweb.raptoreum.com/ipfs/"; void download(const std::string cid, std::string& response_data); void upload(const std::string& file_path, std::string& response_data);