feat: add persistent image cache and centralize frontend constants#74
Merged
feat: add persistent image cache and centralize frontend constants#74
Conversation
30f95b2 to
80872ab
Compare
Implement Issue #72 - persistent image cache that keeps downloaded images for faster retry when flashing fails. Cache Features: - Toggle to enable/disable image caching in Settings - Configurable maximum cache size (5-100 GB, default 20 GB) - LRU eviction when cache exceeds size limit - Clear cache button with confirmation dialog - Auto-delete cached image after 3 consecutive flash failures Backend (Rust): - New cache.rs module with thread-safe operations (Mutex) - Path traversal protection using canonicalize() - Cache size validation with configurable bounds - LRU eviction based on file modification time (filetime crate) Frontend Constants Centralization: - EVENTS: Custom DOM events for inter-component communication - STORAGE_KEYS: SessionStorage keys for flash failure tracking - SETTINGS: Tauri Store keys and default values - COLORS: UI colors (icons, alerts, QR codes) - QR_CODE: QR code generation configuration - UI: Skeleton counts, marquee sizes, icon dimensions - VENDOR: Board vendor fallback identifiers Bug Fixes: - Fixed board image fallback not displaying when preload fails (404) - Pin zbus to 5.12.0 to avoid breaking changes in 5.13.0 Build: - Commit Cargo.lock for reproducible builds Localization: - Added cache-related translations to all 18 locales
80872ab to
67ece73
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements persistent image cache (#72) to prevent re-downloading images when flashing fails. Downloaded images are now stored locally and reused for subsequent flash attempts, significantly improving the user experience when dealing with unreliable SD cards or connection issues.
Also includes frontend codebase improvements: centralization of all hardcoded constants and a bug fix for board image fallback.
Cache Features
Frontend Constants Centralization
Moved all hardcoded values to
src/config/constants.ts:Bug Fixes
zbusto 5.12.0 to avoid breaking changes in 5.13.0Build Improvements
Cargo.lockfor reproducible buildsTechnical Details
Backend (Rust):
cache.rsmodule with thread-safe operations (Mutex+once_cell::Lazy)canonicalize()before file operationsfiletimecrate)Frontend (React):
sessionStorageScreenshots
Closes #72