Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: remove hotmart_debug_auth command and related debug logic

Tonhoe4f783fc5bb0
diff --git a/src-tauri/src/commands/auth.rs b/src-tauri/src/commands/auth.rs
index 3b16c576..d1634eae 100644
--- a/src-tauri/src/commands/auth.rs
+++ b/src-tauri/src/commands/auth.rs
@@ -1,6 +1,5 @@
use std::time::{Duration, Instant};
-use crate::platforms::hotmart::api;
use crate::platforms::hotmart::auth::{authenticate, delete_saved_session, load_saved_session, save_session};
use crate::AppState;
@@ -111,96 +110,3 @@ pub async fn hotmart_logout(
Ok(())
}
-#[tauri::command]
-pub async fn hotmart_debug_auth(
- state: tauri::State<'_, AppState>,
-) -> Result<String, String> {
- tracing::info!("=== DEBUG AUTH INICIADO ===");
-
- let guard = state.hotmart_session.lock().await;
- let has_session = guard.is_some();
- drop(guard);
-
- if !has_session {
- tracing::info!("[DEBUG] Nenhuma sessão ativa, fazendo login...");
- match authenticate("[email protected]", "Cecilinda2019").await {
- Ok(session) => {
- tracing::info!("[DEBUG] Login bem-sucedido!");
- let mut guard = state.hotmart_session.lock().await;
- *guard = Some(session);
- }
- Err(e) => {
- let msg = format!("[DEBUG] FALHA no login: {}", e);
- tracing::error!("{}", msg);
- return Err(msg);
- }
- }
- }
-
- let guard = state.hotmart_session.lock().await;
- let session = guard.as_ref().unwrap();
-
-
- tracing::info!("[DEBUG] Token extraído: {}...", &session.token[..20.min(session.token.len())]);
-
- let cookie_names: Vec<&str> = session.cookies.iter().map(|(name, _)| name.as_str()).collect();
- tracing::info!("[DEBUG] Cookies na sessão: {:?}", cookie_names);
-
- let has_vlc = session.cookies.iter().any(|(name, _)| name == "hmVlcIntegration");
- tracing::info!("[DEBUG] hmVlcIntegration presente: {}", has_vlc);
-
- tracing::info!("[DEBUG] Chamando check_token...");
- match api::get_subdomains(session).await {
- Ok(subdomains) => {
- tracing::info!("[DEBUG] Subdomínios encontrados: {}", subdomains.len());
- for s in &subdomains {
- tracing::info!("[DEBUG] productId: {} → subdomain: {}", s.product_id, s.subdomain);
- }
- }
- Err(e) => {
- tracing::error!("[DEBUG] FALHA check_token: {}", e);
- return Err(format!("check_token falhou: {}", e));
- }
- }
-
- tracing::info!("[DEBUG] Chamando list_courses...");
- let mut courses = match api::list_courses(session).await {
- Ok(c) => {
- tracing::info!("[DEBUG] Cursos encontrados: {}", c.len());
- c
- }
- Err(e) => {
- tracing::error!("[DEBUG] FALHA list_courses: {}", e);
- return Err(format!("list_courses falhou: {}", e));
- }
- };
-
- if let Ok(subdomains) = api::get_subdomains(session).await {
- api::merge_subdomains(&mut courses, &subdomains);
- }
-
- let mut output_lines = Vec::new();
- for course in &mut courses {
- let price = match api::get_course_price(session, course.id).await {
- Ok(p) => {
- course.price = Some(p);
- format!("R${:.2}", p)
- }
- Err(_) => "N/A".to_string(),
- };
- let line = format!(
- "- {} (ID: {}, slug: {:?}, preço: {})",
- course.name, course.id, course.slug, price
- );
- tracing::info!("[DEBUG] {}", line);
- output_lines.push(line);
- }
-
- tracing::info!("=== DEBUG AUTH CONCLUÍDO: {} cursos ===", courses.len());
-
- Ok(format!(
- "Debug concluído: {} cursos encontrados\n{}",
- courses.len(),
- output_lines.join("\n")
- ))
-}