add quickjs but has bugs

This commit is contained in:
Julian Freeman
2025-12-02 11:59:30 -04:00
parent 38ad2e64cc
commit 320c95041a
10 changed files with 700 additions and 178 deletions

View File

@@ -1,6 +1,6 @@
// filepath: src-tauri/src/commands.rs
use tauri::{AppHandle, Manager};
use crate::{ytdlp, downloader, storage};
use crate::{binary_manager, downloader, storage};
use crate::downloader::DownloadOptions;
use crate::storage::{Settings, HistoryItem};
use uuid::Uuid;
@@ -8,25 +8,35 @@ use std::path::Path;
#[tauri::command]
pub async fn init_ytdlp(app: AppHandle) -> Result<bool, String> {
if ytdlp::check_ytdlp(&app) {
if binary_manager::check_binaries(&app) {
return Ok(true);
}
// If not found, try to download
match ytdlp::download_ytdlp(&app).await {
match binary_manager::ensure_binaries(&app).await {
Ok(_) => Ok(true),
Err(e) => Err(format!("Failed to download yt-dlp: {}", e)),
Err(e) => Err(format!("Failed to download binaries: {}", e)),
}
}
#[tauri::command]
pub async fn update_ytdlp(app: AppHandle) -> Result<String, String> {
ytdlp::update_ytdlp(&app).await.map_err(|e| e.to_string())
binary_manager::update_ytdlp(&app).await.map_err(|e| e.to_string())
}
#[tauri::command]
pub async fn update_quickjs(app: AppHandle) -> Result<String, String> {
binary_manager::update_qjs(&app).await.map_err(|e| e.to_string())
}
#[tauri::command]
pub fn get_ytdlp_version(app: AppHandle) -> Result<String, String> {
ytdlp::get_version(&app).map_err(|e| e.to_string())
binary_manager::get_ytdlp_version(&app).map_err(|e| e.to_string())
}
#[tauri::command]
pub fn get_quickjs_version(app: AppHandle) -> Result<String, String> {
binary_manager::get_qjs_version(&app).map_err(|e| e.to_string())
}
#[tauri::command]