Files
openclaw-skill-qiniu/CHANGELOG_OVERRIDE.md
daoqi 1aeae9cc51 initial: 七牛云上传 OpenClaw Skill
功能特性:
- 支持 /upload, /u 命令上传文件到七牛云
- 支持 /qiniu-config 配置管理
- 支持飞书卡片交互
- 支持指定上传路径和存储桶
- 自动刷新 CDN 缓存
- 支持文件覆盖上传

包含组件:
- OpenClaw 处理器 (openclaw-processor.js)
- 独立监听器 (scripts/feishu-listener.js)
- 核心上传脚本 (scripts/upload-to-qiniu.js)
- 部署脚本 (deploy.sh)
- 完整文档

部署方式:
1. 复制 skill 到 ~/.openclaw/workspace/skills/
2. 配置 ~/.openclaw/credentials/qiniu-config.json
3. 重启 OpenClaw Gateway
2026-03-07 16:02:18 +08:00

80 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 七牛云上传 Skill - 覆盖上传功能更新
## 📅 更新日期
2026-03-04
## 🔄 更新内容
### 新增功能
-**支持文件覆盖上传**:上传同名文件时自动覆盖旧文件
-**明确上传策略**:在上传凭证中设置 `insertOnly: 0` 允许覆盖
### 修改文件
1. `scripts/upload-to-qiniu.js`
-`generateUploadToken()` 函数中添加 `insertOnly: 0` 参数
- 明确允许覆盖同名文件
2. `SKILL.md`
- 在"注意事项"部分添加覆盖行为说明
- 在"上传文件"部分添加覆盖行为描述
### 技术细节
**七牛云上传策略参数:**
```javascript
const putPolicy = {
scope: scope,
deadline: deadline,
insertOnly: 0, // 0=允许覆盖1=仅允许上传(不允许覆盖)
returnBody: { ... }
};
```
**覆盖行为:**
- 当上传文件的 key路径 + 文件名)与存储桶中已有文件相同时
- `insertOnly: 0` → 自动覆盖旧文件
- `insertOnly: 1` → 上传失败,返回错误 "file exists"
### 使用示例
```bash
# 第一次上传
node scripts/upload-to-qiniu.js upload --file test.txt --key /config/test.txt
# 再次上传同名文件(会覆盖)
node scripts/upload-to-qiniu.js upload --file test-updated.txt --key /config/test.txt
# 结果:/config/test.txt 被新文件覆盖
```
### 注意事项
1. **CDN 刷新**:覆盖上传后会自动刷新 CDN但可能有几秒延迟
2. **版本管理**:覆盖后旧文件无法恢复,建议自行管理版本
3. **并发上传**:避免同时上传同名文件,可能导致冲突
### 测试验证
```bash
# 1. 检查脚本语法
node --check scripts/upload-to-qiniu.js
# 2. 查看配置
node scripts/upload-to-qiniu.js config list
# 3. 测试上传(会覆盖同名文件)
node scripts/upload-to-qiniu.js upload --file test-override.txt --key /test/override.txt --bucket default
```
## 📋 版本信息
- **Skill 版本**: 1.1.0
- **兼容版本**: OpenClaw 2026.3.2+
- **七牛云 SDK**: 使用原生 API无需额外 SDK
## 🔗 相关文档
- [七牛云上传策略文档](https://developer.qiniu.com/kodo/1206/put-policy)
- [七牛云 CDN 刷新文档](https://developer.qiniu.com/fusion/kb/1670/refresh)
- SKILL.md - 完整使用说明