Skip to content

Commit

Permalink
Merge branch 'develop' into release/2.0.3.1-rc
Browse files Browse the repository at this point in the history
  • Loading branch information
npq7721 committed Aug 27, 2024
2 parents 81851e8 + d94533d commit 394fd5e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 2 additions & 1 deletion src/qt/assetsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<a href=\"" + IPFS_GATEWAY_URL + cid + "\">" + cid + "</a>";
std::string ipfsGatewayUrl = gArgs.GetArg("-ipfsgateway", DEFAULT_IPFS_GATEWAY_URL);
std::string displayUrl = "<a href=\"" + ipfsGatewayUrl + cid + "\">" + cid + "</a>";
ui->referenceDisplay->setText(QString::fromStdString(displayUrl));
ui->referenceDisplay->setToolTip("");
ui->referenceDisplay->setOpenExternalLinks(true);
Expand Down
16 changes: 9 additions & 7 deletions src/qt/uploaddownload.cpp
Original file line number Diff line number Diff line change
@@ -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 <qt/uploaddownload.h>

Expand Down Expand Up @@ -93,13 +93,14 @@ void graceful_disconnect(beast::ssl_stream<beast::tcp_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<beast::tcp_stream> stream = create_and_connect_ssl_stream(ioc, IPFS_SERVICE_HOST, "443", ctx);
beast::ssl_stream<beast::tcp_stream> stream = create_and_connect_ssl_stream(ioc, ipfsServiceHost, "443", ctx);

http::request<http::empty_body> 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);
Expand All @@ -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 <beast::tcp_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 <beast::tcp_stream> stream = create_and_connect_ssl_stream(ioc, ipfsServiceHost, "443", ctx);

// Generate a boundary for the multipart form data
std::string boundary = generate_boundary();
Expand All @@ -138,7 +140,7 @@ void upload(const std::string& file_path, std::string& response_data) {
std::string body_str = body.str();

http::request <http::string_body> 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()));
Expand Down
10 changes: 5 additions & 5 deletions src/qt/uploaddownload.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);
Expand Down
10 changes: 7 additions & 3 deletions src/rpc/rpcassets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static std::string GetDistributionType(int t) {
}
return "invalid";
}

#ifdef ENABLE_WALLET
UniValue createasset(const JSONRPCRequest &request) {

if (request.fHelp || !Updates().IsAssetsActive(::ChainActive().Tip()) || request.params.size() < 1 ||
Expand Down Expand Up @@ -732,7 +732,7 @@ UniValue sendasset(const JSONRPCRequest &request) {
result.pushKV("txid", wtx->GetHash().GetHex());
return result;
}

#endif//ENABLE_WALLET

UniValue getassetdetailsbyname(const JSONRPCRequest &request) {
if (request.fHelp || !Updates().IsAssetsActive(::ChainActive().Tip()) || request.params.size() < 1 ||
Expand Down Expand Up @@ -1287,14 +1287,18 @@ UniValue listassetbalancesbyaddress(const JSONRPCRequest& request)
static const CRPCCommand commands[] =
{ // category name actor (function)
// --------------------- ------------------------ -----------------------
#ifdef ENABLE_WALLET
{"assets", "createasset", &createasset, {"asset"}},
{"assets", "updateasset", &updateasset, {"asset"}},
{"assets", "mintasset", &mintasset, {"assetId"}},
{"assets", "sendasset", &sendasset, {"assetId", "amount", "address", "change_address", "asset_change_address"}},
#endif //ENABLE_WALLET
{"assets", "getassetdetailsbyname", &getassetdetailsbyname, {"assetname"}},
{"assets", "getassetdetailsbyid", &getassetdetailsbyid, {"assetid"}},
#ifdef ENABLE_WALLET
{"assets", "listassetsbalance", &listassetsbalance, {}},
{"assets", "listunspentassets", &listunspentassets, {"minconf", "maxconf", "addresses", "include_unsafe", "query_options"}},
#endif //ENABLE_WALLET
{"assets", "listassets", &listassets, {"verbose", "count", "start"}},
{"assets", "listaddressesbyasset", &listaddressesbyasset, {"asset_name", "onlytotal", "count", "start"}},
{"assets", "listassetbalancesbyaddress", &listassetbalancesbyaddress, {"address", "onlytotal", "count", "start"} },
Expand All @@ -1304,4 +1308,4 @@ void RegisterAssetsRPCCommands(CRPCTable &tableRPC) {
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) {
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
}
}
}
5 changes: 3 additions & 2 deletions src/rpc/rpcevo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,8 +1554,9 @@ UniValue protx(const JSONRPCRequest &request) {
} else if(command == "protxquick_setup") {
return protx_quick_setup(new_request);
}
#endif
else if (command == "protxlist") {
else
#endif //ENABLE_WALLET
if (command == "protxlist") {
return protx_list(new_request);
} else if (command == "protxinfo") {
return protx_info(new_request);
Expand Down

0 comments on commit 394fd5e

Please sign in to comment.