collabdocchat 2.4.4 → 2.4.5

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.
Files changed (79) hide show
  1. package/package.json +2 -2
  2. package/scripts/add-button-hover.js +2 -0
  3. package/scripts/add-missing-braces.js +27 -0
  4. package/scripts/add-missing-functions.js +2 -0
  5. package/scripts/add-more-features.js +2 -0
  6. package/scripts/add-user-functions.js +2 -0
  7. package/scripts/auto-publish.js +2 -0
  8. package/scripts/beautify-buttons.js +2 -0
  9. package/scripts/beautify-ui.js +2 -0
  10. package/scripts/check-brackets.js +50 -0
  11. package/scripts/check-encoding.js +2 -0
  12. package/scripts/check-syntax.js +2 -0
  13. package/scripts/delete-orphan-block.js +27 -0
  14. package/scripts/find-buttons.js +2 -0
  15. package/scripts/find-duplicate.js +2 -0
  16. package/scripts/find-extra-brace.js +63 -0
  17. package/scripts/find-sidebar-buttons.js +2 -0
  18. package/scripts/fix-file-end.js +46 -0
  19. package/scripts/fix-help.js +2 -0
  20. package/scripts/fix-issues-step1.js +2 -0
  21. package/scripts/fix-issues-step2.js +2 -0
  22. package/scripts/fix-issues-step3.js +2 -0
  23. package/scripts/fix-issues-step4.js +2 -0
  24. package/scripts/fix-optimized-views.js +2 -0
  25. package/scripts/fix-settings.js +2 -0
  26. package/scripts/fix-syntax-error.js +38 -0
  27. package/scripts/fix-workflow.js +2 -0
  28. package/scripts/refactor-step1.js +2 -0
  29. package/scripts/refactor-step2.js +2 -0
  30. package/scripts/refactor-step3.js +2 -0
  31. package/scripts/refactor-step4.js +2 -0
  32. package/scripts/refactor-step5.js +2 -0
  33. package/scripts/refactor-step6.js +2 -0
  34. package/scripts/refactor-step7.js +2 -0
  35. package/scripts/remove-orphan-code.js +57 -0
  36. package/scripts/update-port-user.js +2 -0
  37. package/scripts/update-port.js +2 -0
  38. package/server/index.js +4 -0
  39. package/server/index.js.bak +97 -0
  40. package/server/models/Document.js +5 -0
  41. package/server/models/KnowledgeBase.js +259 -254
  42. package/server/models/Poll.js +97 -0
  43. package/server/routes/ai.js +391 -327
  44. package/server/routes/audit.js +61 -0
  45. package/server/routes/documents.js +74 -5
  46. package/server/routes/export.js +171 -10
  47. package/server/routes/files.js +27 -4
  48. package/server/routes/knowledge.js +31 -22
  49. package/server/routes/messages.js +142 -0
  50. package/server/routes/polls.js +241 -0
  51. package/server/routes/tasks.js +1 -0
  52. package/server/routes/workflows.js +27 -0
  53. package/server/utils/auditLogger.js +268 -238
  54. package/src/pages/admin-dashboard.js +1431 -335
  55. package/src/pages/admin-dashboard.js.audit-optimize.bak +4134 -0
  56. package/src/pages/admin-dashboard.js.bak +4041 -0
  57. package/src/pages/admin-dashboard.js.broken.bak +4099 -0
  58. package/src/pages/admin-dashboard.js.comprehensive.bak +4099 -0
  59. package/src/pages/admin-dashboard.js.escape.bak +4099 -0
  60. package/src/pages/admin-dashboard.js.final-final-fix.bak +4099 -0
  61. package/src/pages/admin-dashboard.js.final-fix.bak +4099 -0
  62. package/src/pages/admin-dashboard.js.final.bak +4099 -0
  63. package/src/pages/admin-dashboard.js.indent-fix.bak +4099 -0
  64. package/src/pages/admin-dashboard.js.last-fix.bak +4099 -0
  65. package/src/pages/admin-dashboard.js.line595-fix.bak +4099 -0
  66. package/src/pages/admin-dashboard.js.pre-manual-fix.bak +4099 -0
  67. package/src/pages/admin-dashboard.js.syntax.bak +4099 -0
  68. package/src/pages/admin-dashboard.js.test.bak +4099 -0
  69. package/src/pages/optimized-task-detail-original.js +838 -0
  70. package/src/pages/optimized-task-detail.js +324 -22
  71. package/src/pages/optimized-task-detail.js.bak +1162 -0
  72. package/src/pages/poll-detail-enhanced.js +394 -0
  73. package/src/pages/update-poll-display.js +380 -0
  74. package/src/pages/user-dashboard.js +1860 -1006
  75. package/src/services/api.js +326 -265
  76. package/src/services/auth.js +54 -54
  77. package/src/services/websocket.js +88 -80
  78. package/src/pages/simplified-workflows.js +0 -652
  79. package/src/utils/ai-assistant.js +0 -1384
@@ -1,54 +1,54 @@
1
- const API_URL = 'http://localhost:8765/api';
2
-
3
- export class AuthService {
4
- async login(username, password) {
5
- const response = await fetch(`${API_URL}/auth/login`, {
6
- method: 'POST',
7
- headers: { 'Content-Type': 'application/json' },
8
- body: JSON.stringify({ username, password })
9
- });
10
-
11
- if (!response.ok) {
12
- const error = await response.json();
13
- throw new Error(error.message);
14
- }
15
-
16
- return await response.json();
17
- }
18
-
19
- async register(username, password) {
20
- const response = await fetch(`${API_URL}/auth/register`, {
21
- method: 'POST',
22
- headers: { 'Content-Type': 'application/json' },
23
- body: JSON.stringify({ username, password })
24
- });
25
-
26
- if (!response.ok) {
27
- const error = await response.json();
28
- throw new Error(error.message);
29
- }
30
-
31
- return await response.json();
32
- }
33
-
34
- async getCurrentUser() {
35
- const token = localStorage.getItem('token');
36
- const response = await fetch(`${API_URL}/auth/me`, {
37
- headers: { 'Authorization': `Bearer ${token}` }
38
- });
39
-
40
- if (!response.ok) {
41
- throw new Error('获取用户信息失败');
42
- }
43
-
44
- const data = await response.json();
45
- return data.user;
46
- }
47
-
48
- logout() {
49
- localStorage.removeItem('token');
50
- window.location.reload();
51
- }
52
- }
53
-
54
-
1
+ const API_URL = 'http://localhost:8765/api';
2
+
3
+ export class AuthService {
4
+ async login(username, password) {
5
+ const response = await fetch(`${API_URL}/auth/login`, {
6
+ method: 'POST',
7
+ headers: { 'Content-Type': 'application/json' },
8
+ body: JSON.stringify({ username, password })
9
+ });
10
+
11
+ if (!response.ok) {
12
+ const error = await response.json();
13
+ throw new Error(error.message);
14
+ }
15
+
16
+ return await response.json();
17
+ }
18
+
19
+ async register(username, password) {
20
+ const response = await fetch(`${API_URL}/auth/register`, {
21
+ method: 'POST',
22
+ headers: { 'Content-Type': 'application/json' },
23
+ body: JSON.stringify({ username, password })
24
+ });
25
+
26
+ if (!response.ok) {
27
+ const error = await response.json();
28
+ throw new Error(error.message);
29
+ }
30
+
31
+ return await response.json();
32
+ }
33
+
34
+ async getCurrentUser() {
35
+ const token = localStorage.getItem('token');
36
+ const response = await fetch(`${API_URL}/auth/me`, {
37
+ headers: { 'Authorization': `Bearer ${token}` }
38
+ });
39
+
40
+ if (!response.ok) {
41
+ throw new Error('获取用户信息失败');
42
+ }
43
+
44
+ const data = await response.json();
45
+ return data.user;
46
+ }
47
+
48
+ logout() {
49
+ localStorage.removeItem('token');
50
+ window.location.reload();
51
+ }
52
+ }
53
+
54
+
@@ -1,80 +1,88 @@
1
- export class WebSocketService {
2
- constructor() {
3
- this.ws = null;
4
- this.listeners = new Map();
5
- }
6
-
7
- connect(token) {
8
- this.ws = new WebSocket('ws://localhost:8765');
9
-
10
- this.ws.onopen = () => {
11
- console.log('✅ WebSocket 连接成功');
12
- this.send({ type: 'auth', token });
13
- };
14
-
15
- this.ws.onmessage = (event) => {
16
- const data = JSON.parse(event.data);
17
- this.notifyListeners(data.type, data);
18
- };
19
-
20
- this.ws.onerror = (error) => {
21
- console.error('❌ WebSocket 错误:', error);
22
- };
23
-
24
- this.ws.onclose = () => {
25
- console.log('🔌 WebSocket 连接关闭');
26
- setTimeout(() => this.connect(token), 3000);
27
- };
28
- }
29
-
30
- send(data) {
31
- if (this.ws && this.ws.readyState === WebSocket.OPEN) {
32
- this.ws.send(JSON.stringify(data));
33
- }
34
- }
35
-
36
- on(event, callback) {
37
- if (!this.listeners.has(event)) {
38
- this.listeners.set(event, []);
39
- }
40
- this.listeners.get(event).push(callback);
41
- }
42
-
43
- off(event, callback) {
44
- if (this.listeners.has(event)) {
45
- const callbacks = this.listeners.get(event);
46
- const index = callbacks.indexOf(callback);
47
- if (index > -1) {
48
- callbacks.splice(index, 1);
49
- }
50
- }
51
- }
52
-
53
- notifyListeners(event, data) {
54
- if (this.listeners.has(event)) {
55
- this.listeners.get(event).forEach(callback => callback(data));
56
- }
57
- }
58
-
59
- joinGroup(groupId) {
60
- this.send({ type: 'join_group', groupId });
61
- }
62
-
63
- sendChatMessage(groupId, username, content) {
64
- this.send({ type: 'chat_message', groupId, username, content });
65
- }
66
-
67
- syncDocument(documentId, content, cursorPosition) {
68
- this.send({ type: 'document_sync', documentId, content, cursorPosition });
69
- }
70
-
71
- respondToCall(groupId, username) {
72
- this.send({ type: 'call_response', groupId, username });
73
- }
74
-
75
- sendTyping(documentId, username, isTyping) {
76
- this.send({ type: 'typing', documentId, username, isTyping });
77
- }
78
- }
79
-
80
-
1
+ export class WebSocketService {
2
+ constructor() {
3
+ this.ws = null;
4
+ this.listeners = new Map();
5
+ }
6
+
7
+ connect(token) {
8
+ this.ws = new WebSocket('ws://localhost:8765');
9
+
10
+ this.ws.onopen = () => {
11
+ console.log('✅ WebSocket 连接成功');
12
+ this.send({ type: 'auth', token });
13
+ };
14
+
15
+ this.ws.onmessage = (event) => {
16
+ const data = JSON.parse(event.data);
17
+ this.notifyListeners(data.type, data);
18
+ };
19
+
20
+ this.ws.onerror = (error) => {
21
+ console.error('❌ WebSocket 错误:', error);
22
+ };
23
+
24
+ this.ws.onclose = () => {
25
+ console.log('🔌 WebSocket 连接关闭');
26
+ setTimeout(() => this.connect(token), 3000);
27
+ };
28
+ }
29
+
30
+ send(data) {
31
+ if (this.ws && this.ws.readyState === WebSocket.OPEN) {
32
+ this.ws.send(JSON.stringify(data));
33
+ }
34
+ }
35
+
36
+ on(event, callback) {
37
+ if (!this.listeners.has(event)) {
38
+ this.listeners.set(event, []);
39
+ }
40
+ this.listeners.get(event).push(callback);
41
+ }
42
+
43
+ off(event, callback) {
44
+ if (this.listeners.has(event)) {
45
+ const callbacks = this.listeners.get(event);
46
+ const index = callbacks.indexOf(callback);
47
+ if (index > -1) {
48
+ callbacks.splice(index, 1);
49
+ }
50
+ }
51
+ }
52
+
53
+ notifyListeners(event, data) {
54
+ if (this.listeners.has(event)) {
55
+ this.listeners.get(event).forEach(callback => callback(data));
56
+ }
57
+ }
58
+
59
+ joinGroup(groupId) {
60
+ this.send({ type: 'join_group', groupId });
61
+ }
62
+
63
+ sendChatMessage(groupId, username, content) {
64
+ this.send({ type: 'chat_message', groupId, username, content });
65
+ }
66
+
67
+ syncDocument(documentId, content, cursorPosition) {
68
+ this.send({ type: 'document_sync', documentId, content, cursorPosition });
69
+ }
70
+
71
+ respondToCall(groupId, username) {
72
+ this.send({ type: 'call_response', groupId, username });
73
+ }
74
+
75
+ sendTyping(documentId, username, isTyping) {
76
+ this.send({ type: 'typing', documentId, username, isTyping });
77
+ }
78
+
79
+ sendWhiteboardDraw(groupId, drawData) {
80
+ this.send({ type: 'whiteboard_draw', groupId, ...drawData });
81
+ }
82
+
83
+ sendWhiteboardClear(groupId) {
84
+ this.send({ type: 'whiteboard_clear', groupId });
85
+ }
86
+ }
87
+
88
+