Skip to content

Commit

Permalink
backout QT changes, merge fuzzball's mods
Browse files Browse the repository at this point in the history
  • Loading branch information
CaveSpectre11 committed Jul 26, 2019
1 parent 8768556 commit def3dc5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
13 changes: 0 additions & 13 deletions src/masternode-budget.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,19 +515,6 @@ class CBudgetProposal

void CleanAndRemove(bool fSignatureCheck);

// If URL doesn't have a scheme, add one
std::string GetFixedupURL(std::string scheme="http")
{
std::string ret=strURL;
std::string delim ("://");
if (strURL.find(delim) == std::string::npos)
{
// URL is missing scheme; add one
ret = scheme+"://"+strURL;
}
return ret;
}

uint256 GetHash() const
{
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
Expand Down
10 changes: 5 additions & 5 deletions src/qt/proposalframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void ProposalFrame::refresh()

QLabel* strProposalURL = new QLabel();
strProposalURL->setObjectName(QStringLiteral("strProposalURL"));
QString strURL = QString::fromStdString(proposal->GetFixedupURL());
QString strURL = QString::fromStdString(proposal->GetURL());
QString strClick = tr("Open proposal page in browser");
strProposalURL->setText("<a href=\"" + strURL + "\">" + strClick + "</a>");
strProposalURL->setTextFormat(Qt::RichText);
Expand Down Expand Up @@ -182,7 +182,7 @@ void ProposalFrame::proposalLink_clicked(const QString &link)
{
QMessageBox Msgbox;
QString strMsgBox = tr("A proposal URL can be used for phishing, scams and computer viruses. Open this link only if you trust the following URL.\n");
strMsgBox += QString::fromStdString(proposal->GetFixedupURL());
strMsgBox += QString::fromStdString(proposal->GetURL());
Msgbox.setText(strMsgBox);
Msgbox.setStandardButtons(QMessageBox::Cancel);
QAbstractButton *openButton = Msgbox.addButton(tr("Open link"), QMessageBox::ApplyRole);
Expand All @@ -192,10 +192,10 @@ void ProposalFrame::proposalLink_clicked(const QString &link)
Msgbox.exec();

if (Msgbox.clickedButton() == openButton) {
QDesktopServices::openUrl(QUrl(QString::fromStdString(proposal->GetFixedupURL())));
QDesktopServices::openUrl(QUrl(QString::fromStdString(proposal->GetURL())));
}
if (Msgbox.clickedButton() == copyButton) {
QGuiApplication::clipboard()->setText(QString::fromStdString(proposal->GetFixedupURL()));
QGuiApplication::clipboard()->setText(QString::fromStdString(proposal->GetURL()));
}
governancePage->lockUpdating(false);
}
Expand Down Expand Up @@ -246,7 +246,7 @@ void ProposalFrame::voteButton_clicked(int nVote)
questionString += tr("using all your masternodes?");
questionString += "<br /><br />";
questionString += tr("Proposal Hash:") + " " + QString::fromStdString(proposal->GetHash().ToString()) + "<br />";
questionString += tr("Proposal URL:") + " " + QString::fromStdString(proposal->GetFixedupURL());
questionString += tr("Proposal URL:") + " " + QString::fromStdString(proposal->GetURL());
governancePage->lockUpdating(true);
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm Vote"),
questionString,
Expand Down
21 changes: 15 additions & 6 deletions src/rpc/budget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ UniValue preparebudget(const UniValue& params, bool fHelp)
std::string strURL = SanitizeString(params[1].get_str());
if (strURL.size() > 64)
throw runtime_error("Invalid url, limit of 64 characters.");
if ((strURL.find("://") == std::string::npos) ||
((strURL.front() != 'h') && (strURL.front() != 'H')))
throw std::runtime_error("Invalid url format, add scheme (e.g. https://).");

if ((strURL.front() == 'h') || (strURL.front() == 'H')) {
std::size_t found = strURL.find("ttp://") == 1 ? strURL.find("ttp://") : strURL.find("ttps://");
if (found != 1)
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid url, add scheme (e.g. https://)"));
} else {
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid url, add scheme (e.g. https://)"));
}

int nPaymentCount = params[2].get_int();
if (nPaymentCount < 1)
Expand Down Expand Up @@ -184,9 +188,14 @@ UniValue submitbudget(const UniValue& params, bool fHelp)
std::string strURL = SanitizeString(params[1].get_str());
if (strURL.size() > 64)
throw runtime_error("Invalid url, limit of 64 characters.");
if ((strURL.find("://") == std::string::npos) ||
((strURL.front() != 'h') && (strURL.front() != 'H')))
throw std::runtime_error("Invalid url format, add scheme (e.g. https://).");

if ((strURL.front() == 'h') || (strURL.front() == 'H')) {
std::size_t found = strURL.find("ttp://") == 1 ? strURL.find("ttp://") : strURL.find("ttps://");
if (found != 1)
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid url, add scheme (e.g. https://)"));
} else {
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid url, add scheme (e.g. https://)"));
}

int nPaymentCount = params[2].get_int();
if (nPaymentCount < 1)
Expand Down

0 comments on commit def3dc5

Please sign in to comment.