add quickjs but has bugs
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user