whistle.mock-plugins 1.4.0-beta.0 → 1.4.0-beta.2

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 (71) hide show
  1. package/VERSION.md +14 -0
  2. package/app/cgi-bin/interfaces.js +2 -0
  3. package/app/cgi-bin/stats.js +22 -12
  4. package/app/public/index.html +1 -1
  5. package/app/public/js/11.index.js +2 -0
  6. package/app/public/js/11.index.js.LICENSE.txt +5 -0
  7. package/app/public/js/704.index.js +2 -0
  8. package/app/public/js/704.index.js.LICENSE.txt +1 -0
  9. package/app/public/js/798.index.js +2 -0
  10. package/app/public/js/798.index.js.LICENSE.txt +53 -0
  11. package/app/public/js/807.index.js +2 -0
  12. package/app/public/js/807.index.js.LICENSE.txt +1 -0
  13. package/app/public/js/968.index.js +2 -0
  14. package/app/public/js/968.index.js.LICENSE.txt +12 -0
  15. package/app/public/js/index.js +1 -1
  16. package/app/public/js/index.js.LICENSE.txt +0 -185
  17. package/package.json +9 -2
  18. package/API.md +0 -247
  19. package/COLUMN_RESIZE_IMPLEMENTATION.md +0 -162
  20. package/FEATURE_ENHANCEMENT.md +0 -157
  21. package/TEST_GUIDE.md +0 -156
  22. package/data/features.json +0 -1
  23. package/data/interfaces.json +0 -1
  24. package/index.html +0 -52
  25. package/initialize.js +0 -32
  26. package/public/bundle.js +0 -2
  27. package/public/bundle.js.LICENSE.txt +0 -38
  28. package/public/index.html +0 -1
  29. package/public/plugin.mock-plugin.html +0 -14
  30. package/rules.txt +0 -22
  31. package/test/api-error.test.js +0 -29
  32. package/test/webdav-sync.test.js +0 -428
  33. package/ui/src/App.css +0 -173
  34. package/ui/src/components/AppLayout.js +0 -407
  35. package/ui/src/components/FeatureCard.js +0 -58
  36. package/ui/src/components/KeyboardShortcutsHelp.js +0 -58
  37. package/ui/src/components/Layout.js +0 -94
  38. package/ui/src/components/MainNav.js +0 -42
  39. package/ui/src/components/PageContainer.js +0 -16
  40. package/ui/src/components/VersionModal.js +0 -99
  41. package/ui/src/components/WebDavSyncModal.js +0 -516
  42. package/ui/src/components/interface-management/DataManagementDrawer.js +0 -115
  43. package/ui/src/components/interface-management/DataManagementModal.js +0 -110
  44. package/ui/src/components/interface-management/InterfaceTestModal.js +0 -313
  45. package/ui/src/components/interface-management/PreviewModal.js +0 -48
  46. package/ui/src/components/interface-management/README.md +0 -184
  47. package/ui/src/components/interface-management/RealResponseRecorder.js +0 -165
  48. package/ui/src/components/interface-management/ResponseContentEditor.js +0 -645
  49. package/ui/src/components/interface-management/constants.js +0 -36
  50. package/ui/src/components/interface-management/index.js +0 -7
  51. package/ui/src/components/interface-management/utils.js +0 -103
  52. package/ui/src/hooks/useKeyboardShortcuts.js +0 -99
  53. package/ui/src/index.html +0 -14
  54. package/ui/src/index.js +0 -50
  55. package/ui/src/pages/InterfaceManagementV2.js +0 -2351
  56. package/ui/src/pages/MockDataV2.js +0 -1122
  57. package/ui/src/pages/Settings.js +0 -341
  58. package/ui/src/pages/Sniffer.js +0 -521
  59. package/ui/src/pages/Stats.js +0 -288
  60. package/ui/src/services/del_api.js +0 -192
  61. package/ui/src/styles/app-layout.css +0 -373
  62. package/ui/src/styles/cyber-theme.css +0 -1234
  63. package/ui/src/styles/earth-theme.css +0 -618
  64. package/ui/src/styles/global.css +0 -224
  65. package/ui/src/styles/interface-management.css +0 -1321
  66. package/ui/src/styles/mock-data.css +0 -1185
  67. package/ui/src/styles/settings.css +0 -252
  68. package/ui/src/styles/version-modal.css +0 -116
  69. package/ui/src/styles/webdav-sync.css +0 -408
  70. package/ui/src/utils/api-error.js +0 -57
  71. package/webpack.config.js +0 -54
package/VERSION.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # 🔄 版本更新记录
2
2
 
3
+ ## 1.4.0-beta.2(2026-10-13)
4
+
5
+ - UI 3.0、新旧界面切换、工作台独立滚动与恢复默认布局反馈的 beta 发布。
6
+ - 与待审批 beta.1 功能一致,重新构建为独立版本;两个界面继续共用原有数据。
7
+
8
+
9
+ ## 1.4.0-beta.1(2026-10-13,待发布)
10
+
11
+ - 统一顶部导航、页面层级和四套主题,增加布局偏好与恢复入口。
12
+ - 接口页升级为模块 / 接口列表 / 详情三栏工作台;支持统一编辑、多响应管理、批量表格列设置和未保存草稿保护。
13
+ - 重整模块、嗅探、统计、设置页面;嗅探支持完整历史与追加响应,统计统一日期 / URL 筛选。
14
+ - 详细验收记录见仓库 `docs/ui-3.0-todo.md`。
15
+
16
+
3
17
  ## v1.4.0-beta.0
4
18
 
5
19
  ### ✨ Feature
@@ -191,6 +191,7 @@ module.exports = function(req, res) {
191
191
  activeResponseId: interfaceData.activeResponseId !== undefined ? interfaceData.activeResponseId : interfacesData.interfaces[index].activeResponseId,
192
192
  targetUrl: interfaceData.targetUrl,
193
193
  customHeaders: interfaceData.customHeaders || {},
194
+ headers: interfaceData.headers || {},
194
195
  paramMatchers: interfaceData.paramMatchers || [],
195
196
  filePath: interfaceData.filePath,
196
197
  httpStatus: interfaceData.httpStatus || 200,
@@ -226,6 +227,7 @@ module.exports = function(req, res) {
226
227
  activeResponseId: interfaceData.activeResponseId || null,
227
228
  targetUrl: interfaceData.targetUrl || '',
228
229
  customHeaders: interfaceData.customHeaders || {},
230
+ headers: interfaceData.headers || {},
229
231
  paramMatchers: interfaceData.paramMatchers || [],
230
232
  filePath: interfaceData.filePath || '',
231
233
  httpStatus: interfaceData.httpStatus || 200,
@@ -14,18 +14,30 @@ module.exports = (req, res) => {
14
14
  const type = req.query.type || 'overview';
15
15
 
16
16
  if (!fs.existsSync(LOGS_FILE)) {
17
- return res.json({ code: 0, data: { logs: [], stats: {} } });
17
+ return res.json({ code: 0, data: { logs: [], timeline: {}, topInterfaces: [], topFeatures: [] } });
18
18
  }
19
19
 
20
20
  const logsData = fs.readJsonSync(LOGS_FILE);
21
21
  const logs = logsData.logs || [];
22
22
 
23
- // 只取最近 7 天的日志做统计(避免数据量过大)
24
23
  const now = new Date();
25
- const sevenDaysAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
24
+ const dayKey = value => {
25
+ const date = new Date(value);
26
+ return `${date.getFullYear()}-${String(date.getMonth()+1).padStart(2,'0')}-${String(date.getDate()).padStart(2,'0')}`;
27
+ };
28
+ const parseDay = value => {
29
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value || '')) return null;
30
+ const date = new Date(`${value}T00:00:00`);
31
+ return Number.isFinite(date.getTime()) && dayKey(date) === value ? date : null;
32
+ };
33
+ const start = req.query.startDate ? parseDay(req.query.startDate) : new Date(now.getFullYear(),now.getMonth(),now.getDate()-6);
34
+ const end = req.query.endDate ? parseDay(req.query.endDate) : new Date(now.getFullYear(),now.getMonth(),now.getDate());
35
+ if (!start || !end || start > end || end-start > 366*86400000) return res.status(400).json({code:400,message:'请选择有效的日期范围(最多 366 天)'});
36
+ const endExclusive = new Date(end); endExclusive.setDate(endExclusive.getDate()+1);
37
+ const filterUrl = String(req.query.url || '').toLowerCase();
26
38
  const recentLogs = logs.filter(log => {
27
39
  const t = new Date(log.timestamp);
28
- return t >= sevenDaysAgo;
40
+ return t >= start && t < endExclusive && (!filterUrl || String(log.url || '').toLowerCase().includes(filterUrl));
29
41
  });
30
42
 
31
43
  // 分离命中和未命中
@@ -69,7 +81,7 @@ module.exports = (req, res) => {
69
81
  const id = log.interfaceId || log.interfaceName || 'unknown';
70
82
  const name = log.interfaceName || id;
71
83
  if (!interfaceHitMap[id]) {
72
- interfaceHitMap[id] = { id, name, count: 0 };
84
+ interfaceHitMap[id] = { id, name, featureId: log.featureId, count: 0 };
73
85
  }
74
86
  interfaceHitMap[id].count++;
75
87
  });
@@ -80,7 +92,7 @@ module.exports = (req, res) => {
80
92
  // Top 10 命中功能模块
81
93
  const featureHitMap = {};
82
94
  hitLogs.forEach(log => {
83
- const id = log.featureName || log.featureId || 'unknown';
95
+ const id = log.featureId || log.featureName || 'unknown';
84
96
  const name = log.featureName || '未分类';
85
97
  if (!featureHitMap[id]) {
86
98
  featureHitMap[id] = { id, name, count: 0 };
@@ -98,13 +110,11 @@ module.exports = (req, res) => {
98
110
  case 'timeline': {
99
111
  // 最近 7 天每天的命中数
100
112
  const timeline = {};
101
- for (let i = 6; i >= 0; i--) {
102
- const d = new Date(now.getTime() - i * 24 * 60 * 60 * 1000);
103
- const key = d.toISOString().slice(0, 10);
104
- timeline[key] = 0;
113
+ for (let date = new Date(start); date <= end; date.setDate(date.getDate()+1)) {
114
+ timeline[dayKey(date)] = 0;
105
115
  }
106
116
  hitLogs.forEach(log => {
107
- const key = new Date(log.timestamp).toISOString().slice(0, 10);
117
+ const key = dayKey(log.timestamp);
108
118
  if (timeline[key] !== undefined) {
109
119
  timeline[key]++;
110
120
  }
@@ -120,7 +130,7 @@ module.exports = (req, res) => {
120
130
 
121
131
  if (filterDate) {
122
132
  filteredLogs = filteredLogs.filter(log => {
123
- const logDate = new Date(log.timestamp).toISOString().slice(0, 10);
133
+ const logDate = dayKey(log.timestamp);
124
134
  return logDate === filterDate;
125
135
  });
126
136
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Whistle Mock Plugin</title><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&family=Orbitron:wght@400;500;600;700;800;900&family=Share+Tech+Mono&display=swap" rel="stylesheet"><script defer="defer" src="/js/index.js"></script></head><body><div id="root"></div></body></html>
1
+ <!doctype html><html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Whistle Mock Plugin</title><script defer="defer" src="/js/index.js"></script></head><body><div id="root"></div></body></html>