improve diagnostics, security UX, and network tab refresh

Diagnostics & logging:
- add verbose logging system (VERBOSE_LOGF) with toggle in Settings
- forward app-level log messages to Console tab for in-UI visibility
- add detailed connection attempt logging (attempt #, daemon state,
  config paths, auth failures, port owner identification)
- detect HTTP 401 auth failures and show actionable error messages
- identify port owner process (PID + name) on both Linux and Windows
- demote noisy acrylic/shader traces from DEBUG_LOGF to VERBOSE_LOGF
- persist verbose_logging preference in settings.json
- link iphlpapi on Windows for GetExtendedTcpTable

Security & encryption:
- update local encryption state immediately after encryptwallet RPC
  so Settings reflects the change before daemon restarts
- show notifications for encrypt success/failure and PIN skip
- use dedicated RPC client for z_importwallet during decrypt flow
  to avoid blocking main rpc_ curl_mutex (which starved peer/tx refresh)
- force full state refresh (addresses, transactions, peers) after
  successful wallet import

Network tab:
- redesign peers refresh button as glass-panel with icon + label,
  matching the mining button style
- add spinning arc animation while peer data is loading
  (peer_refresh_in_progress_ atomic flag set/cleared in refreshPeerInfo)
- prevent double-click spam during refresh
- add refresh-button size to ui.toml

Other:
- use fast_rpc_ for rescan polling to avoid blocking on main rpc_
- enable DRAGONX_DEBUG in all build configs (was debug-only)
- setup.sh: pull latest xmrig-hac when repo already exists
This commit is contained in:
dan_s
2026-03-05 05:26:04 -06:00
parent c51d3dafff
commit 4b16a2a2c4
19 changed files with 461 additions and 52 deletions

View File

@@ -73,6 +73,11 @@ void Logger::write(const std::string& message)
#ifdef DRAGONX_DEBUG
printf("%s\n", line.c_str());
#endif
// Forward to callback (e.g. ConsoleTab) with the raw message
if (callback_) {
callback_(message);
}
}
void Logger::writef(const char* format, ...)
@@ -87,5 +92,11 @@ void Logger::writef(const char* format, ...)
write(buffer);
}
void Logger::setCallback(std::function<void(const std::string&)> cb)
{
std::lock_guard<std::mutex> lock(mutex_);
callback_ = std::move(cb);
}
} // namespace util
} // namespace dragonx

View File

@@ -6,6 +6,7 @@
#include <string>
#include <fstream>
#include <functional>
#include <mutex>
namespace dragonx {
@@ -43,10 +44,26 @@ public:
*/
static Logger& instance();
/**
* @brief Set a callback invoked for every log message.
* The callback receives the raw (unformatted) message string.
* Thread-safe — the callback is invoked under the logger lock.
*/
void setCallback(std::function<void(const std::string&)> cb);
/**
* @brief Enable/disable verbose (diagnostic) logging.
* When disabled, VERBOSE_LOGF calls are suppressed.
*/
void setVerbose(bool v) { verbose_ = v; }
bool isVerbose() const { return verbose_; }
private:
std::ofstream file_;
std::mutex mutex_;
bool initialized_ = false;
bool verbose_ = false;
std::function<void(const std::string&)> callback_;
};
// Convenience macros
@@ -61,5 +78,12 @@ private:
#define DEBUG_LOGF(...)
#endif
// Verbose logging — only emitted when Logger::isVerbose() is true.
// Used for detailed diagnostic output (connection attempts, daemon state, etc.)
#define VERBOSE_LOGF(...) do { \
if (dragonx::util::Logger::instance().isVerbose()) \
dragonx::util::Logger::instance().writef(__VA_ARGS__); \
} while (0)
} // namespace util
} // namespace dragonx