collabdocchat 2.2.0 → 2.4.0

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.
@@ -0,0 +1,291 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+
8
+ const filePath = path.join(__dirname, '../src/pages/admin-dashboard.js');
9
+
10
+ console.log('读取文件...');
11
+ let content = fs.readFileSync(filePath, 'utf8');
12
+
13
+ // 在备份管理后添加数据导出菜单项
14
+ console.log('添加数据导出菜单项...');
15
+ const backupMenuPattern = /(<button class="nav-item" data-view="backup">[\s\S]*?备份管理[\s\S]*?<\/button>)/;
16
+ const backupMenuReplacement = `$1
17
+ <button class="nav-item" data-view="export">
18
+ <span class="icon">📤</span> 数据导出
19
+ </button>`;
20
+
21
+ content = content.replace(backupMenuPattern, backupMenuReplacement);
22
+
23
+ // 美化设置界面
24
+ console.log('美化设置界面...');
25
+ const settingsPattern = /\/\/ 设置[\s\S]*?async function renderSettingsView\(container\)[\s\S]*?}\s*;[\s\S]*?}\);[\s\S]*?}\s*;/;
26
+ const settingsReplacement = `// 设置
27
+ async function renderSettingsView(container) {
28
+ container.innerHTML = \`
29
+ <div class="view-header">
30
+ <h2>⚙️ 设置</h2>
31
+ </div>
32
+ <div class="settings-container" style="padding: 20px; max-width: 900px; margin: 0 auto;">
33
+ <div class="settings-section" style="background: var(--bg-secondary); padding: 30px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--border);">
34
+ <h3 style="margin: 0 0 25px 0; font-size: 20px; display: flex; align-items: center; gap: 10px;">
35
+ <span style="font-size: 24px;">👤</span> 个人设置
36
+ </h3>
37
+ <div class="setting-item" style="margin-bottom: 20px;">
38
+ <label style="display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-secondary);">用户名</label>
39
+ <input type="text" value="\${user.username}" disabled style="width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-tertiary);">
40
+ </div>
41
+ <div class="setting-item" style="margin-bottom: 20px;">
42
+ <label style="display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-secondary);">邮箱</label>
43
+ <input type="email" value="\${user.email || '未设置'}" placeholder="请输入邮箱" style="width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px;">
44
+ </div>
45
+ <div class="setting-item">
46
+ <label style="display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-secondary);">修改密码</label>
47
+ <button class="btn-secondary" id="changePasswordBtn" style="width: 100%; padding: 12px;">🔒 修改密码</button>
48
+ </div>
49
+ </div>
50
+
51
+ <div class="settings-section" style="background: var(--bg-secondary); padding: 30px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--border);">
52
+ <h3 style="margin: 0 0 25px 0; font-size: 20px; display: flex; align-items: center; gap: 10px;">
53
+ <span style="font-size: 24px;">🔔</span> 通知设置
54
+ </h3>
55
+ <div class="setting-item" style="margin-bottom: 15px;">
56
+ <label style="display: flex; align-items: center; gap: 12px; padding: 15px; background: var(--bg); border-radius: 8px; cursor: pointer; transition: background 0.2s;">
57
+ <input type="checkbox" id="emailNotifications" checked style="width: 20px; height: 20px; cursor: pointer;">
58
+ <div>
59
+ <div style="font-weight: 600;">📧 邮件通知</div>
60
+ <div style="font-size: 12px; color: var(--text-secondary); margin-top: 4px;">接收重要事件的邮件通知</div>
61
+ </div>
62
+ </label>
63
+ </div>
64
+ <div class="setting-item" style="margin-bottom: 15px;">
65
+ <label style="display: flex; align-items: center; gap: 12px; padding: 15px; background: var(--bg); border-radius: 8px; cursor: pointer; transition: background 0.2s;">
66
+ <input type="checkbox" id="desktopNotifications" checked style="width: 20px; height: 20px; cursor: pointer;">
67
+ <div>
68
+ <div style="font-weight: 600;">🖥️ 桌面通知</div>
69
+ <div style="font-size: 12px; color: var(--text-secondary); margin-top: 4px;">在桌面显示通知提醒</div>
70
+ </div>
71
+ </label>
72
+ </div>
73
+ <div class="setting-item">
74
+ <label style="display: flex; align-items: center; gap: 12px; padding: 15px; background: var(--bg); border-radius: 8px; cursor: pointer; transition: background 0.2s;">
75
+ <input type="checkbox" id="soundNotifications" checked style="width: 20px; height: 20px; cursor: pointer;">
76
+ <div>
77
+ <div style="font-weight: 600;">🔊 声音提示</div>
78
+ <div style="font-size: 12px; color: var(--text-secondary); margin-top: 4px;">播放通知声音</div>
79
+ </div>
80
+ </label>
81
+ </div>
82
+ </div>
83
+
84
+ <div class="settings-section" style="background: var(--bg-secondary); padding: 30px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--border);">
85
+ <h3 style="margin: 0 0 25px 0; font-size: 20px; display: flex; align-items: center; gap: 10px;">
86
+ <span style="font-size: 24px;">🎨</span> 系统设置
87
+ </h3>
88
+ <div class="setting-item" style="margin-bottom: 20px;">
89
+ <label style="display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-secondary);">主题</label>
90
+ <select id="themeSelect" style="width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
91
+ <option value="light">☀️ 浅色</option>
92
+ <option value="dark">🌙 深色</option>
93
+ <option value="auto">🔄 跟随系统</option>
94
+ </select>
95
+ </div>
96
+ <div class="setting-item">
97
+ <label style="display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-secondary);">语言</label>
98
+ <select id="languageSelect" style="width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;">
99
+ <option value="zh-CN">🇨🇳 简体中文</option>
100
+ <option value="en-US">🇺🇸 English</option>
101
+ </select>
102
+ </div>
103
+ </div>
104
+
105
+ <div class="settings-actions" style="display: flex; gap: 15px;">
106
+ <button class="btn-primary" id="saveSettingsBtn" style="flex: 1; padding: 15px; font-size: 16px;">💾 保存设置</button>
107
+ <button class="btn-secondary" id="resetSettingsBtn" style="padding: 15px;">🔄 重置</button>
108
+ </div>
109
+ </div>
110
+ \`;
111
+
112
+ document.getElementById('changePasswordBtn').addEventListener('click', () => {
113
+ alert('修改密码功能开发中...');
114
+ });
115
+
116
+ document.getElementById('saveSettingsBtn').addEventListener('click', () => {
117
+ alert('设置已保存!');
118
+ });
119
+
120
+ document.getElementById('resetSettingsBtn').addEventListener('click', () => {
121
+ if (confirm('确定要重置所有设置吗?')) {
122
+ alert('设置已重置!');
123
+ }
124
+ });
125
+ }`;
126
+
127
+ content = content.replace(settingsPattern, settingsReplacement);
128
+
129
+ // 美化帮助界面
130
+ console.log('美化帮助界面...');
131
+ const helpPattern = /\/\/ 帮助[\s\S]*?async function renderHelpView\(container\)[\s\S]*?}\s*;[\s\S]*?}\s*;/;
132
+ const helpReplacement = `// 帮助
133
+ async function renderHelpView(container) {
134
+ container.innerHTML = \`
135
+ <div class="view-header">
136
+ <h2>❓ 帮助中心</h2>
137
+ </div>
138
+ <div class="help-container" style="padding: 20px; max-width: 1200px; margin: 0 auto;">
139
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px;">
140
+ <div class="help-section" style="background: var(--bg-secondary); padding: 25px; border-radius: 12px; border: 1px solid var(--border);">
141
+ <h3 style="margin: 0 0 20px 0; font-size: 20px; display: flex; align-items: center; gap: 10px;">
142
+ <span style="font-size: 28px;">📖</span> 快速开始
143
+ </h3>
144
+ <ul style="list-style: none; padding: 0; margin: 0;">
145
+ <li style="margin-bottom: 12px;">
146
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
147
+ <span>👥</span> 如何创建群组?
148
+ </a>
149
+ </li>
150
+ <li style="margin-bottom: 12px;">
151
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
152
+ <span>✉️</span> 如何邀请成员?
153
+ </a>
154
+ </li>
155
+ <li style="margin-bottom: 12px;">
156
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
157
+ <span>📄</span> 如何创建文档?
158
+ </a>
159
+ </li>
160
+ <li>
161
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
162
+ <span>🎨</span> 如何使用协作白板?
163
+ </a>
164
+ </li>
165
+ </ul>
166
+ </div>
167
+
168
+ <div class="help-section" style="background: var(--bg-secondary); padding: 25px; border-radius: 12px; border: 1px solid var(--border);">
169
+ <h3 style="margin: 0 0 20px 0; font-size: 20px; display: flex; align-items: center; gap: 10px;">
170
+ <span style="font-size: 28px;">🔧</span> 功能说明
171
+ </h3>
172
+ <ul style="list-style: none; padding: 0; margin: 0;">
173
+ <li style="margin-bottom: 12px;">
174
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
175
+ <span>👥</span> 群组管理
176
+ </a>
177
+ </li>
178
+ <li style="margin-bottom: 12px;">
179
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
180
+ <span>📋</span> 任务管理
181
+ </a>
182
+ </li>
183
+ <li style="margin-bottom: 12px;">
184
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
185
+ <span>📄</span> 文档协作
186
+ </a>
187
+ </li>
188
+ <li style="margin-bottom: 12px;">
189
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
190
+ <span>📚</span> 知识库
191
+ </a>
192
+ </li>
193
+ <li style="margin-bottom: 12px;">
194
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
195
+ <span>⚙️</span> 工作流引擎
196
+ </a>
197
+ </li>
198
+ <li>
199
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
200
+ <span>🤖</span> AI 助手
201
+ </a>
202
+ </li>
203
+ </ul>
204
+ </div>
205
+
206
+ <div class="help-section" style="background: var(--bg-secondary); padding: 25px; border-radius: 12px; border: 1px solid var(--border);">
207
+ <h3 style="margin: 0 0 20px 0; font-size: 20px; display: flex; align-items: center; gap: 10px;">
208
+ <span style="font-size: 28px;">❓</span> 常见问题
209
+ </h3>
210
+ <ul style="list-style: none; padding: 0; margin: 0;">
211
+ <li style="margin-bottom: 12px;">
212
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
213
+ <span>🔑</span> 如何重置密码?
214
+ </a>
215
+ </li>
216
+ <li style="margin-bottom: 12px;">
217
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
218
+ <span>📤</span> 如何导出数据?
219
+ </a>
220
+ </li>
221
+ <li style="margin-bottom: 12px;">
222
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
223
+ <span>💾</span> 如何备份数据?
224
+ </a>
225
+ </li>
226
+ <li>
227
+ <a href="#" class="help-link" style="display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg); border-radius: 8px; text-decoration: none; color: inherit; transition: transform 0.2s;">
228
+ <span>📞</span> 如何联系技术支持?
229
+ </a>
230
+ </li>
231
+ </ul>
232
+ </div>
233
+ </div>
234
+
235
+ <div class="help-section" style="background: var(--bg-secondary); padding: 30px; border-radius: 12px; margin-top: 20px; border: 1px solid var(--border);">
236
+ <h3 style="margin: 0 0 20px 0; font-size: 20px; display: flex; align-items: center; gap: 10px;">
237
+ <span style="font-size: 28px;">📞</span> 联系我们
238
+ </h3>
239
+ <p style="margin: 0 0 20px 0; line-height: 1.8; color: var(--text-secondary);">如果您有任何问题或建议,请通过以下方式联系我们:</p>
240
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px;">
241
+ <div style="display: flex; align-items: center; gap: 12px; padding: 15px; background: var(--bg); border-radius: 8px;">
242
+ <span style="font-size: 24px;">📧</span>
243
+ <div>
244
+ <div style="font-size: 12px; color: var(--text-tertiary);">邮箱</div>
245
+ <div style="font-weight: 600;">support@collabdocchat.com</div>
246
+ </div>
247
+ </div>
248
+ <div style="display: flex; align-items: center; gap: 12px; padding: 15px; background: var(--bg); border-radius: 8px;">
249
+ <span style="font-size: 24px;">🌐</span>
250
+ <div>
251
+ <div style="font-size: 12px; color: var(--text-tertiary);">GitHub</div>
252
+ <a href="https://github.com/shijinghao/collabdocchat" target="_blank" style="font-weight: 600; color: var(--primary); text-decoration: none;">github.com/shijinghao/collabdocchat</a>
253
+ </div>
254
+ </div>
255
+ <div style="display: flex; align-items: center; gap: 12px; padding: 15px; background: var(--bg); border-radius: 8px;">
256
+ <span style="font-size: 24px;">📦</span>
257
+ <div>
258
+ <div style="font-size: 12px; color: var(--text-tertiary);">npm</div>
259
+ <a href="https://www.npmjs.com/package/collabdocchat" target="_blank" style="font-weight: 600; color: var(--primary); text-decoration: none;">npmjs.com/package/collabdocchat</a>
260
+ </div>
261
+ </div>
262
+ </div>
263
+ </div>
264
+
265
+ <div class="help-section" style="background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); padding: 30px; border-radius: 12px; margin-top: 20px; color: white; text-align: center;">
266
+ <h3 style="margin: 0 0 10px 0; font-size: 24px;">ℹ️ 关于</h3>
267
+ <p style="margin: 0 0 5px 0; font-size: 18px; font-weight: 600;">CollabDocChat v2.2.0</p>
268
+ <p style="margin: 0 0 20px 0; opacity: 0.9;">开源的实时协作文档聊天平台</p>
269
+ <p style="margin: 0; opacity: 0.8; font-size: 14px;">© 2026 CollabDocChat. All rights reserved.</p>
270
+ </div>
271
+ </div>
272
+ \`;
273
+
274
+ // 添加悬停效果
275
+ document.querySelectorAll('.help-link').forEach(link => {
276
+ link.addEventListener('mouseenter', (e) => {
277
+ e.target.style.transform = 'translateX(5px)';
278
+ });
279
+ link.addEventListener('mouseleave', (e) => {
280
+ e.target.style.transform = 'translateX(0)';
281
+ });
282
+ });
283
+ }`;
284
+
285
+ content = content.replace(helpPattern, helpReplacement);
286
+
287
+ console.log('写入文件...');
288
+ fs.writeFileSync(filePath, content, 'utf8');
289
+
290
+ console.log('✅ 第七步完成!已美化设置和帮助界面,并添加数据导出菜单');
291
+