whistle.mock-plugins 1.0.0

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 (68) hide show
  1. package/API.md +247 -0
  2. package/README.md +91 -0
  3. package/app/cgi-bin/features.js +285 -0
  4. package/app/cgi-bin/index.js +31 -0
  5. package/app/cgi-bin/interfaces.js +409 -0
  6. package/app/cgi-bin/logs.js +151 -0
  7. package/app/cgi-bin/test-interface.js +152 -0
  8. package/app/public/index.html +1 -0
  9. package/app/public/js/index.js +2 -0
  10. package/app/public/js/index.js.LICENSE.txt +150 -0
  11. package/app/util/index.js +24 -0
  12. package/index.html +52 -0
  13. package/initialize.js +32 -0
  14. package/lib/dataManager.js +500 -0
  15. package/lib/index.js +3 -0
  16. package/lib/models.js +64 -0
  17. package/lib/routes/features.js +213 -0
  18. package/lib/routes/interfaces.js +304 -0
  19. package/lib/routes/proxy.js +239 -0
  20. package/lib/ruleManager.js +551 -0
  21. package/lib/rules-server.js +267 -0
  22. package/lib/server.js +805 -0
  23. package/lib/storage.js +16 -0
  24. package/lib/ui-server.js +68 -0
  25. package/package.json +51 -0
  26. package/public/bundle.js +2 -0
  27. package/public/bundle.js.LICENSE.txt +38 -0
  28. package/public/index.html +1 -0
  29. package/public/plugin.mock-plugin.html +14 -0
  30. package/rules.txt +22 -0
  31. package/test/rulesServer.test.js +120 -0
  32. package/ui/src/App.css +173 -0
  33. package/ui/src/App.js +24 -0
  34. package/ui/src/components/AppLayout.js +149 -0
  35. package/ui/src/components/FeatureCard.js +53 -0
  36. package/ui/src/components/Layout.js +94 -0
  37. package/ui/src/components/MainNav.js +42 -0
  38. package/ui/src/components/PageContainer.js +16 -0
  39. package/ui/src/index.html +11 -0
  40. package/ui/src/index.js +43 -0
  41. package/ui/src/pages/FileProxy.js +235 -0
  42. package/ui/src/pages/FilesPage.js +292 -0
  43. package/ui/src/pages/Home.js +128 -0
  44. package/ui/src/pages/HomePage.js +195 -0
  45. package/ui/src/pages/InterfaceManagement.js +829 -0
  46. package/ui/src/pages/InterfacePage.js +342 -0
  47. package/ui/src/pages/MockData.js +472 -0
  48. package/ui/src/pages/Settings.js +192 -0
  49. package/ui/src/pages/SettingsPage.js +165 -0
  50. package/ui/src/pages/UrlRedirect.js +225 -0
  51. package/ui/src/pages/Welcome.js +155 -0
  52. package/ui/src/services/api.js +186 -0
  53. package/ui/src/styles/app-layout.css +337 -0
  54. package/ui/src/styles/feature-card.css +172 -0
  55. package/ui/src/styles/file-proxy.css +301 -0
  56. package/ui/src/styles/global.css +224 -0
  57. package/ui/src/styles/home.css +123 -0
  58. package/ui/src/styles/index.css +419 -0
  59. package/ui/src/styles/interface-management.css +694 -0
  60. package/ui/src/styles/layout.css +159 -0
  61. package/ui/src/styles/logs-page.css +427 -0
  62. package/ui/src/styles/main-nav.css +52 -0
  63. package/ui/src/styles/mock-data.css +850 -0
  64. package/ui/src/styles/page-container.css +11 -0
  65. package/ui/src/styles/settings.css +208 -0
  66. package/ui/src/styles/url-redirect.css +279 -0
  67. package/ui/src/styles/welcome.css +282 -0
  68. package/webpack.config.js +49 -0
@@ -0,0 +1,11 @@
1
+ .page-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ min-height: 100vh;
5
+ }
6
+
7
+ .page-content {
8
+ flex: 1;
9
+ padding: 20px;
10
+ background-color: #f0f2f5;
11
+ }
@@ -0,0 +1,208 @@
1
+ .settings-container {
2
+ width: 100%;
3
+ max-width: 900px;
4
+ margin: 0 auto;
5
+ background-color: #fff;
6
+ border-radius: 8px;
7
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
8
+ padding: 24px;
9
+ }
10
+
11
+ .settings-header {
12
+ margin-bottom: 24px;
13
+ padding-bottom: 16px;
14
+ border-bottom: 1px solid #f0f0f0;
15
+ }
16
+
17
+ .settings-header h4 {
18
+ margin-bottom: 8px;
19
+ color: #1890ff;
20
+ }
21
+
22
+ .settings-card {
23
+ margin-bottom: 20px;
24
+ }
25
+
26
+ .settings-card .ant-card-head {
27
+ border-bottom: 1px solid #f0f0f0;
28
+ padding-bottom: 0;
29
+ }
30
+
31
+ .settings-card .ant-card-head-title {
32
+ font-size: 16px;
33
+ font-weight: 500;
34
+ }
35
+
36
+ .settings-section {
37
+ margin-bottom: 32px;
38
+ }
39
+
40
+ .settings-section h2 {
41
+ font-size: 16px;
42
+ font-weight: 600;
43
+ color: #262626;
44
+ margin: 0 0 16px 0;
45
+ padding-bottom: 8px;
46
+ border-bottom: 1px solid #f0f0f0;
47
+ }
48
+
49
+ .setting-item {
50
+ display: flex;
51
+ justify-content: space-between;
52
+ align-items: center;
53
+ padding: 12px 0;
54
+ border-bottom: 1px solid #f5f5f5;
55
+ }
56
+
57
+ .setting-item:last-child {
58
+ border-bottom: none;
59
+ }
60
+
61
+ .setting-label {
62
+ display: flex;
63
+ flex-direction: column;
64
+ }
65
+
66
+ .setting-label span:first-child {
67
+ font-weight: 500;
68
+ color: #262626;
69
+ margin-bottom: 4px;
70
+ }
71
+
72
+ .setting-description {
73
+ color: #999;
74
+ font-size: 12px;
75
+ margin-top: 4px;
76
+ }
77
+
78
+ .setting-control {
79
+ display: flex;
80
+ align-items: center;
81
+ }
82
+
83
+ .setting-control input[type="number"] {
84
+ width: 100px;
85
+ height: 32px;
86
+ padding: 0 12px;
87
+ border: 1px solid #d9d9d9;
88
+ border-radius: 4px;
89
+ font-size: 14px;
90
+ }
91
+
92
+ /* 切换开关样式 */
93
+ .switch {
94
+ position: relative;
95
+ display: inline-block;
96
+ width: 36px;
97
+ height: 20px;
98
+ }
99
+
100
+ .switch input {
101
+ opacity: 0;
102
+ width: 0;
103
+ height: 0;
104
+ }
105
+
106
+ .slider {
107
+ position: absolute;
108
+ cursor: pointer;
109
+ top: 0;
110
+ left: 0;
111
+ right: 0;
112
+ bottom: 0;
113
+ background-color: #ccc;
114
+ transition: .4s;
115
+ border-radius: 20px;
116
+ }
117
+
118
+ .slider:before {
119
+ position: absolute;
120
+ content: "";
121
+ height: 16px;
122
+ width: 16px;
123
+ left: 2px;
124
+ bottom: 2px;
125
+ background-color: white;
126
+ transition: .4s;
127
+ border-radius: 50%;
128
+ }
129
+
130
+ input:checked + .slider {
131
+ background-color: #1890ff;
132
+ }
133
+
134
+ input:checked + .slider:before {
135
+ transform: translateX(16px);
136
+ }
137
+
138
+ .settings-actions {
139
+ display: flex;
140
+ justify-content: flex-end;
141
+ margin-top: 24px;
142
+ padding-top: 16px;
143
+ border-top: 1px solid #f0f0f0;
144
+ }
145
+
146
+ .reset-button {
147
+ height: 32px;
148
+ padding: 0 16px;
149
+ background-color: white;
150
+ border: 1px solid #d9d9d9;
151
+ border-radius: 4px;
152
+ cursor: pointer;
153
+ font-size: 14px;
154
+ }
155
+
156
+ .save-button {
157
+ height: 32px;
158
+ padding: 0 16px;
159
+ background-color: #1890ff;
160
+ color: white;
161
+ border: none;
162
+ border-radius: 4px;
163
+ cursor: pointer;
164
+ font-size: 14px;
165
+ }
166
+
167
+ .reset-button:disabled,
168
+ .save-button:disabled {
169
+ opacity: 0.5;
170
+ cursor: not-allowed;
171
+ }
172
+
173
+ .about-section {
174
+ margin-top: 20px;
175
+ }
176
+
177
+ .about-content {
178
+ display: flex;
179
+ flex-direction: column;
180
+ gap: 16px;
181
+ }
182
+
183
+ .plugin-info p {
184
+ margin: 8px 0;
185
+ }
186
+
187
+ .plugin-description p {
188
+ margin: 8px 0;
189
+ color: #595959;
190
+ line-height: 1.5;
191
+ }
192
+
193
+ /* 响应式调整 */
194
+ @media (max-width: 768px) {
195
+ .settings-container {
196
+ padding: 16px;
197
+ }
198
+
199
+ .settings-actions {
200
+ flex-direction: column;
201
+ align-items: center;
202
+ }
203
+
204
+ .settings-actions button {
205
+ width: 100%;
206
+ margin-bottom: 8px;
207
+ }
208
+ }
@@ -0,0 +1,279 @@
1
+ .url-redirect-container {
2
+ height: 100%;
3
+ }
4
+
5
+ .page-header {
6
+ display: flex;
7
+ justify-content: space-between;
8
+ align-items: center;
9
+ margin-bottom: 16px;
10
+ }
11
+
12
+ .page-header h1 {
13
+ font-size: 20px;
14
+ font-weight: 600;
15
+ color: #262626;
16
+ margin: 0;
17
+ }
18
+
19
+ .add-button {
20
+ background-color: #1890ff;
21
+ color: white;
22
+ border: none;
23
+ border-radius: 4px;
24
+ padding: 0 16px;
25
+ height: 32px;
26
+ cursor: pointer;
27
+ font-size: 14px;
28
+ display: flex;
29
+ align-items: center;
30
+ }
31
+
32
+ .add-button:hover {
33
+ background-color: #40a9ff;
34
+ }
35
+
36
+ .redirect-list-container {
37
+ background-color: white;
38
+ border-radius: 4px;
39
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
40
+ overflow: hidden;
41
+ }
42
+
43
+ .redirect-table {
44
+ width: 100%;
45
+ border-collapse: collapse;
46
+ }
47
+
48
+ .redirect-table th,
49
+ .redirect-table td {
50
+ padding: 12px 16px;
51
+ text-align: left;
52
+ border-bottom: 1px solid #f0f0f0;
53
+ }
54
+
55
+ .redirect-table th {
56
+ background-color: #fafafa;
57
+ color: #8c8c8c;
58
+ font-weight: 500;
59
+ font-size: 14px;
60
+ }
61
+
62
+ .redirect-table tr:hover {
63
+ background-color: #fafafa;
64
+ }
65
+
66
+ .redirect-table tr.inactive {
67
+ color: #a6a6a6;
68
+ background-color: #f9f9f9;
69
+ }
70
+
71
+ .url-text {
72
+ font-family: monospace;
73
+ word-break: break-all;
74
+ }
75
+
76
+ .action-buttons {
77
+ display: flex;
78
+ gap: 8px;
79
+ }
80
+
81
+ .edit-button,
82
+ .delete-button {
83
+ border: none;
84
+ border-radius: 4px;
85
+ padding: 4px 8px;
86
+ cursor: pointer;
87
+ font-size: 12px;
88
+ }
89
+
90
+ .edit-button {
91
+ background-color: #e6f7ff;
92
+ color: #1890ff;
93
+ }
94
+
95
+ .edit-button:hover {
96
+ background-color: #bae7ff;
97
+ }
98
+
99
+ .delete-button {
100
+ background-color: #fff1f0;
101
+ color: #f5222d;
102
+ }
103
+
104
+ .delete-button:hover {
105
+ background-color: #ffccc7;
106
+ }
107
+
108
+ /* 切换开关样式 */
109
+ .switch {
110
+ position: relative;
111
+ display: inline-block;
112
+ width: 36px;
113
+ height: 20px;
114
+ }
115
+
116
+ .switch input {
117
+ opacity: 0;
118
+ width: 0;
119
+ height: 0;
120
+ }
121
+
122
+ .slider {
123
+ position: absolute;
124
+ cursor: pointer;
125
+ top: 0;
126
+ left: 0;
127
+ right: 0;
128
+ bottom: 0;
129
+ background-color: #ccc;
130
+ transition: .4s;
131
+ border-radius: 20px;
132
+ }
133
+
134
+ .slider:before {
135
+ position: absolute;
136
+ content: "";
137
+ height: 16px;
138
+ width: 16px;
139
+ left: 2px;
140
+ bottom: 2px;
141
+ background-color: white;
142
+ transition: .4s;
143
+ border-radius: 50%;
144
+ }
145
+
146
+ input:checked + .slider {
147
+ background-color: #1890ff;
148
+ }
149
+
150
+ input:checked + .slider:before {
151
+ transform: translateX(16px);
152
+ }
153
+
154
+ /* 空数据样式 */
155
+ .empty-data {
156
+ display: flex;
157
+ flex-direction: column;
158
+ align-items: center;
159
+ justify-content: center;
160
+ padding: 60px 0;
161
+ color: #8c8c8c;
162
+ }
163
+
164
+ .empty-icon {
165
+ font-size: 48px;
166
+ margin-bottom: 16px;
167
+ color: #d9d9d9;
168
+ }
169
+
170
+ .empty-text {
171
+ font-size: 16px;
172
+ margin-bottom: 24px;
173
+ color: #8c8c8c;
174
+ }
175
+
176
+ /* 模态框样式 */
177
+ .modal-overlay {
178
+ position: fixed;
179
+ top: 0;
180
+ left: 0;
181
+ right: 0;
182
+ bottom: 0;
183
+ background-color: rgba(0, 0, 0, 0.5);
184
+ display: flex;
185
+ align-items: center;
186
+ justify-content: center;
187
+ z-index: 1000;
188
+ }
189
+
190
+ .modal {
191
+ background-color: white;
192
+ border-radius: 4px;
193
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
194
+ width: 500px;
195
+ max-width: 90%;
196
+ max-height: 90vh;
197
+ overflow-y: auto;
198
+ }
199
+
200
+ .modal-header {
201
+ display: flex;
202
+ justify-content: space-between;
203
+ align-items: center;
204
+ padding: 16px;
205
+ border-bottom: 1px solid #f0f0f0;
206
+ }
207
+
208
+ .modal-header h2 {
209
+ margin: 0;
210
+ font-size: 16px;
211
+ font-weight: 600;
212
+ color: #262626;
213
+ }
214
+
215
+ .close-button {
216
+ background: none;
217
+ border: none;
218
+ font-size: 20px;
219
+ color: #8c8c8c;
220
+ cursor: pointer;
221
+ }
222
+
223
+ .redirect-form {
224
+ padding: 16px;
225
+ }
226
+
227
+ .form-group {
228
+ margin-bottom: 16px;
229
+ }
230
+
231
+ .form-group label {
232
+ display: block;
233
+ margin-bottom: 8px;
234
+ font-weight: 500;
235
+ color: #262626;
236
+ }
237
+
238
+ .form-group input {
239
+ width: 100%;
240
+ height: 32px;
241
+ padding: 0 12px;
242
+ border: 1px solid #d9d9d9;
243
+ border-radius: 4px;
244
+ font-size: 14px;
245
+ }
246
+
247
+ .help-text {
248
+ font-size: 12px;
249
+ color: #8c8c8c;
250
+ margin-top: 4px;
251
+ }
252
+
253
+ .form-actions {
254
+ display: flex;
255
+ justify-content: flex-end;
256
+ gap: 8px;
257
+ margin-top: 24px;
258
+ }
259
+
260
+ .cancel-button {
261
+ height: 32px;
262
+ padding: 0 16px;
263
+ background-color: white;
264
+ border: 1px solid #d9d9d9;
265
+ border-radius: 4px;
266
+ cursor: pointer;
267
+ font-size: 14px;
268
+ }
269
+
270
+ .submit-button {
271
+ height: 32px;
272
+ padding: 0 16px;
273
+ background-color: #1890ff;
274
+ color: white;
275
+ border: none;
276
+ border-radius: 4px;
277
+ cursor: pointer;
278
+ font-size: 14px;
279
+ }