collabdocchat 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +262 -0
- package/bin/cli.js +18 -4
- package/package.json +2 -2
- package/QUICK_START.md +0 -147
package/README.md
CHANGED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# CollabDocChat 📝💬
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/collabdocchat)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
|
|
7
|
+
> 🚀 开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能
|
|
8
|
+
|
|
9
|
+
一个功能强大的实时协作平台,支持多人同时编辑文档、实时聊天、任务管理和团队协作。基于 Yjs CRDT 算法实现的无冲突协同编辑,让团队协作更加高效。
|
|
10
|
+
|
|
11
|
+
## ✨ 核心特性
|
|
12
|
+
|
|
13
|
+
- 🔄 **实时协作编辑** - 基于 Yjs CRDT 算法,支持多人同时编辑,自动解决冲突
|
|
14
|
+
- 💬 **即时通讯** - WebSocket 实时聊天,支持 @提及、智能点名
|
|
15
|
+
- 📋 **任务管理** - 创建、分配、跟踪任务,提升团队效率
|
|
16
|
+
- 👥 **团队协作** - 群组管理、权限控制、成员管理
|
|
17
|
+
- 📁 **文件管理** - 文件上传、下载、版本控制
|
|
18
|
+
- 🔐 **安全可靠** - JWT 认证、权限管理、审计日志
|
|
19
|
+
- 🎨 **现代化 UI** - 响应式设计,支持深色模式
|
|
20
|
+
- 📊 **管理后台** - 完整的管理员控制面板
|
|
21
|
+
|
|
22
|
+
## 🚀 快速开始
|
|
23
|
+
|
|
24
|
+
### 方式一:使用 npx (推荐)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx collabdocchat
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 方式二:全局安装
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# 全局安装
|
|
34
|
+
npm install -g collabdocchat
|
|
35
|
+
|
|
36
|
+
# 启动应用
|
|
37
|
+
collabdocchat
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 方式三:项目中使用
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# 安装到项目
|
|
44
|
+
npm install collabdocchat
|
|
45
|
+
|
|
46
|
+
# 启动
|
|
47
|
+
npm start
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 📋 系统要求
|
|
51
|
+
|
|
52
|
+
- **Node.js**: >= 16.0.0
|
|
53
|
+
- **npm**: >= 7.0.0
|
|
54
|
+
- **MongoDB**: >= 4.4 (需要单独安装)
|
|
55
|
+
|
|
56
|
+
## 🔧 配置说明
|
|
57
|
+
|
|
58
|
+
首次运行时,系统会自动创建配置文件。您也可以手动创建 `.env` 文件:
|
|
59
|
+
|
|
60
|
+
```env
|
|
61
|
+
# 服务器配置
|
|
62
|
+
PORT=3000
|
|
63
|
+
NODE_ENV=development
|
|
64
|
+
|
|
65
|
+
# MongoDB 配置
|
|
66
|
+
MONGODB_URI=mongodb://localhost:27017/collabdocchat
|
|
67
|
+
|
|
68
|
+
# JWT 配置
|
|
69
|
+
JWT_SECRET=your-secret-key-here
|
|
70
|
+
JWT_EXPIRES_IN=7d
|
|
71
|
+
|
|
72
|
+
# 管理员账号(首次启动时创建)
|
|
73
|
+
ADMIN_USERNAME=admin
|
|
74
|
+
ADMIN_PASSWORD=admin123
|
|
75
|
+
ADMIN_EMAIL=admin@example.com
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 📖 使用指南
|
|
79
|
+
|
|
80
|
+
### 1. 启动应用
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# 开发模式(自动重启)
|
|
84
|
+
npm run dev
|
|
85
|
+
|
|
86
|
+
# 生产模式
|
|
87
|
+
npm start
|
|
88
|
+
|
|
89
|
+
# 快速启动(自动配置)
|
|
90
|
+
npm run quick-start
|
|
91
|
+
|
|
92
|
+
# 停止应用
|
|
93
|
+
npm run stop
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 2. 访问应用
|
|
97
|
+
|
|
98
|
+
启动成功后,浏览器会自动打开:
|
|
99
|
+
- **应用地址**: http://localhost:3000
|
|
100
|
+
- **默认管理员账号**: admin / admin123
|
|
101
|
+
|
|
102
|
+
### 3. 主要功能
|
|
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
|
+
- **Node.js** + **Express** - 服务器框架
|
|
132
|
+
- **MongoDB** + **Mongoose** - 数据库
|
|
133
|
+
- **WebSocket** (ws) - 实时通信
|
|
134
|
+
- **JWT** - 身份认证
|
|
135
|
+
- **Yjs** - CRDT 协同编辑
|
|
136
|
+
|
|
137
|
+
### 前端
|
|
138
|
+
- **Vanilla JavaScript** - 轻量级前端
|
|
139
|
+
- **Quill** - 富文本编辑器
|
|
140
|
+
- **Vite** - 构建工具
|
|
141
|
+
- **CSS3** - 现代化样式
|
|
142
|
+
|
|
143
|
+
## 📁 项目结构
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
collabdocchat/
|
|
147
|
+
├── bin/ # CLI 入口
|
|
148
|
+
│ └── cli.js
|
|
149
|
+
├── server/ # 后端代码
|
|
150
|
+
│ ├── models/ # 数据模型
|
|
151
|
+
│ ├── routes/ # API 路由
|
|
152
|
+
│ ├── middleware/ # 中间件
|
|
153
|
+
│ ├── utils/ # 工具函数
|
|
154
|
+
│ ├── websocket/ # WebSocket 处理
|
|
155
|
+
│ └── index.js # 服务器入口
|
|
156
|
+
├── src/ # 前端代码
|
|
157
|
+
│ ├── pages/ # 页面组件
|
|
158
|
+
│ ├── services/ # API 服务
|
|
159
|
+
│ └── styles/ # 样式文件
|
|
160
|
+
├── scripts/ # 脚本工具
|
|
161
|
+
│ ├── postinstall.js # 安装后脚本
|
|
162
|
+
│ ├── start-app.js # 启动脚本
|
|
163
|
+
│ └── quick-start.js # 快速启动
|
|
164
|
+
└── package.json
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## 🔐 安全特性
|
|
168
|
+
|
|
169
|
+
- **JWT 认证** - 安全的用户身份验证
|
|
170
|
+
- **密码加密** - bcrypt 加密存储
|
|
171
|
+
- **权限控制** - 基于角色的访问控制
|
|
172
|
+
- **审计日志** - 记录所有重要操作
|
|
173
|
+
- **CORS 保护** - 跨域请求保护
|
|
174
|
+
|
|
175
|
+
## 🛠️ 开发指南
|
|
176
|
+
|
|
177
|
+
### 本地开发
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# 克隆仓库
|
|
181
|
+
git clone https://github.com/shijinghao/collabdocchat.git
|
|
182
|
+
cd collabdocchat
|
|
183
|
+
|
|
184
|
+
# 安装依赖
|
|
185
|
+
npm install
|
|
186
|
+
|
|
187
|
+
# 启动开发服务器
|
|
188
|
+
npm run dev
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 构建生产版本
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# 构建前端
|
|
195
|
+
npm run build
|
|
196
|
+
|
|
197
|
+
# 启动生产服务器
|
|
198
|
+
npm run serve
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## 🤝 贡献指南
|
|
202
|
+
|
|
203
|
+
欢迎贡献代码!请遵循以下步骤:
|
|
204
|
+
|
|
205
|
+
1. Fork 本仓库
|
|
206
|
+
2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)
|
|
207
|
+
3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
|
|
208
|
+
4. 推送到分支 (`git push origin feature/AmazingFeature`)
|
|
209
|
+
5. 开启 Pull Request
|
|
210
|
+
|
|
211
|
+
## 📝 更新日志
|
|
212
|
+
|
|
213
|
+
### v1.2.2 (2026-01-26)
|
|
214
|
+
- ✅ 发布到 npm
|
|
215
|
+
- 🔧 修复 package.json 配置
|
|
216
|
+
- 📚 完善文档
|
|
217
|
+
|
|
218
|
+
### v1.2.0
|
|
219
|
+
- ✨ 添加任务管理功能
|
|
220
|
+
- 🎨 优化 UI 界面
|
|
221
|
+
- 🐛 修复已知问题
|
|
222
|
+
|
|
223
|
+
### v1.0.0
|
|
224
|
+
- 🎉 首次发布
|
|
225
|
+
- 📝 实时文档协作
|
|
226
|
+
- 💬 即时通讯功能
|
|
227
|
+
|
|
228
|
+
## 📄 许可证
|
|
229
|
+
|
|
230
|
+
本项目采用 [MIT](LICENSE) 许可证。
|
|
231
|
+
|
|
232
|
+
## 👨💻 作者
|
|
233
|
+
|
|
234
|
+
**shijinghao**
|
|
235
|
+
|
|
236
|
+
- GitHub: [@shijinghao](https://github.com/shijinghao)
|
|
237
|
+
- npm: [collabdocchat](https://www.npmjs.com/package/collabdocchat)
|
|
238
|
+
|
|
239
|
+
## 🙏 致谢
|
|
240
|
+
|
|
241
|
+
感谢以下开源项目:
|
|
242
|
+
|
|
243
|
+
- [Yjs](https://github.com/yjs/yjs) - CRDT 协同编辑
|
|
244
|
+
- [Quill](https://quilljs.com/) - 富文本编辑器
|
|
245
|
+
- [Express](https://expressjs.com/) - Web 框架
|
|
246
|
+
- [MongoDB](https://www.mongodb.com/) - 数据库
|
|
247
|
+
|
|
248
|
+
## 📞 支持
|
|
249
|
+
|
|
250
|
+
如果您遇到问题或有建议,请:
|
|
251
|
+
|
|
252
|
+
- 提交 [Issue](https://github.com/shijinghao/collabdocchat/issues)
|
|
253
|
+
- 发送邮件至项目维护者
|
|
254
|
+
- 查看 [文档](https://github.com/shijinghao/collabdocchat#readme)
|
|
255
|
+
|
|
256
|
+
## ⭐ Star History
|
|
257
|
+
|
|
258
|
+
如果这个项目对您有帮助,请给我们一个 Star ⭐️
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
**Made with ❤️ by shijinghao**
|
package/bin/cli.js
CHANGED
|
@@ -14,10 +14,24 @@ const isWindows = platform() === 'win32';
|
|
|
14
14
|
|
|
15
15
|
// 打开浏览器
|
|
16
16
|
function openBrowser(url) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
try {
|
|
18
|
+
if (isWindows) {
|
|
19
|
+
// Windows: 使用 start 命令,需要添加空标题
|
|
20
|
+
spawn('cmd', ['/c', 'start', '""', url], {
|
|
21
|
+
stdio: 'ignore',
|
|
22
|
+
detached: true,
|
|
23
|
+
shell: true
|
|
24
|
+
}).unref();
|
|
25
|
+
} else if (platform() === 'darwin') {
|
|
26
|
+
// macOS
|
|
27
|
+
spawn('open', [url], { stdio: 'ignore', detached: true }).unref();
|
|
28
|
+
} else {
|
|
29
|
+
// Linux
|
|
30
|
+
spawn('xdg-open', [url], { stdio: 'ignore', detached: true }).unref();
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.log(`\n⚠️ 无法自动打开浏览器,请手动访问: ${url}`);
|
|
34
|
+
}
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
// 检查是否在正确的目录
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "collabdocchat",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能",
|
|
5
5
|
"main": "./server/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"collabdocchat": "
|
|
8
|
+
"collabdocchat": "bin/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"bin",
|
package/QUICK_START.md
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
# CollabDocChat 快速启动指南 🚀
|
|
2
|
-
|
|
3
|
-
## 方法一:使用一键启动脚本(推荐)
|
|
4
|
-
|
|
5
|
-
### Windows 用户
|
|
6
|
-
|
|
7
|
-
1. 下载启动脚本:
|
|
8
|
-
```bash
|
|
9
|
-
curl -O https://raw.githubusercontent.com/shijinghao/collabdocchat/main/install-and-start.bat
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
2. 双击运行 `install-and-start.bat`
|
|
13
|
-
|
|
14
|
-
或者在命令行中运行:
|
|
15
|
-
```bash
|
|
16
|
-
install-and-start.bat
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Linux/Mac 用户
|
|
20
|
-
|
|
21
|
-
1. 下载启动脚本:
|
|
22
|
-
```bash
|
|
23
|
-
curl -O https://raw.githubusercontent.com/shijinghao/collabdocchat/main/install-and-start.sh
|
|
24
|
-
chmod +x install-and-start.sh
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
2. 运行脚本:
|
|
28
|
-
```bash
|
|
29
|
-
./install-and-start.sh
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## 方法二:手动安装并启动
|
|
35
|
-
|
|
36
|
-
### 1. 安装(跳过 postinstall 脚本)
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install collabdocchat --ignore-scripts
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 2. 启动
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
cd node_modules/collabdocchat
|
|
46
|
-
node scripts/quick-start.js
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
或者手动分别启动:
|
|
50
|
-
|
|
51
|
-
**启动后端:**
|
|
52
|
-
```bash
|
|
53
|
-
cd node_modules/collabdocchat
|
|
54
|
-
node server/index.js
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**启动前端(新终端):**
|
|
58
|
-
```bash
|
|
59
|
-
cd node_modules/collabdocchat
|
|
60
|
-
npm run client
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**打开浏览器:**
|
|
64
|
-
访问 `http://localhost:5173`
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## 方法三:一行命令
|
|
69
|
-
|
|
70
|
-
### Windows (PowerShell)
|
|
71
|
-
|
|
72
|
-
```powershell
|
|
73
|
-
npm install collabdocchat --ignore-scripts; cd node_modules\collabdocchat; Start-Process node -ArgumentList "server/index.js" -WindowStyle Hidden; Start-Sleep -Seconds 3; Start-Process npm -ArgumentList "run","client" -WindowStyle Hidden; Start-Sleep -Seconds 8; Start-Process "http://localhost:5173"
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Linux/Mac
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
npm install collabdocchat --ignore-scripts && cd node_modules/collabdocchat && node server/index.js & sleep 3 && npm run client & sleep 8 && open http://localhost:5173
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## 停止服务
|
|
85
|
-
|
|
86
|
-
### Windows
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
taskkill /F /IM node.exe
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Linux/Mac
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
pkill -f node
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
或者:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
cd node_modules/collabdocchat
|
|
102
|
-
npm run stop
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## 注意事项
|
|
108
|
-
|
|
109
|
-
- 确保 MongoDB 已启动
|
|
110
|
-
- 确保端口 3000 和 5173 未被占用
|
|
111
|
-
- 首次运行需要配置 `.env` 文件(可选)
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## 常见问题
|
|
116
|
-
|
|
117
|
-
### Q: 安装卡住了怎么办?
|
|
118
|
-
|
|
119
|
-
A: 使用 `--ignore-scripts` 选项:
|
|
120
|
-
```bash
|
|
121
|
-
npm install collabdocchat --ignore-scripts
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Q: 浏览器没有自动打开?
|
|
125
|
-
|
|
126
|
-
A: 手动访问 `http://localhost:5173`
|
|
127
|
-
|
|
128
|
-
### Q: 如何查看是否启动成功?
|
|
129
|
-
|
|
130
|
-
A: 检查端口占用:
|
|
131
|
-
```bash
|
|
132
|
-
# Windows
|
|
133
|
-
netstat -ano | findstr :3000
|
|
134
|
-
netstat -ano | findstr :5173
|
|
135
|
-
|
|
136
|
-
# Linux/Mac
|
|
137
|
-
lsof -i:3000
|
|
138
|
-
lsof -i:5173
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
---
|
|
142
|
-
|
|
143
|
-
**提示**: 推荐使用一键启动脚本,最简单快捷!
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|