From 47d60e695ff916f6f5e45042a7d01ad587a712a0 Mon Sep 17 00:00:00 2001 From: Xheldon Date: Wed, 30 Jul 2025 16:22:58 +0800 Subject: [PATCH] [update] readme --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README_CN.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) diff --git a/README.md b/README.md index fa9f3e6..434ae85 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ An Obsidian plugin that supports synchronization with GitHub repositories, built - 🌍 **Internationalization**: Support for Chinese and English languages - 💾 **Smart Caching**: File status caching to reduce GitHub API calls - 📊 **Real-time Status**: Status bar showing file sync status and last modified time +- 🖼️ **Image Processing**: Automatic image upload to cloud storage when pasting images ## Installation @@ -74,6 +75,54 @@ Examples: - `https://github.com/Xheldon/git-sync/data/_post` - `username/notes/obsidian-vault` +### 3. Image Processing Configuration (Optional) + +The plugin includes an optional image processing feature that automatically uploads pasted images to cloud storage services. + +#### Supported Cloud Storage Providers + +- **Aliyun OSS**: Alibaba Cloud Object Storage Service +- **Tencent COS**: Tencent Cloud Object Storage +- **AWS S3**: Amazon Simple Storage Service +- **Cloudflare R2**: Cloudflare's S3-compatible storage + +#### Configuration Steps + +1. **Enable Image Processing**: Turn on the "Enable Image Processing" toggle in settings +2. **Select Cloud Provider**: Choose your preferred cloud storage service +3. **Configure Credentials**: Enter your cloud storage credentials: + - Access Key ID / Secret ID + - Access Key Secret / Secret Key + - Bucket Name + - Region (required for all providers) + - Endpoint (required for Cloudflare R2 only) + - CDN URL (optional, for faster image loading) + +#### Image Upload Settings + +- **Keep Images Locally**: Optionally keep a local copy of uploaded images +- **Local Image Path**: Specify where to store local image copies (when enabled) +- **Upload Path Template**: Customize the remote storage path using variables: + - `{YYYY}`: Current year + - `{MM}`: Current month + - `{DD}`: Current day + - `{FILENAME}`: Current file name + - `{FOLDER}`: Current folder name + +#### How It Works + +1. **Paste Image**: When you paste an image in a markdown file +2. **Automatic Upload**: The image is automatically uploaded to your configured cloud storage +3. **Link Replacement**: The pasted image is replaced with a CDN link +4. **Local Copy** (optional): A local copy is saved if enabled + +#### Behavior Options + +- **Image Processing Disabled**: Uses Obsidian's default image handling +- **Image Processing Enabled + Cloud Storage Configured**: Uploads to cloud and inserts CDN links +- **Image Processing Enabled + Local Storage Only**: Saves images to specified local directory +- **Image Processing Enabled + No Configuration**: Shows configuration reminder + ## Usage ### Settings Interface @@ -102,6 +151,14 @@ Menu options: - **GitHub Repository Path**: Configure target repository and path - **Show Ribbon Icon**: Toggle sidebar button visibility +#### Image Processing Settings + +- **Enable Image Processing**: Master toggle for image upload functionality +- **Cloud Storage Provider**: Select from Aliyun OSS, Tencent COS, AWS S3, or Cloudflare R2 +- **Storage Credentials**: Configure access keys, bucket, region, and optional CDN URL +- **Local Image Storage**: Option to keep local copies of uploaded images +- **Upload Path Template**: Customize remote storage path with date and file variables + #### Batch Operations (Danger Zone) - **Initialize Repository**: Download all files from remote when Vault is empty @@ -121,6 +178,7 @@ Menu options: ├── main.ts # Main plugin file ├── types.ts # Type definitions ├── github-service.ts # GitHub API service +├── cos-service.ts # Cloud storage service ├── file-cache.ts # File caching service ├── i18n-simple.ts # Internationalization system ├── styles.css # Stylesheet diff --git a/README_CN.md b/README_CN.md index 445e3ec..4deb99d 100644 --- a/README_CN.md +++ b/README_CN.md @@ -13,6 +13,7 @@ - 🌍 **国际化支持**: 支持中文和英文界面 - 💾 **智能缓存**: 文件状态缓存,减少 GitHub API 调用 - 📊 **实时状态**: 状态栏显示文件同步状态和最后修改时间 +- 🖼️ **图片处理**: 粘贴图片时自动上传到云存储服务 ## 安装 @@ -74,6 +75,54 @@ - `https://github.com/Xheldon/git-sync/data/_post` - `username/notes/obsidian-vault` +### 3. 图片处理配置(可选) + +插件包含一个可选的图片处理功能,可以自动将粘贴的图片上传到云存储服务。 + +#### 支持的云存储服务商 + +- **阿里云 OSS**: 阿里云对象存储服务 +- **腾讯云 COS**: 腾讯云对象存储 +- **AWS S3**: 亚马逊简单存储服务 +- **Cloudflare R2**: Cloudflare 的 S3 兼容存储服务 + +#### 配置步骤 + +1. **启用图片处理**: 在设置中打开"启用图片处理功能"开关 +2. **选择云服务商**: 选择你偏好的云存储服务 +3. **配置凭据**: 输入你的云存储凭据: + - Access Key ID / Secret ID + - Access Key Secret / Secret Key + - Bucket 名称 + - 区域(所有服务商都必需) + - 端点(仅 Cloudflare R2 必需) + - CDN URL(可选,用于更快的图片加载) + +#### 图片上传设置 + +- **保留图片到本地**: 可选择保留已上传图片的本地副本 +- **本地图片路径**: 指定本地图片副本的存储位置(启用时) +- **上传路径模板**: 使用变量自定义远程存储路径: + - `{YYYY}`: 当前年份 + - `{MM}`: 当前月份 + - `{DD}`: 当前日期 + - `{FILENAME}`: 当前文件名 + - `{FOLDER}`: 当前文件夹名 + +#### 工作原理 + +1. **粘贴图片**: 在 markdown 文件中粘贴图片时 +2. **自动上传**: 图片自动上传到你配置的云存储 +3. **链接替换**: 粘贴的图片被替换为 CDN 链接 +4. **本地副本**(可选): 如果启用,会保存本地副本 + +#### 行为选项 + +- **图片处理已禁用**: 使用 Obsidian 的默认图片处理方式 +- **图片处理已启用 + 云存储已配置**: 上传到云端并插入 CDN 链接 +- **图片处理已启用 + 仅本地存储**: 将图片保存到指定的本地目录 +- **图片处理已启用 + 未配置**: 显示配置提醒 + ## 使用方法 ### 设置界面 @@ -102,6 +151,14 @@ - **GitHub 仓库路径**: 配置目标仓库和路径 - **显示侧边栏按钮**: 切换侧边栏按钮的显示 +#### 图片处理设置 + +- **启用图片处理功能**: 图片上传功能的总开关 +- **云存储服务商**: 从阿里云 OSS、腾讯云 COS、AWS S3 或 Cloudflare R2 中选择 +- **存储凭据**: 配置访问密钥、存储桶、区域和可选的 CDN URL +- **本地图片存储**: 选择是否保留已上传图片的本地副本 +- **上传路径模板**: 使用日期和文件变量自定义远程存储路径 + #### 批量操作(危险区域) - **初始化仓库**: 当 Vault 为空时,从远端下载所有文件 @@ -121,6 +178,7 @@ ├── main.ts # 插件主文件 ├── types.ts # 类型定义 ├── github-service.ts # GitHub API 服务 +├── cos-service.ts # 云存储服务 ├── file-cache.ts # 文件缓存服务 ├── i18n-simple.ts # 国际化系统 ├── styles.css # 样式文件