collabdocchat 2.0.7 → 2.0.8

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.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能",
5
5
  "main": "./server/index.js",
6
6
  "type": "module",
@@ -31,12 +31,18 @@ function replacePort(filePath) {
31
31
  let content = fs.readFileSync(filePath, 'utf8');
32
32
  const originalContent = content;
33
33
 
34
+ // 移除 BOM(如果存在)
35
+ if (content.charCodeAt(0) === 0xFEFF) {
36
+ content = content.slice(1);
37
+ }
38
+
34
39
  // 替换所有 8765 端口为 3000
35
40
  content = content.replace(/http:\/\/localhost:8765/g, 'http://localhost:3000');
36
41
  content = content.replace(/ws:\/\/localhost:8765/g, 'ws://localhost:3000');
37
42
 
38
43
  if (content !== originalContent) {
39
- fs.writeFileSync(filePath, content, 'utf8');
44
+ // 写入时不添加 BOM
45
+ fs.writeFileSync(filePath, content, { encoding: 'utf8' });
40
46
  console.log(`✅ 已修复: ${filePath}`);
41
47
  return true;
42
48
  }
@@ -0,0 +1,69 @@
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
+ // 递归查找所有 .js 文件
9
+ function findJsFiles(dir, fileList = []) {
10
+ const files = fs.readdirSync(dir);
11
+
12
+ files.forEach(file => {
13
+ const filePath = path.join(dir, file);
14
+ const stat = fs.statSync(filePath);
15
+
16
+ if (stat.isDirectory()) {
17
+ if (file !== 'node_modules' && file !== '.git') {
18
+ findJsFiles(filePath, fileList);
19
+ }
20
+ } else if (file.endsWith('.js')) {
21
+ fileList.push(filePath);
22
+ }
23
+ });
24
+
25
+ return fileList;
26
+ }
27
+
28
+ // 移除 BOM
29
+ function removeBOM(filePath) {
30
+ try {
31
+ const buffer = fs.readFileSync(filePath);
32
+
33
+ // 检查是否有 UTF-8 BOM (EF BB BF)
34
+ if (buffer.length >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {
35
+ // 移除 BOM
36
+ const contentWithoutBOM = buffer.slice(3);
37
+ fs.writeFileSync(filePath, contentWithoutBOM);
38
+ console.log(`✅ 已移除 BOM: ${filePath}`);
39
+ return true;
40
+ }
41
+ return false;
42
+ } catch (error) {
43
+ console.error(`❌ 处理失败: ${filePath}`, error.message);
44
+ return false;
45
+ }
46
+ }
47
+
48
+ // 主函数
49
+ function main() {
50
+ console.log('🔍 开始扫描并移除 BOM...\n');
51
+
52
+ const projectRoot = path.join(__dirname, '..');
53
+ const srcDir = path.join(projectRoot, 'src');
54
+ const jsFiles = findJsFiles(srcDir);
55
+
56
+ console.log(`📁 找到 ${jsFiles.length} 个 JavaScript 文件\n`);
57
+
58
+ let fixedCount = 0;
59
+ jsFiles.forEach(file => {
60
+ if (removeBOM(file)) {
61
+ fixedCount++;
62
+ }
63
+ });
64
+
65
+ console.log(`\n✅ 处理完成!共移除 ${fixedCount} 个文件的 BOM`);
66
+ }
67
+
68
+ main();
69
+
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 知识库创建和编辑功能
3
3
  */
4
4
 
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 优化后的投票详情界面
3
3
  * 美化投票结果展示,提升用户体�? */
4
4
 
package/src/main.js CHANGED
@@ -1,4 +1,4 @@
1
- import './styles/main.css';
1
+ import './styles/main.css';
2
2
  import { AuthService } from './services/auth.js';
3
3
  import { WebSocketService } from './services/websocket.js';
4
4
  import { renderLoginPage } from './pages/login.js';
@@ -1,4 +1,4 @@
1
- import { ApiService } from '../services/api.js';
1
+ import { ApiService } from '../services/api.js';
2
2
  import { AuthService } from '../services/auth.js';
3
3
  import { FeatureIntegrator } from '../utils/feature-integrator.js';
4
4
  import { uiEnhancementsLoader } from '../utils/ui-enhancements-loader.js';
@@ -1,4 +1,4 @@
1
- import { AuthService } from '../services/auth.js';
1
+ import { AuthService } from '../services/auth.js';
2
2
 
3
3
  export function renderLoginPage(onSuccess) {
4
4
  const app = document.getElementById('app');
@@ -1,4 +1,4 @@
1
- // 优化后的备份管理界面
1
+ // 优化后的备份管理界面
2
2
  // 使用卡片式布局,提升视觉效果和用户体验
3
3
 
4
4
  async function renderOptimizedBackupView(container) {
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 美化后的知识库视�? * 现代化卡片布局,增强视觉效�? */
3
3
 
4
4
  import { showCreateKnowledgeModal, showEditKnowledgeModal } from '../components/knowledge-modal.js';
@@ -1,4 +1,4 @@
1
- // 优化后的任务详情界面
1
+ // 优化后的任务详情界面
2
2
  // 使用卡片式布局,提升视觉效果和信息层次
3
3
 
4
4
  function renderOptimizedTaskDetail(task, container) {
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 优化后的工作流管理界�? * 可视化创建工作流,无需编写JSON代码
3
3
  */
4
4
 
@@ -1,4 +1,4 @@
1
- // 简化的工作流视�?- 为非技术用户设�?
1
+ // 简化的工作流视�?- 为非技术用户设�?
2
2
  // 替换原有的复�?JSON 配置方式
3
3
 
4
4
  async function renderSimplifiedWorkflowsView(container) {
@@ -1,4 +1,4 @@
1
- import { ApiService } from '../services/api.js';
1
+ import { ApiService } from '../services/api.js';
2
2
  import { AuthService } from '../services/auth.js';
3
3
  import { FeatureIntegrator } from '../utils/feature-integrator.js';
4
4
  import { renderOptimizedPollDetail, addPollDetailStyles } from '../components/optimized-poll-detail.js';
@@ -1,4 +1,4 @@
1
- const API_URL = 'http://localhost:3000/api';
1
+ const API_URL = 'http://localhost:3000/api';
2
2
 
3
3
  export class ApiService {
4
4
  constructor() {
@@ -1,4 +1,4 @@
1
- const API_URL = 'http://localhost:3000/api';
1
+ const API_URL = 'http://localhost:3000/api';
2
2
 
3
3
  export class AuthService {
4
4
  async login(username, password) {
@@ -1,4 +1,4 @@
1
- export class WebSocketService {
1
+ export class WebSocketService {
2
2
  constructor() {
3
3
  this.ws = null;
4
4
  this.listeners = new Map();
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 优化后的协作工具样式
3
3
  * 美化白板、投票、代码编辑器等协作工具界�? */
4
4
 
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * AI 助手系统
3
3
  * 提供智能回复、内容摘要、翻译等功能
4
4
  */
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 聊天增强功能模块
3
3
  * 包含消息撤回、@提及、已读状态等功能
4
4
  */
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 协作增强功能
3
3
  * 提供更多协作工具和功�? */
4
4
 
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 功能集成�? * 将所有增强功能集成到仪表板中
3
3
  */
4
4
 
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 新手引导系统
3
3
  * 提供交互式的新手引导和帮�? */
4
4
 
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 虚拟滚动实现
3
3
  * 用于优化长列表渲染性能
4
4
  */
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 权限管理系统
3
3
  * 提供细粒度的权限控制
4
4
  */
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 响应式处理器
3
3
  * 处理不同设备的交互优�?
4
4
  */
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * 主题管理系统
3
3
  * 支持多种主题切换和自定义主题
4
4
  */
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * UI 美化增强加载�? * 自动加载所有界面美化功�? * 确保所有优化的界面在启动时自动集成
3
3
  */
4
4