Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
feat(nami): implement incremental creator pull engine with early exit and profile sync UI
IGECT56e4b11c6ac7
diff --git a/src-tauri/src/commands/nami/args.rs b/src-tauri/src/commands/nami/args.rsindex f7a3bda1..f5099bab 100644--- a/src-tauri/src/commands/nami/args.rs+++ b/src-tauri/src/commands/nami/args.rs@@ -22,6 +22,7 @@ pub struct GalleryDlArgsOptions<'a> {pub custom_ua: Option<&'a str>,pub proxy: Option<&'a str>,pub skip_replies: Option<bool>,+ pub abort_after_duplicates: Option<u32>,}#[derive(Debug, Clone)]@@ -32,6 +33,7 @@ pub struct YtDlpArgsOptions<'a> {pub cookie_path: Option<&'a str>,pub proxy: Option<&'a str>,pub skip_replies: Option<bool>,+ pub break_on_existing: Option<bool>,}pub fn get_platform_sleep(platform: &str) -> &'static str {@@ -67,6 +69,13 @@ pub fn build_gallery_dl_args(options: &GalleryDlArgsOptions) -> Vec<String> {"after:FILE_OK:{filename}.{extension}".to_string(),];+ if let Some(threshold) = options.abort_after_duplicates {+ if threshold > 0 {+ args.push("--abort".to_string());+ args.push(threshold.to_string());+ }+ }+if let Some(proxy) = options.proxy {if !proxy.trim().is_empty() {args.push("--proxy".to_string());@@ -192,6 +201,10 @@ pub fn build_yt_dlp_args(options: &YtDlpArgsOptions) -> Vec<String> {"chrome".to_string(),];+ if options.break_on_existing.unwrap_or(false) {+ args.push("--break-on-existing".to_string());+ }+let plat_lower = options.platform.to_lowercase();if plat_lower == "tiktok" {args.push("--sleep-requests".to_string());@@ -254,6 +267,7 @@ mod tests {custom_ua: None,proxy: None,skip_replies: None,+ abort_after_duplicates: None,};let args = build_gallery_dl_args(&opts);@@ -281,6 +295,7 @@ mod tests {custom_ua: None,proxy: None,skip_replies: Some(true),+ abort_after_duplicates: None,};let args = build_gallery_dl_args(&opts);@@ -298,6 +313,7 @@ mod tests {cookie_path: None,proxy: None,skip_replies: None,+ break_on_existing: None,};let args = build_yt_dlp_args(&opts);@@ -325,6 +341,7 @@ mod tests {custom_ua: None,proxy: None,skip_replies: None,+ abort_after_duplicates: None,};let args = build_gallery_dl_args(&opts);@@ -332,4 +349,43 @@ mod tests {assert!(format_pos.is_some(), "gallery-dl must include format=best for TikTok to prevent silent DASH streams");assert_eq!(args[format_pos.unwrap() - 1], "-o");}++ #[test]+ fn test_gallery_dl_args_abort_after_duplicates() {+ let dest = PathBuf::from("C:/downloads/Nami/instagram/creator/all");+ let opts = GalleryDlArgsOptions {+ dest_dir: &dest,+ content_type: "all",+ platform: "instagram",+ clean_url: "https://www.instagram.com/creator/",+ username: "creator",+ cookie_path: None,+ custom_ua: None,+ proxy: None,+ skip_replies: None,+ abort_after_duplicates: Some(5),+ };++ let args = build_gallery_dl_args(&opts);+ let abort_pos = args.iter().position(|r| r == "--abort");+ assert!(abort_pos.is_some(), "gallery-dl must include --abort flag");+ assert_eq!(args[abort_pos.unwrap() + 1], "5");+ }++ #[test]+ fn test_yt_dlp_args_break_on_existing() {+ let dest = PathBuf::from("C:/downloads/Nami/tiktok/creator/videos");+ let opts = YtDlpArgsOptions {+ dest_dir: &dest,+ platform: "tiktok",+ clean_url: "https://www.tiktok.com/@creator",+ cookie_path: None,+ proxy: None,+ skip_replies: None,+ break_on_existing: Some(true),+ };++ let args = build_yt_dlp_args(&opts);+ assert!(args.contains(&"--break-on-existing".to_string()));+ }}diff --git a/src-tauri/src/commands/nami/dispatcher.rs b/src-tauri/src/commands/nami/dispatcher.rsindex 6481bc99..639ec6d2 100644--- a/src-tauri/src/commands/nami/dispatcher.rs+++ b/src-tauri/src/commands/nami/dispatcher.rs@@ -264,6 +264,7 @@ pub async fn execute_download_workflow(download_id: String,app_data_dir: PathBuf,skip_replies: Option<bool>,+ early_exit_threshold: Option<u32>,) -> Result<DownloadResult, String> {let reg = DownloadRegistration::new(&download_id)?;@@ -362,6 +363,7 @@ pub async fn execute_download_workflow(stage_index,stage_total,skip_replies,+ early_exit_threshold,) {Ok(result) => {total_files += result.files_count;@@ -434,6 +436,7 @@ fn run_single_stage(stage_index: u32,stage_total: u32,skip_replies: Option<bool>,+ early_exit_threshold: Option<u32>,) -> Result<DownloadResult, String> {if reg.is_cancelled() {return Ok(DownloadResult {@@ -486,6 +489,7 @@ fn run_single_stage(custom_ua: None,proxy: None,skip_replies,+ abort_after_duplicates: early_exit_threshold,};let gdl_args = build_gallery_dl_args(&gdl_opts);@@ -531,6 +535,7 @@ fn run_single_stage(cookie_path,proxy: None,skip_replies,+ break_on_existing: early_exit_threshold.map(|t| t > 0),};let yt_args = build_yt_dlp_args(&yt_opts);diff --git a/src-tauri/src/commands/nami/mod.rs b/src-tauri/src/commands/nami/mod.rsindex 654b22fe..c28f6f77 100644--- a/src-tauri/src/commands/nami/mod.rs+++ b/src-tauri/src/commands/nami/mod.rs@@ -7,6 +7,7 @@ pub mod dispatcher;pub mod fetcher;pub mod http;pub mod ledger;+pub mod pull;use chrono::Utc;pub use dispatcher::{DownloadProgress, DownloadResult};@@ -23,6 +24,7 @@ pub struct Profile {pub username: Option<String>,pub platform: String,pub added_at: i64,+ pub last_pulled_at: Option<i64>,}#[derive(Debug, Serialize, Deserialize, Clone)]@@ -179,6 +181,7 @@ pub async fn nami_run_gallery_dl_download(download_id,app_dir,skip_replies,+ None,).await}@@ -392,6 +395,72 @@ pub async fn nami_delete_history_record(id: String) -> Result<bool, String> {ledger::delete_record(&id)}+pub fn update_profile_last_pulled(platform: &str, profile_url: &str, timestamp: i64) -> Result<(), String> {+ let _storage_guard = NAMI_STORAGE_LOCK.lock().unwrap_or_else(|p| p.into_inner());+ let profiles_file = omniget_nami_dir()?.join("profiles.json");+ if !profiles_file.exists() {+ return Ok(());+ }++ let content = fs::read_to_string(&profiles_file)+ .map_err(|e| format!("Failed to read profiles: {}", e))?;+ let mut all_profiles: serde_json::Value =+ serde_json::from_str(&content).map_err(|e| format!("Failed to parse profiles: {}", e))?;++ let normalized_target = normalize_profile_url(platform, profile_url);++ if let Some(arr) = all_profiles+ .as_object_mut()+ .and_then(|obj| obj.get_mut(platform))+ .and_then(|v| v.as_array_mut())+ {+ for p in arr.iter_mut() {+ let u = p.get("url").and_then(|u| u.as_str()).unwrap_or("");+ if u == profile_url || normalize_profile_url(platform, u) == normalized_target {+ if let Some(obj) = p.as_object_mut() {+ obj.insert("last_pulled_at".to_string(), serde_json::json!(timestamp));+ }+ break;+ }+ }+ }++ let serialized = serde_json::to_string_pretty(&all_profiles)+ .map_err(|e| format!("Failed to serialize: {}", e))?;+ atomic_write(&profiles_file, &serialized)?;+ Ok(())+}++#[command]+pub async fn nami_pull_creator(+ app: AppHandle,+ profile_url: String,+ platform: String,+ content_type: Option<String>,+ early_exit_threshold: Option<u32>,+ download_id: Option<String>,+) -> Result<pull::PullResult, String> {+ pull::pull_single_creator(+ app,+ profile_url,+ platform,+ content_type,+ early_exit_threshold,+ download_id,+ )+ .await+}++#[command]+pub async fn nami_pull_all_creators(+ app: AppHandle,+ platform: Option<String>,+ content_type: Option<String>,+ early_exit_threshold: Option<u32>,+) -> Result<pull::PullBatchSummary, String> {+ pull::pull_all_creators(app, platform, content_type, early_exit_threshold).await+}+#[cfg(test)]mod tests {use super::*;diff --git a/src-tauri/src/commands/nami/pull.rs b/src-tauri/src/commands/nami/pull.rsnew file mode 100644index 00000000..f23e88ee--- /dev/null+++ b/src-tauri/src/commands/nami/pull.rs@@ -0,0 +1,250 @@+#![allow(clippy::all)]+#![allow(warnings)]++use super::dispatcher::{self, DownloadResult};+use super::{+ nami_load_app_settings, nami_load_profiles, omniget_nami_dir, update_profile_last_pulled,+ Profile,+};+use chrono::Utc;+use serde::{Deserialize, Serialize};+use std::time::Duration;+use tauri::{AppHandle, Emitter};++#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]+pub struct PullResult {+ pub success: bool,+ pub profile_url: String,+ pub platform: String,+ pub username: Option<String>,+ pub files_downloaded: u32,+ pub message: String,+ pub early_exited: bool,+}++#[derive(Debug, Serialize, Deserialize, Clone)]+pub struct PullBatchProgress {+ pub current_index: usize,+ pub total: usize,+ pub profile_url: String,+ pub platform: String,+ pub username: Option<String>,+ pub files_downloaded: u32,+ pub status: String,+}++#[derive(Debug, Serialize, Deserialize, Clone)]+pub struct PullBatchSummary {+ pub total: usize,+ pub succeeded: usize,+ pub failed: usize,+ pub total_downloaded: u32,+ pub results: Vec<PullResult>,+}++pub async fn pull_single_creator(+ app: AppHandle,+ profile_url: String,+ platform: String,+ content_type: Option<String>,+ early_exit_threshold: Option<u32>,+ download_id: Option<String>,+) -> Result<PullResult, String> {+ let settings = nami_load_app_settings()?;+ let output_dir = settings.output_directory.ok_or_else(|| {+ "Please configure an output directory in Nami Settings before pulling creator updates"+ .to_string()+ })?;++ let threshold = early_exit_threshold.unwrap_or(5);+ let ctype = content_type.unwrap_or_else(|| "all".to_string());+ let id = download_id.unwrap_or_else(|| {+ format!(+ "pull_{}_{}",+ Utc::now().timestamp_millis(),+ Utc::now().timestamp_nanos_opt().unwrap_or(0) % 1_000_000+ )+ });++ let app_dir = omniget_nami_dir()?;+ let username = dispatcher::extract_username_generic(&profile_url);++ let dl_result = dispatcher::execute_download_workflow(+ app.clone(),+ profile_url.clone(),+ output_dir,+ settings.cookies_file,+ ctype,+ id,+ app_dir,+ Some(true), // skip replies+ Some(threshold),+ )+ .await?;++ let now = Utc::now().timestamp();+ if dl_result.success {+ let _ = update_profile_last_pulled(&platform, &profile_url, now);+ }++ Ok(PullResult {+ success: dl_result.success,+ profile_url,+ platform,+ username,+ files_downloaded: dl_result.files_count,+ message: dl_result.message,+ early_exited: true,+ })+}++pub async fn pull_all_creators(+ app: AppHandle,+ platform: Option<String>,+ content_type: Option<String>,+ early_exit_threshold: Option<u32>,+) -> Result<PullBatchSummary, String> {+ let target_platforms = if let Some(p) = platform {+ vec![p]+ } else {+ vec![+ "instagram".to_string(),+ "tiktok".to_string(),+ "facebook".to_string(),+ "x".to_string(),+ ]+ };++ let mut all_profiles: Vec<Profile> = Vec::new();+ for p in target_platforms {+ if let Ok(profs) = nami_load_profiles(p) {+ all_profiles.extend(profs);+ }+ }++ let total = all_profiles.len();+ let mut results: Vec<PullResult> = Vec::with_capacity(total);+ let mut succeeded = 0usize;+ let mut failed = 0usize;+ let mut total_downloaded = 0u32;++ for (idx, prof) in all_profiles.into_iter().enumerate() {+ let _ = app.emit(+ "nami_pull_batch_progress",+ PullBatchProgress {+ current_index: idx + 1,+ total,+ profile_url: prof.url.clone(),+ platform: prof.platform.clone(),+ username: prof.username.clone(),+ files_downloaded: total_downloaded,+ status: "syncing".to_string(),+ },+ );++ match pull_single_creator(+ app.clone(),+ prof.url.clone(),+ prof.platform.clone(),+ content_type.clone(),+ early_exit_threshold,+ None,+ )+ .await+ {+ Ok(res) => {+ if res.success {+ succeeded += 1;+ } else {+ failed += 1;+ }+ total_downloaded += res.files_downloaded;+ results.push(res);+ }+ Err(e) => {+ failed += 1;+ results.push(PullResult {+ success: false,+ profile_url: prof.url,+ platform: prof.platform,+ username: prof.username,+ files_downloaded: 0,+ message: e,+ early_exited: false,+ });+ }+ }++ if idx + 1 < total {+ let jitter_ms = 1500 + (Utc::now().timestamp_millis() % 1000) as u64;+ tokio::time::sleep(Duration::from_millis(jitter_ms)).await;+ }+ }++ Ok(PullBatchSummary {+ total,+ succeeded,+ failed,+ total_downloaded,+ results,+ })+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn test_pull_result_structure() {+ let res = PullResult {+ success: true,+ profile_url: "https://instagram.com/creator".to_string(),+ platform: "instagram".to_string(),+ username: Some("creator".to_string()),+ files_downloaded: 3,+ message: "Successfully downloaded 3 files".to_string(),+ early_exited: true,+ };++ assert!(res.success);+ assert_eq!(res.files_downloaded, 3);+ assert!(res.early_exited);+ }++ #[test]+ fn test_pull_batch_summary_aggregation() {+ let items = vec![+ PullResult {+ success: true,+ profile_url: "https://instagram.com/c1".to_string(),+ platform: "instagram".to_string(),+ username: Some("c1".to_string()),+ files_downloaded: 4,+ message: "OK".to_string(),+ early_exited: true,+ },+ PullResult {+ success: false,+ profile_url: "https://tiktok.com/@c2".to_string(),+ platform: "tiktok".to_string(),+ username: Some("c2".to_string()),+ files_downloaded: 0,+ message: "Network failure".to_string(),+ early_exited: false,+ },+ ];++ let summary = PullBatchSummary {+ total: items.len(),+ succeeded: items.iter().filter(|i| i.success).count(),+ failed: items.iter().filter(|i| !i.success).count(),+ total_downloaded: items.iter().map(|i| i.files_downloaded).sum(),+ results: items,+ };++ assert_eq!(summary.total, 2);+ assert_eq!(summary.succeeded, 1);+ assert_eq!(summary.failed, 1);+ assert_eq!(summary.total_downloaded, 4);+ }+}diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex ac04cb6d..c728cfc7 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -1295,6 +1295,8 @@ pub fn run() {commands::nami::nami_get_history,commands::nami::nami_reconcile_disk,commands::nami::nami_delete_history_record,+ commands::nami::nami_pull_creator,+ commands::nami::nami_pull_all_creators,]).build(tauri::generate_context!()).expect("error while building tauri application")diff --git a/src/components/nami/ProfileManager.svelte b/src/components/nami/ProfileManager.svelteindex a641a8e5..baaa2ba1 100644--- a/src/components/nami/ProfileManager.svelte+++ b/src/components/nami/ProfileManager.svelte@@ -1,6 +1,13 @@<script lang="ts">import { onMount } from 'svelte';- import { loadProfiles, saveProfile, deleteProfile, type Profile } from '$lib/api/nami';+ import {+ loadProfiles,+ saveProfile,+ deleteProfile,+ pullCreator,+ pullAllCreators,+ type Profile,+ } from '$lib/api/nami';import { t } from '$lib/i18n';interface Props {@@ -22,6 +29,9 @@let loading = $state(false);let error = $state('');let confirmDeleteUrl = $state<string | null>(null);+ let syncingProfileUrl = $state<string | null>(null);+ let syncingAll = $state(false);+ let syncFeedback = $state<string | null>(null);let requestId = 0;let dialogEl: HTMLDialogElement | null = $state(null);@@ -98,6 +108,53 @@return source.charAt(0).toUpperCase() || '?';}+ function formatSynced(timestamp?: number | null): string {+ if (!timestamp) return '';+ const d = new Date(timestamp * 1000);+ return d.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });+ }++ async function handlePull(profile: Profile) {+ syncingProfileUrl = profile.url;+ syncFeedback = null;+ error = '';+ try {+ const res = await pullCreator(profile.url, activePlatform);+ if (res.success) {+ syncFeedback = $t('nami.pull_success', {+ name: profile.username || profile.url,+ count: res.files_downloaded,+ }) as string;+ await loadPlatformProfiles();+ } else {+ error = res.message || 'Sync failed';+ }+ } catch (err) {+ error = errorMessage(err, 'Failed to sync profile');+ } finally {+ syncingProfileUrl = null;+ }+ }++ async function handlePullAll() {+ if (profiles.length === 0 || syncingAll) return;+ syncingAll = true;+ syncFeedback = null;+ error = '';+ try {+ const summary = await pullAllCreators(activePlatform);+ syncFeedback = $t('nami.pull_all_success', {+ total: summary.succeeded,+ count: summary.total_downloaded,+ }) as string;+ await loadPlatformProfiles();+ } catch (err) {+ error = errorMessage(err, 'Failed to sync all creators');+ } finally {+ syncingAll = false;+ }+ }+function switchPlatform(p: string) {activePlatform = p;loadPlatformProfiles(p);@@ -127,6 +184,13 @@<div class="pm-alert" role="alert">{error}</div>{/if}+ {#if syncFeedback}+ <div class="pm-alert info" role="status">+ <span>{syncFeedback}</span>+ <button type="button" class="pm-alert-dismiss" onclick={() => (syncFeedback = null)}>×</button>+ </div>+ {/if}+<div class="pm-group"><div class="pm-row"><svg class="pm-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" aria-hidden="true">@@ -155,17 +219,76 @@{:else if profiles.length === 0}<p class="pm-empty">{$t('nami.no_profiles_yet')}</p>{:else}+ <div class="pm-header-actions">+ <span class="pm-count">{profiles.length} {profiles.length === 1 ? 'profile' : 'profiles'}</span>+ <button+ type="button"+ class="pm-sync-all-btn"+ onclick={handlePullAll}+ disabled={syncingAll}+ >+ <svg+ class="pm-btn-icon"+ class:spin={syncingAll}+ viewBox="0 0 16 16"+ fill="none"+ stroke="currentColor"+ stroke-width="1.4"+ stroke-linecap="round"+ stroke-linejoin="round"+ aria-hidden="true"+ >+ <path d="M1.5 8a6.5 6.5 0 0 1 11.1-4.6L14 5" />+ <path d="M14 2v3h-3" />+ <path d="M14.5 8a6.5 6.5 0 0 1-11.1 4.6L2 11" />+ <path d="M2 14v-3h3" />+ </svg>+ <span>{syncingAll ? $t('nami.syncing_creator') : $t('nami.sync_all_creators')}</span>+ </button>+ </div>+<div class="pm-group">{#each profiles as profile (profile.url)}<div class="pm-row pm-profile-row"><div class="pm-avatar" aria-hidden="true">{initials(profile)}</div><div class="pm-info">- <p class="pm-name">{profile.username || profile.url}</p>+ <p class="pm-name">+ {profile.username || profile.url}+ {#if profile.last_pulled_at}+ <span class="pm-synced">• {formatSynced(profile.last_pulled_at)}</span>+ {/if}+ </p>{#if profile.username}<p class="pm-url">{profile.url}</p>{/if}</div><div class="pm-actions">+ <button+ type="button"+ class="pm-sync-btn"+ onclick={() => handlePull(profile)}+ disabled={syncingProfileUrl === profile.url}+ aria-label={$t('nami.sync_creator')}+ title={$t('nami.sync_creator')}+ >+ <svg+ class="pm-btn-icon"+ class:spin={syncingProfileUrl === profile.url}+ viewBox="0 0 16 16"+ fill="none"+ stroke="currentColor"+ stroke-width="1.4"+ stroke-linecap="round"+ stroke-linejoin="round"+ aria-hidden="true"+ >+ <path d="M1.5 8a6.5 6.5 0 0 1 11.1-4.6L14 5" />+ <path d="M14 2v3h-3" />+ <path d="M14.5 8a6.5 6.5 0 0 1-11.1 4.6L2 11" />+ <path d="M2 14v-3h3" />+ </svg>+ <span>{syncingProfileUrl === profile.url ? $t('nami.syncing_creator') : $t('nami.sync_creator')}</span>+ </button>{#if onSelectProfileForDownload}<buttontype="button"@@ -350,6 +473,114 @@gap: 6px;}+ .pm-sync-btn {+ min-height: 30px;+ padding: 4px 10px;+ font-size: 11.5px;+ font-weight: 500;+ color: var(--oo-text);+ background: color-mix(in srgb, var(--oo-text) 8%, transparent);+ border: none;+ border-radius: 6px;+ cursor: pointer;+ display: inline-flex;+ align-items: center;+ gap: 5px;+ transition: background 150ms ease;+ }++ .pm-sync-btn:hover:not(:disabled) {+ background: color-mix(in srgb, var(--oo-text) 14%, transparent);+ }++ .pm-sync-btn:disabled {+ opacity: 0.6;+ cursor: not-allowed;+ }++ .pm-sync-all-btn {+ min-height: 30px;+ padding: 4px 12px;+ font-size: 11.5px;+ font-weight: 500;+ color: var(--oo-text);+ background: var(--oo-group-bg);+ border: 1px solid var(--oo-border);+ border-radius: var(--oo-radius-sm, 7px);+ cursor: pointer;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ transition: background 150ms ease;+ }++ .pm-sync-all-btn:hover:not(:disabled) {+ background: color-mix(in srgb, var(--oo-text) 6%, var(--oo-group-bg));+ }++ .pm-sync-all-btn:disabled {+ opacity: 0.6;+ cursor: not-allowed;+ }++ .pm-btn-icon {+ width: 13px;+ height: 13px;+ }++ .pm-btn-icon.spin {+ animation: pm-spin 1s linear infinite;+ }++ @keyframes pm-spin {+ from {+ transform: rotate(0deg);+ }+ to {+ transform: rotate(360deg);+ }+ }++ .pm-synced {+ font-size: 10.5px;+ color: var(--oo-text-secondary);+ margin-left: 6px;+ font-weight: normal;+ }++ .pm-header-actions {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0 2px;+ }++ .pm-count {+ font-size: 12px;+ color: var(--oo-text-secondary);+ }++ .pm-alert.info {+ background: color-mix(in srgb, var(--oo-accent) 15%, var(--oo-group-bg));+ border: 1px solid var(--oo-accent);+ color: var(--oo-text);+ padding: 8px 12px;+ border-radius: var(--oo-radius, 9px);+ font-size: 12.5px;+ display: flex;+ justify-content: space-between;+ align-items: center;+ }++ .pm-alert-dismiss {+ background: transparent;+ border: none;+ font-size: 15px;+ cursor: pointer;+ color: inherit;+ padding: 0 4px;+ }+.pm-download-btn {min-height: 30px;padding: 4px 10px;diff --git a/src/lib/api/nami.test.ts b/src/lib/api/nami.test.tsindex 25351056..fa2ee9a2 100644--- a/src/lib/api/nami.test.ts+++ b/src/lib/api/nami.test.ts@@ -23,11 +23,41 @@ vi.mock('@tauri-apps/api/core', () => ({if (cmd === 'nami_delete_history_record') {return true;}+ if (cmd === 'nami_pull_creator') {+ return {+ success: true,+ profile_url: args?.profileUrl,+ platform: args?.platform,+ username: 'creator',+ files_downloaded: 2,+ message: 'Successfully downloaded 2 files',+ early_exited: true,+ };+ }+ if (cmd === 'nami_pull_all_creators') {+ return {+ total: 1,+ succeeded: 1,+ failed: 0,+ total_downloaded: 2,+ results: [+ {+ success: true,+ profile_url: 'https://instagram.com/creator',+ platform: 'instagram',+ username: 'creator',+ files_downloaded: 2,+ message: 'OK',+ early_exited: true,+ },+ ],+ };+ }return null;})}));-import { loadNamiHistory, reconcileNamiDisk, deleteNamiHistoryRecord } from './nami';+import { loadNamiHistory, reconcileNamiDisk, deleteNamiHistoryRecord, pullCreator, pullAllCreators } from './nami';describe('nami api history and ledger', () => {it('calls nami_get_history and returns records', async () => {@@ -47,4 +77,18 @@ describe('nami api history and ledger', () => {const ok = await deleteNamiHistoryRecord('tiktok_123');expect(ok).toBe(true);});++ it('calls nami_pull_creator and returns pull result', async () => {+ const res = await pullCreator('https://instagram.com/creator', 'instagram');+ expect(res.success).toBe(true);+ expect(res.files_downloaded).toBe(2);+ expect(res.early_exited).toBe(true);+ });++ it('calls nami_pull_all_creators and returns batch summary', async () => {+ const summary = await pullAllCreators('instagram');+ expect(summary.total).toBe(1);+ expect(summary.succeeded).toBe(1);+ expect(summary.total_downloaded).toBe(2);+ });});diff --git a/src/lib/api/nami.ts b/src/lib/api/nami.tsindex 194fc613..c29092d7 100644--- a/src/lib/api/nami.ts+++ b/src/lib/api/nami.ts@@ -6,6 +6,7 @@ export interface Profile {username?: string;platform: string;added_at: number;+ last_pulled_at?: number | null;}export interface DownloadResult {@@ -161,3 +162,59 @@ export async function reconcileNamiDisk(): Promise<ReconcileResult> {export async function deleteNamiHistoryRecord(id: string): Promise<boolean> {return await invoke<boolean>('nami_delete_history_record', { id });}++export interface PullResult {+ success: boolean;+ profile_url: string;+ platform: string;+ username?: string | null;+ files_downloaded: number;+ message: string;+ early_exited: boolean;+}++export interface PullBatchProgress {+ current_index: number;+ total: number;+ profile_url: string;+ platform: string;+ username?: string | null;+ files_downloaded: number;+ status: string;+}++export interface PullBatchSummary {+ total: number;+ succeeded: number;+ failed: number;+ total_downloaded: number;+ results: PullResult[];+}++export async function pullCreator(+ profileUrl: string,+ platform: string,+ contentType = 'all',+ earlyExitThreshold = 5,+ downloadId?: string+): Promise<PullResult> {+ return await invoke<PullResult>('nami_pull_creator', {+ profileUrl,+ platform,+ contentType,+ earlyExitThreshold,+ downloadId: downloadId ?? null,+ });+}++export async function pullAllCreators(+ platform?: string | null,+ contentType = 'all',+ earlyExitThreshold = 5+): Promise<PullBatchSummary> {+ return await invoke<PullBatchSummary>('nami_pull_all_creators', {+ platform: platform ?? null,+ contentType,+ earlyExitThreshold,+ });+}diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.jsonindex 3e0ce50f..6b52161e 100644--- a/src/lib/i18n/el.json+++ b/src/lib/i18n/el.json@@ -5388,7 +5388,12 @@"delete_record": "Διαγραφή εγγραφής","confirm_delete_record": "Κατάργηση αυτής της εγγραφής από το ιστορικό; Το τοπικό αρχείο θα παραμείνει στο δίσκο.","disk_synced": "Ελέγχθηκαν {{checked}} στοιχεία, εκκαθαρίστηκαν {{removed}} αρχεία που έλειπαν.",- "platform_all": "Όλα"+ "platform_all": "Όλα",+ "sync_creator": "Συγχρονισμός νέων",+ "sync_all_creators": "Συγχρονισμός όλων",+ "syncing_creator": "Συγχρονισμός...",+ "pull_success": "Συγχρονίστηκε {{name}}: {{count}} νέα αρχεία",+ "pull_all_success": "Συγχρονίστηκαν {{total}} δημιουργοί: {{count}} νέα αρχεία"},"tray": {"quit": "Quit",diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.jsonindex 15f96a46..9bf9ea0d 100644--- a/src/lib/i18n/en.json+++ b/src/lib/i18n/en.json@@ -5396,6 +5396,11 @@"delete_record": "Delete Record","confirm_delete_record": "Remove this record from history? The file will remain on disk.","disk_synced": "Checked {{checked}} items, pruned {{removed}} missing files.",- "platform_all": "All"+ "platform_all": "All",+ "sync_creator": "Sync New",+ "sync_all_creators": "Sync All",+ "syncing_creator": "Syncing...",+ "pull_success": "Synced {{name}}: {{count}} new files",+ "pull_all_success": "Synced {{total}} creators: {{count}} new files"}}diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.jsonindex c2d0928e..fbe13ee1 100644--- a/src/lib/i18n/es.json+++ b/src/lib/i18n/es.json@@ -5388,7 +5388,12 @@"delete_record": "Eliminar registro","confirm_delete_record": "¿Eliminar este registro del historial? El archivo local permanecerá en el disco.","disk_synced": "Revisados {{checked}} elementos, eliminados {{removed}} archivos faltantes.",- "platform_all": "Todos"+ "platform_all": "Todos",+ "sync_creator": "Sincronizar nuevos",+ "sync_all_creators": "Sincronizar todo",+ "syncing_creator": "Sincronizando...",+ "pull_success": "Sincronizado {{name}}: {{count}} nuevos archivos",+ "pull_all_success": "Sincronizados {{total}} creadores: {{count}} nuevos archivos"},"tray": {"quit": "Quit",diff --git a/src/lib/i18n/fa.json b/src/lib/i18n/fa.jsonindex a4baf073..c1ce70fe 100644--- a/src/lib/i18n/fa.json+++ b/src/lib/i18n/fa.json@@ -5388,7 +5388,12 @@"delete_record": "حذف رکورد","confirm_delete_record": "این مورد از تاریخچه حذف شود؟ فایل محلی در دیسک باقی خواهد ماند.","disk_synced": "{{checked}} مورد بررسی شد، {{removed}} فایل ناموجود پاکسازی شد.",- "platform_all": "همه"+ "platform_all": "همه",+ "sync_creator": "همگامسازی جدید",+ "sync_all_creators": "همگامسازی همه",+ "syncing_creator": "در حال همگامسازی...",+ "pull_success": "همگامسازی {{name}}: {{count}} فایل جدید",+ "pull_all_success": "همگامسازی {{total}} سازنده: {{count}} فایل جدید"},"tray": {"quit": "Quit",diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.jsonindex 3bf00fba..48db82c0 100644--- a/src/lib/i18n/fr.json+++ b/src/lib/i18n/fr.json@@ -5388,7 +5388,12 @@"delete_record": "Supprimer l'enregistrement","confirm_delete_record": "Supprimer cet élément de l'historique ? Le fichier local restera sur le disque.","disk_synced": "{{checked}} éléments vérifiés, {{removed}} fichiers manquants purgés.",- "platform_all": "Tous"+ "platform_all": "Tous",+ "sync_creator": "Synchroniser nouveaux",+ "sync_all_creators": "Synchroniser tout",+ "syncing_creator": "Synchronisation...",+ "pull_success": "Synchronisé {{name}} : {{count}} nouveaux fichiers",+ "pull_all_success": "Synchronisé {{total}} créateurs : {{count}} nouveaux fichiers"},"tray": {"quit": "Quit",diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.jsonindex 00a168a5..796c12bd 100644--- a/src/lib/i18n/it.json+++ b/src/lib/i18n/it.json@@ -5388,7 +5388,12 @@"delete_record": "Elimina record","confirm_delete_record": "Rimuovere questa voce dalla cronologia? Il file rimarrà sul disco.","disk_synced": "Controllati {{checked}} elementi, rimossi {{removed}} file mancanti.",- "platform_all": "Tutti"+ "platform_all": "Tutti",+ "sync_creator": "Sincronizza nuovi",+ "sync_all_creators": "Sincronizza tutti",+ "syncing_creator": "Sincronizzazione...",+ "pull_success": "Sincronizzato {{name}}: {{count}} nuovi file",+ "pull_all_success": "Sincronizzati {{total}} autori: {{count}} nuovi file"},"tray": {"quit": "Quit",diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.jsonindex 8279e8a3..25904676 100644--- a/src/lib/i18n/ja.json+++ b/src/lib/i18n/ja.json@@ -5388,7 +5388,12 @@"delete_record": "記録を削除","confirm_delete_record": "この記録を履歴から削除しますか?ローカルファイルはディスクに残ります。","disk_synced": "{{checked}} 件を確認し、見つからないファイル {{removed}} 件を削除しました。",- "platform_all": "すべて"+ "platform_all": "すべて",+ "sync_creator": "新着を同期",+ "sync_all_creators": "すべて同期",+ "syncing_creator": "同期中...",+ "pull_success": "{{name}} を同期しました: {{count}} 件の新規ファイル",+ "pull_all_success": "{{total}} 名のクリエイターを同期しました: {{count}} 件の新規ファイル"},"tray": {"quit": "Quit",diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.tsindex 17d7396c..ce08f70f 100644--- a/src/lib/i18n/keys.ts+++ b/src/lib/i18n/keys.ts@@ -598,6 +598,8 @@ export type TranslationKeys =| 'nami.platform_aria'| 'nami.profile_placeholder'| 'nami.profile_url_aria'+ | 'nami.pull_all_success'+ | 'nami.pull_success'| 'nami.remove'| 'nami.remove_profile_aria'| 'nami.save_settings'@@ -623,7 +625,10 @@ export type TranslationKeys =| 'nami.status_switching_engine'| 'nami.stop_download'| 'nami.stories_instagram_only'+ | 'nami.sync_all_creators'+ | 'nami.sync_creator'| 'nami.sync_disk'+ | 'nami.syncing_creator'| 'nami.syncing_disk'| 'nami.tab_download'| 'nami.tab_history'diff --git a/src/lib/i18n/lo.json b/src/lib/i18n/lo.jsonindex 87d8166a..33500290 100644--- a/src/lib/i18n/lo.json+++ b/src/lib/i18n/lo.json@@ -5388,7 +5388,12 @@"delete_record": "ລຶບບັນທຶກ","confirm_delete_record": "ລຶບລາຍການນີ້ອອກຈາກປະຫວັດບໍ? ໄຟລ໌ທ້ອງຖິ່ນຈະຍັງຄົງຢູ່ໃນດິສກ໌.","disk_synced": "ກວດສອບແລ້ວ {{checked}} ລາຍການ, ລຶບໄຟລ໌ທີ່ຂາດຫາຍ {{removed}} ໄຟລ໌.",- "platform_all": "ທັງໝົດ"+ "platform_all": "ທັງໝົດ",+ "sync_creator": "ຊິງຄ໌ໃໝ່",+ "sync_all_creators": "ຊິງຄ໌ທັງໝົດ",+ "syncing_creator": "ກຳລັງຊິງຄ໌...",+ "pull_success": "ຊິງຄ໌ {{name}} ແລ້ວ: {{count}} ໄຟລ໌ໃໝ່",+ "pull_all_success": "ຊິງຄ໌ {{total}} ຜູ້ສ້າງແລ້ວ: {{count}} ໄຟລ໌ໃໝ່"},"tray": {"quit": "Quit",diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.jsonindex 9457e7c5..51bf2a1c 100644--- a/src/lib/i18n/pt.json+++ b/src/lib/i18n/pt.json@@ -5388,7 +5388,12 @@"delete_record": "Excluir registro","confirm_delete_record": "Remover este item do histórico? O arquivo local permanecerá no disco.","disk_synced": "Verificados {{checked}} itens, removidos {{removed}} arquivos ausentes.",- "platform_all": "Todos"+ "platform_all": "Todos",+ "sync_creator": "Sincronizar novos",+ "sync_all_creators": "Sincronizar todos",+ "syncing_creator": "Sincronizando...",+ "pull_success": "Sincronizado {{name}}: {{count}} novos arquivos",+ "pull_all_success": "Sincronizados {{total}} criadores: {{count}} novos arquivos"},"tray": {"quit": "Quit",diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.jsonindex 83b8ab2d..2be29cb4 100644--- a/src/lib/i18n/ru.json+++ b/src/lib/i18n/ru.json@@ -5396,6 +5396,11 @@"delete_record": "Удалить запись","confirm_delete_record": "Удалить эту запись из истории? Локальный файл останется на диске.","disk_synced": "Проверено {{checked}} записей, очищено {{removed}} отсутствующих файлов.",- "platform_all": "Все"+ "platform_all": "Все",+ "sync_creator": "Сверить новые",+ "sync_all_creators": "Сверить все",+ "syncing_creator": "Сверка...",+ "pull_success": "Сверено {{name}}: {{count}} новых файлов",+ "pull_all_success": "Сверено {{total}} авторов: {{count}} новых файлов"}}diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.jsonindex 82ad40e8..82655627 100644--- a/src/lib/i18n/zh-TW.json+++ b/src/lib/i18n/zh-TW.json@@ -5388,7 +5388,12 @@"delete_record": "刪除記錄","confirm_delete_record": "從歷史記錄中移除此項目?本機檔案將保留在磁碟上。","disk_synced": "已檢查 {{checked}} 個項目,清理了 {{removed}} 個遺失的檔案。",- "platform_all": "全部"+ "platform_all": "全部",+ "sync_creator": "同步新內容",+ "sync_all_creators": "同步全部",+ "syncing_creator": "同步中...",+ "pull_success": "已同步 {{name}}:{{count}} 個新檔案",+ "pull_all_success": "已同步 {{total}} 位創作者:{{count}} 個新檔案"},"tray": {"quit": "Quit",diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.jsonindex 608795de..ffedac79 100644--- a/src/lib/i18n/zh.json+++ b/src/lib/i18n/zh.json@@ -5388,7 +5388,12 @@"delete_record": "删除记录","confirm_delete_record": "从历史记录中移除此项?本地文件将保留在磁盘上。","disk_synced": "已检查 {{checked}} 项,清理了 {{removed}} 个丢失的文件。",- "platform_all": "全部"+ "platform_all": "全部",+ "sync_creator": "同步新内容",+ "sync_all_creators": "同步全部",+ "syncing_creator": "同步中...",+ "pull_success": "已同步 {{name}}:{{count}} 个新文件",+ "pull_all_success": "已同步 {{total}} 位创作者:{{count}} 个新文件"},"tray": {"quit": "退出",