fix some ui and trying to fix black window
This commit is contained in:
@@ -5,6 +5,8 @@ use tauri::AppHandle;
|
|||||||
use anyhow::{Result, anyhow};
|
use anyhow::{Result, anyhow};
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
use std::os::windows::process::CommandExt;
|
||||||
use zip::ZipArchive;
|
use zip::ZipArchive;
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
@@ -104,9 +106,13 @@ pub async fn update_ytdlp(app: &AppHandle) -> Result<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use built-in update for yt-dlp
|
// Use built-in update for yt-dlp
|
||||||
let output = std::process::Command::new(&path)
|
let mut cmd = std::process::Command::new(&path);
|
||||||
.arg("-U")
|
cmd.arg("-U");
|
||||||
.output()?;
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
cmd.creation_flags(0x08000000);
|
||||||
|
|
||||||
|
let output = cmd.output()?;
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
let stderr = String::from_utf8_lossy(&output.stderr).to_string();
|
let stderr = String::from_utf8_lossy(&output.stderr).to_string();
|
||||||
@@ -127,9 +133,13 @@ pub fn get_ytdlp_version(app: &AppHandle) -> Result<String> {
|
|||||||
return Ok("未安装".to_string());
|
return Ok("未安装".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
let output = std::process::Command::new(&path)
|
let mut cmd = std::process::Command::new(&path);
|
||||||
.arg("--version")
|
cmd.arg("--version");
|
||||||
.output()?;
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
cmd.creation_flags(0x08000000);
|
||||||
|
|
||||||
|
let output = cmd.output()?;
|
||||||
|
|
||||||
if output.status.success() {
|
if output.status.success() {
|
||||||
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
|
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ pub async fn fetch_metadata(app: &AppHandle, url: &str, parse_mix_playlist: bool
|
|||||||
let qjs_path = binary_manager::get_qjs_path(app)?; // Get absolute path to quickjs
|
let qjs_path = binary_manager::get_qjs_path(app)?; // Get absolute path to quickjs
|
||||||
|
|
||||||
let mut cmd = Command::new(ytdlp_path);
|
let mut cmd = Command::new(ytdlp_path);
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
cmd.creation_flags(0x08000000);
|
||||||
|
|
||||||
// Pass the runtime and its absolute path to --js-runtimes
|
// Pass the runtime and its absolute path to --js-runtimes
|
||||||
cmd.arg("--js-runtimes").arg(format!("quickjs:{}", qjs_path.to_string_lossy()));
|
cmd.arg("--js-runtimes").arg(format!("quickjs:{}", qjs_path.to_string_lossy()));
|
||||||
@@ -200,6 +202,8 @@ pub async fn download_video(
|
|||||||
}).ok();
|
}).ok();
|
||||||
|
|
||||||
let mut cmd = Command::new(ytdlp_path);
|
let mut cmd = Command::new(ytdlp_path);
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
cmd.creation_flags(0x08000000);
|
||||||
|
|
||||||
let mut child = cmd
|
let mut child = cmd
|
||||||
.args(&args)
|
.args(&args)
|
||||||
|
|||||||
@@ -225,23 +225,22 @@ async function startDownload() {
|
|||||||
<!-- Right: Settings -->
|
<!-- Right: Settings -->
|
||||||
<div class="flex items-center gap-6 w-full md:w-auto justify-end">
|
<div class="flex items-center gap-6 w-full md:w-auto justify-end">
|
||||||
<!-- Audio Only Toggle -->
|
<!-- Audio Only Toggle -->
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-x-4 p-3 bg-gray-50 dark:bg-zinc-800 rounded-xl">
|
||||||
<span class="font-medium text-sm text-zinc-700 dark:text-gray-300">仅音频</span>
|
<span class="font-medium text-base text-zinc-700 dark:text-gray-300">仅音频</span>
|
||||||
<button
|
<button
|
||||||
@click="analysisStore.options.is_audio_only = !analysisStore.options.is_audio_only"
|
@click="analysisStore.options.is_audio_only = !analysisStore.options.is_audio_only"
|
||||||
class="w-10 h-5 rounded-full relative transition-colors duration-200 ease-in-out shrink-0"
|
class="w-12 h-6 rounded-full relative transition-colors duration-200 ease-in-out"
|
||||||
:class="analysisStore.options.is_audio_only ? 'bg-blue-600' : 'bg-gray-300 dark:bg-zinc-600'"
|
:class="analysisStore.options.is_audio_only ? 'bg-blue-600' : 'bg-gray-300 dark:bg-zinc-600'"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="absolute top-1 left-1 w-3 h-3 bg-white rounded-full transition-transform duration-200"
|
class="absolute top-1 left-1 w-4 h-4 bg-white rounded-full transition-transform duration-200"
|
||||||
:class="analysisStore.options.is_audio_only ? 'translate-x-5' : 'translate-x-0'"
|
:class="analysisStore.options.is_audio_only ? 'translate-x-6' : 'translate-x-0'"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Quality Dropdown -->
|
<!-- Quality Dropdown -->
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
<span class="font-medium text-sm text-zinc-700 dark:text-gray-300">画质</span>
|
|
||||||
<div class="w-44">
|
<div class="w-44">
|
||||||
<AppSelect
|
<AppSelect
|
||||||
v-model="analysisStore.options.quality"
|
v-model="analysisStore.options.quality"
|
||||||
@@ -302,7 +301,7 @@ async function startDownload() {
|
|||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-6">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-6">
|
||||||
<!-- Audio Only Toggle -->
|
<!-- Audio Only Toggle -->
|
||||||
<div class="flex items-center justify-between p-3 bg-gray-50 dark:bg-zinc-800 rounded-xl">
|
<div class="flex items-center justify-between p-3 bg-gray-50 dark:bg-zinc-800 rounded-xl">
|
||||||
<span class="font-medium text-sm">仅音频</span>
|
<span class="font-medium text-base">仅音频</span>
|
||||||
<button
|
<button
|
||||||
@click="analysisStore.options.is_audio_only = !analysisStore.options.is_audio_only"
|
@click="analysisStore.options.is_audio_only = !analysisStore.options.is_audio_only"
|
||||||
class="w-12 h-6 rounded-full relative transition-colors duration-200 ease-in-out"
|
class="w-12 h-6 rounded-full relative transition-colors duration-200 ease-in-out"
|
||||||
|
|||||||
Reference in New Issue
Block a user