@ -3,4 +3,4 @@ There are many ways that you can contribute.
- Creating [pull requests](https://github.com/larteyoh/testshop/pulls) that solve issues found on the [Issues page](https://github.com/larteyoh/testshop/issues)
- Making a [donation](https://github.com/larteyoh/testshop#donations) to fund the development of the project
- Reporting any bugs or vulnerabilities found in the code as a GitHub [issue](https://github.com/larteyoh/testshop/issues)
- Sharing this project so more people can learn about its existence
// either neroshop's daemon does not exist or remote is set to true
if(!std::filesystem::is_regular_file(daemon_dir)||remote==true){std::cout<<"\033[1;90;49m"<<"connecting to remote node - "<<(ip+":"+port)<<"\033[0m"<<std::endl;return;}// exit function
if(!std::filesystem::is_regular_file(daemon_dir)){std::cout<<"monerod not found. Please set the path or use a remote node instead"/*"\033[1;90;49m" << "connecting to remote node - " << (ip + ":" + port) << "\033[0m"*/<<"\n";return;}// exit function
// check if there is another monerod process running in the background
if(monerod!=-1){std::cout<<"\033[1;90;49m"<<"monerod is running (ID:"<<monerod<<")\033[0m"<<std::endl;return;}// daemon that was previously running in the background // exit function
database->execute("CREATE TABLE users(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT);");
database->execute("ALTER TABLE users ADD COLUMN name TEXT;");// optional display name
database->execute("ALTER TABLE users ADD COLUMN name TEXT;");// DEFAULT '' NOT NULL;"); // optional display name
database->execute("ALTER TABLE users ADD COLUMN monero_address TEXT;");// verify_key - public_key used for logins and for verification of signatures
database->execute("ALTER TABLE users ADD COLUMN public_key TEXT;");// encrypt_key - public_key used for encryption of messages
database->execute("ALTER TABLE users ADD COLUMN public_key TEXT DEFAULT NULL;");// encrypt_key - public_key used for encryption of messages
database->execute("CREATE UNIQUE INDEX index_user_names ON users (name);");// enforce that the user names are unique, in case there is an attempt to insert a new "name" of the same value
////database->execute("CREATE UNIQUE INDEX index_user_names ON users (name);"); // Will not allow empty strings :(
database->execute("CREATE UNIQUE INDEX index_user_auth_keys ON users (monero_address);");
database->execute("CREATE UNIQUE INDEX index_public_keys ON users (public_key);");
// username (will appear only in lower-case letters within the app)
std::stringusername=display_name.toStdString();
// Empty display names are acceptable
if(display_name.isEmpty())return{true,""};
// If display name is set, make sure it is at least 2 characters short (min_user_length=2)
unsignedintmin_user_length=2;
if(username.length()<min_user_length){
std::stringmessage="Your username must be at least "+std::to_string(min_user_length)+" characters in length";
return{false,QString::fromStdString(message)};
}
// make sure username is at least 30 characters long (max_user_length=30)
unsignedintmax_user_length=30;// what if a company has a long name? :o // also consider the textbox's max-length
if(username.length()>max_user_length){
std::stringmessage="Your username must not exceed "+std::to_string(max_user_length)+" characters in length";
return{false,QString::fromStdString(message)};
}
for(inti=0;i<username.length();i++)
{
// make sure username does not contain any spaces //std::cout << username[i] << " - char\n";
if(isspace(username[i])){
std::stringmessage="Your username cannot contain any spaces";
return{false,QString::fromStdString(message)};
}
// make sure username can only contain letters, numbers, and these specific symbols: a hyphen, underscore, and period (-,_,.) //https://stackoverflow.com/questions/39819830/what-are-the-allowed-character-in-snapchat-username#comment97381763_41959421
if(!database)throwstd::runtime_error("database is NULL");
//----------------------------
Wallet*wallet=newWallet();
// Initialize monero wallet with existing wallet file
std::stringwallet_password;// = "supersecretpassword123"; // Apparently passwords are not used nor required for mnemonics. ONLY wallet files use passwords
//std::cout << "Please upload your wallet file:\n";
std::cout<<"Please enter your wallet password:\n";
if(!database)throwstd::runtime_error("database is NULL");
//----------------------------
Wallet*wallet=newWallet();
// Initialize monero wallet with existing wallet mnemonic
std::stringwallet_mnemonic;// = "hefty value later extra artistic firm radar yodel talent future fungal nutshell because sanity awesome nail unjustly rage unafraid cedar delayed thumbs comb custom sanity";
std::cout<<"Please enter your wallet mnemonic:\n";
std::getline(std::cin,wallet_mnemonic);
// todo: allow user to specify a custom location for the wallet keyfile or use a default location