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: add ModuleList and CoursePlatform components, enhance plugin status handling, and implement platform icons
Tonho46a768a53815
diff --git a/src/components/hotmart/ModuleList.svelte b/src/components/hotmart/ModuleList.sveltenew file mode 100644index 00000000..9dcdf03b--- /dev/null+++ b/src/components/hotmart/ModuleList.svelte@@ -0,0 +1,73 @@+<script lang="ts">+ type Module = {+ id: string;+ name: string;+ pages: { hash: string; name: string; page_type: string }[];+ };++ let { modules }: { modules: Module[] } = $props();+</script>++<ul class="module-list">+ {#each modules as mod, i}+ <li class="module-item">+ <div class="module-header">+ <span class="module-number">{i + 1}.</span>+ <span class="module-name">{mod.name}</span>+ <span class="module-count">{mod.pages.length} {mod.pages.length === 1 ? 'aula' : 'aulas'}</span>+ </div>+ </li>+ {/each}+</ul>++<style>+ .module-list {+ list-style: none;+ padding: 0;+ margin: 0;+ display: flex;+ flex-direction: column;+ gap: 2px;+ }++ .module-item {+ padding: calc(var(--padding) / 1.5) var(--padding);+ border-radius: calc(var(--border-radius) - 4px);+ }++ @media (hover: hover) {+ .module-item:hover {+ background: var(--button-stroke);+ }+ }++ .module-header {+ display: flex;+ align-items: center;+ gap: calc(var(--padding) / 1.5);+ }++ .module-number {+ color: var(--gray);+ font-size: 12.5px;+ font-weight: 500;+ min-width: 22px;+ font-variant-numeric: tabular-nums;+ }++ .module-name {+ flex: 1;+ font-size: 14.5px;+ color: var(--secondary);+ }++ .module-count {+ font-size: 11px;+ font-weight: 500;+ color: var(--gray);+ background: var(--button-stroke);+ padding: 2px calc(var(--padding) / 2);+ border-radius: calc(var(--border-radius) / 2);+ white-space: nowrap;+ }+</style>diff --git a/src/lib/courses/platforms.ts b/src/lib/courses/platforms.tsnew file mode 100644index 00000000..41dd836a--- /dev/null+++ b/src/lib/courses/platforms.ts@@ -0,0 +1,305 @@+export interface CoursePlatform {+ id: string;+ name: string;+ route: string;+ icon: string;+ color: string;+ enabled: boolean;+ authCheckCommand?: string;+}++export const COURSE_PLATFORMS: CoursePlatform[] = [+ {+ id: "hotmart",+ name: "Hotmart",+ route: "/courses/hotmart",+ icon: "hotmart",+ color: "#F04E23",+ enabled: true,+ authCheckCommand: "hotmart_check_session",+ },+ {+ id: "udemy",+ name: "Udemy",+ route: "/courses/udemy",+ icon: "udemy",+ color: "#A435F0",+ enabled: true,+ authCheckCommand: "udemy_check_session",+ },+ {+ id: "kiwify",+ name: "Kiwify",+ route: "/courses/kiwify",+ icon: "kiwify",+ color: "#22C55E",+ enabled: true,+ authCheckCommand: "kiwify_check_session",+ },+ {+ id: "gumroad",+ name: "Gumroad",+ route: "/courses/gumroad",+ icon: "gumroad",+ color: "#FF90E8",+ enabled: true,+ },+ {+ id: "teachable",+ name: "Teachable",+ route: "/courses/teachable",+ icon: "teachable",+ color: "#4B5563",+ enabled: true,+ },+ {+ id: "kajabi",+ name: "Kajabi",+ route: "/courses/kajabi",+ icon: "kajabi",+ color: "#2563EB",+ enabled: true,+ },+ {+ id: "skool",+ name: "Skool",+ route: "/courses/skool",+ icon: "skool",+ color: "#5865F2",+ enabled: true,+ },+ {+ id: "pluralsight",+ name: "Pluralsight",+ route: "/courses/pluralsight",+ icon: "pluralsight",+ color: "#E80A89",+ enabled: true,+ },+ {+ id: "greatcourses",+ name: "Wondrium",+ route: "/courses/greatcourses",+ icon: "greatcourses",+ color: "#1E3A5F",+ enabled: true,+ },+ {+ id: "masterclass",+ name: "MasterClass",+ route: "/courses/masterclass",+ icon: "masterclass",+ color: "#000000",+ enabled: true,+ },+ {+ id: "thinkific",+ name: "Thinkific",+ route: "/courses/thinkific",+ icon: "thinkific",+ color: "#4A90D9",+ enabled: true,+ authCheckCommand: "thinkific_check_session",+ },+ {+ id: "curseduca",+ name: "Curseduca",+ route: "/courses/curseduca",+ icon: "curseduca",+ color: "#6366F1",+ enabled: true,+ },+ {+ id: "cademi",+ name: "Cademi",+ route: "/courses/cademi",+ icon: "cademi",+ color: "#10B981",+ enabled: true,+ },+ {+ id: "cakto",+ name: "Cakto",+ route: "/courses/cakto",+ icon: "cakto",+ color: "#F59E0B",+ enabled: true,+ },+ {+ id: "kirvano",+ name: "Kirvano",+ route: "/courses/kirvano",+ icon: "kirvano",+ color: "#8B5CF6",+ enabled: true,+ },+ {+ id: "memberkit",+ name: "MemberKit",+ route: "/courses/memberkit",+ icon: "memberkit",+ color: "#3B82F6",+ enabled: true,+ },+ {+ id: "rocketseat",+ name: "Rocketseat",+ route: "/courses/rocketseat",+ icon: "rocketseat",+ color: "#8257E5",+ enabled: true,+ authCheckCommand: "rocketseat_check_session",+ },+ {+ id: "grancursos",+ name: "Gran Cursos",+ route: "/courses/grancursos",+ icon: "grancursos",+ color: "#1D4ED8",+ enabled: true,+ },+ {+ id: "fluencyacademy",+ name: "Fluency Academy",+ route: "/courses/fluencyacademy",+ icon: "fluencyacademy",+ color: "#F97316",+ enabled: true,+ },+ {+ id: "datascienceacademy",+ name: "Data Science Academy",+ route: "/courses/datascienceacademy",+ icon: "datascienceacademy",+ color: "#059669",+ enabled: true,+ },+ {+ id: "medcel",+ name: "Medcel",+ route: "/courses/medcel",+ icon: "medcel",+ color: "#DC2626",+ enabled: true,+ },+ {+ id: "medcof",+ name: "Medcof",+ route: "/courses/medcof",+ icon: "medcof",+ color: "#0891B2",+ enabled: true,+ },+ {+ id: "medway",+ name: "Medway",+ route: "/courses/medway",+ icon: "medway",+ color: "#7C3AED",+ enabled: true,+ },+ {+ id: "afyainternato",+ name: "Afya Internato",+ route: "/courses/afyainternato",+ icon: "afyainternato",+ color: "#EF4444",+ enabled: true,+ },+ {+ id: "alpaclass",+ name: "AlpaClass",+ route: "/courses/alpaclass",+ icon: "alpaclass",+ color: "#14B8A6",+ enabled: true,+ },+ {+ id: "areademembros",+ name: "Area de Membros",+ route: "/courses/areademembros",+ icon: "areademembros",+ color: "#6B7280",+ enabled: true,+ },+ {+ id: "astronmembers",+ name: "Astron Members",+ route: "/courses/astronmembers",+ icon: "astronmembers",+ color: "#1E40AF",+ enabled: true,+ },+ {+ id: "eduzznutror",+ name: "Eduzz / Nutror",+ route: "/courses/eduzznutror",+ icon: "eduzznutror",+ color: "#EA580C",+ enabled: true,+ },+ {+ id: "entregadigital",+ name: "Entrega Digital",+ route: "/courses/entregadigital",+ icon: "entregadigital",+ color: "#4338CA",+ enabled: true,+ },+ {+ id: "greennclub",+ name: "Greenn Club",+ route: "/courses/greennclub",+ icon: "greennclub",+ color: "#16A34A",+ enabled: true,+ },+ {+ id: "themembers",+ name: "TheMembers",+ route: "/courses/themembers",+ icon: "themembers",+ color: "#9333EA",+ enabled: true,+ },+ {+ id: "voompplay",+ name: "Voomp Play",+ route: "/courses/voompplay",+ icon: "voompplay",+ color: "#0EA5E9",+ enabled: true,+ },+ {+ id: "estrategia_concursos",+ name: "Estratégia Concursos",+ route: "/courses/estrategia-concursos",+ icon: "estrategia",+ color: "#1E3A8A",+ enabled: true,+ },+ {+ id: "estrategia_ldi",+ name: "Estratégia LDI",+ route: "/courses/estrategia-ldi",+ icon: "estrategia",+ color: "#1E40AF",+ enabled: true,+ },+ {+ id: "estrategia_militares",+ name: "Estratégia Militares",+ route: "/courses/estrategia-militares",+ icon: "estrategia",+ color: "#15803D",+ enabled: true,+ },+ {+ id: "caktomembers",+ name: "Cakto Members",+ route: "/courses/caktomembers",+ icon: "cakto",+ color: "#D97706",+ enabled: true,+ },+];diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelteindex d0378cd8..c7827f2b 100644--- a/src/routes/+layout.svelte+++ b/src/routes/+layout.svelte@@ -148,7 +148,9 @@<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">{#if item.iconSvg}- {@html item.iconSvg}+ {#each item.iconSvg.split(' M').map((d, i) => i === 0 ? d : 'M' + d) as pathD}+ <path d={pathD} />+ {/each}{:else if item.icon === "home"}<path d="M3 12L12 3l9 9" /><path d="M5 10v9a1 1 0 001 1h3v-5h6v5h3a1 1 0 001-1v-9" />@@ -192,7 +194,9 @@<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">{#if item.iconSvg}- {@html item.iconSvg}+ {#each item.iconSvg.split(' M').map((d, i) => i === 0 ? d : 'M' + d) as pathD}+ <path d={pathD} />+ {/each}{:else if item.icon === "about"}<circle cx="12" cy="12" r="10" /><path d="M12 16v-4m0-4h.01" />diff --git a/src/routes/convert/+page.svelte b/src/routes/convert/+page.svelteindex 275bbc36..e3f21717 100644--- a/src/routes/convert/+page.svelte+++ b/src/routes/convert/+page.svelte@@ -3,51 +3,55 @@import { onMount } from "svelte";import { t } from "$lib/i18n";- let checking = $state(true);- let installed = $state(false);+ type PluginStatus = "checking" | "ready" | "needs-restart" | "not-installed";+ let pluginStatus = $state<PluginStatus>("checking");onMount(async () => {try {- const plugins = await invoke<{ id: string; enabled: boolean }[]>("list_plugins");- installed = plugins.some((p) => p.id === "convert" && p.enabled);- } catch {}- checking = false;+ const plugins = await invoke<{ id: string; enabled: boolean; loaded: boolean }[]>("list_plugins");+ const plugin = plugins.find((p) => p.id === "convert");+ if (!plugin || !plugin.enabled) {+ pluginStatus = "not-installed";+ } else {+ pluginStatus = "ready";+ }+ } catch {+ pluginStatus = "ready";+ }});</script>-{#if checking}- <div class="redirect-page">- <span class="spinner"></span>+{#if pluginStatus === "checking"}+ <div class="plugin-guard"><span class="spinner"></span></div>+{:else if pluginStatus === "not-installed"}+ <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>{$t("marketplace.plugin_not_installed")}</h2>+ <p>{$t("marketplace.plugin_install_hint")}</p>+ <a href="/marketplace" class="guard-link">{$t("marketplace.go_to_marketplace")}</a></div>-{:else if installed}- <div class="redirect-page">- <p>{$t("marketplace.browse_loading")}</p>+{:else if pluginStatus === "needs-restart"}+ <div class="plugin-guard">+ <h2>{$t("marketplace.restart_required")}</h2>+ <p>{$t("marketplace.plugin_restart_hint")}</p></div>{:else}- <div class="redirect-page">+ <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>{$t("marketplace.plugin_not_installed")}</h2>- <p>{$t("marketplace.plugin_install_hint")}</p>- <a href="/marketplace" class="marketplace-link">{$t("marketplace.go_to_marketplace")}</a>+ <h2>Convert</h2>+ <p>{$t("marketplace.restart_required")}</p></div>{/if}<style>- .redirect-page {- 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);- }- .redirect-page h2 { font-size: 18px; color: var(--secondary); }- .redirect-page p { font-size: 14px; max-width: 300px; }+ .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); } }- .marketplace-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; }</style>diff --git a/src/routes/courses/+layout.svelte b/src/routes/courses/+layout.sveltenew file mode 100644index 00000000..5dd96809--- /dev/null+++ b/src/routes/courses/+layout.svelte@@ -0,0 +1,6 @@+<script lang="ts">+ import type { Snippet } from "svelte";+ let { children }: { children: Snippet } = $props();+</script>++{@render children()}diff --git a/src/routes/courses/platform-icons.ts b/src/routes/courses/platform-icons.tsnew file mode 100644index 00000000..40c018f7--- /dev/null+++ b/src/routes/courses/platform-icons.ts@@ -0,0 +1,37 @@+export const PLATFORM_ICONS: Record<string, string> = {+ hotmart: '<path d="M7 4v16" /><path d="M17 4v16" /><path d="M7 12h10" />',+ udemy: '<path d="M7 4l5-2 5 2" /><path d="M7 10v6a5 5 0 0 0 10 0v-6" />',+ kiwify: '<path d="M8 4v16" /><path d="M8 12l7-8" /><path d="M8 12l7 8" />',+ gumroad: '<circle cx="12" cy="12" r="9" /><path d="M12 8a4 4 0 1 0 0 8h0v-4" />',+ teachable: '<path d="M6 6h12" /><path d="M12 6v14" />',+ kajabi: '<path d="M8 4v16" /><path d="M8 12l6-8" /><path d="M8 12c2 2 4 5 7 7" />',+ skool: '<path d="M17 7a5 3 0 0 0-10 0c0 2 2 3 5 5s5 1 5 3a5 3 0 0 1-10 0" />',+ pluralsight: '<path d="M8 5v14l11-7z" />',+ greatcourses: '<path d="M4 5l4 14 4-10 4 10 4-14" />',+ masterclass: '<path d="M4 20V6l4 8 4-8 4 8 4-8v14" />',+ thinkific: '<path d="M5 5h14" /><path d="M12 5v15" />',+ curseduca: '<path d="M18 8a8 8 0 1 0-1 9" />',+ cademi: '<path d="M17 7a7 7 0 1 0 0 10" />',+ cakto: '<path d="M12 4v16" /><path d="M12 8h-3v4h3" /><path d="M12 11h3v4h-3" />',+ kirvano: '<path d="M8 4v16" /><path d="M16 4l-8 8 8 8" />',+ memberkit: '<path d="M12 3a4 4 0 1 0 0 8" /><path d="M12 11v9" /><path d="M10 16h4" />',+ rocketseat: '<path d="M12 2l-4 6h8z" /><path d="M12 8v12" /><path d="M9 18l3 4 3-4" />',+ grancursos: '<path d="M18 9a8 8 0 1 0-6 11" /><path d="M12 14h6" />',+ fluencyacademy: '<path d="M4 12a8 8 0 1 1 5 7l-3 3" /><path d="M10 10h4" /><path d="M10 14h2" />',+ datascienceacademy: '<path d="M4 12h4l2-6 4 12 2-6h4" />',+ medcel: '<path d="M12 4v16" /><path d="M4 12h16" />',+ medcof: '<path d="M12 3v18" /><path d="M8 7c0-2 8-2 8 0" /><path d="M8 11c0-2 8-2 8 0" />',+ medway: '<path d="M4 20l4-14 4 8 4-8 4 14" />',+ afyainternato: '<path d="M4 20l8-16 8 16" /><path d="M8 13h8" />',+ alpaclass: '<path d="M4 14l8-4 8 4" /><path d="M4 14v6l8 4 8-4v-6" />',+ areademembros: '<path d="M4 4h16v16H4z" /><path d="M12 9a2 2 0 1 0 0 4" /><path d="M9 15h6" />',+ astronmembers: '<path d="M12 2l3 7h7l-5.5 4.5 2 7L12 16l-6.5 4.5 2-7L2 9h7z" />',+ eduzznutror: '<path d="M17 5H8v14h9" /><path d="M8 12h7" />',+ entregadigital: '<path d="M12 3v12" /><path d="M8 11l4 4 4-4" /><path d="M5 17v2h14v-2" />',+ greennclub: '<path d="M12 20V10" /><path d="M12 10c-4-4-8 0-8 4" /><path d="M12 10c4-4 8 0 8 4" />',+ themembers: '<path d="M4 4h16v12H4z" /><path d="M10 8v4l3-2z" />',+ voompplay: '<path d="M5 5l7 7-7 7" /><path d="M13 5l7 7-7 7" />',+ estrategia: '<path d="M17 5H8v14h9" /><path d="M8 12h6" /><path d="M8 5h9" />',+};++export const DEFAULT_ICON = '<path d="M4 19.5A2.5 2.5 0 016.5 17H20" /><path d="M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z" />';diff --git a/src/routes/plugins/[pluginId]/[...path]/+page.svelte b/src/routes/plugins/[pluginId]/[...path]/+page.sveltedeleted file mode 100644index 879121ca..00000000--- a/src/routes/plugins/[pluginId]/[...path]/+page.svelte+++ /dev/null@@ -1,118 +0,0 @@-<script lang="ts">- import { page } from "$app/state";- import { invoke } from "@tauri-apps/api/core";- import { onMount } from "svelte";- import { t } from "$lib/i18n";-- type PluginManifest = {- id: string;- name: string;- version: string;- };-- let pluginId = $derived(page.params.pluginId);- let subPath = $derived(page.params.path || "");- let pluginFound = $state<boolean | null>(null);- let pluginName = $state("");- let frontendHtml = $state("");-- onMount(async () => {- try {- const manifests = await invoke<PluginManifest[]>("get_loaded_plugin_manifests");- const manifest = manifests.find((m) => m.id === pluginId);- if (manifest) {- pluginFound = true;- pluginName = manifest.name;- const frontendPath = await invoke<string>("get_plugin_frontend_path", { pluginId });- frontendHtml = frontendPath;- } else {- pluginFound = false;- }- } catch {- pluginFound = false;- }- });-</script>--<div class="plugin-page">- {#if pluginFound === null}- <div class="plugin-loading">- <span class="spinner"></span>- </div>- {:else if pluginFound === false}- <div class="plugin-not-found">- <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="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" />- </svg>- <h2>{$t("marketplace.plugin_not_installed")}</h2>- <p>{$t("marketplace.plugin_install_hint")}</p>- <a href="/marketplace" class="marketplace-link">{$t("marketplace.go_to_marketplace")}</a>- </div>- {:else}- <div class="plugin-content">- <p>{pluginName} — {subPath || "index"}</p>- </div>- {/if}-</div>--<style>- .plugin-page {- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- min-height: calc(100vh - var(--padding) * 4);- }-- .plugin-loading {- display: flex;- align-items: center;- justify-content: center;- }-- .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); }- }-- .plugin-not-found {- display: flex;- flex-direction: column;- align-items: center;- gap: calc(var(--padding) * 1.5);- text-align: center;- color: var(--gray);- }-- .plugin-not-found h2 {- font-size: 18px;- color: var(--secondary);- }-- .plugin-not-found p {- font-size: 14px;- max-width: 300px;- }-- .marketplace-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;- }-- .plugin-content {- width: 100%;- }-</style>