Merge pull request #262 from layters/backup

backup
main
layters 2 weeks ago committed by GitHub
commit d2ed6355fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -215,8 +215,6 @@ This project is licensed under the [GNU General Public License v3.0](LICENSE)
## Donations
Donate if you like, to any of the addresses below. Received payments will be used to reward developers for completing bounties and will also be used to keep the `neroshop.org` domain up and running.
**Monero (XMR):**
```
83QbQvnnyo7515rEnW8XwF1hbP5qMab6sHXFzP6pg3EKGscgXCbVjbt1FX5SF7AV9p4Ur1tiommuQSzrQQRHkZicVYu6j8Y
@ -239,20 +237,15 @@ WW2pQTQWHpyJf2CHrCmZG7Tn3zBnYRZTH8g4U3pSZf5s6xsTXrZc9odDWmrWzjRc9MMQWrKXxjHsRdzH
## Resources
- Website: [neroshop.org](https://neroshop.org/)
- Neroshop DHT Specification: [specs](https://github.com/layters/specs)
- Wiki: [Wikipage](https://github.com/layters/testshop/wiki)
- DHT Specification: [specs](https://github.com/layters/specs)
- Git Mirrors:
- [Codeberg](https://codeberg.org/layter/neroshop)
- [Gitea](https://git.wownero.com/layter/neroshop)
- Mail: larteyoh@pm.me
- Matrix: [#neroshop:matrix.org](https://matrix.to/#/#neroshop:matrix.org)
- Matrix 2: [#neroshop-dev:matrix.org](https://matrix.to/#/#neroshop-dev:matrix.org)
- Lemmy: https://monero.town/c/neroshop
- Mail: neroshop@protonmail.com
- Matrix:
- [#neroshop:matrix.org](https://matrix.to/#/#neroshop:matrix.org)
- [#neroshop-dev:matrix.org](https://matrix.to/#/#neroshop-dev:matrix.org)
## Thanks
@ -260,7 +253,7 @@ WW2pQTQWHpyJf2CHrCmZG7Tn3zBnYRZTH8g4U3pSZf5s6xsTXrZc9odDWmrWzjRc9MMQWrKXxjHsRdzH
* [woodser](https://github.com/woodser) — for his guidance and for his work on the monero-cpp library which has made the development of this app possible
* [yuriio147](https://github.com/yuriio147) — for his work on various QML components, the currency converter, wallet address qr provider, fixing a major bug in the RSA encryption code, the RSA signing and verifying functions, and for teaching me some Qt/QML techniques
* [yuriio147](https://github.com/yuriio147) — for his work on various QML components, the currency converter, wallet address qr provider, image loader and image provider, fixing a major bug in the RSA encryption code, the RSA signing and verifying functions, and for teaching me some Qt/QML techniques
* [lza_menace](https://twitter.com/lza_menace) — for creating the new monero.fail JSON API endpoint

@ -265,6 +265,27 @@ Page {
border.width: parent.activeFocus ? 2 : 1
radius: balanceTxColumn.radius
}
rightPadding: resolveButton.visible ? (15 + resolveButton.width) : leftPadding
Button {
id: resolveButton
text: qsTr("Resolve")
anchors.right: parent.right
anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
hoverEnabled: true
visible: Wallet.isValidOpenAliasAddress(addressField.text)
////onClicked: // TODO: handle OpenAlias resolution
background: Rectangle {
color: NeroshopComponents.Style.moneroGrayColor
radius: 10
}
contentItem: Text {
text: parent.text
color: "#ffffff"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
// amountField
TextField {

@ -54,6 +54,27 @@ static bool is_product_code(const std::string& code) {
std::regex_match(code, issn) || std::regex_match(code, gtin) || std::regex_match(code, sku) ||
std::regex_match(code, mpn) || std::regex_match(code, ndc);
}
// does not work for email-styled addresses
static bool is_valid_domain(const std::string& domain) {
std::regex regex("^[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)+$"); // Basic domain structure
if (!std::regex_match(domain, regex)) {
return false;
}
std::string lastPart = domain.substr(domain.find_last_of('.') + 1);
try {
int lastPartInt = std::stoi(lastPart);
if (std::to_string(lastPartInt) != lastPart) {
return true;
}
} catch (const std::invalid_argument& e) {
return true;
}
return false;
}
}
namespace string {
static std::string lower(const std::string& str)

@ -1312,6 +1312,10 @@ bool neroshop::Wallet::is_valid_monero_address(const std::string& address) {
return ;
}*/
//-------------------------------------------------------
bool neroshop::Wallet::is_valid_openalias_address(const std::string& address) {
return (string_tools::is_valid_domain(address) || string_tools::is_email(address));
}
//-------------------------------------------------------
bool neroshop::Wallet::is_cryptonote_based() const {
return (wallet_type == WalletType::Monero || wallet_type == WalletType::Wownero);
}

@ -187,6 +187,7 @@ public:
virtual bool is_valid_address(const std::string& address) const;
static bool is_valid_monero_address(const std::string& address);
//static bool is_valid_wownero_address(const std::string& address);
static bool is_valid_openalias_address(const std::string& address);
bool is_cryptonote_based() const;
// friends
friend class Seller; // seller can access wallet private members

@ -368,6 +368,16 @@ bool neroshop::WalletController::fileExists(const QString& filename) const {
return _wallet->file_exists(filename.toStdString());
}
bool neroshop::WalletController::isValidAddress(const QString& address) const {
if (!_wallet) throw std::runtime_error("neroshop::Wallet is not initialized");
return _wallet->is_valid_address(address.toStdString());
}
bool neroshop::WalletController::isValidOpenAliasAddress(const QString& address) const {
if (!_wallet) throw std::runtime_error("neroshop::Wallet is not initialized");
return _wallet->is_valid_openalias_address(address.toStdString());
}
// Callbacks
void neroshop::WalletController::on_sync_progress(uint64_t height, uint64_t start_height, uint64_t end_height, double percent_done, const std::string& message) {
std::lock_guard<std::mutex> lock(_wallet->wallet_data_mutex);

@ -78,6 +78,8 @@ public:
Q_INVOKABLE bool isSynced() const;
Q_INVOKABLE bool isDaemonSynced() const;
Q_INVOKABLE bool fileExists(const QString& filename) const;
Q_INVOKABLE bool isValidAddress(const QString& address) const;
Q_INVOKABLE bool isValidOpenAliasAddress(const QString& address) const;
// Callbacks
void on_sync_progress(uint64_t height, uint64_t start_height, uint64_t end_height, double percent_done, const std::string& message);
void on_new_block (uint64_t height);

Loading…
Cancel
Save