feat(halo): 添加图片自动上传功能

- 新增图片处理工具模块 `src/utils/image.ts`,包含图片引用提取、绝对路径解析和路径替换功能
- 新增图片上传服务 `src/service/image-uploader.ts`,支持调用 Halo 媒体 API 上传图片并实现缓存机制
- 在设置界面添加图片上传开关和上传路径配置项
- 更新发布流程,在提交到 Halo 前自动检测并上传本地图片,替换为远程 URL
- 添加英文、简体中文和繁体中文的国际化文案
- 更新插件版本至 1.1.1 并完善相关配置文件
This commit is contained in:
2026-04-26 16:11:11 +08:00
commit 7d332d3b8c
213 changed files with 128271 additions and 0 deletions
+114
View File
@@ -0,0 +1,114 @@
{
"ribbon_icon": {
"publish": "Publish current document to Halo"
},
"command": {
"publish": {
"name": "Publish to Halo",
"error_no_matched_site": "The site this document publishes to is not configured"
},
"publish_with_defaults": {
"name": "Publish to Halo (use default settings)",
"error_no_default_site": "Please configure the default site first"
},
"update_post": {
"name": "Update content from Halo",
"error_not_published": "This document is not published to Halo yet",
"error_no_matched_site": "The site this document publishes to is not configured",
"success": "Updated"
},
"pull_post": {
"name": "Pull posts from Halo",
"error_no_sites": "Please configure sites first"
}
},
"settings": {
"title": "Halo publishing settings",
"site": {
"name": "Halo sites",
"description": "Halo site management, supports multiple sites",
"actions": {
"open": "Open"
}
},
"publishByDefault": {
"name": "Publish post by default",
"description": "After checking, the first post created will be published directly"
},
"imageUpload": {
"title": "Image Upload Settings",
"enabled": {
"name": "Enable image upload",
"description": "Automatically upload local images to Halo when publishing"
},
"uploadPath": {
"name": "Upload path",
"description": "Media path for uploading images to Halo, leave empty for root directory"
},
"preserveOriginal": {
"name": "Preserve original path",
"description": "Also keep local image path as fallback"
}
}
},
"post_selection_modal": {
"title": "Pull posts from Halo",
"button_pull": "Pull"
},
"site_editing_modal": {
"title": "Halo site",
"settings": {
"name": {
"name": "Site name",
"description": "Halo site name"
},
"url": {
"name": "Site URL",
"description": "Halo site URL"
},
"token": {
"name": "Personal Access Token",
"description": "Can be created in user profile, need permissions for managing posts"
},
"default": {
"name": "Set as default",
"description": "Set as default publishing site"
},
"validate": {
"button": "Validate",
"button_validating": "Validating...",
"notice_validated": "Validation succeeded",
"error_no_permissions": "Current account has no permissions for managing posts"
},
"save": {
"button": "Save"
}
}
},
"site_selection_modal": {
"title": "Choose a Halo site",
"button_choose": "Choose"
},
"sites_modal": {
"title": "Halo sites",
"actions": {
"set_default": "Set as default",
"edit": "Edit",
"add": "Add"
}
},
"service": {
"error_site_not_match": "Site URL does not match",
"error_publish_failed": "Publishing failed, please retry",
"notice_publish_success": "Published successfully",
"error_not_published": "This document is not published to Halo yet",
"error_post_not_found": "Post does not exist",
"image_upload_success": "Image uploaded successfully",
"image_upload_failed": "Image upload failed",
"image_uploading": "Uploading image..."
},
"common": {
"error_connection_failed": "Connection failed",
"button_close": "Close"
}
}