bug fix 1
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
// filepath: src-tauri/src/commands.rs
|
// filepath: src-tauri/src/commands.rs
|
||||||
use tauri::AppHandle;
|
use tauri::{AppHandle, Manager};
|
||||||
use crate::{ytdlp, downloader, storage};
|
use crate::{ytdlp, downloader, storage};
|
||||||
use crate::downloader::DownloadOptions;
|
use crate::downloader::DownloadOptions;
|
||||||
use crate::storage::{Settings, HistoryItem};
|
use crate::storage::{Settings, HistoryItem};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn init_ytdlp(app: AppHandle) -> Result<bool, String> {
|
pub async fn init_ytdlp(app: AppHandle) -> Result<bool, String> {
|
||||||
@@ -89,18 +90,26 @@ pub fn delete_history_item(app: AppHandle, id: String) -> Result<(), String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn open_in_explorer(path: String) -> Result<(), String> {
|
pub fn open_in_explorer(app: AppHandle, path: String) -> Result<(), String> {
|
||||||
|
let path_to_open = if Path::new(&path).exists() {
|
||||||
|
path
|
||||||
|
} else {
|
||||||
|
app.path().download_dir()
|
||||||
|
.map(|p| p.to_string_lossy().to_string())
|
||||||
|
.unwrap_or_else(|_| ".".to_string())
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
std::process::Command::new("explorer")
|
std::process::Command::new("explorer")
|
||||||
.arg(path)
|
.arg(path_to_open)
|
||||||
.spawn()
|
.spawn()
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
std::process::Command::new("open")
|
std::process::Command::new("open")
|
||||||
.arg(path)
|
.arg(path_to_open)
|
||||||
.spawn()
|
.spawn()
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,3 +6,31 @@
|
|||||||
body {
|
body {
|
||||||
@apply bg-gray-50 text-zinc-900 dark:bg-zinc-950 dark:text-gray-100 transition-colors duration-300;
|
@apply bg-gray-50 text-zinc-900 dark:bg-zinc-950 dark:text-gray-100 transition-colors duration-300;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Scrollbar Styling */
|
||||||
|
/* Webkit (Chrome, Safari, Edge, Tauri) */
|
||||||
|
|
||||||
|
/* Light Mode Scrollbar */
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
@apply bg-transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
@apply bg-gray-300 rounded-full border-4 border-solid border-transparent bg-clip-content hover:bg-gray-400;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark Mode Scrollbar */
|
||||||
|
.dark ::-webkit-scrollbar-thumb {
|
||||||
|
@apply bg-zinc-700 hover:bg-zinc-600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make the thumb thicker on hover if desired, but consistent look is better */
|
||||||
|
/* Corner */
|
||||||
|
::-webkit-scrollbar-corner {
|
||||||
|
@apply bg-transparent;
|
||||||
|
}
|
||||||
@@ -36,13 +36,11 @@ async function clearHistory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function deleteItem(id: string) {
|
async function deleteItem(id: string) {
|
||||||
if(confirm('Delete this history record? (File will not be deleted)')) {
|
try {
|
||||||
try {
|
await invoke('delete_history_item', { id })
|
||||||
await invoke('delete_history_item', { id })
|
history.value = history.value.filter(h => h.id !== id)
|
||||||
history.value = history.value.filter(h => h.id !== id)
|
} catch (e) {
|
||||||
} catch (e) {
|
console.error(e)
|
||||||
console.error(e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user