9a32272 feat: Add backup status display feat: Improve readability of the status
git-subtree-dir: sample-front-end
git-subtree-split: 9a32272023ea256a35332463386a557424828946
- Normalize Windows paths by replacing \\\\ with \\ before pattern matching
- Escape backslashes in replacement strings for post-processing
- Add debug logging to help diagnose path matching issues
Root cause: UI stored escaped paths (\\\\Koha9-Main\\\\Music) but playlist
content uses single backslashes (\\Koha9-Main\\Music). Now normalizes paths
before compiling regex patterns.
Co-authored-by: Koha9 <36852125+Koha9@users.noreply.github.com>
Root cause: The UUID (id) field was being stripped when saving path mapping:
- Backend ReplacementRule model was missing id field
- Frontend pathMappingToApi() didn't include id in conversion
- Backend update_path_mapping endpoint didn't save id
Changes:
- Add id field to ReplacementRule model in main.py
- Include id when saving path mapping rules in update_path_mapping
- Include id in frontend pathMappingToApi conversion
Co-authored-by: Koha9 <36852125+Koha9@users.noreply.github.com>
- Add generateUUID() function using crypto.randomUUID() with fallback
- Update handleAdd to use UUID instead of Date.now() + Math.random()
- UUIDs are now properly validated in backend to prevent injection
- mapping_id is persisted when creating mapping pairs for reuse
Co-authored-by: Koha9 <36852125+Koha9@users.noreply.github.com>
- Add CompiledRegexRules dataclass for all four processing stages
- Update _compile_regex_rules to support both legacy (pattern/replacement)
and new (search/replace) field names with proper empty string handling
- Add _compile_path_mapping_rules helper function
- Update _write_results to apply post-processing rules:
- local_result.m3u8 with local_post rules
- remote_result.m3u8 with remote_post rules
- base_next.m3u8 unprocessed (normalized sync result)
- Update merge_playlists and _sync_single_playlist to pass compiled_rules
- Update sync_all_playlists to implement full processing flow:
1. Detect REGEX mode from path_mapping config
2. Apply local_pre rules to local playlists before sync
3. Apply remote_pre rules to remote playlists before sync
4. Perform sync/merge
5. Apply post rules to results for respective outputs
Co-authored-by: Koha9 <36852125+Koha9@users.noreply.github.com>
- Updated frontend/types.ts with new types: ReplacementRule, PathMappingRules, PathMappingMode, PathMappingConfig
- Replaced StrategySelector.tsx with new UI featuring:
- Simple Mapping tab for local/cloud path pairs
- Regex Rules tab with 4 rule groups (localPre, localPost, remotePre, remotePost)
- MappingGroupEditor sub-component for editing rule lists
- Updated App.tsx to use PathMappingConfig state instead of RegexReplacement[]
- Updated api.ts to handle new PathMappingConfig structure
- Updated backend config.py with path_mapping field support
- Added /api/settings/path-mapping endpoint in main.py
Co-authored-by: Koha9 <36852125+Koha9@users.noreply.github.com>