collabdocchat 2.4.0 → 2.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "collabdocchat",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能",
5
5
  "main": "./server/index.js",
6
6
  "type": "module",
@@ -0,0 +1,54 @@
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
+ const content = fs.readFileSync(filePath, 'utf8');
12
+
13
+ // 检查是否有明显的语法错误
14
+ const lines = content.split('\n');
15
+ let inFunction = false;
16
+ let functionName = '';
17
+ const scopeVars = {};
18
+
19
+ lines.forEach((line, i) => {
20
+ const lineNum = i + 1;
21
+
22
+ // 检测函数开始
23
+ if (line.match(/(?:async\s+)?function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\(/)) {
24
+ const match = line.match(/(?:async\s+)?function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\(/);
25
+ functionName = match[1] || match[2] || 'anonymous';
26
+ inFunction = true;
27
+ scopeVars[functionName] = {};
28
+ }
29
+
30
+ // 检测变量声明
31
+ const varMatch = line.match(/(?:const|let|var)\s+(\w+)\s*=/);
32
+ if (varMatch && inFunction) {
33
+ const varName = varMatch[1];
34
+ if (!scopeVars[functionName][varName]) {
35
+ scopeVars[functionName][varName] = [];
36
+ }
37
+ scopeVars[functionName][varName].push(lineNum);
38
+ }
39
+
40
+ // 检测函数结束(简单检测)
41
+ if (line.match(/^\s*}\s*$/) && inFunction) {
42
+ // 检查当前函数作用域的重复声明
43
+ for (const [varName, lineNumbers] of Object.entries(scopeVars[functionName])) {
44
+ if (lineNumbers.length > 1) {
45
+ console.log(`\n⚠️ 在函数 ${functionName} 中发现重复声明: ${varName}`);
46
+ console.log(` 出现在第 ${lineNumbers.join(', ')} 行`);
47
+ }
48
+ }
49
+ inFunction = false;
50
+ }
51
+ });
52
+
53
+ console.log('\n✅ 语法检查完成');
54
+
@@ -0,0 +1,35 @@
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
+ const content = fs.readFileSync(filePath, 'utf8');
12
+ const lines = content.split('\n');
13
+
14
+ const declarations = {};
15
+ lines.forEach((line, i) => {
16
+ const match = line.match(/(?:const|let|var)\s+(\w+)\s*=/);
17
+ if (match) {
18
+ const varName = match[1];
19
+ if (!declarations[varName]) {
20
+ declarations[varName] = [];
21
+ }
22
+ declarations[varName].push(i + 1);
23
+ }
24
+ });
25
+
26
+ console.log('\n重复声明的变量:');
27
+ for (const [varName, lineNumbers] of Object.entries(declarations)) {
28
+ if (lineNumbers.length > 1) {
29
+ console.log(`\n${varName}: 出现在第 ${lineNumbers.join(', ')} 行`);
30
+ lineNumbers.forEach(lineNum => {
31
+ console.log(` ${lineNum}: ${lines[lineNum - 1].trim()}`);
32
+ });
33
+ }
34
+ }
35
+
@@ -1290,12 +1290,12 @@ export function renderAdminDashboard(user, wsService) {
1290
1290
  });
1291
1291
 
1292
1292
  // 发送按钮悬停效果
1293
- const sendBtn = document.getElementById('aiSendBtnModal');
1294
- sendBtn.addEventListener('mouseenter', () => {
1295
- sendBtn.style.transform = 'scale(1.05)';
1293
+ const aiSendBtn = document.getElementById('aiSendBtnModal');
1294
+ aiSendBtn.addEventListener('mouseenter', () => {
1295
+ aiSendBtn.style.transform = 'scale(1.05)';
1296
1296
  });
1297
- sendBtn.addEventListener('mouseleave', () => {
1298
- sendBtn.style.transform = 'scale(1)';
1297
+ aiSendBtn.addEventListener('mouseleave', () => {
1298
+ aiSendBtn.style.transform = 'scale(1)';
1299
1299
  });
1300
1300
 
1301
1301
  document.getElementById('aiSendBtnModal').addEventListener('click', async () => {