next-admin-svr 0.1.49 → 1.0.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/lib/index.js CHANGED
@@ -1319,6 +1319,7 @@ router$7.post('/mcp-upload', uploadWithSlice.single('file'), async (req, res) =>
1319
1319
  console.log('[mcp-upload] req.body', req.body);
1320
1320
  const parsedDir = getUploadDir(dir, cdn);
1321
1321
  const staffName = (req.header('rid') || 'developer');
1322
+ const toolName = (req.header('x-mcp-tool-name') || '');
1322
1323
  const newFileKey = `${parsedDir}/${qiniuKey}`;
1323
1324
  if (!cdn) {
1324
1325
  res.send({ r: -1, msg: '缺少 cdn 参数' });
@@ -1404,6 +1405,7 @@ router$7.post('/mcp-upload', uploadWithSlice.single('file'), async (req, res) =>
1404
1405
  mcpDB,
1405
1406
  mcpName,
1406
1407
  mcpVersion,
1408
+ toolName,
1407
1409
  imageDB,
1408
1410
  operationTool: coreModule.get().operation,
1409
1411
  });
@@ -1425,6 +1427,7 @@ router$6.post('/start-publish', async (req, res) => {
1425
1427
  }
1426
1428
  }
1427
1429
  const staffName = (req.header('rid') || 'developer');
1430
+ const toolName = (req.header('x-mcp-tool-name') || '');
1428
1431
  const { mcpName, mcpVersion, repo, branch, publishReason, subProjectName, } = req.body;
1429
1432
  const result = await shared.startMpCIPipeline({
1430
1433
  repo,
@@ -1437,6 +1440,8 @@ router$6.post('/start-publish', async (req, res) => {
1437
1440
  mcpVersion,
1438
1441
  operationTool: coreModule.get().operation,
1439
1442
  startPipeline: coreModule.get().landun.startPipeline,
1443
+ mcpDB: coreModule.get().mcpDB,
1444
+ toolName,
1440
1445
  });
1441
1446
  res.send(result);
1442
1447
  });
@@ -1470,6 +1475,7 @@ router$4.post('/mcp-start', async (req, res) => {
1470
1475
  }
1471
1476
  }
1472
1477
  const staffName = (req.header('rid') || 'developer');
1478
+ const toolName = (req.header('x-mcp-tool-name') || '');
1473
1479
  const { mcpName, mcpVersion, repo, branch, publishReason, versionType, publishExternalNPM, publishPackage, } = req.body;
1474
1480
  console.log('[mcp-start]', {
1475
1481
  mcpName,
@@ -1503,6 +1509,7 @@ router$4.post('/mcp-start', async (req, res) => {
1503
1509
  mcpName,
1504
1510
  mcpVersion,
1505
1511
  operationTool: coreModule.get().operation,
1512
+ toolName,
1506
1513
  });
1507
1514
  res.send(result);
1508
1515
  });
@@ -2678,7 +2685,7 @@ async function updateWhiteUserStatus({ status = false, pipelineRunId = '', }) {
2678
2685
 
2679
2686
  const CRON_TIME = '0 */10 * * * *';
2680
2687
  function createUpdateWhiteUserCosCron() {
2681
- if (process.env.NODE_ENV === 'development') {
2688
+ if (process.env.NODE_ENV === 'development' || process.platform !== 'linux') {
2682
2689
  return;
2683
2690
  }
2684
2691
  try {
@@ -2944,9 +2951,19 @@ async function notifyRobot(entry, iwikiUrl, robotNotifyConfig) {
2944
2951
  console.warn('[EmailSync] 未配置机器人 webhookUrl,跳过通知');
2945
2952
  return;
2946
2953
  }
2947
- const contentPreview = entry.content.length > 200
2948
- ? `${entry.content.slice(0, 200)}...`
2949
- : entry.content;
2954
+ // 清理 HTML 标签,避免未闭合标签(如 <style、<table 等)破坏企微 Markdown 渲染
2955
+ const plainContent = entry.content
2956
+ .replace(/<style[\s\S]*?<\/style>/gi, '') // 移除完整的 <style> 块
2957
+ .replace(/<script[\s\S]*?<\/script>/gi, '') // 移除完整的 <script> 块
2958
+ .replace(/<[^>]*>/g, '') // 移除所有 HTML 标签
2959
+ .replace(/&nbsp;/g, ' ') // 替换常见 HTML 实体
2960
+ .replace(/&lt;/g, '<')
2961
+ .replace(/&gt;/g, '>')
2962
+ .replace(/&amp;/g, '&')
2963
+ .trim();
2964
+ const contentPreview = plainContent.length > 200
2965
+ ? `${plainContent.slice(0, 200)}...`
2966
+ : plainContent;
2950
2967
  const message = [
2951
2968
  '📬 **邮件知识已同步到 iwiki**',
2952
2969
  '',
package/lib/index.mjs CHANGED
@@ -1308,6 +1308,7 @@ router$7.post('/mcp-upload', uploadWithSlice.single('file'), async (req, res) =>
1308
1308
  console.log('[mcp-upload] req.body', req.body);
1309
1309
  const parsedDir = getUploadDir(dir, cdn);
1310
1310
  const staffName = (req.header('rid') || 'developer');
1311
+ const toolName = (req.header('x-mcp-tool-name') || '');
1311
1312
  const newFileKey = `${parsedDir}/${qiniuKey}`;
1312
1313
  if (!cdn) {
1313
1314
  res.send({ r: -1, msg: '缺少 cdn 参数' });
@@ -1393,6 +1394,7 @@ router$7.post('/mcp-upload', uploadWithSlice.single('file'), async (req, res) =>
1393
1394
  mcpDB,
1394
1395
  mcpName,
1395
1396
  mcpVersion,
1397
+ toolName,
1396
1398
  imageDB,
1397
1399
  operationTool: coreModule.get().operation,
1398
1400
  });
@@ -1414,6 +1416,7 @@ router$6.post('/start-publish', async (req, res) => {
1414
1416
  }
1415
1417
  }
1416
1418
  const staffName = (req.header('rid') || 'developer');
1419
+ const toolName = (req.header('x-mcp-tool-name') || '');
1417
1420
  const { mcpName, mcpVersion, repo, branch, publishReason, subProjectName, } = req.body;
1418
1421
  const result = await startMpCIPipeline({
1419
1422
  repo,
@@ -1426,6 +1429,8 @@ router$6.post('/start-publish', async (req, res) => {
1426
1429
  mcpVersion,
1427
1430
  operationTool: coreModule.get().operation,
1428
1431
  startPipeline: coreModule.get().landun.startPipeline,
1432
+ mcpDB: coreModule.get().mcpDB,
1433
+ toolName,
1429
1434
  });
1430
1435
  res.send(result);
1431
1436
  });
@@ -1459,6 +1464,7 @@ router$4.post('/mcp-start', async (req, res) => {
1459
1464
  }
1460
1465
  }
1461
1466
  const staffName = (req.header('rid') || 'developer');
1467
+ const toolName = (req.header('x-mcp-tool-name') || '');
1462
1468
  const { mcpName, mcpVersion, repo, branch, publishReason, versionType, publishExternalNPM, publishPackage, } = req.body;
1463
1469
  console.log('[mcp-start]', {
1464
1470
  mcpName,
@@ -1492,6 +1498,7 @@ router$4.post('/mcp-start', async (req, res) => {
1492
1498
  mcpName,
1493
1499
  mcpVersion,
1494
1500
  operationTool: coreModule.get().operation,
1501
+ toolName,
1495
1502
  });
1496
1503
  res.send(result);
1497
1504
  });
@@ -2667,7 +2674,7 @@ async function updateWhiteUserStatus({ status = false, pipelineRunId = '', }) {
2667
2674
 
2668
2675
  const CRON_TIME = '0 */10 * * * *';
2669
2676
  function createUpdateWhiteUserCosCron() {
2670
- if (process.env.NODE_ENV === 'development') {
2677
+ if (process.env.NODE_ENV === 'development' || process.platform !== 'linux') {
2671
2678
  return;
2672
2679
  }
2673
2680
  try {
@@ -2933,9 +2940,19 @@ async function notifyRobot(entry, iwikiUrl, robotNotifyConfig) {
2933
2940
  console.warn('[EmailSync] 未配置机器人 webhookUrl,跳过通知');
2934
2941
  return;
2935
2942
  }
2936
- const contentPreview = entry.content.length > 200
2937
- ? `${entry.content.slice(0, 200)}...`
2938
- : entry.content;
2943
+ // 清理 HTML 标签,避免未闭合标签(如 <style、<table 等)破坏企微 Markdown 渲染
2944
+ const plainContent = entry.content
2945
+ .replace(/<style[\s\S]*?<\/style>/gi, '') // 移除完整的 <style> 块
2946
+ .replace(/<script[\s\S]*?<\/script>/gi, '') // 移除完整的 <script> 块
2947
+ .replace(/<[^>]*>/g, '') // 移除所有 HTML 标签
2948
+ .replace(/&nbsp;/g, ' ') // 替换常见 HTML 实体
2949
+ .replace(/&lt;/g, '<')
2950
+ .replace(/&gt;/g, '>')
2951
+ .replace(/&amp;/g, '&')
2952
+ .trim();
2953
+ const contentPreview = plainContent.length > 200
2954
+ ? `${plainContent.slice(0, 200)}...`
2955
+ : plainContent;
2939
2956
  const message = [
2940
2957
  '📬 **邮件知识已同步到 iwiki**',
2941
2958
  '',
@@ -46,7 +46,7 @@ interface CoreModuleData {
46
46
  operation: OperationTool;
47
47
  mcpValidate: (req: Request, res: Response) => Promise<boolean>;
48
48
  mcpDB?: {
49
- add: (...params: any[]) => Promise<void>;
49
+ add: (mcpName: string, staffName: string, content: string, version?: string, toolName?: string) => Promise<void>;
50
50
  };
51
51
  }
52
52
  interface CoreModule {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-admin-svr",
3
- "version": "0.1.49",
3
+ "version": "1.0.1",
4
4
  "description": "Next Admin 服务端",
5
5
  "keywords": [
6
6
  "vue3",
@@ -26,6 +26,9 @@
26
26
  "lib"
27
27
  ],
28
28
  "dependencies": {
29
+ "@plugin-light/shared": "latest",
30
+ "@tdesign/uniapp": "^0.7.3",
31
+ "@tdesign/uniapp-chat": "^0.2.1",
29
32
  "@tencent-ai/agent-sdk": "latest",
30
33
  "@types/express": "^5.0.6",
31
34
  "@wecom/crypto": "latest",
@@ -36,8 +39,7 @@
36
39
  "multer": "^2.0.2",
37
40
  "t-comm": "latest",
38
41
  "tinify": "^1.8.2",
39
- "tslib": "^2.8.1",
40
- "@plugin-light/shared": "^1.0.15"
42
+ "tslib": "^2.8.1"
41
43
  },
42
44
  "devDependencies": {
43
45
  "axios": "latest"