collabdocchat 2.4.3 → 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.
- package/package.json +2 -2
- package/scripts/add-button-hover.js +58 -0
- package/scripts/add-missing-braces.js +27 -0
- package/scripts/add-missing-functions.js +2 -0
- package/scripts/add-more-features.js +2 -0
- package/scripts/add-user-functions.js +2 -0
- package/scripts/auto-publish.js +2 -0
- package/scripts/beautify-buttons.js +47 -0
- package/scripts/beautify-ui.js +269 -0
- package/scripts/check-brackets.js +50 -0
- package/scripts/check-encoding.js +2 -0
- package/scripts/check-syntax.js +2 -0
- package/scripts/delete-orphan-block.js +27 -0
- package/scripts/find-buttons.js +22 -0
- package/scripts/find-duplicate.js +2 -0
- package/scripts/find-extra-brace.js +63 -0
- package/scripts/find-sidebar-buttons.js +23 -0
- package/scripts/fix-file-end.js +46 -0
- package/scripts/fix-help.js +2 -0
- package/scripts/fix-issues-step1.js +2 -0
- package/scripts/fix-issues-step2.js +2 -0
- package/scripts/fix-issues-step3.js +2 -0
- package/scripts/fix-issues-step4.js +2 -0
- package/scripts/fix-optimized-views.js +2 -0
- package/scripts/fix-settings.js +2 -0
- package/scripts/fix-syntax-error.js +38 -0
- package/scripts/fix-workflow.js +2 -0
- package/scripts/refactor-step1.js +2 -0
- package/scripts/refactor-step2.js +2 -0
- package/scripts/refactor-step3.js +2 -0
- package/scripts/refactor-step4.js +2 -0
- package/scripts/refactor-step5.js +2 -0
- package/scripts/refactor-step6.js +2 -0
- package/scripts/refactor-step7.js +2 -0
- package/scripts/remove-orphan-code.js +57 -0
- package/scripts/update-port-user.js +2 -0
- package/scripts/update-port.js +2 -0
- package/server/index.js +4 -0
- package/server/index.js.bak +97 -0
- package/server/models/Document.js +5 -0
- package/server/models/KnowledgeBase.js +259 -254
- package/server/models/Poll.js +97 -0
- package/server/routes/ai.js +391 -327
- package/server/routes/audit.js +61 -0
- package/server/routes/documents.js +74 -5
- package/server/routes/export.js +171 -10
- package/server/routes/files.js +27 -4
- package/server/routes/knowledge.js +31 -22
- package/server/routes/messages.js +142 -0
- package/server/routes/polls.js +241 -0
- package/server/routes/tasks.js +1 -0
- package/server/routes/workflows.js +27 -0
- package/server/utils/auditLogger.js +268 -238
- package/src/pages/admin-dashboard.js +1395 -261
- package/src/pages/admin-dashboard.js.audit-optimize.bak +4134 -0
- package/src/pages/admin-dashboard.js.bak +4041 -0
- package/src/pages/admin-dashboard.js.broken.bak +4099 -0
- package/src/pages/admin-dashboard.js.comprehensive.bak +4099 -0
- package/src/pages/admin-dashboard.js.escape.bak +4099 -0
- package/src/pages/admin-dashboard.js.final-final-fix.bak +4099 -0
- package/src/pages/admin-dashboard.js.final-fix.bak +4099 -0
- package/src/pages/admin-dashboard.js.final.bak +4099 -0
- package/src/pages/admin-dashboard.js.indent-fix.bak +4099 -0
- package/src/pages/admin-dashboard.js.last-fix.bak +4099 -0
- package/src/pages/admin-dashboard.js.line595-fix.bak +4099 -0
- package/src/pages/admin-dashboard.js.pre-manual-fix.bak +4099 -0
- package/src/pages/admin-dashboard.js.syntax.bak +4099 -0
- package/src/pages/admin-dashboard.js.test.bak +4099 -0
- package/src/pages/optimized-task-detail-original.js +838 -0
- package/src/pages/optimized-task-detail.js +324 -22
- package/src/pages/optimized-task-detail.js.bak +1162 -0
- package/src/pages/poll-detail-enhanced.js +394 -0
- package/src/pages/update-poll-display.js +380 -0
- package/src/pages/user-dashboard.js +1860 -1006
- package/src/services/api.js +326 -265
- package/src/services/auth.js +54 -54
- package/src/services/websocket.js +88 -80
- package/src/pages/simplified-workflows.js +0 -652
- package/src/utils/ai-assistant.js +0 -1384
package/src/services/auth.js
CHANGED
|
@@ -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
|
+
|