Files

119 lines
3.0 KiB
Markdown
Raw Permalink 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.
# 玩玩云桌面客户端Tauri + Vue + TypeScript
这是玩玩云网盘的桌面端,基于 `Tauri 2 + Vue 3 + TypeScript` 开发。
默认对接地址:`https://cs.workyai.cn`
## 功能概览
- 账号登录(复用网页端账号体系)
- 文件列表浏览、目录切换、全局搜索
- 新建文件夹、重命名、删除
- 分享链接 / 直链创建与管理
- 下载(支持断点续传)
- 本地目录同步(手动/定时)
- 客户端版本检测与更新下载
## 环境要求
- Node.js 18+(建议 20 LTS
- Rust stable建议通过 `rustup` 安装)
- Tauri CLI项目已在 `package.json` 中声明)
可选Linux 交叉编译 Windows 时还需要:
- `mingw-w64`
- `nsis`
## 开发运行
```bash
cd desktop-client
npm install
npm run tauri dev
```
## 对接你的网盘后端
### 1. 修改 API 基础地址
当前默认地址在 `desktop-client/src/App.vue`
- `appConfig.baseUrl`(默认 `https://cs.workyai.cn`
改成你的服务地址后重新运行/打包。
### 2. 后端需提供的核心接口
桌面端通过现有 Web API 工作,至少需要这些接口:
- `POST /api/login`
- `POST /api/logout`
- `GET /api/user/profile`
- `GET /api/files`
- `GET /api/files/search`
- `POST /api/files/mkdir`
- `POST /api/files/rename`
- `POST /api/files/delete`
- `POST /api/share/create`
- `GET /api/share/my`
- `DELETE /api/share/:id`
- `POST /api/direct-link/create`
- `GET /api/client/desktop-update`
- 分片上传相关接口(客户端走 `api_upload_file_resumable`
### 3. 鉴权与跨域要求
- 使用 Cookie / Session 鉴权
- 服务端允许桌面端跨域并携带凭据credentials
- 建议启用 HTTPS
## 构建打包
```bash
cd desktop-client
npm install
npm run tauri build
```
构建产物示例:
- `desktop-client/src-tauri/target/release/bundle/nsis/*.exe`
## Linux 交叉编译 Windowsx64
```bash
cd desktop-client
rustup target add x86_64-pc-windows-gnu
npm run tauri build -- --target x86_64-pc-windows-gnu
```
如需生成安装包,请确保系统安装 `mingw-w64``nsis`
## 更新发布接入(与本项目后端配合)
1. 把新安装包上传到服务端下载目录(示例:`frontend/downloads/`)。
2. 在后台设置中更新:
- `desktop_update.latest_version`
- `desktop_update.installer_url`
- `desktop_update.release_notes`
3. 客户端会通过 `GET /api/client/desktop-update` 检查更新并下载新包。
## 常见问题
### Q1改了接口地址但还是连旧地址
确认修改的是 `desktop-client/src/App.vue` 中的 `appConfig.baseUrl`,并重新构建。
### Q2为什么更新接口返回有新版本但客户端不弹更新
检查:
- `latest_version` 是否确实大于客户端当前版本
- `installer_url` 是否可访问
- 客户端能否访问后端 `desktop-update` 接口
### Q3分享/直链重复创建问题
当前后端已支持“同一用户同一路径复用已有链接”。若要生成新链接,请先删除旧链接再创建。