diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index a253608..b15fb3f 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -3088,7 +3088,18 @@ fn add_theme_folder_to_zip( } let entry_path = entry.path(); + let relative = entry_path + .strip_prefix(root) + .map_err(|e| format!("Failed to build archive path: {e}"))? + .to_string_lossy() + .replace('\\', "/"); + if file_type.is_dir() { + // API 2.0 packages are limited to theme.json and assets/. Do not + // copy README files, editor artifacts, or any other root folder. + if asset_filter.is_some() && directory == root && relative != "assets" { + continue; + } add_theme_folder_to_zip(zip, root, &entry_path, asset_filter, options)?; continue; } @@ -3096,19 +3107,18 @@ fn add_theme_folder_to_zip( continue; } - if let Some(filter) = asset_filter - && let Ok(asset_path) = entry_path.strip_prefix(&assets_root) { - let key = asset_path.to_string_lossy().replace('\\', "/"); - if !filter.contains(&key) { - continue; - } - } + if asset_filter.is_some() && directory == root && relative != "theme.json" { + continue; + } - let relative = entry_path - .strip_prefix(root) - .map_err(|e| format!("Failed to build archive path: {e}"))? - .to_string_lossy() - .replace('\\', "/"); + if let Some(filter) = asset_filter + && let Ok(asset_path) = entry_path.strip_prefix(&assets_root) + { + let key = asset_path.to_string_lossy().replace('\\', "/"); + if !filter.contains(&key) { + continue; + } + } zip.start_file(relative, options) .map_err(|e| format!("Failed to add a file to the theme archive: {e}"))?; diff --git a/src/lib/communityThemes.ts b/src/lib/communityThemes.ts index 1fb98c5..90178c0 100644 --- a/src/lib/communityThemes.ts +++ b/src/lib/communityThemes.ts @@ -9,6 +9,7 @@ export interface CommunityThemeAuthor { id: number; name: string; donor: boolean; + role?: 'owner' | 'moderator' | 'supporter' | null; avatarUrl: string; } diff --git a/src/lib/components/theme/CommunityWorkshopView.svelte b/src/lib/components/theme/CommunityWorkshopView.svelte index c2a592a..f50a667 100644 --- a/src/lib/components/theme/CommunityWorkshopView.svelte +++ b/src/lib/components/theme/CommunityWorkshopView.svelte @@ -32,6 +32,7 @@ import { isThemeTrusted } from '$lib/themeTrust'; import type { Theme } from '$lib/themes'; import { Button } from '$lib/components/ui/button'; + import * as DropdownMenu from '$lib/components/ui/dropdown-menu'; import { Input } from '$lib/components/ui/input'; import Badge from '$lib/components/ui/badge/badge.svelte'; import ScrollContainer from '$lib/components/ui/scroll-container/ScrollContainer.svelte'; @@ -46,7 +47,9 @@ ChevronDown, Code2, CopyPlus, + Crown, Download, + Ellipsis, ExternalLink, Eye, EyeOff, @@ -1255,6 +1258,13 @@ {@const isDeleted = Boolean(theme.deletedAt)} {@const hasUpdate = Boolean(!isDeleted && localTheme && localTheme.version !== theme.version)} {@const owned = isOwnedByCurrentUser(theme)} + {@const isLegacy = + theme.apiVersion === '1.0' || Boolean(theme.tags?.includes('legacy'))} + {@const showOverflowMenu = + !isDeleted && + (owned || + canModerate || + Boolean($currentUser && !isLegacy && !theme.isHidden && !theme.isQuarantined))}
+ Add tags to help people discover this theme. +
+ {/if} ++ {definition.name || 'Untitled theme'} +
++ by {definition.author || 'Unknown'} ยท v{definition.version || '1.0.0'} +
++ {definition.description?.trim() || 'No description yet.'} +
+{publishThemeId}
No tags
+ {/if}+ These details come from the Theme tab. Change them there before publishing. +