Skip to content

Commit 9757f73

Browse files
committed
chore(all): 项目第一次发版
0 parents  commit 9757f73

114 files changed

Lines changed: 21507 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
logs
2+
output
3+
data/share.db
4+
session.json
5+
.idea
6+
7+
fe/node_modules
8+
fe/llm-prompt.txt
9+
fe/dist
10+
fe/.idea

Dockerfile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Stage 1: Build the Go backend
2+
FROM golang:1.24.4-alpine AS backend-builder
3+
4+
WORKDIR /app
5+
6+
# 使用中国镜像源
7+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
8+
9+
# 设置 Go 代理为中国镜像
10+
ENV GOPROXY=https://goproxy.cn,direct
11+
ENV GOSUMDB=sum.golang.google.cn
12+
13+
COPY go.mod go.sum ./
14+
RUN go mod download
15+
16+
COPY . .
17+
18+
ARG MODULE_NAME=github.com/xxcheng123/cloudpan189-share
19+
ARG VAR_COMMIT
20+
ARG VAR_BUILD_DATE
21+
ARG VAR_GIT_SUMMARY
22+
ARG VAR_GIT_BRANCH
23+
24+
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-X ${MODULE_NAME}/configs.Commit=${VAR_COMMIT} -X ${MODULE_NAME}/configs.BuildDate=${VAR_BUILD_DATE} -X ${MODULE_NAME}/configs.GitSummary=${VAR_GIT_SUMMARY} -X ${MODULE_NAME}/configs.GitBranch=${VAR_GIT_BRANCH}" -o /app/share ./cmd/main.go
25+
26+
# Stage 2: Build the Vue frontend
27+
FROM node:22-alpine AS frontend-builder
28+
29+
WORKDIR /app/fe
30+
31+
# 使用中国镜像源
32+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
33+
34+
# 设置 npm 为淘宝镜像
35+
RUN npm config set registry https://registry.npmmirror.com
36+
37+
COPY fe/package.json fe/package-lock.json ./
38+
RUN npm install
39+
40+
COPY fe/ ./
41+
42+
RUN npm run build
43+
44+
# Stage 3: Final image
45+
FROM alpine:latest
46+
47+
WORKDIR /app
48+
49+
# 使用中国镜像源
50+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
51+
52+
# 设置时区
53+
ENV TZ=Asia/Shanghai
54+
ENV GIN_MODE=release
55+
RUN apk add --no-cache ca-certificates tzdata
56+
57+
# Copy backend executable from backend-builder stage
58+
COPY --from=backend-builder /app/share .
59+
60+
# Copy frontend static files from frontend-builder stage
61+
COPY --from=frontend-builder /app/fe/dist ./fe/dist
62+
63+
# Copy configuration file
64+
COPY etc/config.yaml ./etc/config.yaml
65+
66+
# Expose the port the application runs on (from config.yaml, default 12395)
67+
EXPOSE 12395
68+
69+
# Command to run the application
70+
CMD ["./share", "-config", "./etc/config.yaml"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 [Your Name or Project Name]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
PROJECT_NAME=cloudpan189-share
2+
MODULE_NAME=github.com/xxcheng123/cloudpan189-share
3+
VAR_COMMIT ?= $(shell git rev-parse HEAD)
4+
VAR_BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
5+
VAR_GIT_SUMMARY ?= $(shell git describe --tags --dirty --always )
6+
VAR_GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
7+
8+
.PHONY: build
9+
build:
10+
GOOS=linux GOARCH=amd64 go build -ldflags="-X $(MODULE_NAME)/configs.Commit=$(VAR_COMMIT) -X $(MODULE_NAME)/configs.BuildDate=$(VAR_BUILD_DATE) -X $(MODULE_NAME)/configs.GitSummary=$(VAR_GIT_SUMMARY) -X $(MODULE_NAME)/configs.GitBranch=$(VAR_GIT_BRANCH)" -o output/subscribe ./cmd/main.go
11+
12+
13+
.PHONY: clear
14+
clear:
15+
golangci-lint cache clean
16+
17+
.PHONY: docker-build
18+
docker-build:
19+
docker build \
20+
--build-arg MODULE_NAME=$(MODULE_NAME) \
21+
--build-arg VAR_COMMIT=$(VAR_COMMIT) \
22+
--build-arg VAR_BUILD_DATE=$(VAR_BUILD_DATE) \
23+
--build-arg VAR_GIT_SUMMARY=$(VAR_GIT_SUMMARY) \
24+
--build-arg VAR_GIT_BRANCH=$(VAR_GIT_BRANCH) \
25+
-t cloudpan189-share:latest .
26+
27+
.PHONY: docker-run
28+
docker-run:
29+
docker run -d -p 12395:12395 --name cloudpan189-share cloudpan189-share:latest
30+
31+
.PHONY: clean-docker
32+
clean-docker:
33+
docker rm -f cloudpan189-share || true
34+
docker rmi cloudpan189-share:latest || true

README.md

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
# CloudPan189 Share
2+
3+
一个基于天翼云盘的文件分享和管理系统,提供 WebDAV 接口和 Web 管理界面。
4+
5+
## 🚀 项目简介
6+
7+
CloudPan189 Share 是一款专为天翼云盘设计的智能文件分享管理工具。该系统能够将天翼云盘的分享链接转换为标准的目录结构,并通过 WebDAV 协议提供统一的文件访问接口。
8+
9+
## ✨ 核心功能
10+
11+
**🔄 智能链接转换**
12+
- 解析天翼云盘分享链接,转换为标准目录树结构
13+
- 支持多层级文件夹映射,保持原有组织架构
14+
15+
**🌐 WebDAV 统一接口**
16+
- 提供标准 WebDAV 协议支持,兼容主流客户端
17+
- 统一文件访问入口,简化多链接管理流程
18+
19+
**💻 全功能网页端**
20+
- 现代化文件浏览器界面,支持文件夹导航
21+
- 支持在线下载、搜索功能
22+
- 内置媒体播放器,支持视频、音频在线预览
23+
24+
**⚡ 高性能流媒体**
25+
- 多线程并发传输,提升大文件访问速度
26+
- 流式播放技术,实现视频无缓冲即时观看
27+
- 智能带宽适配,确保播放流畅度
28+
29+
## 🚀 快速开始
30+
31+
### Docker 部署(推荐)
32+
```sh
33+
docker run -d \
34+
--name cloudpan189-share \
35+
-p 12395:12395 \
36+
-v $(pwd)/data:/app/data \
37+
--restart unless-stopped \
38+
xxcheng123/cloudpan189-share:latest
39+
```
40+
41+
### Docker 环境变量
42+
```sh
43+
docker run -d \
44+
--name cloudpan189-share \
45+
-p 12395:12395 \
46+
-v $(pwd)/data:/app/data \
47+
-e PORT=12395 \
48+
-e DB_FILE=/app/data/share.db \
49+
--restart unless-stopped \
50+
xxcheng123/cloudpan189-share:latest
51+
```
52+
53+
### 访问系统
54+
- Web 界面: `http://服务器IP:12395`
55+
- WebDAV 地址: `http://服务器IP:12395/dav`
56+
57+
### 初始化设置
58+
1. 首次打开会进入初始化页面
59+
2. 登录后在"令牌管理"中添加天翼云盘令牌
60+
3. 在"存储管理"中配置存储源
61+
4. 开始使用文件管理功能
62+
63+
## 📁 WebDAV 挂载说明
64+
65+
### 挂载地址格式
66+
```
67+
http(s)://你的网站地址/dav
68+
```
69+
70+
### 示例地址
71+
```http
72+
http://localhost:12395/dav
73+
```
74+
75+
### 支持的客户端
76+
- **Windows**: 网络驱动器映射、RaiDrive、WinSCP
77+
- **macOS**: Finder 连接服务器、Cyberduck
78+
- **Linux**: davfs2、文件管理器(Nautilus、Dolphin)
79+
- **移动端**: ES文件浏览器、Solid Explorer、FE文件管理器
80+
- **专业工具**: Cyberduck、FileZilla Pro
81+
82+
### 挂载步骤
83+
1. 打开支持 WebDAV 的客户端
84+
2. 输入服务器地址:`http://你的域名或IP:端口/dav`
85+
3. 输入认证信息(如需要)
86+
4. 连接成功后即可像本地磁盘一样使用
87+
88+
### 注意事项
89+
- 确保服务正常运行且端口可访问
90+
- 部分客户端可能需要启用不安全连接(HTTP)
91+
- 建议在生产环境中使用 HTTPS 协议
92+
93+
## 🛠️ 技术栈
94+
95+
### 后端
96+
- **语言**: Go 1.24
97+
- **框架**: Gin
98+
- **数据库**: SQLite (GORM)
99+
- **认证**: JWT
100+
101+
### 前端
102+
- **框架**: Vue 3 + TypeScript
103+
- **构建工具**: Vite
104+
- **状态管理**: Pinia
105+
106+
## 📦 开发部署
107+
108+
### 环境要求
109+
- Go 1.24+
110+
- Node.js 22+
111+
- npm 或 yarn 或 pnpm
112+
113+
### 1. 克隆项目
114+
```bash
115+
git clone https://github.com/xxcheng123/cloudpan189-share.git
116+
cd cloudpan189-share
117+
```
118+
119+
### 2. 后端部署
120+
```bash
121+
# 安装依赖
122+
go mod tidy
123+
124+
# 构建项目
125+
make build
126+
127+
# 或直接运行
128+
go run cmd/main.go
129+
```
130+
131+
### 3. 前端部署
132+
```bash
133+
# 进入前端目录
134+
cd fe
135+
136+
# 安装依赖
137+
npm install
138+
139+
# 开发模式
140+
npm run dev
141+
142+
# 构建生产版本
143+
npm run build
144+
```
145+
146+
### 4. 配置文件
147+
148+
编辑 `etc/config.yaml` 配置文件:
149+
150+
```yaml
151+
port: 12395 # 服务端口
152+
dbFile: "data/share.db" # 数据库文件路径
153+
logPath: "logs" # 日志文件路径
154+
```
155+
156+
### 5. 启动服务
157+
```bash
158+
# 启动后端服务
159+
go run cmd/main.go
160+
161+
# 启动前端开发服务器(另一个终端)
162+
cd fe && npm run dev
163+
```
164+
165+
### 6. 访问开发环境
166+
- 前端界面: http://localhost:5173
167+
- 后端 API: http://localhost:12395
168+
- WebDAV 地址: http://localhost:12395/dav
169+
170+
## 🔧 开发指南
171+
172+
### 项目结构
173+
```
174+
cloudpan189-share/
175+
├── cmd/ # 主程序入口
176+
├── configs/ # 配置管理
177+
├── etc/ # 配置文件
178+
├── fe/ # 前端项目
179+
│ ├── src/
180+
│ │ ├── api/ # API 接口
181+
│ │ ├── components/ # 组件
182+
│ │ ├── stores/ # 状态管理
183+
│ │ ├── utils/ # 工具函数
184+
│ │ └── views/ # 页面组件
185+
├── internal/ # 内部模块
186+
│ ├── jobs/ # 后台任务
187+
│ ├── models/ # 数据模型
188+
│ ├── router/ # 路由
189+
│ └── services/ # 业务服务
190+
└── logs/ # 日志文件
191+
```
192+
193+
### API 接口
194+
- `/api/user/*` - 用户管理
195+
- `/api/cloudtoken/*` - 令牌管理
196+
- `/api/storage/*` - 存储管理
197+
- `/api/setting/*` - 系统设置
198+
- `/dav/*` - WebDAV 接口
199+
200+
## ❓ 常见问题
201+
202+
### WebDAV 连接失败
203+
- 检查防火墙设置,确保端口开放
204+
- 某些客户端需要在地址末尾添加 `/`
205+
- Windows 网络驱动器可能需要启用基本认证
206+
207+
### 文件播放卡顿
208+
- 检查网络带宽和服务器性能
209+
- 尝试降低播放质量
210+
- 确保天翼云盘令牌有效
211+
212+
### 令牌失效问题
213+
- 定期检查令牌状态
214+
- 及时更新过期令牌
215+
- 建议配置多个备用令牌
216+
217+
### Docker 相关问题
218+
- 确保 Docker 服务正常运行
219+
- 检查端口映射是否正确
220+
- 数据卷挂载路径是否有权限
221+
222+
## 🤝 贡献
223+
224+
我们欢迎各种形式的贡献,包括但不限于提交 Bug 报告、功能请求、文档改进和代码贡献。请在提交之前阅读我们的贡献指南(如果可用)。
225+
226+
## 📄 许可证
227+
228+
本项目采用 MIT 许可证。详情请参阅 `LICENSE` 文件。
229+
230+
## 🙏 致谢
231+
232+
感谢所有为本项目做出贡献的开发者和社区成员。
233+
234+
## 💬 支持
235+
236+
如果您在使用过程中遇到任何问题,可以通过以下方式获得支持:
237+
238+
- 提交 GitHub Issue
239+
- 查阅项目文档
240+
- 参与社区讨论
241+
242+
---
243+
244+
⭐ 如果这个项目对您有帮助,请给它一个 Star!

0 commit comments

Comments
 (0)