diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 3e3c98e9d2e8..be596e1171cb 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -7644,6 +7644,12 @@ name = "Zhenbo Li"; matrix = "@zhenbo:matrix.org"; }; + enkarterisi = { + name = "xNefas"; + email = "enkarterisi@proton.me"; + github = "xNefas"; + githubId = 199727225; + }; enorris = { name = "Eric Norris"; email = "erictnorris@gmail.com"; diff --git a/pkgs/by-name/qu/quantframe/0001-disable-telemetry.patch b/pkgs/by-name/qu/quantframe/0001-disable-telemetry.patch index 4ff0cb5b1085..e83e4e5c84c1 100644 --- a/pkgs/by-name/qu/quantframe/0001-disable-telemetry.patch +++ b/pkgs/by-name/qu/quantframe/0001-disable-telemetry.patch @@ -1,5 +1,5 @@ diff --git a/src-tauri/src/qf_client/modules/analytics.rs b/src-tauri/src/qf_client/modules/analytics.rs -index 3b31cfa..562e0b4 100644 +index f68e185..355723e 100644 --- a/src-tauri/src/qf_client/modules/analytics.rs +++ b/src-tauri/src/qf_client/modules/analytics.rs @@ -37,7 +37,7 @@ impl AnalyticsModule { @@ -11,26 +11,32 @@ index 3b31cfa..562e0b4 100644 last_user_activity: Arc::new(Mutex::new(Instant::now())), metricAndLabelPairsScheduledToSend: vec![], } -@@ -96,69 +96,6 @@ impl AnalyticsModule { - // Create Timer for sending metrics - let mut last_metric_time = Instant::now(); - +@@ -77,90 +77,7 @@ impl AnalyticsModule { + } + pub fn init(&mut self) -> Result<(), AppError> { + let app = states::app_state()?; +- if self.is_init { +- return Ok(()); +- } +- self.is_init = true; +- self.update_state(); +- +- let is_first_install = app.is_first_install.clone(); +- tauri::async_runtime::spawn({ +- async move { +- // Create a new instance of the QFClient and store it in the app state +- let qf = states::qf_client().expect("Failed to get qf client"); +- +- // Create Timer for sending metrics +- let mut last_metric_time = Instant::now(); +- - if is_first_install { -- logger::info( -- &&qf.analytics().get_component("init"), -- "Detected first install", -- LoggerOptions::default(), -- ); -- match qf -- .analytics() -- .try_send_analytics("install", 3, json!({})) -- .await -- { -- Ok(_) => {} -- Err(e) => { -- error::create_log_file("analytics.log", &e); -- } -- }; +- qf.analytics() +- .metricAndLabelPairsScheduledToSend +- .push(HashMap::from([( +- "First_Install".to_string(), +- "true".to_string(), +- )])); - } - loop { - let send_metrics = qf.analytics().send_metrics; @@ -38,50 +44,66 @@ index 3b31cfa..562e0b4 100644 - tokio::time::sleep(std::time::Duration::from_secs(60)).await; - continue; - } -- if last_metric_time.elapsed() > Duration::from_secs(15) -- || qf.analytics().is_user_active() -- { -- if last_metric_time.elapsed() > Duration::from_secs(60) -- && qf.analytics().is_user_active() -- { -- continue; -- } - -- last_metric_time = Instant::now(); -- // logger::info_con( -- // &qf.analytics().get_component("TrySendAnalytics"), -- // "Sending user activity", -- // ); -- match qf -- .analytics() -- .try_send_analytics( -- "metrics/periodic", -- 3, -- json!(qf.analytics().metricAndLabelPairsScheduledToSend), -- ) -- .await -- { -- Ok(_) => { -- qf.analytics().clear_metrics(); -- } -- Err(e) => { -- if e.cause().contains("Unauthorized") -- || e.cause().contains("Banned") -- || e.cause().contains("WFMBanned") -- { -- error::create_log_file("analytics.log", &e); -- break; -- } -- error::create_log_file("analytics.log", &e); -- } -- }; +- if last_metric_time.elapsed() < Duration::from_secs(15) +- || !qf.analytics().is_user_active() +- { +- tokio::time::sleep(std::time::Duration::from_secs(5)).await; +- continue; - } -- tokio::time::sleep(std::time::Duration::from_secs(5)).await; +- +- if last_metric_time.elapsed() < Duration::from_secs(60) +- && !qf.analytics().is_user_active() +- { +- tokio::time::sleep(std::time::Duration::from_secs(5)).await; +- continue; +- } +- +- last_metric_time = Instant::now(); +- // logger::info_con( +- // &qf.analytics().get_component("TrySendAnalytics"), +- // "Sending user activity", +- // ); +- match qf +- .analytics() +- .try_send_analytics( +- "users/metrics/periodic", +- 3, +- json!(qf.analytics().metricAndLabelPairsScheduledToSend), +- ) +- .await +- { +- Ok(_) => { +- qf.analytics().clear_metrics(); +- } +- Err(e) => { +- if e.cause().contains("Unauthorized") +- || e.cause().contains("Banned") +- || e.cause().contains("WFMBanned") +- { +- error::create_log_file("analytics.log", &e); +- break; +- } else if e.cause().contains("429") { +- logger::info( +- &qf.analytics().get_component("TrySendAnalytics"), +- "Rate limit reached, waiting for 60 seconds", +- LoggerOptions::default(), +- ); +- tokio::time::sleep(std::time::Duration::from_secs(60)).await; +- continue; +- } +- error::create_log_file("analytics.log", &e); +- } +- }; - } - qf.analytics().is_init = false; - } - }); -@@ -174,45 +111,6 @@ impl AnalyticsModule { +- qf.analytics().is_init = false; +- } +- }); ++ self.is_init = false; + Ok(()) + } + pub fn set_send_metrics(&mut self, send_metrics: bool) { +@@ -173,45 +90,6 @@ impl AnalyticsModule { mut retry_count: i64, data: Value, ) -> Result<(), AppError> { @@ -94,7 +116,7 @@ index 3b31cfa..562e0b4 100644 - let err = match self - .client - .post::( -- format!("analytics/{}?{}", url, parameters.join("&")).as_str(), +- format!("{}?{}", url, parameters.join("&")).as_str(), - data.clone(), - ) - .await @@ -124,12 +146,11 @@ index 3b31cfa..562e0b4 100644 - ); - tokio::time::sleep(std::time::Duration::from_secs(5)).await; - } -- Ok(()) -+ return Ok(()) + Ok(()) } } diff --git a/src/contexts/app.context.tsx b/src/contexts/app.context.tsx -index 8b3ced9..5da811f 100644 +index 7897db9..1945ab9 100644 --- a/src/contexts/app.context.tsx +++ b/src/contexts/app.context.tsx @@ -160,7 +160,7 @@ export function AppContextProvider({ children }: AppContextProviderProps) { diff --git a/pkgs/by-name/qu/quantframe/package.nix b/pkgs/by-name/qu/quantframe/package.nix index 440851cff716..b30f8a02ec6b 100644 --- a/pkgs/by-name/qu/quantframe/package.nix +++ b/pkgs/by-name/qu/quantframe/package.nix @@ -15,16 +15,15 @@ gtk3, nix-update-script, }: - rustPlatform.buildRustPackage (finalAttrs: { pname = "quantframe"; - version = "1.4.3"; + version = "1.5.3"; src = fetchFromGitHub { owner = "Kenya-DK"; repo = "quantframe-react"; tag = "v${finalAttrs.version}"; - hash = "sha256-ls6c9xLmjjx0kSh1s+HkdClrcTOvsAemjzqNwMeOd9c="; + hash = "sha256-afTiQzHat6k+BF8EhYhd0o0FzYjq7GpnOnjRhjXASG8="; }; postPatch = '' @@ -35,17 +34,15 @@ rustPlatform.buildRustPackage (finalAttrs: { --replace-fail '"createUpdaterArtifacts": "v1Compatible"' '"createUpdaterArtifacts": false' ''; - patches = [ - ./0001-disable-telemetry.patch - ]; + patches = [ ./0001-disable-telemetry.patch ]; pnpmDeps = pnpm_9.fetchDeps { inherit (finalAttrs) pname version src; fetcherVersion = 1; - hash = "sha256-3IHwwbl1aH3Pzh9xq2Jfev9hj6/LXZaVaIJOPbgsquE="; + hash = "sha256-ncoxliXnLxWEXL1Z7ixOULI/uYkxmfLiDWu1tDSRsrM="; }; - cargoHash = "sha256-UyfSmlr+5mWmlisNtjF6jZKx92kdQziG26mgeZtkySY="; + cargoHash = "sha256-0IgQK0jMVN6u5i4lBKK8njbMyRQCLguTdDcSBnFnyso="; nativeBuildInputs = [ cargo-tauri.hook @@ -75,6 +72,9 @@ rustPlatform.buildRustPackage (finalAttrs: { homepage = "https://quantframe.app/"; license = lib.licenses.mit; platforms = lib.platforms.linux; - maintainers = with lib.maintainers; [ nyukuru ]; + maintainers = with lib.maintainers; [ + nyukuru + enkarterisi + ]; }; })