Commit c9b959c0 authored by nyukuru's avatar nyukuru
Browse files

quantframe: init at 1.3.4

parent 8fe0b9de
Loading
Loading
Loading
Loading
+103 −0
Original line number Diff line number Diff line
diff --git a/src-tauri/src/qf_client/modules/analytics.rs b/src-tauri/src/qf_client/modules/analytics.rs
index f6f1209..e08490b 100644
--- a/src-tauri/src/qf_client/modules/analytics.rs
+++ b/src-tauri/src/qf_client/modules/analytics.rs
@@ -115,52 +115,6 @@ impl AnalyticsModule {
                         }
                     };
                 }
-                loop {
-                    let send_metrics = qf.analytics().send_metrics;
-                    if !send_metrics {
-                        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".to_string(), &e);
-                                    break;
-                                }
-                                error::create_log_file("analytics.log".to_string(), &e);
-                            }
-                        };
-                    }
-                    tokio::time::sleep(std::time::Duration::from_secs(5)).await;
-                }
                 qf.analytics().is_init = false;
             }
         });
@@ -176,44 +130,6 @@ impl AnalyticsModule {
         mut retry_count: i64,
         data: Value,
     ) -> Result<(), AppError> {
-        let mut parameters: Vec<String> = vec![];
-        if self.is_user_active() {
-            parameters.push(format!("Active_Page={}", self.current_page));
-        }
-
-        while retry_count >= 0 {
-            let err = match self
-                .client
-                .post::<Value>(
-                    format!("analytics/{}?{}", url, parameters.join("&")).as_str(),
-                    data.clone(),
-                )
-                .await
-            {
-                Ok(ApiResult::Success(_, _)) => {
-                    return Ok(());
-                }
-                Ok(ApiResult::Error(e, _headers)) => AppError::new_api(
-                    &self.get_component("TrySendAnalytics"),
-                    e,
-                    eyre!("Failed to send analytics"),
-                    LogLevel::Error,
-                ),
-                Err(e) => e,
-            };
-            if retry_count == 0 {
-                return Err(err);
-            }
-            retry_count -= 1;
-            logger::warning_con(
-                &self.get_component("TrySendAnalytics"),
-                &format!(
-                    "Failed to send analytics, retrying in 5 seconds, retries left: {}",
-                    retry_count
-                ),
-            );
-            tokio::time::sleep(std::time::Duration::from_secs(5)).await;
-        }
-        Ok(())
+        return Ok(());
     }
 }
+76 −0
Original line number Diff line number Diff line
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  cargo-tauri_1,
  nodejs,
  pnpm_9,
  pkg-config,
  glib-networking,
  openssl,
  webkitgtk_4_0,
  wrapGAppsHook3,
  libsoup_2_4,
  libayatana-appindicator,
  gtk3,
}:

rustPlatform.buildRustPackage (finalAttrs: {
  pname = "quantframe";
  version = "1.3.4";

  src = fetchFromGitHub {
    owner = "Kenya-DK";
    repo = "quantframe-react";
    tag = "v${finalAttrs.version}";
    hash = "sha256-/cjlYQHb23DY4RSjc2HosTar6p1epsqlWQX6TlrzSe8=";
  };

  postPatch = ''
    substituteInPlace $cargoDepsCopy/libappindicator-sys-*/src/lib.rs \
      --replace-fail "libayatana-appindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
  '';

  patches = [
    ./0001-disable-telemetry.patch
  ];

  pnpmDeps = pnpm_9.fetchDeps {
    inherit (finalAttrs) pname version src;
    hash = "sha256-4uyjvwvrMDe+86wcB7MBBWWc4NGKzqBsgG3TScf7BMk=";
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-mtHbWTNrWh4hq4IAncE9TCWr7sozIy2zf3DK3WN7wqI=";

  nativeBuildInputs = [
    cargo-tauri_1.hook

    pkg-config
    wrapGAppsHook3

    nodejs
    pnpm_9.configHook
  ];

  buildInputs = [
    openssl
    libsoup_2_4
    glib-networking
    gtk3
    libayatana-appindicator
    webkitgtk_4_0
  ];

  cargoRoot = "src-tauri";
  buildAndTestSubdir = finalAttrs.cargoRoot;

  meta = {
    description = "Warframe Market listings and transactions manager";
    mainProgram = "quantframe";
    homepage = "https://quantframe.app/";
    license = lib.licenses.mit;
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ nyukuru ];
  };
})