Refactor migration#69
Merged
Merged
Conversation
- Replace nested cards with flat bordered design for better contrast - Make attachment strategy selection more compact - Add MigrateAttachmentHandler component for upload/manual strategies - Update data summary pills to flat border style - Support attachment extraction for Ghost and Hugo - Add url field to MigrateAttachment type
Add a VAlert hint at the top of each provider's import component explaining what file or link the user should provide: - Halo: Halo 1.x exported JSON - WordPress: WXR (.xml) from Tools → Export - Hugo: ZIP of content directory - Ghost: JSON from Settings → Labs - Typecho: backup .dat/.txt file - RSS/Atom: feed file (.xml) or subscription URL
- Merge duplicate "迁移提示" and "注意事项/提示" VAlerts into one - Remove sm:w-1/2 and sm:w-2/3 constraints for consistent full width - Keep original actions (e.g. Ghost docs link) in merged alert
Add self-center to border-t divider divs so the dashed lines are vertically centered with the step numbers and text in both the platform selection and migration execution pages.
Change SelectProviderView step 1 from indigo-50 to gray-900/text-white to match the active step style used in MigrateView.vue.
- Flatten HaloMigrateDataParser layout and remove redundant success alert - Update HaloMigrateAttachmentHandler to match generic MigrateAttachmentHandler styling (cards, buttons, spacing, and detail area)
…ement - Add useAttachmentPreprocessor composable to extract image URLs from posts/pages/moments content, match files in selected folder, upload via uploadAttachmentForConsole, and replace URLs with permalink. - MigrateAttachmentHandler & HaloMigrateAttachmentHandler: remove eager upload flow; getProcessedData no longer replaces URLs; expose selectedFolderFiles and localStrategy. - MigrateView: persist attachment selections before entering task panel so they survive v-if unmount; run preprocessor in handleImport before fastq execution. - Fix WordPress parser attachment path to use _wp_attached_file directly.
- Extract src from <video>, <audio>, and <source> tags in HTML content - Add Markdown media link regex for common video/audio extensions
- Extract and replace URLs in photos (url/cover), tags (cover), categories (cover), and links (logo) in addition to posts/pages/moments.
- Detect moments, photos, and links in parsed Halo 1.x data - Check activatedPluginNames for PluginMoment, PluginPhotoAlbum, and PluginLinks - Show warning alert with store links and disable next step if any required plugin is missing
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
- Move Halo attachment handler and action buttons from HaloMigrateDataParser to MigrateView for consistent layout across all providers. - HaloMigrateDataParser now only handles: hint, file selection, and plugin dependency check. - Add reset() expose to all provider parsers for unified "re-select file" flow. - MigrateView renders attachment handler and bottom actions for all platforms.
Add .github/copilot-instructions.md documenting build/test/lint commands (Gradle/Java and pnpm/Node), high-level architecture of the plugin (minimal Java backend + Vue 3 frontend), migration flow, provider/parser and attachment handling conventions, API client usage, and other development guidelines to help contributors and tooling.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Improve Typecho backup parsing and UX: add typecho-src/ to .gitignore; introduce parseError state in the TypechoMigrateDataParser component (cleared on reset/file change), accept .dat and .txt files, and show a UI error alert when parsing fails. In the parser, explicitly reject when file buffer is empty, unify attachment parsing into parseTypechoAttachment (supports JSON and PHP-serialized formats) and normalize attachment fields, and centralize comment owner creation with createCommentOwner. Also tighten error typing and small typing/structure improvements for parsed comment/reply shapes.
Use sanitized HTML for posts and pages and transform WP gallery blocks into structured gallery markup. Adds sanitizeWordPressHtml which strips srcset/sizes, parses content with DOMParser, and runs transformWordPressGalleryBlocks to convert figure.wp-block-gallery into a data-type="gallery" structure with groups and gallery-image elements. Includes helper utilities (getWordPressGalleryGroupSize, chunkArray, getImageAspectRatio, copyAttribute). This normalizes WordPress export HTML so importer handles images and galleries reliably.
Add attachment URL mapping and featured image resolution to the WordPress parser: parsePosts and parsePages now use an attachmentUrlMap to resolve post/page thumbnails (cover). Introduce createAttachmentUrlMap, resolveFeaturedImageUrl and resolveAttachmentUrl helpers and update parsePages signature to accept attachments. Also adjust providerItems: rename "Halo" to "Halo 1.x" and move RSS/Atom/Hugo entries to a different position in the list.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Handle Halo exports more robustly: set sourceProvider='halo' in the Halo parser and accept users as either array or single object. Derive comment/reply sourceId from comment.email or comment.author and remove unused ownerRef/sourceId helper functions. Add a MigrateData.sourceProvider field and implement applyHaloOwnershipFallback in the user preprocessor to assign current user as owner for posts/pages and convert Email-type comment owners that match the exported email to the current user. Invoke this fallback early for Halo imports.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the Hugo-specific migration flow with a generic Markdown provider supporting Hugo/Hexo/other Markdown+FrontMatter sources. Added a design doc (docs/plans/2026-04-18-markdown-provider-design.md), updated README/docs to reference Markdown, and revamped the UI/provider registry to load the new Markdown parser and attachment handler options. Introduced new parsing modules and components: MarkdownMigrateDataParser.vue, use-markdown-data-parser.ts, markdown-frontmatter.ts, markdown-attachments.ts, and related tests; moved markdown-it-id into the markdown module path. Removed the old Hugo ZIP-based parser and its UI (hugo-data-parser.ts, HugoMigrateDataParser.vue). Also added a slot to MigrateSourceUploadCard for extra selectors and updated provider descriptions/options to reflect attachment handling and UX changes.
Introduce configurable local attachment strategies and improve Markdown import flow. - Add halo.png and markdown.svg assets and update provider icons. - MigrateAttachmentHandler: add localStrategies prop, compute allowed strategies, expose allowLocalUpload/allowLocalManual, and adapt UI and watchers to show/hide upload/manual options accordingly. - MigrateSourceUploadCard: add folder prop to allow folder selection. - Markdown parser: switch to directory-based import (folder selection), remove single-file path, and update UI text. - Modules: set Markdown provider to use markdown icon and enable localAttachmentStrategies: ['upload']; use halo icon for Halo provider. - Types: add localAttachmentStrategies to MigrationOption. - MigrateView: pass localStrategies from provider options into attachment handler. - Docs: update docs/provider/hugo.md to clarify directory import and attachment behavior. These changes enable providers to control which local attachment handling modes (upload/manual) are available and streamline importing multiple Markdown files from a directory.
Remove local selection state from MigrateProvider.vue by deleting the currentProvider ref and related conditional classes/markup, making provider selection purely emit-driven. Update markdown parser to derive a fileBaseName and use it as the fallback for both title and slug (slug now falls back to a slugified filename instead of the title). Add a test with a Chinese title file to ensure slugs are generated from filenames and adjust expectations accordingly to prevent non-Latin titles from producing unexpected slugs.
Add ui/tests/fixtures/provider-fixtures.ts which provides factory functions for WordPress WXR, Typecho backup (binary builder with MD5), and Halo export files to reuse in tests. Update tests to consume these fixtures: import and use createTypechoBackupFile in typecho tests (and add a new useTypechoDataParser integration test), replace inline Halo/WordPress sample builders with createHaloExportFile and createWordPressWxrFile, and add an integration test for useWordPressDataParser. These changes consolidate sample data, reduce duplication, and verify parsing of users, posts, pages, comments, tags, categories, and attachments.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make the Ghost import parser more defensive and accurate: handle missing db/data with optional chaining and early return; default missing arrays to empty lists in parsing helpers; normalize optional strings for cover, avatar, website and excerpts; create createGhostContentHtml to sanitize HTML or generate paragraph HTML from plaintext; filter post-tag and post-author relations against known tag/user ids to avoid dangling relations; improve attachment extraction to ignore invalid paths and to extract media URLs from generated HTML; update owner resolution to respect existing users. Also moved Ghost export fixtures into shared test fixtures and added tests covering plaintext fallback and sparse relations.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Set the MigrateSourceUploadCard buttonText prop in Ghost, WordPress, and Typecho data parser components to provide explicit, localized labels for the file picker ("选择 JSON 文件", "选择 XML 文件", "选择 DAT / TXT 文件"). Improves clarity of the upload buttons for each import type in the UI.
Move the RSS and Atom provider entries in ui/src/modules/index.ts so they appear after the Markdown provider in the providerItems array. No functional changes to the components or imports—this only adjusts the provider listing order (affects UI ordering).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Enhance the Halo migration components: import VButton and add an openDocument helper that opens the Halo 1.x migration doc. Replace the vague description with a step-by-step ordered list guiding users to export the JSON, optionally download the upload directory, choose the JSON file, handle attachments, start the import, and verify data. Add an actions slot with a small ghost VButton that links to the detailed migration documentation. Also update the page heading text from “导入数据” to “上传数据”.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refactor and clarify documentation for the migration plugin: - Update README to use Halo doc callout blocks ([!NOTE], [!TIP]) and point to the official halo.run plugin-migrate doc URL. - Simplify docs/index heading and remove the secondary "运行方式 2" instructions to keep the recommended Docker-based run flow concise. - Fix YAML indentation/formatting in provider docs (Ghost, Typecho) for attachment resource-mappings. - Add guidance in Markdown provider to prefer timezone-aware ISO 8601 timestamps in Front Matter to avoid import time shifts. - Clarify WordPress provider behavior: only import comments for posts/pages (skip custom-type comments like WooCommerce) and note that nested comments are converted to Halo's reply structure. These changes are documentation-only and improve clarity and correctness of usage/config examples.
Remove the VitePress docs site and many documentation assets under docs/ (config, theme, pages, images, package/pnpm files) and add a consolidated provider doc and preview image. Updated README to use images/preview.png and added a link to the new docs/provider.md for adding migration platforms. This simplifies the docs layout and consolidates provider guidance into docs/provider.md.
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
This PR refactors the migration flow around provider-specific parsing + shared preparation/task execution, while also hardening existing providers and refreshing the migration docs.
What changed
Migration flow refactor
useMigratePreparationuseMigrateTaskRunneruseUserPreprocessoruseBeforeUnloadGuardMigrateSourceUploadCardMigrateAttachmentHandlerMigrateTaskDashboardui/src/modules/index.tsProvider and parser improvements
Shared import behavior
attachmentFolderPathand provider-specific attachment descriptionsTests and docs
Notable behavior changes