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

@@ -105,6 +105,9 @@ bool App::init()
DEBUG_LOGF("Warning: Could not load settings, using defaults\n");
}
// Apply verbose logging preference from saved settings
util::Logger::instance().setVerbose(settings_->getVerboseLogging());
// Apply saved user font scale so fonts are correct on first reload
{
float fs = settings_->getFontScale();
@@ -191,6 +194,31 @@ bool App::init()
console_tab_.addLine(msg, color);
});
// Forward all app-level log messages (DEBUG_LOGF, LOGF, etc.) to the
// console tab so they are visible in the UI, not just in the log file.
util::Logger::instance().setCallback(
[this](const std::string& msg) {
// Classify by content: errors in red, warnings in warning color,
// everything else in the default info color.
ImU32 color = ui::ConsoleTab::COLOR_INFO;
if (msg.find("[ERROR]") != std::string::npos ||
msg.find("error") != std::string::npos ||
msg.find("Error") != std::string::npos ||
msg.find("failed") != std::string::npos ||
msg.find("Failed") != std::string::npos) {
color = ui::ConsoleTab::COLOR_ERROR;
} else if (msg.find("[WARN]") != std::string::npos ||
msg.find("warn") != std::string::npos) {
color = ui::material::Warning();
}
// Strip trailing newline so console tab lines look clean
std::string trimmed = msg;
while (!trimmed.empty() && (trimmed.back() == '\n' || trimmed.back() == '\r'))
trimmed.pop_back();
if (!trimmed.empty())
console_tab_.addLine("[app] " + trimmed, color);
});
// Check for first-run wizard — also re-run if blockchain data is missing
// even when wizard was previously completed (e.g. data dir was deleted)
if (isFirstRun()) {
@@ -286,10 +314,13 @@ void App::update()
refreshMiningInfo();
// Poll getrescaninfo for rescan progress (if rescan flag is set)
// Use fast_rpc_ when available to avoid blocking on rpc_'s
// curl_mutex (which may be held by a long-running import).
if (state_.sync.rescanning && fast_worker_) {
fast_worker_->post([this]() -> rpc::RPCWorker::MainCb {
auto* rescanRpc = (fast_rpc_ && fast_rpc_->isConnected()) ? fast_rpc_.get() : rpc_.get();
fast_worker_->post([this, rescanRpc]() -> rpc::RPCWorker::MainCb {
try {
auto info = rpc_->call("getrescaninfo");
auto info = rescanRpc->call("getrescaninfo");
bool rescanning = info.value("rescanning", false);
float progress = 0.0f;
if (info.contains("rescan_progress")) {