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
Add new mascot images and remove unused SVG files
Tonho94a118ab7dc1
diff --git a/src/lib/stores/download-listener.ts b/src/lib/stores/download-listener.tsindex f8ff9a10..d4e0bdc7 100644--- a/src/lib/stores/download-listener.ts+++ b/src/lib/stores/download-listener.ts@@ -241,6 +241,8 @@ export async function initDownloadListener(): Promise<() => void> {} else if (item.status.type === "Complete") {loggedQueueTerminal.add(item.id);addLog("info", "download", `Download complete: ${item.title}`, item.file_path ?? undefined);+ const tr = get(t);+ showToast("success", tr("toast.generic_download_complete", { name: item.title }));}}throttledSyncQueueState(payload);diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelteindex c7827f2b..e26d3d59 100644--- a/src/routes/+layout.svelte+++ b/src/routes/+layout.svelte@@ -146,7 +146,7 @@title={itemTitle}><span class="indicator"></span>- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">{#if item.iconSvg}{#each item.iconSvg.split(' M').map((d, i) => i === 0 ? d : 'M' + d) as pathD}<path d={pathD} />@@ -173,6 +173,7 @@<path d="M12 8v4m0 4h.01" />{/if}</svg>+ <span class="nav-label">{itemTitle}</span>{#if item.badge === "downloads" && counts.badge > 0}<span class="badge">{badgeLabel}</span>{/if}@@ -192,7 +193,7 @@title={itemTitle}><span class="indicator"></span>- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">{#if item.iconSvg}{#each item.iconSvg.split(' M').map((d, i) => i === 0 ? d : 'M' + d) as pathD}<path d={pathD} />@@ -204,6 +205,7 @@<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" />{/if}</svg>+ <span class="nav-label">{itemTitle}</span></a>{/each}</nav>@@ -262,15 +264,28 @@.nav-item {position: relative;- width: 44px;- height: 44px;+ width: 60px;display: flex;+ flex-direction: column;align-items: center;justify-content: center;+ gap: 2px;+ padding: 6px 0;border-radius: var(--border-radius);color: var(--gray);}+ .nav-label {+ font-size: 9px;+ font-weight: 500;+ line-height: 1;+ text-align: center;+ max-width: 100%;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+@media (hover: hover) {.nav-item:hover {color: var(--secondary);diff --git a/src/routes/+page.svelte b/src/routes/+page.svelteindex c865cbb9..c48f424d 100644--- a/src/routes/+page.svelte+++ b/src/routes/+page.svelte@@ -108,6 +108,18 @@const STALL_THRESHOLD = 30_000;let downloads = $derived(getDownloads());let stallTick = $state(0);+ let lastCompletionAt = $state(0);+ let completionSeenIds = new Set<string | number>();++ $effect(() => {+ for (const [id, item] of downloads.entries()) {+ if (item.status === "complete" && !completionSeenIds.has(id)) {+ completionSeenIds.add(id);+ lastCompletionAt = Date.now();+ break;+ }+ }+ });$effect(() => {const interval = setInterval(() => { stallTick++; }, 5000);@@ -134,9 +146,11 @@handleInput();});- let mascotEmotion = $derived.by((): "idle" | "downloading" | "error" | "stalled" | "queue" => {+ let mascotEmotion = $derived.by((): "idle" | "downloading" | "error" | "stalled" | "queue" | "complete" | "amazed" => {void stallTick;+ if (lastCompletionAt > 0 && Date.now() - lastCompletionAt < 5000) return "complete";+if (omniState.kind === "preparing") return "downloading";if (omniState.kind === "error") return "error";@@ -162,16 +176,39 @@let mascotCompact = $derived(omniState.kind !== "idle");- let mascotBubble = $derived.by((): string | undefined => {- switch (omniState.kind) {- case "idle": return $t("mascot.idle");- case "detecting": return $t("mascot.detecting");- case "detected": return $t("mascot.detected");- case "preparing": return $t("mascot.preparing");- case "searching":- case "search-results": return $t("mascot.search");- case "error": return $t("mascot.error");- default: return undefined;+ function pickRandom(raw: string): string {+ if (raw.includes("|")) {+ const opts = raw.split("|");+ return opts[Math.floor(Math.random() * opts.length)];+ }+ return raw;+ }++ let lastBubbleKey = $state("");+ let bubbleText = $state("");++ $effect(() => {+ let key: string;+ if (mascotEmotion === "complete") key = "complete";+ else if (mascotEmotion === "queue") key = "queue";+ else {+ switch (omniState.kind) {+ case "idle": key = "idle"; break;+ case "detecting": key = "detecting"; break;+ case "detected": key = "detected"; break;+ case "preparing": key = "preparing"; break;+ case "searching":+ case "search-results": key = "search"; break;+ case "error": key = "error"; break;+ default: key = ""; break;+ }+ }+ if (key && key !== lastBubbleKey) {+ lastBubbleKey = key;+ bubbleText = pickRandom($t(`mascot.${key}`));+ } else if (!key) {+ lastBubbleKey = "";+ bubbleText = "";}});@@ -515,7 +552,7 @@</script><div class="home">- <Mascot emotion={mascotEmotion} compact={mascotCompact} bubbleText={mascotBubble} />+ <Mascot emotion={mascotEmotion} compact={mascotCompact} bubbleText={bubbleText || undefined} /><div class="omnibox-area">{#if externalNotice}diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelteindex 983d2328..d641bb47 100644--- a/src/routes/about/+page.svelte+++ b/src/routes/about/+page.svelte@@ -1,8 +1,87 @@<script lang="ts">- import { goto } from "$app/navigation";- import { onMount } from "svelte";-- onMount(() => {- goto("/about/terms", { replaceState: true });- });+ import { t } from "$lib/i18n";</script>++<div class="about-page">+ <div class="about-hero">+ <img src="/loop.png" alt="Loop" class="about-loop" draggable="false" />+ <h1>OmniGet</h1>+ <p class="about-tagline">{$t("about.tagline")}</p>+ </div>++ <div class="about-links">+ <a href="/about/project" class="about-link">{$t("about.project")}</a>+ <a href="/about/changelog" class="about-link">{$t("about.changelog")}</a>+ <a href="/about/terms" class="about-link">{$t("about.terms")}</a>+ <a href="/about/roadmap" class="about-link">{$t("about.roadmap")}</a>+ </div>++ <p class="about-credit">{$t("about.credit")}</p>+</div>++<style>+ .about-page {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: calc(var(--padding) * 2);+ padding: calc(var(--padding) * 3);+ text-align: center;+ }++ .about-hero {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: var(--padding);+ }++ .about-loop {+ width: 120px;+ height: 120px;+ border-radius: 50%;+ object-fit: cover;+ pointer-events: none;+ user-select: none;+ }++ .about-hero h1 {+ font-size: 24px;+ font-weight: 600;+ margin: 0;+ }++ .about-tagline {+ font-size: 14px;+ color: var(--tertiary);+ margin: 0;+ }++ .about-links {+ display: flex;+ flex-wrap: wrap;+ gap: 8px;+ justify-content: center;+ }++ .about-link {+ padding: 8px 16px;+ background: var(--button);+ border-radius: var(--border-radius);+ color: var(--secondary);+ font-size: 13px;+ font-weight: 500;+ text-decoration: none;+ box-shadow: var(--button-box-shadow);+ }++ .about-link:hover {+ background: var(--button-hover);+ }++ .about-credit {+ font-size: 12px;+ color: var(--tertiary);+ margin: 0;+ }+</style>diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelteindex e3f21717..8626fb80 100644--- a/src/routes/convert/+page.svelte+++ b/src/routes/convert/+page.svelte@@ -1,7 +1,26 @@<script lang="ts">import { invoke } from "@tauri-apps/api/core";+ import { open } from "@tauri-apps/plugin-dialog";import { onMount } from "svelte";import { t } from "$lib/i18n";+ import { pluginInvoke } from "$lib/plugin-invoke";+ import { showToast } from "$lib/stores/toast-store.svelte";+ import ContextHint from "$components/hints/ContextHint.svelte";+ import {+ getFiles,+ getOptions,+ getHwAccel,+ addFiles,+ removeFile,+ clearFiles,+ updateFileProbe,+ markFileProbing,+ markFileConverting,+ updateOptions,+ setHwAccel,+ type ProbeInfo,+ type HwAccelInfo,+ } from "$lib/stores/convert-store.svelte";type PluginStatus = "checking" | "ready" | "needs-restart" | "not-installed";let pluginStatus = $state<PluginStatus>("checking");@@ -12,13 +31,173 @@const plugin = plugins.find((p) => p.id === "convert");if (!plugin || !plugin.enabled) {pluginStatus = "not-installed";- } else {- pluginStatus = "ready";+ return;}+ if (!plugin.loaded) {+ pluginStatus = "needs-restart";+ return;+ }+ pluginStatus = "ready";} catch {pluginStatus = "ready";}});++ let files = $derived(getFiles());+ let options = $derived(getOptions());+ let hwAccel = $derived(getHwAccel());+ let converting = $state(false);++ async function selectFiles() {+ const selected = await open({+ multiple: true,+ title: $t("convert.select_files"),+ filters: [+ {+ name: "Media",+ extensions: [+ "mp4", "mkv", "avi", "mov", "webm", "flv", "wmv", "m4v",+ "mp3", "wav", "flac", "aac", "ogg", "m4a", "wma", "opus",+ ],+ },+ ],+ });+ if (selected) {+ const paths = Array.isArray(selected) ? selected : [selected];+ addFiles(paths);+ for (const path of paths) {+ const file = getFiles().find((f) => f.path === path);+ if (file && file.status === "idle") {+ await probeFile(file.id, path);+ }+ }+ }+ }++ async function selectFolder() {+ const selected = await open({+ directory: true,+ title: $t("convert.select_folder"),+ });+ if (selected) {+ addFiles([selected]);+ }+ }++ async function probeFile(id: number, path: string) {+ markFileProbing(id);+ try {+ const info = await pluginInvoke<ProbeInfo>("convert", "probe_file", { path });+ updateFileProbe(id, info);+ } catch (e: any) {+ showToast("error", typeof e === "string" ? e : e.message ?? $t("convert.probe_failed"));+ }+ }++ async function loadHwAccel() {+ try {+ const info = await pluginInvoke<HwAccelInfo>("convert", "get_hwaccel_info");+ setHwAccel(info);+ } catch {+ }+ }++ $effect(() => {+ if (!hwAccel) {+ loadHwAccel();+ }+ });++ function getOutputPath(inputPath: string): string {+ const ext = options.outputFormat || "mp4";+ const lastDot = inputPath.lastIndexOf(".");+ const base = lastDot > 0 ? inputPath.substring(0, lastDot) : inputPath;+ return `${base}_converted.${ext}`;+ }++ async function startConversion() {+ const readyFiles = files.filter((f) => f.status === "ready" || f.status === "idle");+ if (readyFiles.length === 0) return;++ converting = true;++ for (const file of readyFiles) {+ if (!converting) break;++ const outputPath = getOutputPath(file.path);+ const convOptions = {+ input_path: file.path,+ output_path: outputPath,+ video_codec: options.videoCodec === "auto" ? null : options.videoCodec || null,+ audio_codec: options.audioCodec === "auto" ? null : options.audioCodec || null,+ resolution: options.resolution === "original" ? null : options.resolution || null,+ video_bitrate: options.videoBitrate || null,+ audio_bitrate: options.audioBitrate || null,+ sample_rate: null,+ fps: null,+ trim_start: options.trimStart || null,+ trim_end: options.trimEnd || null,+ additional_input_args: null,+ additional_output_args: null,+ preset: options.preset === "medium" ? null : options.preset || null,+ };++ try {+ const conversionId = await pluginInvoke<number>("convert", "convert_file", { options: convOptions });+ markFileConverting(file.id, conversionId);+ await waitForConversion(conversionId);+ } catch (e: any) {+ showToast("error", typeof e === "string" ? e : e.message ?? $t("convert.conversion_failed"));+ }+ }++ converting = false;+ }++ function waitForConversion(conversionId: number): Promise<void> {+ return new Promise((resolve) => {+ const interval = setInterval(() => {+ const current = getFiles().find((f) => f.conversionId === conversionId);+ if (!current || current.status === "complete" || current.status === "error") {+ clearInterval(interval);+ resolve();+ }+ }, 500);+ });+ }++ async function handleCancel() {+ converting = false;+ const activeFile = files.find((f) => f.status === "converting");+ if (activeFile?.conversionId) {+ try {+ await pluginInvoke("convert", "cancel_conversion", { conversionId: activeFile.conversionId });+ } catch {}+ }+ }++ function formatDuration(seconds: number): string {+ const h = Math.floor(seconds / 3600);+ const m = Math.floor((seconds % 3600) / 60);+ const s = Math.floor(seconds % 60);+ if (h > 0) return `${h}:${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}`;+ return `${m}:${String(s).padStart(2, "0")}`;+ }++ function formatSize(bytes: number): string {+ if (bytes < 1024) return `${bytes} B`;+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;+ if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;+ return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;+ }++ function getVideoStream(probe: ProbeInfo) {+ return probe.streams.find((s) => s.codec_type === "video");+ }++ function getAudioStream(probe: ProbeInfo) {+ return probe.streams.find((s) => s.codec_type === "audio");+ }</script>{#if pluginStatus === "checking"}@@ -38,13 +217,199 @@<p>{$t("marketplace.plugin_restart_hint")}</p></div>{:else}- <div class="plugin-guard">- <svg viewBox="0 0 24 24" width="48" height="48" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">- <path d="M20 10H4l4-4" /><path d="M4 14h16l-4 4" />- </svg>- <h2>Convert</h2>- <p>{$t("marketplace.restart_required")}</p>- </div>+<div class="convert">+ <h2>{$t('convert.title')}</h2>++ {#if hwAccel}+ <div class="hwaccel-info">+ {#if hwAccel.recommended_video_encoder}+ <span class="hwaccel-badge detected">{$t('convert.hwaccel_detected', { encoder: hwAccel.recommended_video_encoder })}</span>+ {:else}+ <span class="hwaccel-badge none">{$t('convert.hwaccel_none')}</span>+ {/if}+ </div>+ {/if}++ <section class="section">+ <div class="actions-row">+ <button class="button" onclick={selectFiles}>{$t('convert.select_files')}</button>+ {#if files.length > 0}+ <button class="button clear-btn" onclick={clearFiles}>{$t('convert.clear_all')}</button>+ {/if}+ </div>+ </section>++ {#if files.length === 0}+ <div class="empty">+ <span class="empty-text">{$t('convert.empty')} <ContextHint text={$t('hints.convert')} dismissKey="convert" /></span>+ </div>+ {:else}+ <section class="section">+ <h5 class="section-title">{$t('convert.file_list')}</h5>+ <div class="card">+ {#each files as file, i (file.id)}+ {#if i > 0}+ <div class="divider"></div>+ {/if}+ <div class="file-row">+ <div class="file-info">+ <span class="file-name">{file.name}</span>+ {#if file.probe}+ <div class="file-meta">+ {#if file.probe.duration_seconds > 0}+ <span>{formatDuration(file.probe.duration_seconds)}</span>+ {/if}+ {#if getVideoStream(file.probe)}+ {@const vs = getVideoStream(file.probe)}+ {#if vs && vs.width && vs.height}+ <span>{vs.width}x{vs.height}</span>+ {/if}+ {#if vs}+ <span>{vs.codec_name}</span>+ {/if}+ {/if}+ {#if getAudioStream(file.probe)}+ {@const as_ = getAudioStream(file.probe)}+ {#if as_}+ <span>{as_.codec_name}</span>+ {/if}+ {/if}+ <span>{formatSize(file.probe.file_size_bytes)}</span>+ </div>+ {/if}+ <div class="file-status">+ <span class="status-label" class:converting={file.status === "converting"} class:complete={file.status === "complete"} class:error={file.status === "error"}>+ {$t(`convert.status_${file.status}`)}+ </span>+ {#if file.status === "converting"}+ <span class="percent">{file.percent.toFixed(0)}%</span>+ {/if}+ </div>+ {#if file.status === "converting"}+ <div class="progress-bar">+ <div class="progress-fill" style="width: {file.percent}%"></div>+ </div>+ {/if}+ </div>+ {#if file.status !== "converting"}+ <button class="button remove-btn" onclick={() => removeFile(file.id)} title={$t('convert.remove')}>+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <line x1="18" y1="6" x2="6" y2="18" />+ <line x1="6" y1="6" x2="18" y2="18" />+ </svg>+ </button>+ {/if}+ </div>+ {/each}+ </div>+ </section>++ <section class="section">+ <h5 class="section-title">{$t('convert.options_title')}</h5>+ <div class="card">+ <div class="setting-row">+ <span class="setting-label">{$t('convert.output_format')}</span>+ <select class="select" value={options.outputFormat} onchange={(e) => updateOptions({ outputFormat: (e.target as HTMLSelectElement).value })}>+ <option value="mp4">MP4</option>+ <option value="mkv">MKV</option>+ <option value="webm">WebM</option>+ <option value="avi">AVI</option>+ <option value="mov">MOV</option>+ <option value="mp3">MP3</option>+ <option value="wav">WAV</option>+ <option value="flac">FLAC</option>+ <option value="aac">AAC</option>+ <option value="ogg">OGG</option>+ <option value="opus">Opus</option>+ </select>+ </div>+ <div class="divider"></div>+ <div class="setting-row">+ <span class="setting-label">{$t('convert.video_codec')}</span>+ <select class="select" value={options.videoCodec} onchange={(e) => updateOptions({ videoCodec: (e.target as HTMLSelectElement).value })}>+ <option value="auto">{$t('convert.auto')}</option>+ <option value="libx264">H.264 (x264)</option>+ <option value="libx265">H.265 (x265)</option>+ <option value="libvpx-vp9">VP9</option>+ <option value="libaom-av1">AV1</option>+ {#if hwAccel?.recommended_video_encoder}+ <option value={hwAccel.recommended_video_encoder}>{hwAccel.recommended_video_encoder} (GPU)</option>+ {/if}+ <option value="copy">Copy (no re-encode)</option>+ </select>+ </div>+ <div class="divider"></div>+ <div class="setting-row">+ <span class="setting-label">{$t('convert.audio_codec')}</span>+ <select class="select" value={options.audioCodec} onchange={(e) => updateOptions({ audioCodec: (e.target as HTMLSelectElement).value })}>+ <option value="auto">{$t('convert.auto')}</option>+ <option value="aac">AAC</option>+ <option value="libmp3lame">MP3</option>+ <option value="libvorbis">Vorbis</option>+ <option value="libopus">Opus</option>+ <option value="flac">FLAC</option>+ <option value="copy">Copy (no re-encode)</option>+ </select>+ </div>+ <div class="divider"></div>+ <div class="setting-row">+ <span class="setting-label">{$t('convert.resolution')}</span>+ <select class="select" value={options.resolution} onchange={(e) => updateOptions({ resolution: (e.target as HTMLSelectElement).value })}>+ <option value="original">{$t('convert.original')}</option>+ <option value="3840x2160">4K (3840x2160)</option>+ <option value="1920x1080">1080p</option>+ <option value="1280x720">720p</option>+ <option value="854x480">480p</option>+ <option value="640x360">360p</option>+ </select>+ </div>+ <div class="divider"></div>+ <div class="setting-row">+ <span class="setting-label">{$t('convert.preset')}</span>+ <select class="select" value={options.preset} onchange={(e) => updateOptions({ preset: (e.target as HTMLSelectElement).value })}>+ <option value="ultrafast">Ultrafast</option>+ <option value="fast">Fast</option>+ <option value="medium">Medium</option>+ <option value="slow">Slow</option>+ <option value="veryslow">Very Slow</option>+ </select>+ </div>+ <div class="divider"></div>+ <div class="setting-row">+ <span class="setting-label">{$t('convert.trim_start')}</span>+ <input+ type="text"+ class="input-text"+ placeholder="00:00:00"+ value={options.trimStart}+ onchange={(e) => updateOptions({ trimStart: (e.target as HTMLInputElement).value })}+ />+ </div>+ <div class="divider"></div>+ <div class="setting-row">+ <span class="setting-label">{$t('convert.trim_end')}</span>+ <input+ type="text"+ class="input-text"+ placeholder="00:00:00"+ value={options.trimEnd}+ onchange={(e) => updateOptions({ trimEnd: (e.target as HTMLInputElement).value })}+ />+ </div>+ </div>+ </section>++ <div class="convert-actions">+ {#if converting}+ <button class="button cancel-btn" onclick={handleCancel}>{$t('convert.cancel')}</button>+ {:else}+ <button class="button convert-btn" onclick={startConversion} disabled={files.filter((f) => f.status === "ready" || f.status === "idle").length === 0}>+ {$t('convert.convert_btn')}+ </button>+ {/if}+ </div>+ {/if}+</div>{/if}<style>@@ -54,4 +419,287 @@.guard-link { padding: 10px 24px; font-size: 14px; font-weight: 500; background: var(--cta); color: var(--on-cta); border-radius: var(--border-radius); text-decoration: none; }.spinner { width: 24px; height: 24px; border: 2px solid var(--input-border); border-top-color: var(--secondary); border-radius: 50%; animation: spin 0.8s linear infinite; }@keyframes spin { to { transform: rotate(360deg); } }++ .convert {+ display: flex;+ flex-direction: column;+ align-items: center;+ min-height: calc(100vh - var(--padding) * 4);+ padding-top: calc(var(--padding) * 2);+ gap: calc(var(--padding) * 1.5);+ }++ .convert > :global(*) {+ width: 100%;+ max-width: 560px;+ }++ .hwaccel-info {+ display: flex;+ justify-content: center;+ }++ .hwaccel-badge {+ font-size: 12.5px;+ font-weight: 500;+ padding: calc(var(--padding) / 3) calc(var(--padding) / 1.5);+ border-radius: calc(var(--border-radius) / 2);+ }++ .hwaccel-badge.detected {+ color: var(--green);+ background: rgba(48, 189, 27, 0.1);+ }++ .hwaccel-badge.none {+ color: var(--gray);+ background: var(--button);+ }++ .section {+ display: flex;+ flex-direction: column;+ gap: calc(var(--padding) / 2);+ }++ .section-title {+ color: var(--gray);+ text-transform: uppercase;+ letter-spacing: 0.5px;+ }++ .actions-row {+ display: flex;+ gap: calc(var(--padding) / 2);+ justify-content: center;+ align-items: center;+ }++ .card {+ background: var(--button);+ box-shadow: var(--button-box-shadow);+ border-radius: var(--border-radius);+ padding: 0 calc(var(--padding) + 4px);+ }++ .divider {+ height: 1px;+ background: var(--button-stroke);+ }++ .file-row {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: var(--padding);+ padding: var(--padding) 0;+ }++ .file-info {+ display: flex;+ flex-direction: column;+ gap: 4px;+ min-width: 0;+ flex: 1;+ }++ .file-name {+ font-size: 14.5px;+ font-weight: 500;+ color: var(--secondary);+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ .file-meta {+ display: flex;+ gap: calc(var(--padding) / 2);+ font-size: 12.5px;+ font-weight: 500;+ color: var(--gray);+ flex-wrap: wrap;+ }++ .file-meta span:not(:last-child)::after {+ content: "\00b7";+ margin-left: calc(var(--padding) / 2);+ }++ .file-status {+ display: flex;+ align-items: center;+ gap: calc(var(--padding) / 2);+ }++ .status-label {+ font-size: 12.5px;+ font-weight: 500;+ color: var(--gray);+ }++ .status-label.converting {+ color: var(--blue);+ }++ .status-label.complete {+ color: var(--green);+ }++ .status-label.error {+ color: var(--red);+ }++ .percent {+ font-size: 12.5px;+ font-weight: 500;+ color: var(--blue);+ font-variant-numeric: tabular-nums;+ }++ .progress-bar {+ width: 100%;+ height: 6px;+ background: var(--button-elevated);+ border-radius: 3px;+ overflow: hidden;+ }++ .progress-fill {+ height: 100%;+ background: var(--blue);+ border-radius: 3px;+ transition: width 0.1s;+ }++ .remove-btn {+ padding: calc(var(--padding) / 3);+ color: var(--gray);+ flex-shrink: 0;+ }++ .remove-btn svg {+ pointer-events: none;+ }++ @media (hover: hover) {+ .remove-btn:hover {+ color: var(--red);+ }+ }++ .setting-row {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: var(--padding);+ padding: calc(var(--padding) + 2px) 0;+ min-height: 48px;+ }++ .setting-label {+ font-size: 14.5px;+ font-weight: 500;+ color: var(--secondary);+ }++ .select {+ padding: calc(var(--padding) / 2) 28px calc(var(--padding) / 2) var(--padding);+ font-size: 14.5px;+ font-weight: 500;+ background: var(--button-elevated);+ border-radius: calc(var(--border-radius) / 2);+ color: var(--secondary);+ border: none;+ cursor: pointer;+ flex-shrink: 0;+ appearance: none;+ background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');+ background-repeat: no-repeat;+ background-position: right 8px center;+ background-size: 14px;+ }++ .select:focus-visible {+ outline: var(--focus-ring);+ outline-offset: var(--focus-ring-offset);+ }++ .input-text {+ width: 100px;+ padding: calc(var(--padding) / 2);+ font-size: 14.5px;+ font-weight: 500;+ text-align: center;+ background: var(--button-elevated);+ border-radius: calc(var(--border-radius) / 2);+ color: var(--secondary);+ border: 1px solid var(--input-border);+ font-variant-numeric: tabular-nums;+ }++ .input-text:focus-visible {+ border-color: var(--blue);+ outline: none;+ }++ .convert-actions {+ display: flex;+ justify-content: center;+ padding-bottom: calc(var(--padding) * 2);+ }++ .convert-btn {+ padding: calc(var(--padding) / 1.5) calc(var(--padding) * 2);+ font-size: 14.5px;+ font-weight: 500;+ background: var(--blue);+ color: #fff;+ border: none;+ border-radius: var(--border-radius);+ cursor: pointer;+ }++ .convert-btn:disabled {+ opacity: 0.5;+ cursor: default;+ }++ @media (hover: hover) {+ .convert-btn:not(:disabled):hover {+ opacity: 0.9;+ }+ }++ .convert-btn:focus-visible {+ outline: var(--focus-ring);+ outline-offset: var(--focus-ring-offset);+ }++ .cancel-btn {+ padding: calc(var(--padding) / 1.5) calc(var(--padding) * 2);+ font-size: 14.5px;+ font-weight: 500;+ color: var(--red);+ }++ .clear-btn {+ font-size: 14.5px;+ font-weight: 500;+ color: var(--gray);+ }++ .empty {+ display: flex;+ align-items: center;+ justify-content: center;+ min-height: 200px;+ }++ .empty-text {+ font-size: 14.5px;+ font-weight: 500;+ color: var(--gray);+ text-align: center;+ }</style>diff --git a/src/routes/downloads/+page.svelte b/src/routes/downloads/+page.svelteindex 3024b3b9..cbd6a7ee 100644--- a/src/routes/downloads/+page.svelte+++ b/src/routes/downloads/+page.svelte@@ -94,16 +94,30 @@}}- async function removeItem(id: number) {- try {- await invoke("remove_download", { downloadId: id });- } catch (e: any) {- const msg = typeof e === "string" ? e : e.message ?? $t("common.error");- showToast("error", msg);+ let pendingRemove = $state<number | null>(null);+ let pendingRemoveTimer = $state<ReturnType<typeof setTimeout> | null>(null);++ function removeItem(id: number) {+ if (pendingRemove === id) {+ if (pendingRemoveTimer) clearTimeout(pendingRemoveTimer);+ pendingRemove = null;+ pendingRemoveTimer = null;+ invoke("remove_download", { downloadId: id }).catch((e: any) => {+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");+ showToast("error", msg);+ });+ } else {+ if (pendingRemoveTimer) clearTimeout(pendingRemoveTimer);+ pendingRemove = id;+ pendingRemoveTimer = setTimeout(() => {+ pendingRemove = null;+ pendingRemoveTimer = null;+ }, 3000);}}async function clearFinished() {+ if (!confirm($t("downloads.clear_confirm"))) return;try {await invoke("clear_finished_downloads");} catch (e: any) {@@ -269,12 +283,20 @@</button><buttonclass="action-icon-btn"+ class:confirm-remove={pendingRemove === item.id}onclick={() => removeItem(item.id)}- aria-label={$t('common.close')}+ aria-label={pendingRemove === item.id ? $t('downloads.confirm_remove') : $t('common.close')}+ title={pendingRemove === item.id ? $t('downloads.confirm_remove') : undefined}>- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">- <path d="M18 6L6 18M6 6l12 12" />- </svg>+ {#if pendingRemove === item.id}+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path d="M5 12l5 5L20 7" />+ </svg>+ {:else}+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path d="M18 6L6 18M6 6l12 12" />+ </svg>+ {/if}</button>{:else if item.status === "complete" && item.filePath}<button@@ -289,22 +311,38 @@</button><buttonclass="action-icon-btn"+ class:confirm-remove={pendingRemove === item.id}onclick={() => removeItem(item.id)}- aria-label={$t('common.close')}+ aria-label={pendingRemove === item.id ? $t('downloads.confirm_remove') : $t('common.close')}+ title={pendingRemove === item.id ? $t('downloads.confirm_remove') : undefined}>- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">- <path d="M18 6L6 18M6 6l12 12" />- </svg>+ {#if pendingRemove === item.id}+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path d="M5 12l5 5L20 7" />+ </svg>+ {:else}+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path d="M18 6L6 18M6 6l12 12" />+ </svg>+ {/if}</button>{:else if item.status === "complete"}<buttonclass="action-icon-btn"+ class:confirm-remove={pendingRemove === item.id}onclick={() => removeItem(item.id)}- aria-label={$t('common.close')}+ aria-label={pendingRemove === item.id ? $t('downloads.confirm_remove') : $t('common.close')}+ title={pendingRemove === item.id ? $t('downloads.confirm_remove') : undefined}>- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">- <path d="M18 6L6 18M6 6l12 12" />- </svg>+ {#if pendingRemove === item.id}+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path d="M5 12l5 5L20 7" />+ </svg>+ {:else}+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path d="M18 6L6 18M6 6l12 12" />+ </svg>+ {/if}</button>{:else if item.status === "queued"}<button@@ -624,6 +662,17 @@pointer-events: none;}+ .action-icon-btn.confirm-remove {+ color: var(--red);+ background: color-mix(in srgb, var(--red) 12%, transparent);+ animation: confirm-pulse 1s ease-in-out infinite;+ }++ @keyframes confirm-pulse {+ 0%, 100% { opacity: 1; }+ 50% { opacity: 0.6; }+ }+.item-status {font-size: 11px;font-weight: 500;diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelteindex 453fa9d5..c8798ce0 100644--- a/src/routes/settings/+page.svelte+++ b/src/routes/settings/+page.svelte@@ -403,6 +403,22 @@</div></div></section>++ <section class="section">+ <div class="card">+ <div class="setting-row">+ <div class="setting-col">+ <span class="setting-label">{$t('settings.general.reset_hints')}</span>+ <span class="setting-path">{$t('settings.general.reset_hints_desc')}</span>+ </div>+ <button class="button" onclick={() => {+ const keys = Object.keys(localStorage).filter(k => k.startsWith('hint_dismissed_'));+ for (const k of keys) localStorage.removeItem(k);+ showToast('info', $t('settings.general.hints_restored'));+ }}>{$t('settings.general.restore')}</button>+ </div>+ </div>+ </section>{/if}{#if activeCategory === "downloads"}diff --git a/src/routes/telegram/+page.svelte b/src/routes/telegram/+page.svelteindex 393c6050..44bf74a0 100644--- a/src/routes/telegram/+page.svelte+++ b/src/routes/telegram/+page.svelte@@ -1,10 +1,107 @@<script lang="ts">import { invoke } from "@tauri-apps/api/core";+ import { pluginInvoke } from "$lib/plugin-invoke";+ import { listen, type UnlistenFn } from "@tauri-apps/api/event";+ import { open } from "@tauri-apps/plugin-dialog";+ import { showToast } from "$lib/stores/toast-store.svelte";+ import { getSettings } from "$lib/stores/settings-store.svelte";+ import { onBatchFileStatus, type BatchFileStatusPayload } from "$lib/stores/download-listener";+ import ContextHint from "$components/hints/ContextHint.svelte";import { onMount } from "svelte";import { t } from "$lib/i18n";- type PluginStatus = "checking" | "ready" | "needs-restart" | "not-installed";- let pluginStatus = $state<PluginStatus>("checking");+ type PluginStatus = "checking_plugin" | "ready" | "not-installed" | "needs-restart";+ let pluginStatus = $state<PluginStatus>("checking_plugin");++ type TelegramChat = {+ id: number;+ title: string;+ chat_type: string;+ };++ type TelegramMediaItem = {+ message_id: number;+ file_name: string;+ file_size: number;+ media_type: string;+ date: number;+ };++ type QrStartResponse = {+ svg: string;+ expires: number;+ };++ type FileStatus = "waiting" | "downloading" | "done" | "error" | "skipped";++ type View = "checking" | "qr" | "phone" | "code" | "password" | "chats" | "media";++ let view: View = $state("checking");+ let phone = $state("");+ let code = $state("");+ let password = $state("");+ let passwordHint = $state("");+ let sessionPhone = $state("");+ let loading = $state(false);+ let error = $state("");++ let qrSvg = $state("");+ let qrLoading = $state(false);+ let qrError = $state("");+ let qrPollTimer: ReturnType<typeof setInterval> | null = $state(null);+ let qrRefreshTimer: ReturnType<typeof setTimeout> | null = $state(null);++ let chats: TelegramChat[] = $state([]);+ let loadingChats = $state(false);+ let chatsError = $state("");+ let chatSearch = $state("");++ let selectedChat: TelegramChat | null = $state(null);+ let mediaItems: TelegramMediaItem[] = $state([]);+ let loadingMedia = $state(false);+ let mediaError = $state("");+ let mediaFilter = $state("all");+ let loadingMore = $state(false);+ let hasMore = $state(true);+ let mediaSearch = $state("");+ let searchDebounce: ReturnType<typeof setTimeout> | null = null;+ let isSearching = $state(false);+ let searchInputRef: HTMLInputElement | null = $state(null);++ let batchStatus: Map<number, { status: FileStatus; percent: number }> = $state(new Map());+ let activeBatchId: number | null = $state(null);+ let batchDone = $state(0);+ let batchTotal = $state(0);++ let isBatchActive = $derived(activeBatchId !== null);+ let batchPercent = $derived(batchTotal > 0 ? (batchDone / batchTotal) * 100 : 0);++ let downloadingIds: Set<number> = $state(new Set());+ let downloadIdToMessageId: Map<number, number> = $state(new Map());+ let downloadProgress: Map<number, number> = $state(new Map());+ let downloadUnlisteners: UnlistenFn[] = [];++ let chatPhotos: Map<number, string> = $state(new Map());+ let thumbnails: Map<number, string> = $state(new Map());+ let thumbGeneration = 0;+ let thumbActive = 0;+ const THUMB_MAX_CONCURRENT = 5;+ const thumbQueue: (() => void)[] = [];++ let filteredChats = $derived(+ chatSearch.trim()+ ? chats.filter((c) =>+ c.title.toLowerCase().includes(chatSearch.trim().toLowerCase())+ )+ : chats+ );++ function handleKeydown(e: KeyboardEvent) {+ if ((e.ctrlKey || e.metaKey) && e.key === "f" && view === "media" && searchInputRef) {+ e.preventDefault();+ searchInputRef.focus();+ }+ }onMount(async () => {try {@@ -12,16 +109,615 @@const plugin = plugins.find((p) => p.id === "telegram");if (!plugin || !plugin.enabled) {pluginStatus = "not-installed";- } else {- pluginStatus = "ready";+ return;}+ if (!plugin.loaded) {+ pluginStatus = "needs-restart";+ return;+ }+ pluginStatus = "ready";} catch {pluginStatus = "ready";}});++ $effect(() => {+ if (pluginStatus !== "ready") return;++ checkSession();+ initDownloadListeners();++ onBatchFileStatus(handleBatchFileStatus);+ document.addEventListener("keydown", handleKeydown);++ return () => {+ stopQrPolling();+ onBatchFileStatus(null);+ resetThumbnails();+ document.removeEventListener("keydown", handleKeydown);+ if (searchDebounce) clearTimeout(searchDebounce);+ pluginInvoke("telegram", "telegram_clear_thumbnail_cache").catch(() => {});+ for (const unlisten of downloadUnlisteners) unlisten();+ downloadUnlisteners = [];+ };+ });++ async function initDownloadListeners() {+ type GenericProgress = { id: number; title: string; platform: string; percent: number };+ type GenericComplete = {+ id: number; title: string; platform: string; success: boolean;+ error: string | null; file_path: string | null;+ file_size_bytes: number | null; file_count: number | null;+ };++ const unlistenProgress = await listen<GenericProgress>("generic-download-progress", (event) => {+ const d = event.payload;+ if (d.platform !== "telegram") return;+ const msgId = downloadIdToMessageId.get(d.id);+ if (msgId === undefined) return;+ downloadProgress.set(msgId, d.percent);+ downloadProgress = new Map(downloadProgress);+ });++ const unlistenComplete = await listen<GenericComplete>("generic-download-complete", (event) => {+ const d = event.payload;+ if (d.platform !== "telegram") return;+ const msgId = downloadIdToMessageId.get(d.id);+ if (msgId === undefined) return;++ downloadingIds = new Set([...downloadingIds].filter((id) => id !== msgId));+ downloadIdToMessageId.delete(d.id);+ downloadIdToMessageId = new Map(downloadIdToMessageId);+ downloadProgress.delete(msgId);+ downloadProgress = new Map(downloadProgress);++ if (d.success) {+ showToast("success", $t("toast.download_complete", { name: d.title }));+ } else {+ showToast("error", d.error ?? $t("common.error"));+ }+ });++ downloadUnlisteners = [unlistenProgress, unlistenComplete];+ }++ function handleBatchFileStatus(payload: BatchFileStatusPayload) {+ if (payload.batch_id !== activeBatchId) return;++ batchStatus.set(payload.message_id, {+ status: payload.status,+ percent: payload.percent,+ });+ batchStatus = new Map(batchStatus);++ let done = 0;+ for (const [, entry] of batchStatus) {+ if (entry.status === "done" || entry.status === "error" || entry.status === "skipped") {+ done++;+ }+ }+ batchDone = done;++ if (done >= batchTotal && batchTotal > 0) {+ activeBatchId = null;+ }+ }++ function stopQrPolling() {+ if (qrPollTimer) {+ clearInterval(qrPollTimer);+ qrPollTimer = null;+ }+ if (qrRefreshTimer) {+ clearTimeout(qrRefreshTimer);+ qrRefreshTimer = null;+ }+ }++ async function checkSession() {+ view = "checking";+ try {+ const result = await pluginInvoke<string>("telegram", "telegram_check_session");+ sessionPhone = result;+ view = "chats";+ loadChats();+ } catch {+ view = "qr";+ startQrLogin();+ }+ }++ async function startQrLogin() {+ qrLoading = true;+ qrError = "";+ qrSvg = "";+ stopQrPolling();++ try {+ const result = await pluginInvoke<QrStartResponse>("telegram", "telegram_qr_start");+ qrSvg = result.svg;+ qrLoading = false;++ const now = Math.floor(Date.now() / 1000);+ const expiresIn = Math.max((result.expires - now) * 1000 - 2000, 5000);+ qrRefreshTimer = setTimeout(() => {+ if (view === "qr") startQrLogin();+ }, expiresIn);++ qrPollTimer = setInterval(pollQrLogin, 1500);+ } catch (e: any) {+ qrLoading = false;+ const msg = typeof e === "string" ? e : e.message ?? "";+ if (msg.includes("already_authenticated")) {+ checkSession();+ } else {+ qrError = msg || $t("telegram.qr_error");+ }+ }+ }++ async function pollQrLogin() {+ try {+ const status = await pluginInvoke<string>("telegram", "telegram_qr_poll");+ if (status === "waiting") return;++ stopQrPolling();++ if (status === "password_required" || status.startsWith("password_required:")) {+ passwordHint = status.startsWith("password_required:")+ ? status.slice("password_required:".length)+ : "";+ view = "password";+ } else if (status.startsWith("success:")) {+ sessionPhone = status.slice("success:".length);+ view = "chats";+ loadChats();+ }+ } catch {+ }+ }++ function switchToPhone() {+ stopQrPolling();+ view = "phone";+ }++ function switchToQr() {+ error = "";+ view = "qr";+ startQrLogin();+ }++ async function handleSendCode() {+ error = "";+ loading = true;+ try {+ await pluginInvoke("telegram", "telegram_send_code", { phone: phone.trim() });+ view = "code";+ } catch (e: any) {+ error = typeof e === "string" ? e : e.message ?? $t("telegram.unknown_error");+ } finally {+ loading = false;+ }+ }++ async function handleVerifyCode() {+ error = "";+ loading = true;+ try {+ const result = await pluginInvoke<string>("telegram", "telegram_verify_code", { code: code.trim() });+ sessionPhone = result;+ view = "chats";+ loadChats();+ } catch (e: any) {+ const msg = typeof e === "string" ? e : e.message ?? "";+ if (msg === "invalid_code") {+ error = $t("telegram.invalid_code");+ } else if (msg.startsWith("password_required:")) {+ passwordHint = msg.slice("password_required:".length);+ view = "password";+ } else {+ error = msg || $t("telegram.unknown_error");+ }+ } finally {+ loading = false;+ }+ }++ async function handleVerifyPassword() {+ error = "";+ loading = true;+ try {+ const result = await pluginInvoke<string>("telegram", "telegram_verify_2fa", { password });+ sessionPhone = result;+ view = "chats";+ loadChats();+ } catch (e: any) {+ const msg = typeof e === "string" ? e : e.message ?? "";+ if (msg === "invalid_password") {+ error = $t("telegram.invalid_password");+ } else {+ error = msg || $t("telegram.unknown_error");+ }+ } finally {+ loading = false;+ }+ }++ async function handleLogout() {+ stopQrPolling();+ try {+ await pluginInvoke("telegram", "telegram_logout");+ } catch {}+ sessionPhone = "";+ chats = [];+ mediaItems = [];+ selectedChat = null;+ chatPhotos = new Map();+ phone = "";+ code = "";+ password = "";+ error = "";+ view = "qr";+ startQrLogin();+ }++ async function loadChats() {+ loadingChats = true;+ chatsError = "";+ try {+ chats = await pluginInvoke<TelegramChat[]>("telegram", "telegram_list_chats");+ } catch (e: any) {+ chatsError = typeof e === "string" ? e : e.message ?? $t("telegram.chats_error");+ } finally {+ loadingChats = false;+ }+ }++ async function selectChat(chat: TelegramChat) {+ selectedChat = chat;+ mediaFilter = "all";+ mediaSearch = "";+ view = "media";+ batchStatus = new Map();+ activeBatchId = null;+ batchDone = 0;+ batchTotal = 0;+ downloadingIds = new Set();+ resetThumbnails();+ hasMore = true;+ loadMedia();+ }++ function backToChats() {+ selectedChat = null;+ mediaItems = [];+ mediaError = "";+ batchStatus = new Map();+ activeBatchId = null;+ batchDone = 0;+ batchTotal = 0;+ downloadingIds = new Set();+ resetThumbnails();+ view = "chats";+ }++ async function loadMedia() {+ if (!selectedChat) return;+ loadingMedia = true;+ mediaError = "";+ try {+ const items: TelegramMediaItem[] = await pluginInvoke<TelegramMediaItem[]>("telegram", "telegram_list_media", {+ chatId: selectedChat.id,+ chatType: selectedChat.chat_type,+ mediaType: mediaFilter === "all" ? null : mediaFilter,+ offset: 0,+ limit: 100,+ });+ mediaItems = items;+ hasMore = items.length >= 100;+ } catch (e: any) {+ mediaError = typeof e === "string" ? e : e.message ?? $t("telegram.media_error");+ } finally {+ loadingMedia = false;+ }+ }++ async function loadMoreMedia() {+ if (!selectedChat || loadingMore || !hasMore) return;+ loadingMore = true;+ try {+ const offset = mediaItems.length > 0+ ? Math.min(...mediaItems.map((m) => m.message_id))+ : 0;+ const items: TelegramMediaItem[] = await pluginInvoke<TelegramMediaItem[]>("telegram", "telegram_list_media", {+ chatId: selectedChat.id,+ chatType: selectedChat.chat_type,+ mediaType: mediaFilter === "all" ? null : mediaFilter,+ offset,+ limit: 100,+ });+ if (items.length > 0) {+ const existingIds = new Set(mediaItems.map((m) => m.message_id));+ const newItems = items.filter((item) => !existingIds.has(item.message_id));+ mediaItems = [...mediaItems, ...newItems];+ }+ hasMore = items.length >= 100;+ } catch (e: any) {+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");+ showToast("error", msg);+ } finally {+ loadingMore = false;+ }+ }++ async function searchMedia() {+ if (!selectedChat) return;+ const query = mediaSearch.trim();+ if (!query) {+ loadMedia();+ return;+ }+ isSearching = true;+ loadingMedia = true;+ mediaError = "";+ hasMore = false;+ try {+ const items: TelegramMediaItem[] = await pluginInvoke<TelegramMediaItem[]>("telegram", "telegram_search_media", {+ chatId: selectedChat.id,+ chatType: selectedChat.chat_type,+ query,+ mediaType: mediaFilter === "all" ? null : mediaFilter,+ limit: 100,+ });+ mediaItems = items;+ } catch (e: any) {+ mediaError = typeof e === "string" ? e : e.message ?? $t("telegram.media_error");+ } finally {+ loadingMedia = false;+ isSearching = false;+ }+ }++ function handleSearchInput() {+ if (searchDebounce) clearTimeout(searchDebounce);+ searchDebounce = setTimeout(() => {+ if (mediaSearch.trim()) {+ searchMedia();+ } else {+ hasMore = true;+ loadMedia();+ }+ }, 400);+ }++ function changeFilter(filter: string) {+ mediaFilter = filter;+ batchStatus = new Map();+ activeBatchId = null;+ batchDone = 0;+ batchTotal = 0;+ hasMore = true;+ if (mediaSearch.trim()) {+ searchMedia();+ } else {+ loadMedia();+ }+ }++ function formatSize(bytes: number): string {+ if (bytes === 0) return "\u2014";+ if (bytes < 1024) return `${bytes} B`;+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;+ if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;+ return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;+ }++ function formatDate(ts: number): string {+ return new Date(ts * 1000).toLocaleDateString();+ }++ function chatTypeLabel(type: string): string {+ const key = `telegram.chat_type_${type}` as const;+ return $t(key);+ }++ async function resolveOutputDir(): Promise<string | null> {+ const appSettings = getSettings();+ if (appSettings?.download.always_ask_path) {+ return (await open({ directory: true, title: $t("telegram.choose_folder") })) as string | null;+ }+ const defaultDir = appSettings?.download.default_output_dir ?? null;+ if (defaultDir) return defaultDir;+ return (await open({ directory: true, title: $t("telegram.choose_folder") })) as string | null;+ }++ async function downloadItem(item: TelegramMediaItem) {+ if (!selectedChat) return;+ if (downloadingIds.has(item.message_id)) return;++ const outputDir = await resolveOutputDir();+ if (!outputDir) return;++ downloadingIds = new Set([...downloadingIds, item.message_id]);++ try {+ const result = await pluginInvoke<{ id: number; file_name: string }>("telegram", "telegram_download_media", {+ chatId: selectedChat.id,+ chatType: selectedChat.chat_type,+ messageId: item.message_id,+ fileName: item.file_name,+ outputDir,+ });+ downloadIdToMessageId.set(result.id, item.message_id);+ downloadIdToMessageId = new Map(downloadIdToMessageId);+ showToast("info", $t("toast.download_started", { name: item.file_name }));+ } catch (e: any) {+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");+ showToast("error", msg);+ downloadingIds = new Set([...downloadingIds].filter((id) => id !== item.message_id));+ }+ }++ async function downloadAll() {+ if (!selectedChat || isBatchActive || mediaItems.length === 0) return;++ const outputDir = await resolveOutputDir();+ if (!outputDir) return;++ const items = mediaItems.map((m) => ({+ message_id: m.message_id,+ file_name: m.file_name,+ file_size: m.file_size,+ }));++ batchTotal = items.length;+ batchDone = 0;+ batchStatus = new Map(+ items.map((item) => [item.message_id, { status: "waiting" as FileStatus, percent: 0 }])+ );++ try {+ const batchId = await pluginInvoke<number>("telegram", "telegram_download_batch", {+ chatId: selectedChat.id,+ chatType: selectedChat.chat_type,+ chatTitle: selectedChat.title,+ items,+ outputDir,+ });+ activeBatchId = batchId;+ } catch (e: any) {+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");+ showToast("error", msg);+ batchStatus = new Map();+ batchTotal = 0;+ }+ }++ async function cancelBatch() {+ if (!activeBatchId) return;+ try {+ await pluginInvoke("telegram", "telegram_cancel_batch", { batchId: activeBatchId });+ showToast("info", $t("telegram.batch_cancelled"));+ } catch {}+ activeBatchId = null;+ }++ function getItemStatus(messageId: number): FileStatus | null {+ return batchStatus.get(messageId)?.status ?? null;+ }++ function getItemPercent(messageId: number): number {+ return batchStatus.get(messageId)?.percent ?? 0;+ }++ function thumbAcquire(): Promise<void> {+ if (thumbActive < THUMB_MAX_CONCURRENT) {+ thumbActive++;+ return Promise.resolve();+ }+ return new Promise((resolve) => {+ thumbQueue.push(() => {+ thumbActive++;+ resolve();+ });+ });+ }++ function thumbRelease() {+ thumbActive--;+ if (thumbQueue.length > 0) {+ thumbQueue.shift()!();+ }+ }++ async function getThumbnail(chatId: number, chatType: string, messageId: number): Promise<string | null> {+ if (thumbnails.has(messageId)) return thumbnails.get(messageId)!;++ const gen = thumbGeneration;+ await thumbAcquire();+ try {+ if (gen !== thumbGeneration) return null;+ if (thumbnails.has(messageId)) return thumbnails.get(messageId)!;++ const result = await pluginInvoke<string>("telegram", "telegram_get_thumbnail", { chatId, chatType, messageId });+ if (gen !== thumbGeneration) return null;++ thumbnails.set(messageId, result);+ thumbnails = new Map(thumbnails);+ return result;+ } catch {+ return null;+ } finally {+ thumbRelease();+ }+ }++ function resetThumbnails() {+ thumbnails = new Map();+ thumbGeneration++;+ thumbQueue.length = 0;+ }++ async function getChatPhoto(chatId: number, chatType: string) {+ if (chatPhotos.has(chatId)) return;+ try {+ const result = await pluginInvoke<string>("telegram", "telegram_get_chat_photo", { chatId, chatType });+ chatPhotos.set(chatId, result);+ chatPhotos = new Map(chatPhotos);+ } catch {+ }+ }++ function observeChatPhoto(node: HTMLElement, params: { chatId: number; chatType: string }) {+ if (chatPhotos.has(params.chatId)) return;++ const observer = new IntersectionObserver(+ (entries) => {+ if (entries[0].isIntersecting) {+ observer.disconnect();+ getChatPhoto(params.chatId, params.chatType);+ }+ },+ { rootMargin: "200px" }+ );+ observer.observe(node);++ return {+ destroy() {+ observer.disconnect();+ },+ };+ }++ function observeThumbnail(node: HTMLElement, params: { messageId: number; mediaType: string }) {+ if (!selectedChat) return;+ if (params.mediaType !== "photo" && params.mediaType !== "video") return;+ if (thumbnails.has(params.messageId)) return;++ const chatId = selectedChat.id;+ const chatType = selectedChat.chat_type;++ const observer = new IntersectionObserver(+ (entries) => {+ if (entries[0].isIntersecting) {+ observer.disconnect();+ getThumbnail(chatId, chatType, params.messageId);+ }+ },+ { rootMargin: "200px" }+ );+ observer.observe(node);++ return {+ destroy() {+ observer.disconnect();+ },+ };+ }</script>-{#if pluginStatus === "checking"}+{#if pluginStatus === "checking_plugin"}<div class="plugin-guard"><span class="spinner"></span></div>{:else if pluginStatus === "not-installed"}<div class="plugin-guard">@@ -38,20 +734,896 @@<p>{$t("marketplace.plugin_restart_hint")}</p></div>{:else}- <div class="plugin-guard">- <svg viewBox="0 0 24 24" width="48" height="48" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">- <path d="M21 5L2 12.5l7 1M21 5l-5.5 15-4.5-7.5M21 5L9 13.5" />- </svg>- <h2>Telegram</h2>- <p>{$t("marketplace.restart_required")}</p>+{#if view === "checking"}+ <div class="page-center">+ <span class="spinner"></span>+ <span class="spinner-text">{$t("telegram.checking_session")}</span>+ </div>+{:else if view === "qr"}+ <div class="page-center">+ <div class="login-card">+ <h2>{$t("telegram.title")} <ContextHint text={$t('hints.telegram')} dismissKey="telegram" /></h2>++ {#if qrLoading}+ <div class="qr-placeholder">+ <span class="spinner"></span>+ <span class="spinner-text">{$t("telegram.qr_loading")}</span>+ </div>+ {:else if qrError}+ <div class="qr-placeholder">+ <p class="error-msg">{qrError}</p>+ <button class="button" onclick={startQrLogin}>{$t("common.retry")}</button>+ </div>+ {:else if qrSvg}+ <div class="qr-container">+ {@html qrSvg}+ </div>+ {/if}++ <div class="qr-text">+ <h3>{$t("telegram.qr_title")}</h3>+ <p class="qr-instruction">{$t("telegram.qr_instruction")}</p>+ </div>++ <div class="separator">+ <span class="separator-line"></span>+ <span class="separator-text">{$t("telegram.or_separator")}</span>+ <span class="separator-line"></span>+ </div>++ <button class="button use-phone-btn" onclick={switchToPhone}>+ {$t("telegram.use_phone")}+ </button>+ </div>+ </div>+{:else if view === "phone"}+ <div class="page-center">+ <div class="login-card">+ <h2>{$t("telegram.title")}</h2>+ <form class="form" onsubmit={(e) => { e.preventDefault(); handleSendCode(); }}>+ <label class="field">+ <span class="field-label">{$t("telegram.phone_label")}</span>+ <input+ type="tel"+ placeholder={$t("telegram.phone_placeholder")}+ bind:value={phone}+ class="input"+ disabled={loading}+ required+ />+ <span class="field-hint">{$t("telegram.phone_hint")}</span>+ </label>+ {#if error}+ <p class="error-msg">{error}</p>+ {/if}+ <button type="submit" class="button" disabled={loading || !phone.trim()}>+ {loading ? $t("telegram.sending_code") : $t("telegram.send_code")}+ </button>+ </form>+ <button class="button back-to-qr-btn" onclick={switchToQr}>+ {$t("telegram.back_to_qr")}+ </button>+ </div>+ </div>+{:else if view === "code"}+ <div class="page-center">+ <div class="login-card">+ <h2>{$t("telegram.title")}</h2>+ <form class="form" onsubmit={(e) => { e.preventDefault(); handleVerifyCode(); }}>+ <label class="field">+ <span class="field-label">{$t("telegram.code_label")}</span>+ <input+ type="text"+ inputmode="numeric"+ placeholder={$t("telegram.code_placeholder")}+ bind:value={code}+ class="input"+ disabled={loading}+ required+ />+ <span class="field-hint">{$t("telegram.code_hint")}</span>+ </label>+ {#if error}+ <p class="error-msg">{error}</p>+ {/if}+ <button type="submit" class="button" disabled={loading || !code.trim()}>+ {loading ? $t("telegram.verifying") : $t("telegram.verify")}+ </button>+ </form>+ </div>+ </div>+{:else if view === "password"}+ <div class="page-center">+ <div class="login-card">+ <h2>{$t("telegram.title")}</h2>+ <form class="form" onsubmit={(e) => { e.preventDefault(); handleVerifyPassword(); }}>+ <label class="field">+ <span class="field-label">{$t("telegram.password_label")}</span>+ <input+ type="password"+ placeholder={$t("telegram.password_placeholder")}+ bind:value={password}+ class="input"+ disabled={loading}+ required+ />+ {#if passwordHint}+ <span class="field-hint">{$t("telegram.password_hint", { hint: passwordHint })}</span>+ {/if}+ </label>+ {#if error}+ <p class="error-msg">{error}</p>+ {/if}+ <button type="submit" class="button" disabled={loading || !password}>+ {loading ? $t("telegram.password_verifying") : $t("telegram.password_submit")}+ </button>+ </form>+ </div>+ </div>+{:else if view === "chats"}+ <div class="page-logged">+ <div class="session-bar">+ <span class="session-info">+ {$t("telegram.logged_as", { phone: sessionPhone || "\u2014" })}+ </span>+ <div class="session-actions">+ <button+ class="button"+ onclick={loadChats}+ disabled={loadingChats}+ aria-label={$t("hotmart.refresh")}+ >+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class:spinning={loadingChats}>+ <path d="M21 2v6h-6" />+ <path d="M3 12a9 9 0 0115-6.7L21 8" />+ <path d="M3 22v-6h6" />+ <path d="M21 12a9 9 0 01-15 6.7L3 16" />+ </svg>+ </button>+ <button class="button" onclick={handleLogout}>{$t("telegram.logout")}</button>+ </div>+ </div>++ {#if loadingChats}+ <div class="spinner-section">+ <span class="spinner"></span>+ <span class="spinner-text">{$t("telegram.loading_chats")}</span>+ </div>+ {:else if chatsError}+ <div class="error-section">+ <p class="error-msg">{chatsError}</p>+ <button class="button" onclick={loadChats}>{$t("common.retry")}</button>+ </div>+ {:else if chats.length === 0}+ <p class="empty-text">{$t("telegram.no_chats")}</p>+ {:else}+ <div class="chats-header">+ <h2>{$t("telegram.chats_title")}</h2>+ <span class="subtext">+ {chats.length === 1+ ? $t("telegram.chat_count_one", { count: chats.length })+ : $t("telegram.chat_count", { count: chats.length })}+ </span>+ </div>++ <input+ type="text"+ class="input search-input"+ placeholder="Search..."+ bind:value={chatSearch}+ />++ <div class="chats-list">+ {#each filteredChats as chat (chat.id)}+ <button class="chat-item button" onclick={() => selectChat(chat)}>+ <div class="chat-avatar" class:has-photo={chatPhotos.get(chat.id)} use:observeChatPhoto={{ chatId: chat.id, chatType: chat.chat_type }}>+ {#if chatPhotos.get(chat.id)}+ <img+ src="data:image/jpeg;base64,{chatPhotos.get(chat.id)}"+ alt=""+ class="chat-photo-img"+ />+ {:else}+ {chat.title.charAt(0).toUpperCase()}+ {/if}+ </div>+ <div class="chat-info">+ <span class="chat-title">{chat.title}</span>+ <span class="chat-type">{chatTypeLabel(chat.chat_type)}</span>+ </div>+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" class="chat-arrow">+ <path d="M9 6l6 6-6 6" />+ </svg>+ </button>+ {/each}+ </div>+ {/if}+ </div>+{:else if view === "media" && selectedChat}+ <div class="page-logged">+ <div class="session-bar">+ <button class="button back-btn" onclick={backToChats}>+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path d="M15 18l-6-6 6-6" />+ </svg>+ {$t("telegram.back_to_chats")}+ </button>+ <span class="session-info">{selectedChat.title}</span>+ </div>++ <div class="filters">+ {#each [+ { key: "all", label: $t("telegram.filter_all") },+ { key: "photo", label: $t("telegram.filter_photo") },+ { key: "video", label: $t("telegram.filter_video") },+ { key: "document", label: $t("telegram.filter_document") },+ { key: "audio", label: $t("telegram.filter_audio") },+ ] as f}+ <button+ class="button filter-btn"+ class:active={mediaFilter === f.key}+ onclick={() => changeFilter(f.key)}+ disabled={isBatchActive}+ >+ {f.label}+ </button>+ {/each}+ </div>++ <input+ type="text"+ class="input search-input"+ placeholder={$t("telegram.search_files")}+ bind:value={mediaSearch}+ bind:this={searchInputRef}+ oninput={handleSearchInput}+ disabled={isBatchActive}+ />++ {#if loadingMedia}+ <div class="spinner-section">+ <span class="spinner"></span>+ <span class="spinner-text">{isSearching ? $t("telegram.searching") : $t("telegram.loading_media")}</span>+ </div>+ {:else if mediaError}+ <div class="error-section">+ <p class="error-msg">{mediaError}</p>+ <button class="button" onclick={loadMedia}>{$t("common.retry")}</button>+ </div>+ {:else if mediaItems.length === 0}+ <p class="empty-text">{$t("telegram.no_media")}</p>+ {:else}+ <div class="media-header">+ <span class="subtext">+ {$t("telegram.file_count", { count: mediaItems.length })}+ </span>+ <div class="media-header-actions">+ {#if isBatchActive}+ <button class="button batch-cancel-btn" onclick={cancelBatch}>+ {$t("telegram.cancel_batch")}+ </button>+ {:else}+ <button+ class="button batch-download-btn"+ onclick={downloadAll}+ disabled={mediaItems.length === 0}+ >+ {$t("telegram.download_all")}+ </button>+ {/if}+ </div>+ </div>++ {#if batchTotal > 0}+ <div class="batch-progress-section">+ <div class="batch-progress-bar-outer">+ <div+ class="batch-progress-bar-inner"+ style="width: {batchPercent}%"+ ></div>+ </div>+ <span class="subtext">+ {$t("telegram.batch_progress", { done: batchDone, total: batchTotal })}+ </span>+ </div>+ {/if}++ <div class="media-list">+ {#each mediaItems as item (item.message_id)}+ {@const itemStatus = getItemStatus(item.message_id)}+ {@const itemPercent = getItemPercent(item.message_id)}+ <div class="media-item" use:observeThumbnail={{ messageId: item.message_id, mediaType: item.media_type }}>+ <div class="media-icon" class:has-thumb={(item.media_type === "photo" || item.media_type === "video") && thumbnails.get(item.message_id)}>+ {#if (item.media_type === "photo" || item.media_type === "video") && thumbnails.get(item.message_id)}+ <img+ src="data:image/jpeg;base64,{thumbnails.get(item.message_id)}"+ alt=""+ class="thumb-img"+ />+ {:else}+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">+ {#if item.media_type === "photo"}+ <rect x="3" y="3" width="18" height="18" rx="2" />+ <circle cx="8.5" cy="8.5" r="1.5" />+ <path d="M21 15l-5-5L5 21" />+ {:else if item.media_type === "video"}+ <rect x="2" y="5" width="20" height="14" rx="2" />+ <path d="M10 9l5 3-5 3z" fill="currentColor" stroke="none" />+ {:else if item.media_type === "audio"}+ <path d="M9 18V5l12-2v13" />+ <circle cx="6" cy="18" r="3" />+ <circle cx="18" cy="16" r="3" />+ {:else}+ <path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" />+ <path d="M14 2v6h6" />+ {/if}+ </svg>+ {/if}+ </div>+ <div class="media-info">+ <span class="media-name">{item.file_name}</span>+ <span class="media-meta">+ {formatSize(item.file_size)} · {formatDate(item.date)}+ {#if itemStatus === "downloading"}+ · {Math.round(itemPercent)}%+ {:else if itemStatus === "done"}+ · {$t("telegram.downloaded")}+ {:else if itemStatus === "skipped"}+ · {$t("telegram.status_skipped")}+ {:else if itemStatus === "error"}+ · {$t("telegram.status_error")}+ {:else if itemStatus === "waiting"}+ · {$t("telegram.status_waiting")}+ {/if}+ </span>+ </div>+ {#if itemStatus === "downloading"}+ <span class="media-status-icon downloading">+ <span class="spinner small"></span>+ </span>+ {:else if itemStatus === "done"}+ <span class="media-status-icon done">+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="var(--green)" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">+ <path d="M20 6L9 17l-5-5" />+ </svg>+ </span>+ {:else if itemStatus === "skipped"}+ <span class="media-status-icon skipped">+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="var(--gray)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <path d="M13 17l5-5-5-5" />+ <path d="M6 17l5-5-5-5" />+ </svg>+ </span>+ {:else if itemStatus === "error"}+ <span class="media-status-icon error-icon">+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="var(--red)" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">+ <path d="M18 6L6 18" />+ <path d="M6 6l12 12" />+ </svg>+ </span>+ {:else if itemStatus === "waiting"}+ <span class="media-status-icon waiting">+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="var(--gray)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <circle cx="12" cy="12" r="10" />+ <path d="M12 6v6l4 2" />+ </svg>+ </span>+ {:else}+ <button+ class="button media-download-btn"+ disabled={downloadingIds.has(item.message_id) || isBatchActive}+ onclick={() => downloadItem(item)}+ >+ {#if downloadingIds.has(item.message_id)}+ {@const pct = downloadProgress.get(item.message_id) ?? 0}+ {pct > 0 ? `${Math.round(pct)}%` : $t("telegram.downloading")}+ {:else}+ {$t("telegram.download_btn")}+ {/if}+ </button>+ {/if}+ </div>+ {/each}+ </div>++ {#if hasMore}+ <button+ class="button load-more-btn"+ onclick={loadMoreMedia}+ disabled={loadingMore || isBatchActive}+ >+ {#if loadingMore}+ <span class="spinner small"></span>+ {:else}+ {$t("telegram.load_more")}+ {/if}+ </button>+ {/if}+ {/if}</div>{/if}+{/if}<style>.plugin-guard { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100vh - var(--padding) * 4); gap: calc(var(--padding) * 1.5); text-align: center; color: var(--gray); }.plugin-guard h2 { font-size: 18px; color: var(--secondary); }.plugin-guard p { font-size: 14px; max-width: 300px; }.guard-link { padding: 10px 24px; font-size: 14px; font-weight: 500; background: var(--cta); color: var(--on-cta); border-radius: var(--border-radius); text-decoration: none; }- .spinner { width: 24px; height: 24px; border: 2px solid var(--input-border); border-top-color: var(--secondary); border-radius: 50%; animation: spin 0.8s linear infinite; }- @keyframes spin { to { transform: rotate(360deg); } }++ .page-center {+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ min-height: calc(100vh - var(--padding) * 4);+ gap: var(--padding);+ }++ .page-logged {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: calc(var(--padding) * 1.5);+ padding: calc(var(--padding) * 1.5);+ width: 100%;+ }++ .page-logged > :global(*) {+ width: 100%;+ max-width: 800px;+ }++ .session-bar {+ display: flex;+ align-items: center;+ justify-content: space-between;+ }++ .session-info {+ font-size: 12.5px;+ font-weight: 500;+ color: var(--gray);+ }++ .session-actions {+ display: flex;+ gap: calc(var(--padding) / 2);+ }++ .session-bar :global(.button) {+ padding: calc(var(--padding) / 2) var(--padding);+ font-size: 12.5px;+ }++ .spinning {+ animation: spin 0.6s linear infinite;+ }++ .back-btn {+ display: flex;+ align-items: center;+ gap: calc(var(--padding) / 2);+ }++ .login-card {+ width: 100%;+ max-width: 400px;+ background: var(--button-elevated);+ border-radius: var(--border-radius);+ padding: calc(var(--padding) * 2);+ display: flex;+ flex-direction: column;+ gap: calc(var(--padding) * 1.5);+ }++ .login-card h2 {+ margin-block: 0;+ }++ .qr-container {+ display: flex;+ justify-content: center;+ align-items: center;+ background: #ffffff;+ border-radius: var(--border-radius);+ padding: var(--padding);+ }++ .qr-container :global(svg) {+ width: 200px;+ height: 200px;+ display: block;+ }++ .qr-placeholder {+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: var(--padding);+ min-height: 200px;+ }++ .qr-text {+ display: flex;+ flex-direction: column;+ gap: calc(var(--padding) / 2);+ text-align: center;+ }++ .qr-text h3 {+ margin-block: 0;+ }++ .qr-instruction {+ font-size: 12.5px;+ font-weight: 500;+ color: var(--gray);+ line-height: 1.6;+ }++ .separator {+ display: flex;+ align-items: center;+ gap: var(--padding);+ }++ .separator-line {+ flex: 1;+ height: 1px;+ background: var(--input-border);+ }++ .separator-text {+ font-size: 12.5px;+ font-weight: 500;+ color: var(--gray);+ }++ .use-phone-btn,+ .back-to-qr-btn {+ width: 100%;+ text-align: center;+ justify-content: center;+ }++ .form {+ display: flex;+ flex-direction: column;+ gap: var(--padding);+ }++ .field {+ display: flex;+ flex-direction: column;+ gap: calc(var(--padding) / 2);+ }++ .field-label {+ font-size: 12.5px;+ font-weight: 500;+ color: var(--gray);+ }++ .field-hint {+ font-size: 11px;+ font-weight: 500;+ color: var(--gray);+ opacity: 0.7;+ }++ .input {+ width: 100%;+ padding: var(--padding);+ font-size: 14.5px;+ background: var(--button);+ border-radius: var(--border-radius);+ color: var(--secondary);+ border: 1px solid var(--input-border);+ }++ .input::placeholder {+ color: var(--gray);+ }++ .input:focus-visible {+ border-color: var(--secondary);+ outline: none;+ }++ .input:disabled {+ opacity: 0.5;+ cursor: default;+ }++ .search-input {+ max-width: 800px;+ }++ .error-msg {+ color: var(--red);+ font-size: 12.5px;+ font-weight: 500;+ }++ .spinner-section {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: var(--padding);+ padding: calc(var(--padding) * 4) 0;+ }++ .spinner {+ width: 24px;+ height: 24px;+ border: 2px solid var(--input-border);+ border-top-color: var(--blue);+ border-radius: 50%;+ animation: spin 0.6s linear infinite;+ }++ .spinner.small {+ width: 14px;+ height: 14px;+ border-width: 1.5px;+ }++ @keyframes spin {+ to {+ transform: rotate(360deg);+ }+ }++ .spinner-text {+ font-size: 12.5px;+ font-weight: 500;+ color: var(--gray);+ }++ .error-section {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: var(--padding);+ padding: calc(var(--padding) * 2) 0;+ }++ .empty-text {+ color: var(--gray);+ font-size: 14.5px;+ text-align: center;+ padding: calc(var(--padding) * 4) 0;+ }++ .chats-header {+ display: flex;+ align-items: baseline;+ gap: var(--padding);+ }++ .chats-header h2 {+ margin-block: 0;+ }++ .subtext {+ font-size: 12.5px;+ font-weight: 500;+ color: var(--gray);+ }++ .chats-list {+ display: flex;+ flex-direction: column;+ gap: 2px;+ }++ .chat-item {+ display: flex;+ align-items: center;+ gap: var(--padding);+ padding: var(--padding);+ text-align: left;+ width: 100%;+ }++ .chat-avatar {+ width: 36px;+ height: 36px;+ min-width: 36px;+ border-radius: 50%;+ background: var(--blue);+ color: #fff;+ display: flex;+ align-items: center;+ justify-content: center;+ font-size: 14.5px;+ font-weight: 500;+ }++ .chat-avatar.has-photo {+ background: none;+ overflow: hidden;+ }++ .chat-photo-img {+ width: 100%;+ height: 100%;+ object-fit: cover;+ display: block;+ pointer-events: none;+ }++ .chat-info {+ flex: 1;+ min-width: 0;+ display: flex;+ flex-direction: column;+ gap: 2px;+ }++ .chat-title {+ font-size: 14.5px;+ font-weight: 500;+ color: var(--secondary);+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ .chat-type {+ font-size: 11px;+ font-weight: 500;+ color: var(--gray);+ }++ .chat-arrow {+ color: var(--gray);+ flex-shrink: 0;+ }++ .filters {+ display: flex;+ gap: calc(var(--padding) / 2);+ flex-wrap: wrap;+ }++ .filter-btn {+ padding: calc(var(--padding) / 2) var(--padding);+ font-size: 12.5px;+ }++ .media-header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ }++ .media-header-actions {+ display: flex;+ gap: calc(var(--padding) / 2);+ }++ .batch-download-btn,+ .batch-cancel-btn {+ padding: calc(var(--padding) / 2) var(--padding);+ font-size: 12.5px;+ }++ .batch-cancel-btn {+ color: var(--red);+ }++ .batch-progress-section {+ display: flex;+ flex-direction: column;+ gap: calc(var(--padding) / 2);+ }++ .batch-progress-bar-outer {+ width: 100%;+ height: 6px;+ background: var(--button-elevated);+ border-radius: 3px;+ overflow: hidden;+ }++ .batch-progress-bar-inner {+ height: 100%;+ background: var(--blue);+ border-radius: 3px;+ transition: width 0.1s;+ }++ .media-list {+ display: flex;+ flex-direction: column;+ gap: 2px;+ }++ .media-item {+ display: flex;+ align-items: center;+ gap: var(--padding);+ padding: var(--padding);+ background: var(--button);+ border-radius: var(--border-radius);+ }++ .media-icon {+ width: 48px;+ height: 48px;+ min-width: 48px;+ display: flex;+ align-items: center;+ justify-content: center;+ background: var(--button-elevated);+ border-radius: calc(var(--border-radius) - 2px);+ color: var(--gray);+ overflow: hidden;+ flex-shrink: 0;+ }++ .media-icon.has-thumb {+ background: none;+ }++ .thumb-img {+ width: 100%;+ height: 100%;+ object-fit: cover;+ display: block;+ pointer-events: none;+ }++ .media-info {+ flex: 1;+ min-width: 0;+ display: flex;+ flex-direction: column;+ gap: 2px;+ }++ .media-name {+ font-size: 13px;+ font-weight: 500;+ color: var(--secondary);+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ .media-meta {+ font-size: 11px;+ font-weight: 500;+ color: var(--gray);+ }++ .media-download-btn {+ padding: calc(var(--padding) / 2) var(--padding);+ font-size: 12.5px;+ flex-shrink: 0;+ }++ .media-download-btn:disabled {+ opacity: 0.6;+ }++ .media-status-icon {+ display: flex;+ align-items: center;+ justify-content: center;+ width: 24px;+ height: 24px;+ flex-shrink: 0;+ }++ .load-more-btn {+ align-self: center;+ padding: calc(var(--padding) / 2) calc(var(--padding) * 2);+ font-size: 12.5px;+ display: flex;+ align-items: center;+ gap: calc(var(--padding) / 2);+ }</style>diff --git a/static/mascot/amazed.png b/static/mascot/amazed.pngnew file mode 100644index 00000000..7b2cf4adBinary files /dev/null and b/static/mascot/amazed.png differdiff --git a/static/mascot/complete.png b/static/mascot/complete.pngnew file mode 100644index 00000000..5a01af8aBinary files /dev/null and b/static/mascot/complete.png differdiff --git a/static/mascot/queue.png b/static/mascot/queue.pngnew file mode 100644index 00000000..41f49ec9Binary files /dev/null and b/static/mascot/queue.png differdiff --git a/static/svelte.svg b/static/svelte.svgdeleted file mode 100644index c5e08481..00000000--- a/static/svelte.svg+++ /dev/null@@ -1 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="26.6" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 308"><path fill="#FF3E00" d="M239.682 40.707C211.113-.182 154.69-12.301 113.895 13.69L42.247 59.356a82.198 82.198 0 0 0-37.135 55.056a86.566 86.566 0 0 0 8.536 55.576a82.425 82.425 0 0 0-12.296 30.719a87.596 87.596 0 0 0 14.964 66.244c28.574 40.893 84.997 53.007 125.787 27.016l71.648-45.664a82.182 82.182 0 0 0 37.135-55.057a86.601 86.601 0 0 0-8.53-55.577a82.409 82.409 0 0 0 12.29-30.718a87.573 87.573 0 0 0-14.963-66.244"></path><path fill="#FFF" d="M106.889 270.841c-23.102 6.007-47.497-3.036-61.103-22.648a52.685 52.685 0 0 1-9.003-39.85a49.978 49.978 0 0 1 1.713-6.693l1.35-4.115l3.671 2.697a92.447 92.447 0 0 0 28.036 14.007l2.663.808l-.245 2.659a16.067 16.067 0 0 0 2.89 10.656a17.143 17.143 0 0 0 18.397 6.828a15.786 15.786 0 0 0 4.403-1.935l71.67-45.672a14.922 14.922 0 0 0 6.734-9.977a15.923 15.923 0 0 0-2.713-12.011a17.156 17.156 0 0 0-18.404-6.832a15.78 15.78 0 0 0-4.396 1.933l-27.35 17.434a52.298 52.298 0 0 1-14.553 6.391c-23.101 6.007-47.497-3.036-61.101-22.649a52.681 52.681 0 0 1-9.004-39.849a49.428 49.428 0 0 1 22.34-33.114l71.664-45.677a52.218 52.218 0 0 1 14.563-6.398c23.101-6.007 47.497 3.036 61.101 22.648a52.685 52.685 0 0 1 9.004 39.85a50.559 50.559 0 0 1-1.713 6.692l-1.35 4.116l-3.67-2.693a92.373 92.373 0 0 0-28.037-14.013l-2.664-.809l.246-2.658a16.099 16.099 0 0 0-2.89-10.656a17.143 17.143 0 0 0-18.398-6.828a15.786 15.786 0 0 0-4.402 1.935l-71.67 45.674a14.898 14.898 0 0 0-6.73 9.975a15.9 15.9 0 0 0 2.709 12.012a17.156 17.156 0 0 0 18.404 6.832a15.841 15.841 0 0 0 4.402-1.935l27.345-17.427a52.147 52.147 0 0 1 14.552-6.397c23.101-6.006 47.497 3.037 61.102 22.65a52.681 52.681 0 0 1 9.003 39.848a49.453 49.453 0 0 1-22.34 33.12l-71.664 45.673a52.218 52.218 0 0 1-14.563 6.398"></path></svg>\ No newline at end of filediff --git a/static/tauri.svg b/static/tauri.svgdeleted file mode 100644index 31b62c92..00000000--- a/static/tauri.svg+++ /dev/null@@ -1,6 +0,0 @@-<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">-<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>-<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>-<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>-<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>-</svg>diff --git a/static/vite.svg b/static/vite.svgdeleted file mode 100644index e7b8dfb1..00000000--- a/static/vite.svg+++ /dev/null@@ -1 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>\ No newline at end of file