minor changes

pull/234/head
larteyoh 3 months ago
parent 8006fbf26e
commit 076665cf93

@ -383,7 +383,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/cxxopts/include/)
######################################
# libi2pd (and i2pd_client)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/i2pd/daemon ${CMAKE_CURRENT_SOURCE_DIR}/external/i2pd/i18n ${CMAKE_CURRENT_SOURCE_DIR}/external/i2pd/libi2pd ${CMAKE_CURRENT_SOURCE_DIR}/external/i2pd/libi2pd_client)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/i2pd/daemon ${CMAKE_CURRENT_SOURCE_DIR}/external/i2pd/i18n ${CMAKE_CURRENT_SOURCE_DIR}/external/i2pd/libi2pd ${CMAKE_CURRENT_SOURCE_DIR}/external/i2pd/libi2pd_client) # v2.50.2
set(i2pd_src ${CMAKE_CURRENT_SOURCE_DIR}/build/libi2pd.a ${CMAKE_CURRENT_SOURCE_DIR}/build/libi2pdclient.a ${CMAKE_CURRENT_SOURCE_DIR}/build/libi2pdlang.a)
######################################

@ -97,7 +97,7 @@ https://user-images.githubusercontent.com/58671384/219222567-f170f728-be31-43d5-
| [json](https://github.com/nlohmann/json/) | ? | json parsing and msgpack | :heavy_check_mark: :package: |
| [curl](https://github.com/curl/curl) | ? | currency conversion | :heavy_check_mark: :white_square_button: |
| [openssl](https://github.com/openssl/openssl) | 1.1.1 | for curl, sha256 sum and message encryption | :heavy_check_mark: |
| [Qt](https://www.qt.io/) | 5.12.8 | graphical user interface | :heavy_check_mark: |
| [Qt](https://www.qt.io/) | 5.15.x | graphical user interface | :heavy_check_mark: |
| [raft](https://github.com/willemt/raft) | ? | consensus mechanism | :grey_question: :package: |
| [stduuid](https://github.com/mariusbancila/stduuid) | ? | unique id generation | :heavy_check_mark: :white_square_button: :package: |
| [linenoise](https://github.com/antirez/linenoise) | ? | command line interface | :heavy_check_mark: :white_square_button: :package: |

@ -1 +1 @@
Subproject commit 5a8de6ad262f9ca5ec4e0ae1134ba803e5cbf046
Subproject commit 289de097fa5f2f88ac5ff362c821319ba2cf8b02

@ -21,7 +21,7 @@ ApplicationWindow {
//visibility: (Script.getJsonRootObject()["window_mode"] == 1) ? "FullScreen" : "Windowed"
title: qsTr("neroshop" + " v" + neroshopVersion)
width: 1024//Script.getJsonRootObject()["window_width"]
height: 768//Script.getJsonRootObject()["window_height"]
height: 700//Script.getJsonRootObject()["window_height"]
minimumWidth: 1024
minimumHeight: 700//768
color: NeroshopComponents.Style.getColorsFromTheme()[0]

@ -0,0 +1,5 @@
#include <iostream>
int main(int argc, char* argv[]) {
return 0;
}

@ -170,7 +170,7 @@ void neroshop::Mapper::sync() {
for (const auto& entry : user_ids) {
const std::string& search_term = entry.first;
const std::vector<std::string>& keys = entry.second;
const std::string content = "account";
const std::string content = "user";
for (const std::string& key : keys) {
// Ignore any empty keys
@ -190,7 +190,7 @@ void neroshop::Mapper::sync() {
for (const auto& entry : display_names) {
const std::string& search_term = entry.first;
const std::vector<std::string>& keys = entry.second;
const std::string content = "account";
const std::string content = "user";
for (const std::string& key : keys) {
// Ignore any empty keys

@ -759,10 +759,10 @@ QVariantList neroshop::Backend::getSellerRatings(const QString& user_id) {
QString neroshop::Backend::getDisplayNameByUserId(const QString& user_id) {
db::Sqlite3 * database = neroshop::get_database();
if(!database) throw std::runtime_error("database is NULL");
std::string key = database->get_text_params("SELECT key FROM mappings WHERE search_term = ?1 AND content = 'account' LIMIT 1;", { user_id.toStdString() });
std::string key = database->get_text_params("SELECT key FROM mappings WHERE search_term = ?1 AND content = 'user' LIMIT 1;", { user_id.toStdString() });
if(key.empty()) return user_id; // Key will never be empty as long as it exists in DHT + database
std::string display_name = database->get_text_params("SELECT search_term FROM mappings WHERE key = ?1 AND LENGTH(search_term) <= 30 AND content = 'account'", { key });
std::string display_name = database->get_text_params("SELECT search_term FROM mappings WHERE key = ?1 AND LENGTH(search_term) <= 30 AND content = 'user'", { key });
if(!display_name.empty()) {
return QString::fromStdString(display_name);
}
@ -778,7 +778,7 @@ QString neroshop::Backend::getDisplayNameByUserId(const QString& user_id) {
QString neroshop::Backend::getKeyByUserId(const QString& user_id) { // not currently in use
db::Sqlite3 * database = neroshop::get_database();
if(!database) throw std::runtime_error("database is NULL");
std::string key = database->get_text_params("SELECT key FROM mappings WHERE search_term = $1 AND content = 'account' LIMIT 1;", { user_id.toStdString() });
std::string key = database->get_text_params("SELECT key FROM mappings WHERE search_term = $1 AND content = 'user' LIMIT 1;", { user_id.toStdString() });
return QString::fromStdString(key);
}
//----------------------------------------------------------------
@ -787,7 +787,7 @@ QVariantMap neroshop::Backend::getUser(const QString& user_id) {
db::Sqlite3 * database = neroshop::get_database();
if(!database) throw std::runtime_error("database is NULL");
std::string key = database->get_text_params("SELECT key FROM mappings WHERE search_term = $1 AND content = 'account' LIMIT 1;", { user_id.toStdString() });
std::string key = database->get_text_params("SELECT key FROM mappings WHERE search_term = $1 AND content = 'user' LIMIT 1;", { user_id.toStdString() });
if(key.empty()) return {};
// Get the value of the corresponding key from the DHT
std::string response;
@ -1831,7 +1831,7 @@ int neroshop::Backend::loginWithWalletFile(WalletController* wallet_controller,
std::string primary_address = wallet_controller->getPrimaryAddress().toStdString();
//----------------------------------------
// Check database to see if user key (hash of primary address) exists
bool user_found = database->get_integer_params("SELECT EXISTS(SELECT * FROM mappings WHERE search_term = ?1 AND content = 'account')", { primary_address });
bool user_found = database->get_integer_params("SELECT EXISTS(SELECT * FROM mappings WHERE search_term = ?1 AND content = 'user')", { primary_address });
// If user key is not found in the database, then create one. This is like registering for an account
if(!user_found) {
// In reality, this function will return false if user key is not registered in the database
@ -1840,9 +1840,9 @@ int neroshop::Backend::loginWithWalletFile(WalletController* wallet_controller,
return static_cast<int>(EnumWrapper::LoginError::UserNotFound);
}
// Get the account DHT key
std::string account_key = database->get_text_params("SELECT key FROM mappings WHERE search_term = ?1 AND content = 'account'", { primary_address });
std::string account_key = database->get_text_params("SELECT key FROM mappings WHERE search_term = ?1 AND content = 'user'", { primary_address });
// Save user information in memory
std::string display_name = database->get_text_params("SELECT search_term FROM mappings WHERE key = ?1 AND LENGTH(search_term) <= 30 AND content = 'account'", { account_key });
std::string display_name = database->get_text_params("SELECT search_term FROM mappings WHERE key = ?1 AND LENGTH(search_term) <= 30 AND content = 'user'", { account_key });
std::unique_ptr<neroshop::User> seller(neroshop::Seller::on_login(*wallet_controller->getWallet()));
user_controller->_user = std::move(seller);
if(user_controller->getUser() == nullptr) {

Loading…
Cancel
Save