File size: 3,911 Bytes
c437678
04ad860
 
 
 
 
 
 
 
 
 
 
 
 
 
c437678
04ad860
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
---

title: PPTist Huggingface
emoji: 📊
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: agpl-3.0
app_port: 7860
tags:
- presentation
- ppt
- powerpoint
- slides
- editor
---


# PPTist Huggingface Space

一个基于 PPTist 的在线演示文稿编辑器,部署在 Huggingface Space 上,支持多用户登录和 GitHub 数据存储。

## 🎯 项目特点

- **多用户支持**: 内置4个测试账号(PS01-PS04)
- **GitHub存储**: 使用GitHub仓库作为数据存储后端
- **公网分享**: 每个PPT页面都有独立的公网URL
- **完整功能**: 保留PPTist的所有编辑和展示功能
- **Docker部署**: 一键部署到Huggingface Space

## 🔑 测试账号

| 用户名 | 密码 | 角色 |
|--------|------|------|
| PS01 | admin_cybercity2025 | 管理员 |

| PS02 | cybercity2025 | 用户 |

| PS03 | cybercity2025 | 用户 |

| PS04 | cybercity2025 | 用户 |



## 🚀 部署说明



### 环境变量配置



在 Huggingface Space 的 Settings 中设置以下环境变量:



```bash

GITHUB_TOKEN=你的GitHub访问令牌
GITHUB_REPOS=https://github.com/CaPaCaptain/PPTist_huggingface_db

JWT_SECRET=pptist-secret-key-2025-huggingface
NODE_ENV=production

```



### GitHub 仓库设置



1. 创建一个 GitHub 仓库用于存储 PPT 数据

2. 生成 GitHub Personal Access Token,需要 `repo` 权限

3. 在仓库中创建 `users/` 目录结构



### 数据存储结构



```

仓库根目录/

├── users/

│   ├── PS01/

│   │   ├── ppt1.json

│   │   └── ppt2.json

│   ├── PS02/

│   │   └── presentation.json

│   └── ...

```



## 📡 API 接口



### 认证接口

- `POST /api/auth/login` - 用户登录

- `GET /api/auth/verify` - 验证token

- `GET /api/auth/user` - 获取用户信息



### PPT管理接口

- `GET /api/ppt/list` - 获取PPT列表

- `GET /api/ppt/:pptId` - 获取PPT数据

- `POST /api/ppt/save` - 保存PPT

- `POST /api/ppt/create` - 创建新PPT

- `DELETE /api/ppt/:pptId` - 删除PPT

- `POST /api/ppt/:pptId/copy` - 复制PPT



### 公共分享接口

- `GET /api/public/view/:userId/:pptId/:slideIndex` - 公开访问单页

- `GET /api/public/ppt/:userId/:pptId` - 公开访问完整PPT

- `POST /api/public/generate-share-link` - 生成分享链接



## 🔧 本地开发



1. 克隆项目:

```bash

git clone <repository-url>

cd PPtist-Huggingface

```



2. 安装依赖:

```bash

# 后端

cd backend

npm install



# 前端

cd ../frontend

npm install

```



3. 配置环境变量:

```bash

cp backend/.env.example backend/.env

# 编辑 .env 文件,填入你的配置

```



4. 启动开发服务器:

```bash

# 启动后端 (端口 7860)

cd backend

npm run dev



# 启动前端 (端口 5173)

cd frontend

npm run dev

```



## 🏗️ 系统架构



```

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐

│   前端 Vue3     │    │   后端 Express  │    │   GitHub 仓库   │

│   PPTist UI     │────│   JWT认证       │────│   JSON数据存储  │

│   Vite构建      │    │   RESTful API   │    │   版本控制      │

└─────────────────┘    └─────────────────┘    └─────────────────┘

```



## 🌐 公网分享功能



每个PPT页面都可以生成公网访问链接:



- **单页链接**: `https://your-space.hf.space/api/public/view/PS01/ppt-id/0`

- **完整PPT**: `https://your-space.hf.space/api/public/ppt/PS01/ppt-id`

- **前端查看**: `https://your-space.hf.space/public/PS01/ppt-id/0`



## 📝 许可证



本项目基于 AGPL-3.0 许可证开源。