Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
shanimal08 committed Oct 25, 2024
2 parents fc46d84 + c7259d2 commit 14111d0
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 39 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ version = "0.5.45"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = {version = "1.5.5", features = ["isolation"]}
tauri-build = {version = "1.5.5", features = ["isolation"] }

[dependencies]
anyhow = "1"
async-trait = "0.1.81"
async_zip = {version = "0.0.17", features = ["full"]}
async_zip = {version = "0.0.17", features = ["full"] }
auto-launch = "0.5.0"
blake2 = "0.10"
chrono = "0.4.38"
Expand All @@ -23,31 +23,32 @@ dunce = "1.0.5"
flate2 = "1.0.30"
futures-lite = "2.3.0"
futures-util = "0.3.30"
human_format = "1.1.0"
jsonwebtoken = "9.3.0"
keyring = {version = "3.0.5", features = [
"windows-native",
"apple-native",
"linux-native",
]}
] }
libsqlite3-sys = {version = "0.25.1", features = [
"bundled",
]}# Required for tari_wallet
] }# Required for tari_wallet
log = "0.4.22"
log4rs = "1.3.0"
minotari_node_grpc_client = {git = "https://github.com/tari-project/tari.git", branch = "development"}
minotari_wallet_grpc_client = {git = "https://github.com/tari-project/tari.git", branch = "development"}
nix = {version = "0.29.0", features = ["signal"]}
nix = {version = "0.29.0", features = ["signal"] }
nvml-wrapper = "0.10.0"
open = "5"
phraze = "0.3.15"
rand = "0.8.5"
regex = "1.10.5"
reqwest = {version = "0.12.5", features = ["stream", "json", "multipart"]}
reqwest = {version = "0.12.5", features = ["stream", "json", "multipart"] }
sanitize-filename = "0.5"
semver = "1.0.23"
sentry = {version = "0.34.0", features = ["anyhow"]}
sentry = {version = "0.34.0", features = ["anyhow"] }
sentry-tauri = "0.3.0"
serde = {version = "1", features = ["derive"]}
serde = {version = "1", features = ["derive"] }
serde_json = "1"
sha2 = "0.10.8"
sys-locale = "0.3.1"
Expand Down Expand Up @@ -79,12 +80,12 @@ tauri = {version = "1.8.0", features = [
"icon-ico",
"icon-png",
"process-command-api",
]}
] }
tauri-plugin-single-instance = {git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1"}
thiserror = "1.0.26"
tokio = {version = "1", features = ["full"]}
tokio-util = {version = "0.7.11", features = ["compat"]}
xz2 = {version = "0.1.7", features = ["static"]}# static bind lzma
tokio = {version = "1", features = ["full"] }
tokio-util = {version = "0.7.11", features = ["compat"] }
xz2 = {version = "0.1.7", features = ["static"] }# static bind lzma
zip = "2.2.0"

[target.'cfg(windows)'.dependencies]
Expand All @@ -93,7 +94,7 @@ winreg = "0.52.0"
# needed for keymanager. TODO: Find a way of creating a keymanager without bundling sqlite
chrono = "0.4.38"
device_query = "2.1.0"
libsqlite3-sys = {version = "0.25.1", features = ["bundled"]}
libsqlite3-sys = {version = "0.25.1", features = ["bundled"] }
log = "0.4.22"
nvml-wrapper = "0.10.0"
rand = "0.8.5"
Expand Down
10 changes: 0 additions & 10 deletions src-tauri/src/format_utils.rs

This file was deleted.

3 changes: 1 addition & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ mod cpu_miner;
mod download_utils;
mod external_dependencies;
mod feedback;
mod format_utils;
mod github;
mod gpu_miner;
mod gpu_miner_adapter;
Expand Down Expand Up @@ -1566,7 +1565,7 @@ async fn get_miner_metrics(
cpu_mining_status.hash_rate,
gpu_mining_status.hash_rate as f64,
hardware_status.clone(),
cpu_mining_status.estimated_earnings as f64,
(cpu_mining_status.estimated_earnings + gpu_mining_status.estimated_earnings) as f64,
);

SystemtrayManager::current().update_systray(app, new_systemtray_data);
Expand Down
2 changes: 2 additions & 0 deletions src-tauri/src/p2pool_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ impl P2poolManager {
return Ok(());
}
process_watcher.adapter.config = Some(config);
process_watcher.health_timeout = Duration::from_secs(28);
process_watcher.poll_time = Duration::from_secs(30);
process_watcher
.start(
app_shutdown,
Expand Down
42 changes: 32 additions & 10 deletions src-tauri/src/systemtray_manager.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use human_format::Formatter;
use log::{error, info};
use std::sync::LazyLock;
use tauri::{
AppHandle, CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu,
SystemTrayMenuItem,
};

use crate::format_utils::format_balance;
use crate::hardware_monitor::HardwareStatus;

const LOG_TARGET: &str = "tari::universe::systemtray_manager";
Expand Down Expand Up @@ -34,12 +34,30 @@ impl SystrayItemId {

pub fn get_title(&self, value: f64) -> String {
match self {
SystrayItemId::CpuHashrate => format!("CPU Hashrate: {:.2} H/s", value),
SystrayItemId::GpuHashrate => format!("GPU Hashrate: {:.2} H/s", value),
SystrayItemId::CpuHashrate => format!(
"CPU Hashrate: {} H/s",
Formatter::new()
.with_decimals(2)
.with_separator("")
.format(value)
),
SystrayItemId::GpuHashrate => format!(
"GPU Hashrate: {} H/s",
Formatter::new()
.with_decimals(2)
.with_separator("")
.format(value)
),
SystrayItemId::CpuUsage => format!("CPU Usage: {:.2}%", value),
SystrayItemId::GpuUsage => format!("GPU Usage: {:.2}%", value),
SystrayItemId::EstimatedEarning => {
format!("Est earning: {} tXTM/day", format_balance(value))
format!(
"Est earning: {} tXTM/day",
Formatter::new()
.with_decimals(2)
.with_separator("")
.format(value / 1_000_000.0)
)
}
SystrayItemId::UnMinimize => "Unminimize".to_string(),
}
Expand Down Expand Up @@ -149,19 +167,23 @@ impl SystemtrayManager {
match current_os {
CurrentOperatingSystem::Windows => {
format!(
"Hashrate | Usage\nCPU: {:.0} H/s | {:.0}%\nGPU: {:.0} H/s | {:.0}%\nEst. earning: {} tXTM/day",
data.cpu_hashrate,
"Hashrate | Usage\nCPU: {} H/s | {:.0}%\nGPU: {} H/s | {:.0}%\nEst. earning: {} tXTM/day",
Formatter::new().with_decimals(2).with_separator("").format(data.cpu_hashrate),
data.cpu_usage,
data.gpu_hashrate,
Formatter::new().with_decimals(2).with_separator("").format(data.gpu_hashrate),
data.gpu_usage,
format_balance(data.estimated_earning)
Formatter::new().with_decimals(2).with_separator("").format(data.estimated_earning / 1_000_000.0)
)
}
CurrentOperatingSystem::Linux => "Not supported".to_string(),
CurrentOperatingSystem::MacOS => {
format!(
"CPU:\n Hashrate: {:.0} H/s\n Usage: {:.0}%\nGPU:\n Hashrate: {:.0} H/s\n Usage: {:.0}%\nEst. earning: {} tXTM/day",
data.cpu_hashrate, data.cpu_usage, data.gpu_hashrate, data.gpu_usage, format_balance(data.estimated_earning)
"CPU:\n Hashrate: {} H/s\n Usage: {:.0}%\nGPU:\n Hashrate: {} H/s\n Usage: {:.0}%\nEst. earning: {} tXTM/day",
Formatter::new().with_decimals(0).with_separator("").format(data.cpu_hashrate),
data.cpu_usage,
Formatter::new().with_decimals(2).with_separator("").format(data.gpu_hashrate),
data.gpu_usage,
Formatter::new().with_decimals(2).with_separator("").format(data.estimated_earning / 1_000_000.0)
)
}
}
Expand Down
32 changes: 30 additions & 2 deletions src/AppWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,43 @@ const sentryOptions = {
tracesSampleRate: 1.0,
attachStacktrace: true,
autoSessionTracking: false,
enabled: environment !== 'development',
};

setupLogger();

const useDisableRefresh = () => {
useEffect(() => {
if (process.env.NODE_ENV === 'development') {
return;
}
const keydownListener = function (event: KeyboardEvent) {
// Prevent F5 or Ctrl+R (Windows/Linux) and Command+R (Mac) from refreshing the page
if (event.key === 'F5' || (event.ctrlKey && event.key === 'r') || (event.metaKey && event.key === 'r')) {
event.preventDefault();
}
};

const contextmenuListener = function (event: MouseEvent) {
event.preventDefault();
};

document.addEventListener('keydown', keydownListener);
document.addEventListener('contextmenu', contextmenuListener);

return () => {
document.removeEventListener('keydown', keydownListener);
document.removeEventListener('contextmenu', contextmenuListener);
};
}, []);
};

export default function AppWrapper() {
useDetectMode();
useLangaugeResolver();
const allowTelemetry = useAppConfigStore((s) => s.allow_telemetry);
const fetchAppConfig = useAppConfigStore((s) => s.fetchAppConfig);
useLangaugeResolver();
useDisableRefresh();

useEffect(() => {
async function initialize() {
Expand All @@ -42,7 +70,7 @@ export default function AppWrapper() {
}, []);

useEffect(() => {
if (allowTelemetry) {
if (allowTelemetry && environment !== 'development') {
Sentry.init(sentryOptions);
} else {
Sentry.close();
Expand Down

0 comments on commit 14111d0

Please sign in to comment.