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.

study

Tonho85711904d850
diff --git a/src-tauri/omniget-core/src/core/mod.rs b/src-tauri/omniget-core/src/core/mod.rs
index 14921f7d..e4004935 100644
--- a/src-tauri/omniget-core/src/core/mod.rs
+++ b/src-tauri/omniget-core/src/core/mod.rs
@@ -13,6 +13,7 @@ pub mod hwaccel;
pub mod log_hook;
pub mod media_processor;
pub mod paths;
+pub mod pdfium;
pub mod pokemon_names;
pub mod process;
pub mod redirect;
diff --git a/src-tauri/omniget-core/src/core/pdfium.rs b/src-tauri/omniget-core/src/core/pdfium.rs
new file mode 100644
index 00000000..01cb7d9c
--- /dev/null
+++ b/src-tauri/omniget-core/src/core/pdfium.rs
@@ -0,0 +1,291 @@
+use std::io::Read;
+use std::path::{Path, PathBuf};
+
+use anyhow::{anyhow, Context};
+use serde::Serialize;
+
+const PDFIUM_DOWNLOAD_BASE: &str =
+ "https://github.com/bblanchon/pdfium-binaries/releases/latest/download";
+
+#[derive(Debug, Clone, Serialize)]
+pub struct DependencyVariant {
+ pub id: String,
+ pub label: String,
+ pub recommended: bool,
+}
+
+pub fn pdfium_lib_filename() -> &'static str {
+ if cfg!(target_os = "windows") {
+ "pdfium.dll"
+ } else if cfg!(target_os = "macos") {
+ "libpdfium.dylib"
+ } else {
+ "libpdfium.so"
+ }
+}
+
+fn default_archive_id() -> &'static str {
+ #[cfg(all(target_os = "windows", target_arch = "x86_64"))]
+ {
+ return "win-x64";
+ }
+ #[cfg(all(target_os = "windows", target_arch = "x86"))]
+ {
+ return "win-x86";
+ }
+ #[cfg(all(target_os = "windows", target_arch = "aarch64"))]
+ {
+ return "win-arm64";
+ }
+ #[cfg(all(target_os = "macos", target_arch = "x86_64"))]
+ {
+ return "mac-x64";
+ }
+ #[cfg(all(target_os = "macos", target_arch = "aarch64"))]
+ {
+ return "mac-arm64";
+ }
+ #[cfg(all(target_os = "linux", target_arch = "x86_64"))]
+ {
+ return "linux-x64";
+ }
+ #[cfg(all(target_os = "linux", target_arch = "aarch64"))]
+ {
+ return "linux-arm64";
+ }
+ #[allow(unreachable_code)]
+ "win-x64"
+}
+
+pub fn list_variants() -> Vec<DependencyVariant> {
+ let default = default_archive_id();
+ let make = |id: &str, label: &str| DependencyVariant {
+ id: id.to_string(),
+ label: label.to_string(),
+ recommended: id == default,
+ };
+
+ if cfg!(target_os = "windows") {
+ vec![
+ make("win-x64", "Windows x64 (64-bit)"),
+ make("win-x64-v8", "Windows x64 + V8 (com JS, maior)"),
+ make("win-x86", "Windows x86 (32-bit)"),
+ make("win-arm64", "Windows ARM64"),
+ ]
+ } else if cfg!(target_os = "macos") {
+ vec![
+ make("mac-x64", "macOS x64 (Intel)"),
+ make("mac-arm64", "macOS ARM64 (Apple Silicon)"),
+ make("mac-univ", "macOS universal"),
+ ]
+ } else {
+ vec![
+ make("linux-x64", "Linux x64"),
+ make("linux-arm64", "Linux ARM64"),
+ make("linux-arm", "Linux ARM (32-bit)"),
+ make("linux-musl-x64", "Linux musl x64 (Alpine)"),
+ make("linux-musl-arm64", "Linux musl ARM64"),
+ ]
+ }
+}
+
+fn archive_name_for_variant(variant: Option<&str>) -> String {
+ let id = variant
+ .map(|s| s.trim())
+ .filter(|s| !s.is_empty() && *s != "auto")
+ .unwrap_or(default_archive_id());
+ if let Some(rest) = id.strip_prefix("win-x64-v8") {
+ let _ = rest;
+ return "pdfium-v8-win-x64.tgz".to_string();
+ }
+ format!("pdfium-{}.tgz", id)
+}
+
+pub fn pdfium_target_dir() -> Option<PathBuf> {
+ let app_data = crate::core::paths::app_data_dir()?;
+ Some(app_data.join("plugins").join("study").join("data"))
+}
+
+pub fn pdfium_target_path() -> Option<PathBuf> {
+ pdfium_target_dir().map(|d| d.join(pdfium_lib_filename()))
+}
+
+pub fn pdfium_version_marker_path() -> Option<PathBuf> {
+ pdfium_target_dir().map(|d| d.join("pdfium.version"))
+}
+
+pub fn is_installed() -> bool {
+ pdfium_target_path()
+ .map(|p| p.is_file())
+ .unwrap_or(false)
+}
+
+pub fn read_version_marker() -> Option<String> {
+ let p = pdfium_version_marker_path()?;
+ let s = std::fs::read_to_string(&p).ok()?;
+ let trimmed = s.trim().to_string();
+ if trimmed.is_empty() {
+ None
+ } else {
+ Some(trimmed)
+ }
+}
+
+pub async fn ensure_pdfium() -> anyhow::Result<PathBuf> {
+ ensure_pdfium_with_variant(None).await
+}
+
+pub async fn ensure_pdfium_with_variant(
+ variant: Option<String>,
+) -> anyhow::Result<PathBuf> {
+ let target_dir =
+ pdfium_target_dir().ok_or_else(|| anyhow!("could not determine app data dir"))?;
+ std::fs::create_dir_all(&target_dir).with_context(|| {
+ format!("creating pdfium target dir {}", target_dir.display())
+ })?;
+
+ let archive_name = archive_name_for_variant(variant.as_deref());
+ let url = format!("{}/{}", PDFIUM_DOWNLOAD_BASE, archive_name);
+ let lib_filename = pdfium_lib_filename();
+ let target_path = target_dir.join(lib_filename);
+
+ tracing::info!("Downloading pdfium from {}", url);
+
+ let client = crate::core::http_client::apply_global_proxy(reqwest::Client::builder())
+ .timeout(std::time::Duration::from_secs(600))
+ .build()?;
+
+ let response = client.get(&url).send().await?;
+ if !response.status().is_success() {
+ return Err(anyhow!(
+ "Failed to download pdfium from {}: HTTP {}",
+ url,
+ response.status()
+ ));
+ }
+ let bytes = response.bytes().await?.to_vec();
+ if bytes.len() < 100_000 {
+ return Err(anyhow!(
+ "Downloaded pdfium archive is too small ({} bytes) — likely an error page",
+ bytes.len()
+ ));
+ }
+
+ let target_path_clone = target_path.clone();
+ let target_dir_clone = target_dir.clone();
+ let lib_name = lib_filename.to_string();
+ let extracted_version = tokio::task::spawn_blocking(move || -> anyhow::Result<Option<String>> {
+ extract_pdfium_archive(&bytes, &target_path_clone, &target_dir_clone, &lib_name)
+ })
+ .await
+ .map_err(|e| anyhow!("spawn_blocking failed: {}", e))??;
+
+ if let Some(version_marker) = pdfium_version_marker_path() {
+ let base = extracted_version.unwrap_or_else(|| "latest".to_string());
+ let value = format!("{} ({})", base, archive_name);
+ let _ = std::fs::write(&version_marker, value);
+ }
+
+ #[cfg(target_os = "macos")]
+ {
+ let _ = tokio::task::spawn_blocking({
+ let p = target_path.clone();
+ move || {
+ crate::core::process::std_command("xattr")
+ .args(["-d", "com.apple.quarantine"])
+ .arg(&p)
+ .output()
+ }
+ })
+ .await;
+ }
+
+ Ok(target_path)
+}
+
+pub fn set_pdfium_from_path(source: &Path) -> anyhow::Result<PathBuf> {
+ if !source.is_file() {
+ return Err(anyhow!(
+ "source not a file: {}",
+ source.display()
+ ));
+ }
+ let target_dir =
+ pdfium_target_dir().ok_or_else(|| anyhow!("could not determine app data dir"))?;
+ std::fs::create_dir_all(&target_dir).with_context(|| {
+ format!("creating pdfium target dir {}", target_dir.display())
+ })?;
+ let lib_filename = pdfium_lib_filename();
+ let target_path = target_dir.join(lib_filename);
+
+ let tmp = target_dir.join(format!(".{}.tmp", lib_filename));
+ std::fs::copy(source, &tmp)
+ .with_context(|| format!("copying {} → {}", source.display(), tmp.display()))?;
+ if target_path.exists() {
+ let _ = std::fs::remove_file(&target_path);
+ }
+ std::fs::rename(&tmp, &target_path)
+ .with_context(|| format!("renaming temp to {}", target_path.display()))?;
+
+ if let Some(version_marker) = pdfium_version_marker_path() {
+ let label = source
+ .file_name()
+ .and_then(|s| s.to_str())
+ .unwrap_or("custom");
+ let value = format!("custom ({})", label);
+ let _ = std::fs::write(&version_marker, value);
+ }
+ Ok(target_path)
+}
+
+fn extract_pdfium_archive(
+ bytes: &[u8],
+ target_path: &std::path::Path,
+ target_dir: &std::path::Path,
+ lib_filename: &str,
+) -> anyhow::Result<Option<String>> {
+ let gz = flate2::read::GzDecoder::new(bytes);
+ let mut tar_archive = tar::Archive::new(gz);
+
+ let mut found_lib = false;
+ let mut version: Option<String> = None;
+
+ for entry in tar_archive.entries()? {
+ let mut entry = entry?;
+ let path = entry.path()?.to_path_buf();
+ let file_name = path
+ .file_name()
+ .and_then(|s| s.to_str())
+ .unwrap_or("")
+ .to_string();
+
+ if file_name == lib_filename {
+ let mut buf = Vec::new();
+ entry.read_to_end(&mut buf)?;
+ let tmp = target_dir.join(format!(".{}.tmp", lib_filename));
+ std::fs::write(&tmp, &buf).with_context(|| {
+ format!("writing temp pdfium lib {}", tmp.display())
+ })?;
+ if target_path.exists() {
+ let _ = std::fs::remove_file(target_path);
+ }
+ std::fs::rename(&tmp, target_path).with_context(|| {
+ format!("moving pdfium to {}", target_path.display())
+ })?;
+ found_lib = true;
+ } else if file_name == "VERSION" {
+ let mut buf = String::new();
+ entry.read_to_string(&mut buf)?;
+ version = Some(buf.trim().to_string());
+ }
+ }
+
+ if !found_lib {
+ return Err(anyhow!(
+ "{} not found inside pdfium archive",
+ lib_filename
+ ));
+ }
+
+ Ok(version)
+}
diff --git a/src-tauri/omniget-core/src/models/settings.rs b/src-tauri/omniget-core/src/models/settings.rs
index 074219ce..b07ed903 100644
--- a/src-tauri/omniget-core/src/models/settings.rs
+++ b/src-tauri/omniget-core/src/models/settings.rs
@@ -13,14 +13,18 @@ pub struct AppSettings {
pub proxy: ProxySettings,
#[serde(default)]
pub onboarding_completed: bool,
+ #[serde(default, alias = "start_with_windows")]
+ pub start_with_system: bool,
#[serde(default)]
- pub start_with_windows: bool,
+ pub start_minimized: bool,
#[serde(default)]
pub portable_mode: bool,
#[serde(default)]
pub legal_acknowledged: bool,
#[serde(default)]
pub last_download_options: LastDownloadOptions,
+ #[serde(default)]
+ pub typography: TypographySettings,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
@@ -160,6 +164,55 @@ fn default_proxy_port() -> u16 {
8080
}
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct TypographySettings {
+ #[serde(default = "default_font_display")]
+ pub font_display: String,
+ #[serde(default = "default_font_body")]
+ pub font_body: String,
+ #[serde(default = "default_font_mono")]
+ pub font_mono: String,
+ #[serde(default = "default_line_height_base")]
+ pub line_height_base: f32,
+ #[serde(default = "default_spacing_scale")]
+ pub spacing_scale: f32,
+ #[serde(default)]
+ pub preset_name: Option<String>,
+}
+
+fn default_font_display() -> String {
+ "Bricolage Grotesque Variable".into()
+}
+
+fn default_font_body() -> String {
+ "Inter".into()
+}
+
+fn default_font_mono() -> String {
+ "IBM Plex Mono".into()
+}
+
+fn default_line_height_base() -> f32 {
+ 1.55
+}
+
+fn default_spacing_scale() -> f32 {
+ 1.0
+}
+
+impl Default for TypographySettings {
+ fn default() -> Self {
+ Self {
+ font_display: default_font_display(),
+ font_body: default_font_body(),
+ font_mono: default_font_mono(),
+ line_height_base: default_line_height_base(),
+ spacing_scale: default_spacing_scale(),
+ preset_name: Some("omniget-default".into()),
+ }
+ }
+}
+
impl Default for AppSettings {
fn default() -> Self {
Self {
@@ -203,10 +256,12 @@ impl Default for AppSettings {
telegram: TelegramSettings::default(),
proxy: ProxySettings::default(),
onboarding_completed: false,
- start_with_windows: false,
+ start_with_system: false,
+ start_minimized: false,
portable_mode: false,
legal_acknowledged: false,
last_download_options: LastDownloadOptions::default(),
+ typography: TypographySettings::default(),
}
}
}
diff --git a/src-tauri/src/commands/autostart.rs b/src-tauri/src/commands/autostart.rs
index 73d98225..af56a4c7 100644
--- a/src-tauri/src/commands/autostart.rs
+++ b/src-tauri/src/commands/autostart.rs
@@ -1,79 +1,38 @@
-#[cfg(windows)]
-use std::os::windows::process::CommandExt;
+use tauri_plugin_autostart::ManagerExt;
-#[cfg(windows)]
-const CREATE_NO_WINDOW: u32 = 0x08000000;
-
-#[cfg(windows)]
-const REG_KEY: &str = r"HKCU\Software\Microsoft\Windows\CurrentVersion\Run";
-
-#[cfg(windows)]
-const APP_NAME: &str = "OmniGet";
-
-pub fn apply_autostart(enabled: bool) -> Result<(), String> {
+pub fn apply_autostart(app: &tauri::AppHandle, enabled: bool) -> Result<(), String> {
if std::env::var("OMNIGET_PORTABLE").is_ok() {
return Ok(());
}
- #[cfg(windows)]
- {
- if enabled {
- let exe =
- std::env::current_exe().map_err(|e| format!("Failed to get exe path: {e}"))?;
- let output = std::process::Command::new("reg")
- .args([
- "add",
- REG_KEY,
- "/v",
- APP_NAME,
- "/d",
- &exe.to_string_lossy(),
- "/f",
- ])
- .creation_flags(CREATE_NO_WINDOW)
- .output()
- .map_err(|e| format!("reg add failed: {e}"))?;
- if !output.status.success() {
- return Err(format!(
- "reg add failed: {}",
- String::from_utf8_lossy(&output.stderr).trim()
- ));
- }
- } else {
- let _ = std::process::Command::new("reg")
- .args(["delete", REG_KEY, "/v", APP_NAME, "/f"])
- .creation_flags(CREATE_NO_WINDOW)
- .output();
- }
+ let manager = app.autolaunch();
+ if enabled {
+ manager
+ .enable()
+ .map_err(|e| format!("Failed to enable autostart: {e}"))?;
+ } else {
+ manager
+ .disable()
+ .map_err(|e| format!("Failed to disable autostart: {e}"))?;
}
- #[cfg(not(windows))]
- let _ = enabled;
Ok(())
}
-pub fn get_autostart_enabled() -> Result<bool, String> {
- #[cfg(windows)]
- {
- let output = std::process::Command::new("reg")
- .args(["query", REG_KEY, "/v", APP_NAME])
- .creation_flags(CREATE_NO_WINDOW)
- .output()
- .map_err(|e| format!("reg query failed: {e}"))?;
- Ok(output.status.success())
- }
- #[cfg(not(windows))]
- Ok(false)
+pub fn get_autostart_enabled(app: &tauri::AppHandle) -> Result<bool, String> {
+ app.autolaunch()
+ .is_enabled()
+ .map_err(|e| format!("Failed to query autostart: {e}"))
}
#[tauri::command]
pub fn set_autostart(app: tauri::AppHandle, enabled: bool) -> Result<(), String> {
- apply_autostart(enabled)?;
+ apply_autostart(&app, enabled)?;
let mut current = crate::storage::config::load_settings(&app);
- current.start_with_windows = enabled;
+ current.start_with_system = enabled;
crate::storage::config::save_settings(&app, &current).map_err(|e| format!("Save: {e}"))?;
Ok(())
}
#[tauri::command]
-pub fn get_autostart_status() -> Result<bool, String> {
- get_autostart_enabled()
+pub fn get_autostart_status(app: tauri::AppHandle) -> Result<bool, String> {
+ get_autostart_enabled(&app)
}
diff --git a/src-tauri/src/commands/dependencies.rs b/src-tauri/src/commands/dependencies.rs
index 0600d560..c9c3671e 100644
--- a/src-tauri/src/commands/dependencies.rs
+++ b/src-tauri/src/commands/dependencies.rs
@@ -1,6 +1,8 @@
+use std::path::PathBuf;
+
use serde::Serialize;
-use crate::core::dependencies;
+use crate::core::{dependencies, pdfium};
#[derive(Debug, Clone, Serialize)]
pub struct DependencyStatus {
@@ -9,6 +11,13 @@ pub struct DependencyStatus {
pub version: Option<String>,
}
+#[derive(Debug, Clone, Serialize)]
+pub struct DependencyVariantInfo {
+ pub id: String,
+ pub label: String,
+ pub recommended: bool,
+}
+
#[tauri::command]
pub async fn check_dependencies() -> Result<Vec<DependencyStatus>, String> {
let (ytdlp_version, ffmpeg_version) = tokio::join!(
@@ -16,6 +25,13 @@ pub async fn check_dependencies() -> Result<Vec<DependencyStatus>, String> {
dependencies::check_version("ffmpeg"),
);
+ let pdfium_installed = pdfium::is_installed();
+ let pdfium_version = if pdfium_installed {
+ Some(pdfium::read_version_marker().unwrap_or_else(|| "installed".to_string()))
+ } else {
+ None
+ };
+
Ok(vec![
DependencyStatus {
name: "yt-dlp".into(),
@@ -27,6 +43,11 @@ pub async fn check_dependencies() -> Result<Vec<DependencyStatus>, String> {
installed: ffmpeg_version.is_some(),
version: ffmpeg_version,
},
+ DependencyStatus {
+ name: "PDFium".into(),
+ installed: pdfium_installed,
+ version: pdfium_version,
+ },
])
}
@@ -36,7 +57,10 @@ pub async fn check_ytdlp_available() -> Result<bool, String> {
}
#[tauri::command]
-pub async fn install_dependency(name: String) -> Result<String, String> {
+pub async fn install_dependency(
+ name: String,
+ variant: Option<String>,
+) -> Result<String, String> {
match name.as_str() {
"yt-dlp" => {
crate::core::ytdlp::ensure_ytdlp()
@@ -51,6 +75,13 @@ pub async fn install_dependency(name: String) -> Result<String, String> {
crate::core::ytdlp::reset_ffmpeg_location_cache();
crate::core::ffmpeg::reset_ffmpeg_available_cache();
}
+ "PDFium" => {
+ let _path: PathBuf = pdfium::ensure_pdfium_with_variant(variant)
+ .await
+ .map_err(|e| e.to_string())?;
+ return Ok(pdfium::read_version_marker()
+ .unwrap_or_else(|| "installed".to_string()));
+ }
_ => return Err(format!("Unknown dependency: {}", name)),
}
@@ -61,3 +92,48 @@ pub async fn install_dependency(name: String) -> Result<String, String> {
.await
.ok_or_else(|| "Installed but version check failed".into())
}
+
+#[tauri::command]
+pub fn dependency_variants(name: String) -> Result<Vec<DependencyVariantInfo>, String> {
+ match name.as_str() {
+ "PDFium" => Ok(pdfium::list_variants()
+ .into_iter()
+ .map(|v| DependencyVariantInfo {
+ id: v.id,
+ label: v.label,
+ recommended: v.recommended,
+ })
+ .collect()),
+ "yt-dlp" | "FFmpeg" => Ok(Vec::new()),
+ _ => Err(format!("Unknown dependency: {}", name)),
+ }
+}
+
+#[tauri::command]
+pub fn dependency_install_dir(name: String) -> Result<String, String> {
+ let dir = match name.as_str() {
+ "PDFium" => pdfium::pdfium_target_dir()
+ .ok_or_else(|| "could not determine plugin data dir".to_string())?,
+ "yt-dlp" | "FFmpeg" => crate::core::paths::app_data_dir()
+ .ok_or_else(|| "could not determine app data dir".to_string())?
+ .join("bin"),
+ _ => return Err(format!("Unknown dependency: {}", name)),
+ };
+ Ok(dir.to_string_lossy().to_string())
+}
+
+#[tauri::command]
+pub fn set_dependency_path(name: String, source_path: String) -> Result<String, String> {
+ let src = PathBuf::from(&source_path);
+ match name.as_str() {
+ "PDFium" => {
+ pdfium::set_pdfium_from_path(&src).map_err(|e| e.to_string())?;
+ Ok(pdfium::read_version_marker()
+ .unwrap_or_else(|| "custom".to_string()))
+ }
+ _ => Err(format!(
+ "Custom file path not supported for: {}",
+ name
+ )),
+ }
+}
diff --git a/src-tauri/src/commands/downloads.rs b/src-tauri/src/commands/downloads.rs
index caa129ba..053a2430 100644
--- a/src-tauri/src/commands/downloads.rs
+++ b/src-tauri/src/commands/downloads.rs
@@ -673,3 +673,35 @@ pub async fn reveal_file(path: String) -> Result<(), String> {
Ok(())
}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn open_path_default(path: String) -> Result<(), String> {
+ #[cfg(target_os = "windows")]
+ {
+ use std::os::windows::process::CommandExt;
+ std::process::Command::new("cmd")
+ .args(["/c", "start", "", &path])
+ .creation_flags(0x08000000)
+ .spawn()
+ .map_err(|e| e.to_string())?;
+ }
+
+ #[cfg(target_os = "macos")]
+ {
+ std::process::Command::new("open")
+ .arg(&path)
+ .spawn()
+ .map_err(|e| e.to_string())?;
+ }
+
+ #[cfg(target_os = "linux")]
+ {
+ std::process::Command::new("xdg-open")
+ .arg(&path)
+ .spawn()
+ .map_err(|e| e.to_string())?;
+ }
+
+ Ok(())
+}
diff --git a/src-tauri/src/commands/host_queue.rs b/src-tauri/src/commands/host_queue.rs
new file mode 100644
index 00000000..f1898bf2
--- /dev/null
+++ b/src-tauri/src/commands/host_queue.rs
@@ -0,0 +1,301 @@
+use std::path::PathBuf;
+use std::sync::atomic::{AtomicU64, Ordering};
+use std::sync::Arc;
+
+use serde::{Deserialize, Serialize};
+use tauri::{AppHandle, Listener, Manager};
+use tokio_util::sync::CancellationToken;
+
+use crate::core::queue::{
+ self, emit_queue_state_from_state, kind_from_platform, QueueItem, QueueItemInfo, QueueKind,
+ QueueStatus,
+};
+use crate::platforms::noop::NoopDownloader;
+use crate::AppState;
+
+static EXTERNAL_ID_COUNTER: AtomicU64 = AtomicU64::new(1);
+
+fn next_external_id() -> u64 {
+ let now_ms = std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .map(|d| d.as_millis() as u64)
+ .unwrap_or(0);
+ let bump = EXTERNAL_ID_COUNTER.fetch_add(1, Ordering::Relaxed);
+ now_ms.wrapping_mul(1000).wrapping_add(bump & 0xFFFF)
+}
+
+#[derive(Deserialize)]
+pub struct EnqueueExternalArgs {
+ pub platform: String,
+ pub title: String,
+ pub output_path: PathBuf,
+ pub total_bytes: Option<u64>,
+ pub thumbnail_url: Option<String>,
+ pub kind: Option<QueueKind>,
+ pub url: Option<String>,
+ pub file_name: Option<String>,
+}
+
+#[derive(Serialize)]
+pub struct EnqueueExternalResult {
+ pub queue_id: u64,
+}
+
+pub async fn enqueue_external_inner(
+ app: &AppHandle,
+ state: &AppState,
+ args: EnqueueExternalArgs,
+ forced_id: Option<u64>,
+) -> Result<u64, String> {
+ let queue_id = forced_id.unwrap_or_else(next_external_id);
+ let kind = args.kind.unwrap_or_else(|| kind_from_platform(&args.platform));
+ let output_dir = args
+ .output_path
+ .parent()
+ .map(|p| p.to_string_lossy().to_string())
+ .unwrap_or_default();
+ let initial_path = args.output_path.to_string_lossy().to_string();
+
+ let item = QueueItem {
+ id: queue_id,
+ url: args.url.unwrap_or_default(),
+ platform: args.platform.clone(),
+ title: args.title,
+ status: QueueStatus::Active,
+ cancel_token: CancellationToken::new(),
+ output_dir,
+ download_mode: None,
+ quality: None,
+ format_id: None,
+ referer: None,
+ extra_headers: None,
+ page_url: None,
+ user_agent: None,
+ percent: 0.0,
+ speed_bytes_per_sec: 0.0,
+ downloaded_bytes: 0,
+ total_bytes: args.total_bytes,
+ file_path: Some(initial_path),
+ file_size_bytes: args.total_bytes,
+ file_count: None,
+ media_info: None,
+ downloader: Arc::new(NoopDownloader::new()),
+ ytdlp_path: None,
+ from_hotkey: false,
+ torrent_id: None,
+ kind: Some(kind),
+ external: true,
+ thumbnail_url_override: args.thumbnail_url,
+ };
+
+ {
+ let mut q = state.download_queue.lock().await;
+ q.items.retain(|i| i.id != queue_id);
+ q.items.push(item);
+ }
+
+ let snapshot: Vec<QueueItemInfo> = {
+ let q = state.download_queue.lock().await;
+ q.get_state()
+ };
+ emit_queue_state_from_state(app, snapshot);
+
+ tracing::info!("[host-queue] enqueue_external id={} platform={} kind={:?}", queue_id, args.platform, kind);
+ Ok(queue_id)
+}
+
+#[tauri::command]
+pub async fn host_queue_enqueue_external(
+ app: AppHandle,
+ state: tauri::State<'_, AppState>,
+ args: EnqueueExternalArgs,
+) -> Result<EnqueueExternalResult, String> {
+ let queue_id = enqueue_external_inner(&app, &state, args, None).await?;
+ Ok(EnqueueExternalResult { queue_id })
+}
+
+#[derive(Deserialize)]
+pub struct ReportProgressArgs {
+ pub queue_id: u64,
+ pub percent: f64,
+ pub downloaded_bytes: u64,
+ pub speed_bytes_per_sec: f64,
+}
+
+pub async fn report_progress_inner(
+ app: &AppHandle,
+ state: &AppState,
+ args: ReportProgressArgs,
+) -> Result<(), String> {
+ let snapshot: Option<Vec<QueueItemInfo>> = {
+ let mut q = state.download_queue.lock().await;
+ let item = q.items.iter_mut().find(|i| i.id == args.queue_id);
+ match item {
+ Some(it) => {
+ if !it.external {
+ return Err(format!("queue_id {} is not external", args.queue_id));
+ }
+ it.percent = args.percent.clamp(0.0, 100.0);
+ it.downloaded_bytes = args.downloaded_bytes;
+ it.speed_bytes_per_sec = args.speed_bytes_per_sec;
+ if !matches!(it.status, QueueStatus::Active) {
+ it.status = QueueStatus::Active;
+ }
+ Some(q.get_state())
+ }
+ None => None,
+ }
+ };
+
+ match snapshot {
+ Some(state_snap) => {
+ emit_queue_state_from_state(app, state_snap);
+ Ok(())
+ }
+ None => Err(format!("queue_id {} not found", args.queue_id)),
+ }
+}
+
+#[tauri::command]
+pub async fn host_queue_report_progress(
+ app: AppHandle,
+ state: tauri::State<'_, AppState>,
+ args: ReportProgressArgs,
+) -> Result<(), String> {
+ report_progress_inner(&app, &state, args).await
+}
+
+#[derive(Deserialize)]
+pub struct ReportCompleteArgs {
+ pub queue_id: u64,
+ pub success: bool,
+ pub file_path: Option<PathBuf>,
+ pub error: Option<String>,
+ pub file_size_bytes: Option<u64>,
+}
+
+pub async fn report_complete_inner(
+ app: &AppHandle,
+ state: &AppState,
+ args: ReportCompleteArgs,
+) -> Result<(), String> {
+ let snapshot: Option<Vec<QueueItemInfo>> = {
+ let mut q = state.download_queue.lock().await;
+ let item = q.items.iter_mut().find(|i| i.id == args.queue_id);
+ match item {
+ Some(it) => {
+ if !it.external {
+ return Err(format!("queue_id {} is not external", args.queue_id));
+ }
+ if args.success {
+ it.percent = 100.0;
+ if let Some(ref p) = args.file_path {
+ it.file_path = Some(p.to_string_lossy().to_string());
+ }
+ if let Some(sz) = args.file_size_bytes {
+ it.file_size_bytes = Some(sz);
+ }
+ it.status = QueueStatus::Complete { success: true };
+ } else {
+ it.status = QueueStatus::Error {
+ message: args.error.clone().unwrap_or_else(|| "Unknown error".to_string()),
+ };
+ }
+ Some(q.get_state())
+ }
+ None => None,
+ }
+ };
+
+ match snapshot {
+ Some(state_snap) => {
+ emit_queue_state_from_state(app, state_snap);
+ tracing::info!(
+ "[host-queue] report_complete id={} success={} ",
+ args.queue_id,
+ args.success
+ );
+ Ok(())
+ }
+ None => Err(format!("queue_id {} not found", args.queue_id)),
+ }
+}
+
+#[tauri::command]
+pub async fn host_queue_report_complete(
+ app: AppHandle,
+ state: tauri::State<'_, AppState>,
+ args: ReportCompleteArgs,
+) -> Result<(), String> {
+ report_complete_inner(&app, &state, args).await
+}
+
+#[derive(Deserialize)]
+struct EnqueueEventPayload {
+ queue_id: u64,
+ #[serde(flatten)]
+ args: EnqueueExternalArgs,
+}
+
+pub fn register_event_listeners(app: &AppHandle) {
+ let app_for_enqueue = app.clone();
+ app.listen("host:queue:external:enqueue", move |event| {
+ let payload_str = event.payload();
+ let parsed: Result<EnqueueEventPayload, _> = serde_json::from_str(payload_str);
+ match parsed {
+ Ok(p) => {
+ let app = app_for_enqueue.clone();
+ tauri::async_runtime::spawn(async move {
+ let state = app.state::<AppState>();
+ if let Err(e) = enqueue_external_inner(&app, &state, p.args, Some(p.queue_id)).await {
+ tracing::warn!("[host-queue] enqueue listener failed: {}", e);
+ }
+ });
+ }
+ Err(e) => tracing::warn!("[host-queue] enqueue payload parse failed: {}", e),
+ }
+ });
+
+ let app_for_progress = app.clone();
+ app.listen("host:queue:external:progress", move |event| {
+ let payload_str = event.payload();
+ let parsed: Result<ReportProgressArgs, _> = serde_json::from_str(payload_str);
+ match parsed {
+ Ok(args) => {
+ let app = app_for_progress.clone();
+ tauri::async_runtime::spawn(async move {
+ let state = app.state::<AppState>();
+ if let Err(e) = report_progress_inner(&app, &state, args).await {
+ tracing::debug!("[host-queue] progress listener failed: {}", e);
+ }
+ });
+ }
+ Err(e) => tracing::warn!("[host-queue] progress payload parse failed: {}", e),
+ }
+ });
+
+ let app_for_complete = app.clone();
+ app.listen("host:queue:external:complete", move |event| {
+ let payload_str = event.payload();
+ let parsed: Result<ReportCompleteArgs, _> = serde_json::from_str(payload_str);
+ match parsed {
+ Ok(args) => {
+ let app = app_for_complete.clone();
+ tauri::async_runtime::spawn(async move {
+ let state = app.state::<AppState>();
+ if let Err(e) = report_complete_inner(&app, &state, args).await {
+ tracing::warn!("[host-queue] complete listener failed: {}", e);
+ }
+ });
+ }
+ Err(e) => tracing::warn!("[host-queue] complete payload parse failed: {}", e),
+ }
+ });
+
+ tracing::info!("[host-queue] registered 3 event listeners (enqueue/progress/complete)");
+}
+
+#[allow(dead_code)]
+fn _ensure_queue_module_loaded() {
+ let _ = queue::ProgressThrottle::new(0);
+}
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index f9ccbecb..f21cdf3c 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -3,6 +3,7 @@ pub mod auth_webview;
pub mod autostart;
pub mod diagnostics;
pub mod downloads;
+pub mod host_queue;
pub mod integration;
pub mod p2p;
pub mod plugins;
diff --git a/src-tauri/src/commands/plugins.rs b/src-tauri/src/commands/plugins.rs
index a0a2c7ee..0a7bac27 100644
--- a/src-tauri/src/commands/plugins.rs
+++ b/src-tauri/src/commands/plugins.rs
@@ -293,9 +293,8 @@ struct GitHubAsset {
browser_download_url: String,
}
-#[tauri::command]
-pub async fn install_plugin_from_registry(
- state: tauri::State<'_, Arc<tokio::sync::RwLock<PluginManager>>>,
+pub async fn install_plugin_zip_from_repo(
+ state: &Arc<tokio::sync::RwLock<PluginManager>>,
plugin_id: String,
repo: String,
) -> Result<String, String> {
@@ -380,6 +379,52 @@ pub async fn install_plugin_from_registry(
Ok(version)
}
+#[tauri::command]
+pub async fn install_plugin_from_registry(
+ state: tauri::State<'_, Arc<tokio::sync::RwLock<PluginManager>>>,
+ plugin_id: String,
+ repo: String,
+) -> Result<String, String> {
+ install_plugin_zip_from_repo(&state.inner().clone(), plugin_id, repo).await
+}
+
+const DEFAULT_PLUGINS: &[(&str, &str)] = &[("study", "tonhowtf/omniget-study-release")];
+
+pub async fn ensure_default_plugins(state: Arc<tokio::sync::RwLock<PluginManager>>) {
+ for (plugin_id, repo) in DEFAULT_PLUGINS {
+ let already_installed = {
+ let manager = state.read().await;
+ manager.installed_plugins().iter().any(|p| p.id == *plugin_id)
+ };
+ if already_installed {
+ tracing::debug!("default plugin '{}' already installed, skipping", plugin_id);
+ continue;
+ }
+ tracing::info!(
+ "default plugin '{}' missing, installing from {}",
+ plugin_id,
+ repo
+ );
+ match install_plugin_zip_from_repo(&state, plugin_id.to_string(), repo.to_string()).await {
+ Ok(version) => {
+ tracing::info!(
+ "default plugin '{}' installed (version {})",
+ plugin_id,
+ version
+ );
+ }
+ Err(e) => {
+ tracing::warn!(
+ "failed to install default plugin '{}' from {}: {}",
+ plugin_id,
+ repo,
+ e
+ );
+ }
+ }
+ }
+}
+
#[derive(Debug, Serialize)]
pub struct PluginUpdateInfo {
pub id: String,
diff --git a/src-tauri/src/commands/settings.rs b/src-tauri/src/commands/settings.rs
index 8b618cc4..81f8c6d7 100644
--- a/src-tauri/src/commands/settings.rs
+++ b/src-tauri/src/commands/settings.rs
@@ -12,7 +12,7 @@ pub fn update_settings(app: tauri::AppHandle, partial: String) -> Result<AppSett
let mut current = config::load_settings(&app);
let old_hotkey_enabled = current.download.hotkey_enabled;
let old_hotkey_binding = current.download.hotkey_binding.clone();
- let old_start_with_windows = current.start_with_windows;
+ let old_start_with_system = current.start_with_system;
let patch: serde_json::Value =
serde_json::from_str(&partial).map_err(|e| format!("Invalid JSON: {}", e))?;
@@ -30,8 +30,8 @@ pub fn update_settings(app: tauri::AppHandle, partial: String) -> Result<AppSett
hotkey::reregister(&app);
}
- if old_start_with_windows != current.start_with_windows {
- crate::commands::autostart::apply_autostart(current.start_with_windows)?;
+ if old_start_with_system != current.start_with_system {
+ crate::commands::autostart::apply_autostart(&app, current.start_with_system)?;
}
Ok(current)
@@ -42,7 +42,7 @@ pub fn reset_settings(app: tauri::AppHandle) -> Result<AppSettings, String> {
let defaults = AppSettings::default();
config::save_settings(&app, &defaults).map_err(|e| format!("Save: {}", e))?;
hotkey::reregister(&app);
- let _ = crate::commands::autostart::apply_autostart(defaults.start_with_windows);
+ let _ = crate::commands::autostart::apply_autostart(&app, defaults.start_with_system);
Ok(defaults)
}
diff --git a/src-tauri/src/core/mod.rs b/src-tauri/src/core/mod.rs
index a0c076f1..38c8543c 100644
--- a/src-tauri/src/core/mod.rs
+++ b/src-tauri/src/core/mod.rs
@@ -10,6 +10,7 @@ pub use omniget_core::core::http_client;
pub use omniget_core::core::hwaccel;
pub use omniget_core::core::media_processor;
pub use omniget_core::core::paths;
+pub use omniget_core::core::pdfium;
pub use omniget_core::core::process;
pub use omniget_core::core::redirect;
pub use omniget_core::core::registry;
diff --git a/src-tauri/src/core/queue.rs b/src-tauri/src/core/queue.rs
index 2363c2f7..08969bdf 100644
--- a/src-tauri/src/core/queue.rs
+++ b/src-tauri/src/core/queue.rs
@@ -54,6 +54,37 @@ pub struct MediaPreviewEvent {
pub duration_seconds: Option<f64>,
}
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, serde::Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum QueueKind {
+ Video,
+ Audio,
+ Image,
+ Pdf,
+ Book,
+ Webpage,
+ TelegramMedia,
+ CourseLesson,
+ Generic,
+}
+
+pub fn kind_from_platform(platform: &str) -> QueueKind {
+ let p = platform.to_ascii_lowercase();
+ match p.as_str() {
+ "youtube" | "vimeo" | "twitch" | "bilibili" | "tiktok" | "twitter" | "x"
+ | "instagram" | "reddit" | "bluesky" | "facebook" | "generic_ytdlp" => QueueKind::Video,
+ "soundcloud" | "spotify" => QueueKind::Audio,
+ "pinterest" => QueueKind::Image,
+ "magnet" | "p2p" | "torrent" => QueueKind::Generic,
+ "telegram" | "telegram_media" => QueueKind::TelegramMedia,
+ "courses" | "course_lesson" => QueueKind::CourseLesson,
+ "annas_archive" | "book" | "libgen" | "gutendex" => QueueKind::Book,
+ "pdf" => QueueKind::Pdf,
+ "webpage" | "embed" => QueueKind::Webpage,
+ _ => QueueKind::Generic,
+ }
+}
+
#[derive(Debug, Clone, Serialize, PartialEq)]
#[serde(tag = "type", content = "data")]
pub enum QueueStatus {
@@ -80,6 +111,10 @@ pub struct QueueItemInfo {
pub file_size_bytes: Option<u64>,
pub file_count: Option<u32>,
pub thumbnail_url: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub kind: Option<QueueKind>,
+ #[serde(default)]
+ pub external: bool,
}
pub struct QueueItem {
@@ -109,6 +144,9 @@ pub struct QueueItem {
pub ytdlp_path: Option<PathBuf>,
pub from_hotkey: bool,
pub torrent_id: Option<usize>,
+ pub kind: Option<QueueKind>,
+ pub external: bool,
+ pub thumbnail_url_override: Option<String>,
}
impl QueueItem {
@@ -127,9 +165,11 @@ impl QueueItem {
file_size_bytes: self.file_size_bytes,
file_count: self.file_count,
thumbnail_url: self
- .media_info
- .as_ref()
- .and_then(|m| m.thumbnail_url.clone()),
+ .thumbnail_url_override
+ .clone()
+ .or_else(|| self.media_info.as_ref().and_then(|m| m.thumbnail_url.clone())),
+ kind: self.kind,
+ external: self.external,
}
}
}
@@ -171,6 +211,7 @@ impl DownloadQueue {
ytdlp_path: Option<PathBuf>,
from_hotkey: bool,
) {
+ let computed_kind = Some(kind_from_platform(&platform));
let item = QueueItem {
id,
url,
@@ -198,6 +239,9 @@ impl DownloadQueue {
ytdlp_path,
from_hotkey,
torrent_id: None,
+ kind: computed_kind,
+ external: false,
+ thumbnail_url_override: None,
};
crate::core::recovery::persist(crate::core::recovery::RecoveryItem {
id: item.id,
@@ -1243,3 +1287,83 @@ fn is_generic_title(title: &str) -> bool {
|| t.starts_with("video [video]")
|| t.starts_with("media [media]")
}
+
+#[cfg(test)]
+mod kind_tests {
+ use super::{kind_from_platform, QueueKind};
+
+ #[test]
+ fn youtube_and_video_platforms_map_to_video() {
+ assert_eq!(kind_from_platform("youtube"), QueueKind::Video);
+ assert_eq!(kind_from_platform("vimeo"), QueueKind::Video);
+ assert_eq!(kind_from_platform("twitch"), QueueKind::Video);
+ assert_eq!(kind_from_platform("bilibili"), QueueKind::Video);
+ assert_eq!(kind_from_platform("tiktok"), QueueKind::Video);
+ assert_eq!(kind_from_platform("instagram"), QueueKind::Video);
+ assert_eq!(kind_from_platform("reddit"), QueueKind::Video);
+ assert_eq!(kind_from_platform("bluesky"), QueueKind::Video);
+ assert_eq!(kind_from_platform("generic_ytdlp"), QueueKind::Video);
+ }
+
+ #[test]
+ fn audio_platforms() {
+ assert_eq!(kind_from_platform("soundcloud"), QueueKind::Audio);
+ assert_eq!(kind_from_platform("spotify"), QueueKind::Audio);
+ }
+
+ #[test]
+ fn pinterest_is_image() {
+ assert_eq!(kind_from_platform("pinterest"), QueueKind::Image);
+ }
+
+ #[test]
+ fn pdf_kind() {
+ assert_eq!(kind_from_platform("pdf"), QueueKind::Pdf);
+ }
+
+ #[test]
+ fn book_platforms() {
+ assert_eq!(kind_from_platform("annas_archive"), QueueKind::Book);
+ assert_eq!(kind_from_platform("libgen"), QueueKind::Book);
+ assert_eq!(kind_from_platform("gutendex"), QueueKind::Book);
+ assert_eq!(kind_from_platform("book"), QueueKind::Book);
+ }
+
+ #[test]
+ fn webpage_kind() {
+ assert_eq!(kind_from_platform("webpage"), QueueKind::Webpage);
+ assert_eq!(kind_from_platform("embed"), QueueKind::Webpage);
+ }
+
+ #[test]
+ fn telegram_kind() {
+ assert_eq!(kind_from_platform("telegram"), QueueKind::TelegramMedia);
+ assert_eq!(kind_from_platform("telegram_media"), QueueKind::TelegramMedia);
+ }
+
+ #[test]
+ fn course_lesson_kind() {
+ assert_eq!(kind_from_platform("courses"), QueueKind::CourseLesson);
+ assert_eq!(kind_from_platform("course_lesson"), QueueKind::CourseLesson);
+ }
+
+ #[test]
+ fn generic_for_torrents_and_p2p() {
+ assert_eq!(kind_from_platform("magnet"), QueueKind::Generic);
+ assert_eq!(kind_from_platform("p2p"), QueueKind::Generic);
+ assert_eq!(kind_from_platform("torrent"), QueueKind::Generic);
+ }
+
+ #[test]
+ fn unknown_platform_falls_back_to_generic() {
+ assert_eq!(kind_from_platform(""), QueueKind::Generic);
+ assert_eq!(kind_from_platform("totally-unknown"), QueueKind::Generic);
+ assert_eq!(kind_from_platform("xyz123"), QueueKind::Generic);
+ }
+
+ #[test]
+ fn case_insensitive() {
+ assert_eq!(kind_from_platform("YouTube"), QueueKind::Video);
+ assert_eq!(kind_from_platform("TELEGRAM"), QueueKind::TelegramMedia);
+ }
+}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index dd4ca6b1..cbc0482e 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -17,6 +17,7 @@ pub mod external_url;
pub mod hotkey;
pub mod models;
pub mod native_host;
+pub mod pets;
pub mod platforms;
pub mod plugin_host;
pub mod plugin_loader;
@@ -92,6 +93,7 @@ pub fn run() {
}
}))
.manage(state)
+ .manage(pets::PetsState::default())
.manage(Arc::new(tokio::sync::RwLock::new(
plugin_loader::PluginManager::new(
core::paths::app_data_dir()
@@ -117,7 +119,12 @@ pub fn run() {
)
.plugin(tauri_plugin_clipboard_manager::init())
.plugin(tauri_plugin_deep_link::init())
+ .plugin(tauri_plugin_autostart::init(
+ tauri_plugin_autostart::MacosLauncher::LaunchAgent,
+ None,
+ ))
.setup(|app| {
+ commands::host_queue::register_event_listeners(app.handle());
let settings = storage::config::load_settings(app.handle());
core::http_client::init_proxy(settings.proxy.clone());
core::ytdlp::set_ext_cookie_path_fn(|| native_host::extension_cookie_file_path());
@@ -228,6 +235,23 @@ pub fn run() {
let plugin_mgr = app
.handle()
.state::<std::sync::Arc<tokio::sync::RwLock<plugin_loader::PluginManager>>>();
+
+ let mgr_for_default = std::sync::Arc::clone(&*plugin_mgr);
+ std::thread::Builder::new()
+ .name("default-plugins".into())
+ .spawn(move || {
+ let rt = match tokio::runtime::Runtime::new() {
+ Ok(rt) => rt,
+ Err(e) => {
+ tracing::warn!("default-plugins runtime failed: {}", e);
+ return;
+ }
+ };
+ rt.block_on(commands::plugins::ensure_default_plugins(mgr_for_default));
+ })
+ .ok()
+ .map(|h| h.join().ok());
+
let mut mgr = plugin_mgr.blocking_write();
mgr.load_all(host);
}
@@ -262,6 +286,13 @@ pub fn run() {
}
});
}
+
+ if settings.start_minimized {
+ if let Some(window) = app.get_webview_window("main") {
+ let _ = window.hide();
+ }
+ }
+
Ok(())
})
.on_window_event(|window, event| {
@@ -296,6 +327,10 @@ pub fn run() {
commands::downloads::discard_recovery,
commands::downloads::restore_recovery,
commands::downloads::reveal_file,
+ commands::downloads::open_path_default,
+ commands::host_queue::host_queue_enqueue_external,
+ commands::host_queue::host_queue_report_progress,
+ commands::host_queue::host_queue_report_complete,
commands::integration::register_external_frontend,
commands::settings::get_settings,
commands::settings::update_settings,
@@ -307,6 +342,9 @@ pub fn run() {
commands::dependencies::check_dependencies,
commands::dependencies::check_ytdlp_available,
commands::dependencies::install_dependency,
+ commands::dependencies::dependency_variants,
+ commands::dependencies::dependency_install_dir,
+ commands::dependencies::set_dependency_path,
commands::search::search_videos,
commands::plugins::list_plugins,
commands::plugins::get_plugin_frontend_path,
@@ -329,6 +367,19 @@ pub fn run() {
commands::app_lifecycle::request_app_quit,
commands::app_lifecycle::force_exit_app,
commands::app_lifecycle::get_debug_info,
+ pets::pets_get_local_index,
+ pets::pets_fetch_remote_manifest,
+ pets::pets_diff,
+ pets::pets_install_bundle,
+ pets::pets_install_missing,
+ pets::pets_force_refresh,
+ pets::pets_uninstall,
+ pets::pets_open_folder,
+ pets::pets_set_active,
+ pets::pets_get_active,
+ pets::pets_resolve_path,
+ pets::pets_get_display_prefs,
+ pets::pets_set_display_prefs,
])
.build(tauri::generate_context!())
.expect("error while building tauri application")
diff --git a/static/pets/animations.json b/static/pets/animations.json
new file mode 100644
index 00000000..24fe7f08
--- /dev/null
+++ b/static/pets/animations.json
@@ -0,0 +1,730 @@
+{
+ "boba": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "boxcat": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "byte-bunny": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "cache-capy": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "cash-cuy": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "cosmo": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "kebo": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "noir-webling": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "nukey": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "pixel-panda": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "prompt-penguin": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "scoop": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ],
+ "socksy": [
+ {
+ "name": "idle",
+ "row": 0,
+ "frame_count": 6,
+ "fps": 6
+ },
+ {
+ "name": "walk_right",
+ "row": 1,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "walk_left",
+ "row": 2,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "wave",
+ "row": 3,
+ "frame_count": 4,
+ "fps": 8
+ },
+ {
+ "name": "tiny",
+ "row": 4,
+ "frame_count": 5,
+ "fps": 8
+ },
+ {
+ "name": "sad",
+ "row": 5,
+ "frame_count": 8,
+ "fps": 8
+ },
+ {
+ "name": "sleep",
+ "row": 6,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "happy",
+ "row": 7,
+ "frame_count": 6,
+ "fps": 8
+ },
+ {
+ "name": "extra",
+ "row": 8,
+ "frame_count": 6,
+ "fps": 8
+ }
+ ]
+}
\ No newline at end of file
diff --git a/static/pets/boba/pet.json b/static/pets/boba/pet.json
new file mode 100644
index 00000000..96437543
--- /dev/null
+++ b/static/pets/boba/pet.json
@@ -0,0 +1,6 @@
+{
+ "id": "boba",
+ "displayName": "Boba",
+ "description": "A tiny otter sipping bubble tea while keeping you company in Codex.",
+ "spritesheetPath": "spritesheet.webp"
+}
diff --git a/static/pets/manifest.json b/static/pets/manifest.json
new file mode 100644
index 00000000..5b95bc14
--- /dev/null
+++ b/static/pets/manifest.json
@@ -0,0 +1,70 @@
+{
+ "generatedAt": "2026-05-02T09:11:12.044Z",
+ "pets": [
+ {
+ "slug": "boba",
+ "displayName": "Boba",
+ "packPath": "/packs/boba.zip"
+ },
+ {
+ "slug": "boxcat",
+ "displayName": "Boxcat",
+ "packPath": "/packs/boxcat.zip"
+ },
+ {
+ "slug": "byte-bunny",
+ "displayName": "Byte Bunny",
+ "packPath": "/packs/byte-bunny.zip"
+ },
+ {
+ "slug": "cache-capy",
+ "displayName": "Cache Capy",
+ "packPath": "/packs/cache-capy.zip"
+ },
+ {
+ "slug": "cash-cuy",
+ "displayName": "Cash Cuy",
+ "packPath": "/packs/cash-cuy.zip"
+ },
+ {
+ "slug": "cosmo",
+ "displayName": "Crafternauta",
+ "packPath": "/packs/cosmo.zip"
+ },
+ {
+ "slug": "kebo",
+ "displayName": "Kebo",
+ "packPath": "/packs/kebo.zip"
+ },
+ {
+ "slug": "noir-webling",
+ "displayName": "Noir Webling",
+ "packPath": "/packs/noir-webling.zip"
+ },
+ {
+ "slug": "nukey",
+ "displayName": "Nukey",
+ "packPath": "/packs/nukey.zip"
+ },
+ {
+ "slug": "pixel-panda",
+ "displayName": "Pixel Panda",
+ "packPath": "/packs/pixel-panda.zip"
+ },
+ {
+ "slug": "prompt-penguin",
+ "displayName": "Prompt Penguin",
+ "packPath": "/packs/prompt-penguin.zip"
+ },
+ {
+ "slug": "scoop",
+ "displayName": "Scoop",
+ "packPath": "/packs/scoop.zip"
+ },
+ {
+ "slug": "socksy",
+ "displayName": "Socksy",
+ "packPath": "/packs/socksy.zip"
+ }
+ ]
+}
\ No newline at end of file