smfetch 1.0.1__py3-none-any.whl
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.
- smfetch/__init__.py +0 -0
- smfetch/app.py +260 -0
- smfetch/config.py +115 -0
- smfetch/jobs.py +105 -0
- smfetch/smonline.py +191 -0
- smfetch/static/index.html +1185 -0
- smfetch/zenius.py +296 -0
- smfetch-1.0.1.dist-info/METADATA +50 -0
- smfetch-1.0.1.dist-info/RECORD +11 -0
- smfetch-1.0.1.dist-info/WHEEL +4 -0
- smfetch-1.0.1.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,1185 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>smfetch</title>
|
|
7
|
+
<style>
|
|
8
|
+
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');
|
|
9
|
+
|
|
10
|
+
:root {
|
|
11
|
+
--bg: #0c0c0f;
|
|
12
|
+
--bg-raised: #14141a;
|
|
13
|
+
--bg-input: #1a1a22;
|
|
14
|
+
--border: #2a2a35;
|
|
15
|
+
--border-focus: #5a5aff;
|
|
16
|
+
--text: #e0e0e8;
|
|
17
|
+
--text-dim: #7a7a8a;
|
|
18
|
+
--text-bright: #ffffff;
|
|
19
|
+
--accent: #6c6cff;
|
|
20
|
+
--accent-dim: #4a4aaa;
|
|
21
|
+
--green: #4ade80;
|
|
22
|
+
--green-dim: #166534;
|
|
23
|
+
--red: #f87171;
|
|
24
|
+
--red-dim: #7f1d1d;
|
|
25
|
+
--yellow: #fbbf24;
|
|
26
|
+
--yellow-dim: #713f12;
|
|
27
|
+
--orange: #fb923c;
|
|
28
|
+
--radius: 6px;
|
|
29
|
+
--mono: 'JetBrains Mono', monospace;
|
|
30
|
+
--sans: 'Outfit', system-ui, sans-serif;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
34
|
+
|
|
35
|
+
html, body { height: 100%; }
|
|
36
|
+
|
|
37
|
+
body {
|
|
38
|
+
font-family: var(--sans);
|
|
39
|
+
background: var(--bg);
|
|
40
|
+
color: var(--text);
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
min-height: 100vh;
|
|
44
|
+
line-height: 1.5;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* --- Header --- */
|
|
48
|
+
header {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
padding: 12px 24px;
|
|
53
|
+
border-bottom: 1px solid var(--border);
|
|
54
|
+
background: var(--bg-raised);
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.logo {
|
|
59
|
+
font-family: var(--mono);
|
|
60
|
+
font-weight: 700;
|
|
61
|
+
font-size: 18px;
|
|
62
|
+
color: var(--accent);
|
|
63
|
+
letter-spacing: -0.5px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.logo span { color: var(--text-dim); font-weight: 400; }
|
|
67
|
+
|
|
68
|
+
.header-right { display: flex; gap: 10px; align-items: center; }
|
|
69
|
+
|
|
70
|
+
.job-badge {
|
|
71
|
+
font-family: var(--mono);
|
|
72
|
+
font-size: 12px;
|
|
73
|
+
padding: 4px 10px;
|
|
74
|
+
border-radius: 20px;
|
|
75
|
+
background: var(--bg);
|
|
76
|
+
border: 1px solid var(--border);
|
|
77
|
+
color: var(--text-dim);
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
transition: all 0.15s;
|
|
80
|
+
}
|
|
81
|
+
.job-badge:hover { border-color: var(--accent); color: var(--text); }
|
|
82
|
+
.job-badge.has-active { border-color: var(--green); color: var(--green); }
|
|
83
|
+
|
|
84
|
+
.icon-btn {
|
|
85
|
+
background: none;
|
|
86
|
+
border: 1px solid var(--border);
|
|
87
|
+
color: var(--text-dim);
|
|
88
|
+
width: 32px;
|
|
89
|
+
height: 32px;
|
|
90
|
+
border-radius: var(--radius);
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
font-size: 16px;
|
|
96
|
+
transition: all 0.15s;
|
|
97
|
+
}
|
|
98
|
+
.icon-btn:hover { border-color: var(--accent); color: var(--text); }
|
|
99
|
+
|
|
100
|
+
/* --- Layout --- */
|
|
101
|
+
.main-layout {
|
|
102
|
+
display: flex;
|
|
103
|
+
flex: 1;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* --- Sidebar --- */
|
|
108
|
+
.sidebar {
|
|
109
|
+
width: 220px;
|
|
110
|
+
border-right: 1px solid var(--border);
|
|
111
|
+
background: var(--bg-raised);
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
flex-shrink: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.sidebar-section {
|
|
118
|
+
padding: 16px 12px 8px;
|
|
119
|
+
font-size: 10px;
|
|
120
|
+
font-weight: 600;
|
|
121
|
+
text-transform: uppercase;
|
|
122
|
+
letter-spacing: 1.2px;
|
|
123
|
+
color: var(--text-dim);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.sidebar-item {
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: 8px;
|
|
130
|
+
padding: 8px 16px;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
font-size: 13px;
|
|
133
|
+
font-weight: 400;
|
|
134
|
+
color: var(--text-dim);
|
|
135
|
+
transition: all 0.1s;
|
|
136
|
+
border-left: 2px solid transparent;
|
|
137
|
+
}
|
|
138
|
+
.sidebar-item:hover { color: var(--text); background: rgba(255,255,255,0.03); }
|
|
139
|
+
.sidebar-item.active {
|
|
140
|
+
color: var(--accent);
|
|
141
|
+
background: rgba(108,108,255,0.06);
|
|
142
|
+
border-left-color: var(--accent);
|
|
143
|
+
font-weight: 500;
|
|
144
|
+
}
|
|
145
|
+
.sidebar-item .icon { font-size: 15px; width: 20px; text-align: center; }
|
|
146
|
+
|
|
147
|
+
/* --- Content --- */
|
|
148
|
+
.content {
|
|
149
|
+
flex: 1;
|
|
150
|
+
overflow-y: auto;
|
|
151
|
+
padding: 24px 32px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.page { display: none; }
|
|
155
|
+
.page.active { display: block; }
|
|
156
|
+
|
|
157
|
+
.page-title {
|
|
158
|
+
font-size: 20px;
|
|
159
|
+
font-weight: 600;
|
|
160
|
+
margin-bottom: 20px;
|
|
161
|
+
color: var(--text-bright);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.page-subtitle {
|
|
165
|
+
font-size: 13px;
|
|
166
|
+
color: var(--text-dim);
|
|
167
|
+
margin-top: -14px;
|
|
168
|
+
margin-bottom: 20px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* --- Form --- */
|
|
172
|
+
.form-row {
|
|
173
|
+
display: flex;
|
|
174
|
+
gap: 10px;
|
|
175
|
+
margin-bottom: 14px;
|
|
176
|
+
align-items: flex-end;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.form-group {
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
gap: 4px;
|
|
183
|
+
flex: 1;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.form-group label {
|
|
187
|
+
font-size: 11px;
|
|
188
|
+
font-weight: 500;
|
|
189
|
+
text-transform: uppercase;
|
|
190
|
+
letter-spacing: 0.6px;
|
|
191
|
+
color: var(--text-dim);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
input[type="text"], input[type="search"] {
|
|
195
|
+
font-family: var(--mono);
|
|
196
|
+
font-size: 13px;
|
|
197
|
+
padding: 8px 12px;
|
|
198
|
+
background: var(--bg-input);
|
|
199
|
+
border: 1px solid var(--border);
|
|
200
|
+
border-radius: var(--radius);
|
|
201
|
+
color: var(--text);
|
|
202
|
+
outline: none;
|
|
203
|
+
transition: border-color 0.15s;
|
|
204
|
+
}
|
|
205
|
+
input:focus { border-color: var(--border-focus); }
|
|
206
|
+
input::placeholder { color: var(--text-dim); opacity: 0.6; }
|
|
207
|
+
|
|
208
|
+
/* --- Buttons --- */
|
|
209
|
+
.btn {
|
|
210
|
+
font-family: var(--sans);
|
|
211
|
+
font-size: 13px;
|
|
212
|
+
font-weight: 500;
|
|
213
|
+
padding: 8px 16px;
|
|
214
|
+
border-radius: var(--radius);
|
|
215
|
+
border: 1px solid var(--border);
|
|
216
|
+
background: var(--bg-input);
|
|
217
|
+
color: var(--text);
|
|
218
|
+
cursor: pointer;
|
|
219
|
+
transition: all 0.15s;
|
|
220
|
+
white-space: nowrap;
|
|
221
|
+
}
|
|
222
|
+
.btn:hover { border-color: var(--accent); color: var(--text-bright); }
|
|
223
|
+
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
224
|
+
|
|
225
|
+
.btn-primary {
|
|
226
|
+
background: var(--accent);
|
|
227
|
+
border-color: var(--accent);
|
|
228
|
+
color: #fff;
|
|
229
|
+
}
|
|
230
|
+
.btn-primary:hover { background: #5858dd; }
|
|
231
|
+
|
|
232
|
+
.btn-sm { padding: 5px 10px; font-size: 12px; }
|
|
233
|
+
|
|
234
|
+
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
|
|
235
|
+
|
|
236
|
+
/* --- Results table --- */
|
|
237
|
+
.results-container {
|
|
238
|
+
margin-top: 16px;
|
|
239
|
+
border: 1px solid var(--border);
|
|
240
|
+
border-radius: var(--radius);
|
|
241
|
+
overflow: hidden;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.results-header {
|
|
245
|
+
display: flex;
|
|
246
|
+
justify-content: space-between;
|
|
247
|
+
align-items: center;
|
|
248
|
+
padding: 8px 12px;
|
|
249
|
+
background: var(--bg-raised);
|
|
250
|
+
border-bottom: 1px solid var(--border);
|
|
251
|
+
font-size: 12px;
|
|
252
|
+
color: var(--text-dim);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.results-table {
|
|
256
|
+
width: 100%;
|
|
257
|
+
border-collapse: collapse;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.results-table th {
|
|
261
|
+
text-align: left;
|
|
262
|
+
padding: 8px 12px;
|
|
263
|
+
font-size: 10px;
|
|
264
|
+
font-weight: 600;
|
|
265
|
+
text-transform: uppercase;
|
|
266
|
+
letter-spacing: 0.8px;
|
|
267
|
+
color: var(--text-dim);
|
|
268
|
+
background: var(--bg-raised);
|
|
269
|
+
border-bottom: 1px solid var(--border);
|
|
270
|
+
position: sticky;
|
|
271
|
+
top: 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.results-table td {
|
|
275
|
+
padding: 7px 12px;
|
|
276
|
+
font-size: 13px;
|
|
277
|
+
border-bottom: 1px solid rgba(255,255,255,0.03);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.results-table tr:hover td { background: rgba(255,255,255,0.02); }
|
|
281
|
+
|
|
282
|
+
.results-scroll {
|
|
283
|
+
max-height: 440px;
|
|
284
|
+
overflow-y: auto;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* --- Checkbox --- */
|
|
288
|
+
.cb {
|
|
289
|
+
appearance: none;
|
|
290
|
+
width: 16px;
|
|
291
|
+
height: 16px;
|
|
292
|
+
border: 1px solid var(--border);
|
|
293
|
+
border-radius: 3px;
|
|
294
|
+
background: var(--bg-input);
|
|
295
|
+
cursor: pointer;
|
|
296
|
+
flex-shrink: 0;
|
|
297
|
+
position: relative;
|
|
298
|
+
}
|
|
299
|
+
.cb:checked {
|
|
300
|
+
background: var(--accent);
|
|
301
|
+
border-color: var(--accent);
|
|
302
|
+
}
|
|
303
|
+
.cb:checked::after {
|
|
304
|
+
content: '✓';
|
|
305
|
+
position: absolute;
|
|
306
|
+
top: -1px;
|
|
307
|
+
left: 2px;
|
|
308
|
+
font-size: 12px;
|
|
309
|
+
color: #fff;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* --- Status badges --- */
|
|
313
|
+
.badge {
|
|
314
|
+
display: inline-block;
|
|
315
|
+
padding: 2px 8px;
|
|
316
|
+
border-radius: 10px;
|
|
317
|
+
font-size: 11px;
|
|
318
|
+
font-weight: 500;
|
|
319
|
+
font-family: var(--mono);
|
|
320
|
+
}
|
|
321
|
+
.badge-running { background: var(--green-dim); color: var(--green); }
|
|
322
|
+
.badge-pending { background: var(--yellow-dim); color: var(--yellow); }
|
|
323
|
+
.badge-completed { background: rgba(108,108,255,0.15); color: var(--accent); }
|
|
324
|
+
.badge-failed { background: var(--red-dim); color: var(--red); }
|
|
325
|
+
|
|
326
|
+
/* --- Fuzzy filter --- */
|
|
327
|
+
.filter-bar {
|
|
328
|
+
margin-bottom: 12px;
|
|
329
|
+
position: relative;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.filter-bar input {
|
|
333
|
+
width: 100%;
|
|
334
|
+
font-family: var(--mono);
|
|
335
|
+
font-size: 13px;
|
|
336
|
+
padding: 10px 12px 10px 32px;
|
|
337
|
+
background: var(--bg-input);
|
|
338
|
+
border: 1px solid var(--border);
|
|
339
|
+
border-radius: var(--radius);
|
|
340
|
+
color: var(--text);
|
|
341
|
+
outline: none;
|
|
342
|
+
transition: border-color 0.15s;
|
|
343
|
+
}
|
|
344
|
+
.filter-bar input:focus { border-color: var(--border-focus); }
|
|
345
|
+
|
|
346
|
+
.filter-bar .search-icon {
|
|
347
|
+
position: absolute;
|
|
348
|
+
left: 10px;
|
|
349
|
+
top: 50%;
|
|
350
|
+
transform: translateY(-50%);
|
|
351
|
+
color: var(--text-dim);
|
|
352
|
+
font-size: 14px;
|
|
353
|
+
pointer-events: none;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.filter-stats {
|
|
357
|
+
font-size: 11px;
|
|
358
|
+
color: var(--text-dim);
|
|
359
|
+
margin-bottom: 8px;
|
|
360
|
+
font-family: var(--mono);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* --- Bundle cards --- */
|
|
364
|
+
.bundle-grid {
|
|
365
|
+
display: grid;
|
|
366
|
+
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
|
367
|
+
gap: 12px;
|
|
368
|
+
margin-top: 12px;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.bundle-card {
|
|
372
|
+
padding: 16px;
|
|
373
|
+
border: 1px solid var(--border);
|
|
374
|
+
border-radius: var(--radius);
|
|
375
|
+
background: var(--bg-raised);
|
|
376
|
+
cursor: pointer;
|
|
377
|
+
transition: all 0.15s;
|
|
378
|
+
}
|
|
379
|
+
.bundle-card:hover { border-color: var(--accent); transform: translateY(-1px); }
|
|
380
|
+
|
|
381
|
+
.bundle-card .bundle-title {
|
|
382
|
+
font-weight: 600;
|
|
383
|
+
font-size: 15px;
|
|
384
|
+
margin-bottom: 4px;
|
|
385
|
+
color: var(--text-bright);
|
|
386
|
+
}
|
|
387
|
+
.bundle-card .bundle-desc {
|
|
388
|
+
font-size: 12px;
|
|
389
|
+
color: var(--text-dim);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/* --- Jobs panel --- */
|
|
393
|
+
.jobs-overlay {
|
|
394
|
+
display: none;
|
|
395
|
+
position: fixed;
|
|
396
|
+
top: 0; right: 0; bottom: 0;
|
|
397
|
+
width: 400px;
|
|
398
|
+
background: var(--bg-raised);
|
|
399
|
+
border-left: 1px solid var(--border);
|
|
400
|
+
z-index: 100;
|
|
401
|
+
flex-direction: column;
|
|
402
|
+
box-shadow: -4px 0 30px rgba(0,0,0,0.5);
|
|
403
|
+
}
|
|
404
|
+
.jobs-overlay.open { display: flex; }
|
|
405
|
+
|
|
406
|
+
.jobs-header {
|
|
407
|
+
display: flex;
|
|
408
|
+
justify-content: space-between;
|
|
409
|
+
align-items: center;
|
|
410
|
+
padding: 14px 16px;
|
|
411
|
+
border-bottom: 1px solid var(--border);
|
|
412
|
+
}
|
|
413
|
+
.jobs-header h3 { font-size: 15px; font-weight: 600; }
|
|
414
|
+
|
|
415
|
+
.jobs-list {
|
|
416
|
+
flex: 1;
|
|
417
|
+
overflow-y: auto;
|
|
418
|
+
padding: 8px;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.job-item {
|
|
422
|
+
padding: 10px 12px;
|
|
423
|
+
border-radius: var(--radius);
|
|
424
|
+
margin-bottom: 4px;
|
|
425
|
+
background: var(--bg);
|
|
426
|
+
font-size: 13px;
|
|
427
|
+
}
|
|
428
|
+
.job-item .job-name {
|
|
429
|
+
margin-bottom: 4px;
|
|
430
|
+
word-break: break-word;
|
|
431
|
+
}
|
|
432
|
+
.job-item .job-meta {
|
|
433
|
+
display: flex;
|
|
434
|
+
justify-content: space-between;
|
|
435
|
+
align-items: center;
|
|
436
|
+
font-size: 11px;
|
|
437
|
+
color: var(--text-dim);
|
|
438
|
+
font-family: var(--mono);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.jobs-footer {
|
|
442
|
+
padding: 10px 16px;
|
|
443
|
+
border-top: 1px solid var(--border);
|
|
444
|
+
display: flex;
|
|
445
|
+
justify-content: flex-end;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/* --- Settings modal --- */
|
|
449
|
+
.modal-overlay {
|
|
450
|
+
display: none;
|
|
451
|
+
position: fixed;
|
|
452
|
+
inset: 0;
|
|
453
|
+
background: rgba(0,0,0,0.6);
|
|
454
|
+
z-index: 200;
|
|
455
|
+
align-items: center;
|
|
456
|
+
justify-content: center;
|
|
457
|
+
}
|
|
458
|
+
.modal-overlay.open { display: flex; }
|
|
459
|
+
|
|
460
|
+
.modal {
|
|
461
|
+
background: var(--bg-raised);
|
|
462
|
+
border: 1px solid var(--border);
|
|
463
|
+
border-radius: 10px;
|
|
464
|
+
width: 560px;
|
|
465
|
+
max-width: 90vw;
|
|
466
|
+
padding: 24px;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.modal h3 {
|
|
470
|
+
font-size: 17px;
|
|
471
|
+
font-weight: 600;
|
|
472
|
+
margin-bottom: 16px;
|
|
473
|
+
color: var(--text-bright);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.modal .form-group { margin-bottom: 14px; }
|
|
477
|
+
.modal input { width: 100%; }
|
|
478
|
+
|
|
479
|
+
.modal-actions {
|
|
480
|
+
display: flex;
|
|
481
|
+
justify-content: flex-end;
|
|
482
|
+
gap: 8px;
|
|
483
|
+
margin-top: 20px;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/* --- Loading --- */
|
|
487
|
+
.spinner {
|
|
488
|
+
display: inline-block;
|
|
489
|
+
width: 14px;
|
|
490
|
+
height: 14px;
|
|
491
|
+
border: 2px solid var(--border);
|
|
492
|
+
border-top-color: var(--accent);
|
|
493
|
+
border-radius: 50%;
|
|
494
|
+
animation: spin 0.6s linear infinite;
|
|
495
|
+
vertical-align: middle;
|
|
496
|
+
margin-right: 6px;
|
|
497
|
+
}
|
|
498
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
499
|
+
|
|
500
|
+
.loading-msg {
|
|
501
|
+
color: var(--text-dim);
|
|
502
|
+
font-size: 13px;
|
|
503
|
+
padding: 20px 0;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.empty-msg {
|
|
507
|
+
color: var(--text-dim);
|
|
508
|
+
font-size: 13px;
|
|
509
|
+
padding: 24px 0;
|
|
510
|
+
text-align: center;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/* --- Cache status --- */
|
|
514
|
+
.cache-bar {
|
|
515
|
+
display: flex;
|
|
516
|
+
align-items: center;
|
|
517
|
+
gap: 10px;
|
|
518
|
+
margin-bottom: 14px;
|
|
519
|
+
padding: 8px 12px;
|
|
520
|
+
background: var(--bg-raised);
|
|
521
|
+
border: 1px solid var(--border);
|
|
522
|
+
border-radius: var(--radius);
|
|
523
|
+
font-size: 12px;
|
|
524
|
+
color: var(--text-dim);
|
|
525
|
+
font-family: var(--mono);
|
|
526
|
+
}
|
|
527
|
+
.cache-bar .dot {
|
|
528
|
+
width: 8px;
|
|
529
|
+
height: 8px;
|
|
530
|
+
border-radius: 50%;
|
|
531
|
+
flex-shrink: 0;
|
|
532
|
+
}
|
|
533
|
+
.cache-bar .dot.green { background: var(--green); }
|
|
534
|
+
.cache-bar .dot.yellow { background: var(--yellow); animation: pulse 1s infinite; }
|
|
535
|
+
@keyframes pulse { 50% { opacity: 0.4; } }
|
|
536
|
+
|
|
537
|
+
/* --- Toast --- */
|
|
538
|
+
.toast-container {
|
|
539
|
+
position: fixed;
|
|
540
|
+
bottom: 20px;
|
|
541
|
+
right: 20px;
|
|
542
|
+
z-index: 300;
|
|
543
|
+
display: flex;
|
|
544
|
+
flex-direction: column;
|
|
545
|
+
gap: 6px;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.toast {
|
|
549
|
+
padding: 10px 16px;
|
|
550
|
+
border-radius: var(--radius);
|
|
551
|
+
font-size: 13px;
|
|
552
|
+
background: var(--bg-raised);
|
|
553
|
+
border: 1px solid var(--border);
|
|
554
|
+
color: var(--text);
|
|
555
|
+
animation: slideIn 0.2s ease;
|
|
556
|
+
max-width: 340px;
|
|
557
|
+
}
|
|
558
|
+
.toast.success { border-color: var(--green); }
|
|
559
|
+
.toast.error { border-color: var(--red); }
|
|
560
|
+
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
561
|
+
|
|
562
|
+
/* Scrollbar */
|
|
563
|
+
::-webkit-scrollbar { width: 6px; }
|
|
564
|
+
::-webkit-scrollbar-track { background: transparent; }
|
|
565
|
+
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
|
|
566
|
+
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
|
|
567
|
+
|
|
568
|
+
.select-all-row {
|
|
569
|
+
display: flex;
|
|
570
|
+
align-items: center;
|
|
571
|
+
gap: 6px;
|
|
572
|
+
padding: 6px 12px;
|
|
573
|
+
font-size: 12px;
|
|
574
|
+
color: var(--text-dim);
|
|
575
|
+
border-bottom: 1px solid var(--border);
|
|
576
|
+
background: var(--bg-raised);
|
|
577
|
+
}
|
|
578
|
+
</style>
|
|
579
|
+
</head>
|
|
580
|
+
<body>
|
|
581
|
+
|
|
582
|
+
<!-- Header -->
|
|
583
|
+
<header>
|
|
584
|
+
<div class="logo">smfetch<span> v1.0</span></div>
|
|
585
|
+
<div class="header-right">
|
|
586
|
+
<button class="job-badge" id="jobBadge" onclick="toggleJobs()">0 jobs</button>
|
|
587
|
+
<button class="icon-btn" onclick="openSettings()" title="Settings">⚙</button>
|
|
588
|
+
</div>
|
|
589
|
+
</header>
|
|
590
|
+
|
|
591
|
+
<!-- Main layout -->
|
|
592
|
+
<div class="main-layout">
|
|
593
|
+
<!-- Sidebar -->
|
|
594
|
+
<nav class="sidebar">
|
|
595
|
+
<div class="sidebar-section">Zenius-i-Vanisher</div>
|
|
596
|
+
<div class="sidebar-item active" data-page="zen-songs" onclick="navigate(this)">
|
|
597
|
+
<span class="icon">♪</span> Song Search
|
|
598
|
+
</div>
|
|
599
|
+
<div class="sidebar-item" data-page="zen-packs" onclick="navigate(this)">
|
|
600
|
+
<span class="icon">📦</span> Pack Search
|
|
601
|
+
</div>
|
|
602
|
+
<div class="sidebar-item" data-page="zen-bundles" onclick="navigate(this)">
|
|
603
|
+
<span class="icon">⬇</span> Download Bundles
|
|
604
|
+
</div>
|
|
605
|
+
<div class="sidebar-section">StepManiaOnline</div>
|
|
606
|
+
<div class="sidebar-item" data-page="smo-title" onclick="navigate(this)">
|
|
607
|
+
<span class="icon">♪</span> Search Title
|
|
608
|
+
</div>
|
|
609
|
+
<div class="sidebar-item" data-page="smo-artist" onclick="navigate(this)">
|
|
610
|
+
<span class="icon">🎤</span> Search Artist
|
|
611
|
+
</div>
|
|
612
|
+
<div class="sidebar-item" data-page="smo-packs" onclick="navigate(this)">
|
|
613
|
+
<span class="icon">📦</span> Search Pack
|
|
614
|
+
</div>
|
|
615
|
+
</nav>
|
|
616
|
+
|
|
617
|
+
<!-- Content -->
|
|
618
|
+
<main class="content">
|
|
619
|
+
|
|
620
|
+
<!-- Zenius: Song Search -->
|
|
621
|
+
<div class="page active" id="page-zen-songs">
|
|
622
|
+
<div class="page-title">Song Search</div>
|
|
623
|
+
<div class="page-subtitle">Search the Zenius-i-Vanisher database by song name and/or artist</div>
|
|
624
|
+
<div class="form-row">
|
|
625
|
+
<div class="form-group">
|
|
626
|
+
<label>Song title</label>
|
|
627
|
+
<input type="text" id="zenSongTitle" placeholder="e.g. Paranoia" onkeydown="if(event.key==='Enter')zenSearchSongs()">
|
|
628
|
+
</div>
|
|
629
|
+
<div class="form-group">
|
|
630
|
+
<label>Artist</label>
|
|
631
|
+
<input type="text" id="zenSongArtist" placeholder="e.g. 180" onkeydown="if(event.key==='Enter')zenSearchSongs()">
|
|
632
|
+
</div>
|
|
633
|
+
<button class="btn btn-primary" onclick="zenSearchSongs()" id="zenSearchBtn">Search</button>
|
|
634
|
+
</div>
|
|
635
|
+
<div id="zenSongResults"></div>
|
|
636
|
+
</div>
|
|
637
|
+
|
|
638
|
+
<!-- Zenius: Pack Search -->
|
|
639
|
+
<div class="page" id="page-zen-packs">
|
|
640
|
+
<div class="page-title">Pack Search</div>
|
|
641
|
+
<div class="page-subtitle">Browse and search packs from Zenius-i-Vanisher</div>
|
|
642
|
+
<div class="form-row">
|
|
643
|
+
<div class="btn-group">
|
|
644
|
+
<button class="btn" onclick="zenLoadPacks('OFFICIAL')" id="zenPackOfficialBtn">Official Packs</button>
|
|
645
|
+
<button class="btn" onclick="zenLoadPacks('USER')" id="zenPackUserBtn">User Packs</button>
|
|
646
|
+
</div>
|
|
647
|
+
</div>
|
|
648
|
+
<div id="zenPackArea"></div>
|
|
649
|
+
</div>
|
|
650
|
+
|
|
651
|
+
<!-- Zenius: Download Bundles -->
|
|
652
|
+
<div class="page" id="page-zen-bundles">
|
|
653
|
+
<div class="page-title">Download Bundles</div>
|
|
654
|
+
<div class="page-subtitle">Quickly download entire groups of official packs</div>
|
|
655
|
+
<div class="bundle-grid">
|
|
656
|
+
<div class="bundle-card" onclick="zenDownloadGroup('ARCADE')">
|
|
657
|
+
<div class="bundle-title">Arcade Packs</div>
|
|
658
|
+
<div class="bundle-desc">All official DDR arcade releases</div>
|
|
659
|
+
</div>
|
|
660
|
+
<div class="bundle-card" onclick="zenDownloadGroup('SPINOFF')">
|
|
661
|
+
<div class="bundle-title">Spinoff Packs</div>
|
|
662
|
+
<div class="bundle-desc">Console exclusives and spinoff titles</div>
|
|
663
|
+
</div>
|
|
664
|
+
<div class="bundle-card" onclick="zenDownloadGroup('OFFICIAL')">
|
|
665
|
+
<div class="bundle-title">All Official</div>
|
|
666
|
+
<div class="bundle-desc">Everything: arcade + spinoff combined</div>
|
|
667
|
+
</div>
|
|
668
|
+
</div>
|
|
669
|
+
</div>
|
|
670
|
+
|
|
671
|
+
<!-- SMOnline: Search Title -->
|
|
672
|
+
<div class="page" id="page-smo-title">
|
|
673
|
+
<div class="page-title">Search by Title</div>
|
|
674
|
+
<div class="page-subtitle">Find songs on StepManiaOnline by title</div>
|
|
675
|
+
<div class="form-row">
|
|
676
|
+
<div class="form-group">
|
|
677
|
+
<label>Song title</label>
|
|
678
|
+
<input type="text" id="smoTitleQuery" placeholder="e.g. butterfly" onkeydown="if(event.key==='Enter')smoSearch('title')">
|
|
679
|
+
</div>
|
|
680
|
+
<button class="btn btn-primary" onclick="smoSearch('title')">Search</button>
|
|
681
|
+
</div>
|
|
682
|
+
<div id="smoTitleResults"></div>
|
|
683
|
+
</div>
|
|
684
|
+
|
|
685
|
+
<!-- SMOnline: Search Artist -->
|
|
686
|
+
<div class="page" id="page-smo-artist">
|
|
687
|
+
<div class="page-title">Search by Artist</div>
|
|
688
|
+
<div class="page-subtitle">Find songs on StepManiaOnline by artist name</div>
|
|
689
|
+
<div class="form-row">
|
|
690
|
+
<div class="form-group">
|
|
691
|
+
<label>Artist name</label>
|
|
692
|
+
<input type="text" id="smoArtistQuery" placeholder="e.g. Naoki" onkeydown="if(event.key==='Enter')smoSearch('artist')">
|
|
693
|
+
</div>
|
|
694
|
+
<button class="btn btn-primary" onclick="smoSearch('artist')">Search</button>
|
|
695
|
+
</div>
|
|
696
|
+
<div id="smoArtistResults"></div>
|
|
697
|
+
</div>
|
|
698
|
+
|
|
699
|
+
<!-- SMOnline: Pack Search -->
|
|
700
|
+
<div class="page" id="page-smo-packs">
|
|
701
|
+
<div class="page-title">Search Packs</div>
|
|
702
|
+
<div class="page-subtitle">Browse all packs on StepManiaOnline with instant fuzzy search</div>
|
|
703
|
+
<div id="smoPackArea">
|
|
704
|
+
<div class="loading-msg"><span class="spinner"></span> Loading pack cache...</div>
|
|
705
|
+
</div>
|
|
706
|
+
</div>
|
|
707
|
+
|
|
708
|
+
</main>
|
|
709
|
+
</div>
|
|
710
|
+
|
|
711
|
+
<!-- Jobs panel -->
|
|
712
|
+
<div class="jobs-overlay" id="jobsPanel">
|
|
713
|
+
<div class="jobs-header">
|
|
714
|
+
<h3>Downloads</h3>
|
|
715
|
+
<button class="icon-btn" onclick="toggleJobs()">✕</button>
|
|
716
|
+
</div>
|
|
717
|
+
<div class="jobs-list" id="jobsList"></div>
|
|
718
|
+
<div class="jobs-footer">
|
|
719
|
+
<button class="btn btn-sm" onclick="clearJobs()">Clear finished</button>
|
|
720
|
+
</div>
|
|
721
|
+
</div>
|
|
722
|
+
|
|
723
|
+
<!-- Settings modal -->
|
|
724
|
+
<div class="modal-overlay" id="settingsModal">
|
|
725
|
+
<div class="modal">
|
|
726
|
+
<h3>Settings</h3>
|
|
727
|
+
<div class="form-group">
|
|
728
|
+
<label>Songs directory</label>
|
|
729
|
+
<input type="text" id="cfgSongs">
|
|
730
|
+
</div>
|
|
731
|
+
<div class="form-group">
|
|
732
|
+
<label>Log directory</label>
|
|
733
|
+
<input type="text" id="cfgLogs">
|
|
734
|
+
</div>
|
|
735
|
+
<div class="form-group">
|
|
736
|
+
<label>Config directory</label>
|
|
737
|
+
<input type="text" id="cfgConfig">
|
|
738
|
+
</div>
|
|
739
|
+
<div class="modal-actions">
|
|
740
|
+
<button class="btn" onclick="closeSettings()">Cancel</button>
|
|
741
|
+
<button class="btn btn-primary" onclick="saveSettings()">Save</button>
|
|
742
|
+
</div>
|
|
743
|
+
</div>
|
|
744
|
+
</div>
|
|
745
|
+
|
|
746
|
+
<!-- Toasts -->
|
|
747
|
+
<div class="toast-container" id="toasts"></div>
|
|
748
|
+
|
|
749
|
+
<script>
|
|
750
|
+
// --- Helpers ---
|
|
751
|
+
async function api(method, url, body) {
|
|
752
|
+
const opts = { method, headers: { 'Content-Type': 'application/json' } };
|
|
753
|
+
if (body) opts.body = JSON.stringify(body);
|
|
754
|
+
const res = await fetch(url, opts);
|
|
755
|
+
return res.json();
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function toast(msg, type = '') {
|
|
759
|
+
const el = document.createElement('div');
|
|
760
|
+
el.className = 'toast ' + type;
|
|
761
|
+
el.textContent = msg;
|
|
762
|
+
document.getElementById('toasts').appendChild(el);
|
|
763
|
+
setTimeout(() => el.remove(), 4000);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
function esc(s) {
|
|
767
|
+
const d = document.createElement('div');
|
|
768
|
+
d.textContent = s;
|
|
769
|
+
return d.innerHTML;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
// Simple fuzzy match: all chars of query appear in order in target
|
|
773
|
+
function fuzzyMatch(query, target) {
|
|
774
|
+
const q = query.toLowerCase();
|
|
775
|
+
const t = target.toLowerCase();
|
|
776
|
+
let qi = 0;
|
|
777
|
+
for (let ti = 0; ti < t.length && qi < q.length; ti++) {
|
|
778
|
+
if (t[ti] === q[qi]) qi++;
|
|
779
|
+
}
|
|
780
|
+
return qi === q.length;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// --- Navigation ---
|
|
784
|
+
function navigate(el) {
|
|
785
|
+
document.querySelectorAll('.sidebar-item').forEach(i => i.classList.remove('active'));
|
|
786
|
+
el.classList.add('active');
|
|
787
|
+
const page = el.dataset.page;
|
|
788
|
+
document.querySelectorAll('.page').forEach(p => p.classList.remove('active'));
|
|
789
|
+
document.getElementById('page-' + page).classList.add('active');
|
|
790
|
+
|
|
791
|
+
// Load SMO packs when navigating to that page
|
|
792
|
+
if (page === 'smo-packs') loadSmoPacks();
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// --- Jobs ---
|
|
796
|
+
let jobsPanelOpen = false;
|
|
797
|
+
|
|
798
|
+
function toggleJobs() {
|
|
799
|
+
jobsPanelOpen = !jobsPanelOpen;
|
|
800
|
+
document.getElementById('jobsPanel').classList.toggle('open', jobsPanelOpen);
|
|
801
|
+
if (jobsPanelOpen) refreshJobs();
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
async function refreshJobs() {
|
|
805
|
+
const data = await api('GET', '/api/jobs');
|
|
806
|
+
const badge = document.getElementById('jobBadge');
|
|
807
|
+
const active = data.active_count;
|
|
808
|
+
badge.textContent = `${active} job${active !== 1 ? 's' : ''}`;
|
|
809
|
+
badge.classList.toggle('has-active', active > 0);
|
|
810
|
+
|
|
811
|
+
const list = document.getElementById('jobsList');
|
|
812
|
+
if (data.jobs.length === 0) {
|
|
813
|
+
list.innerHTML = '<div class="empty-msg">No downloads yet</div>';
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
list.innerHTML = data.jobs.map(j => `
|
|
817
|
+
<div class="job-item">
|
|
818
|
+
<div class="job-name">${esc(j.name)}</div>
|
|
819
|
+
<div class="job-meta">
|
|
820
|
+
<span class="badge badge-${j.status}">${j.status}</span>
|
|
821
|
+
<span>${new Date(j.created_at).toLocaleTimeString()}</span>
|
|
822
|
+
</div>
|
|
823
|
+
${j.error ? `<div style="color:var(--red);font-size:11px;margin-top:4px">${esc(j.error)}</div>` : ''}
|
|
824
|
+
</div>
|
|
825
|
+
`).join('');
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
async function clearJobs() {
|
|
829
|
+
await api('POST', '/api/jobs/clear');
|
|
830
|
+
refreshJobs();
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
// Poll jobs
|
|
834
|
+
setInterval(refreshJobs, 3000);
|
|
835
|
+
|
|
836
|
+
// --- Settings ---
|
|
837
|
+
async function openSettings() {
|
|
838
|
+
const cfg = await api('GET', '/api/config');
|
|
839
|
+
document.getElementById('cfgSongs').value = cfg.songs_dir;
|
|
840
|
+
document.getElementById('cfgLogs').value = cfg.log_dir;
|
|
841
|
+
document.getElementById('cfgConfig').value = cfg.config_dir;
|
|
842
|
+
document.getElementById('settingsModal').classList.add('open');
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
function closeSettings() {
|
|
846
|
+
document.getElementById('settingsModal').classList.remove('open');
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
async function saveSettings() {
|
|
850
|
+
await api('PUT', '/api/config', {
|
|
851
|
+
songs_dir: document.getElementById('cfgSongs').value,
|
|
852
|
+
log_dir: document.getElementById('cfgLogs').value,
|
|
853
|
+
config_dir: document.getElementById('cfgConfig').value,
|
|
854
|
+
});
|
|
855
|
+
toast('Settings saved', 'success');
|
|
856
|
+
closeSettings();
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// Close modal on backdrop click
|
|
860
|
+
document.getElementById('settingsModal').addEventListener('click', e => {
|
|
861
|
+
if (e.target === e.currentTarget) closeSettings();
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
// ==========================================
|
|
865
|
+
// ZENIUS
|
|
866
|
+
// ==========================================
|
|
867
|
+
|
|
868
|
+
// --- Song search ---
|
|
869
|
+
async function zenSearchSongs() {
|
|
870
|
+
const title = document.getElementById('zenSongTitle').value.trim();
|
|
871
|
+
const artist = document.getElementById('zenSongArtist').value.trim();
|
|
872
|
+
if (!title && !artist) { toast('Enter a song title or artist', 'error'); return; }
|
|
873
|
+
|
|
874
|
+
const container = document.getElementById('zenSongResults');
|
|
875
|
+
container.innerHTML = '<div class="loading-msg"><span class="spinner"></span> Searching...</div>';
|
|
876
|
+
|
|
877
|
+
const results = await api('GET', `/api/zenius/search?title=${encodeURIComponent(title)}&artist=${encodeURIComponent(artist)}`);
|
|
878
|
+
|
|
879
|
+
if (results.length === 0) {
|
|
880
|
+
container.innerHTML = '<div class="empty-msg">No results found</div>';
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
container.innerHTML = `
|
|
885
|
+
<div class="results-container">
|
|
886
|
+
<div class="results-header">
|
|
887
|
+
<span>${results.length} result${results.length !== 1 ? 's' : ''}</span>
|
|
888
|
+
<button class="btn btn-sm btn-primary" onclick="zenDownloadSelected()">Download selected</button>
|
|
889
|
+
</div>
|
|
890
|
+
<div class="select-all-row">
|
|
891
|
+
<input type="checkbox" class="cb" onchange="toggleAllZenSongs(this)"> Select all
|
|
892
|
+
</div>
|
|
893
|
+
<div class="results-scroll">
|
|
894
|
+
<table class="results-table">
|
|
895
|
+
<thead><tr>
|
|
896
|
+
<th style="width:30px"></th><th>Song</th><th>Artist</th><th>SP</th><th>DP</th><th>Pack</th><th>Group</th>
|
|
897
|
+
</tr></thead>
|
|
898
|
+
<tbody>
|
|
899
|
+
${results.map((r, i) => `
|
|
900
|
+
<tr>
|
|
901
|
+
<td><input type="checkbox" class="cb zen-song-cb" data-idx="${i}"></td>
|
|
902
|
+
<td>${esc(r.song_name)}</td>
|
|
903
|
+
<td>${esc(r.artist)}</td>
|
|
904
|
+
<td style="font-family:var(--mono);font-size:12px">${esc(r.sp)}</td>
|
|
905
|
+
<td style="font-family:var(--mono);font-size:12px">${esc(r.dp)}</td>
|
|
906
|
+
<td>${esc(r.pack_name)}</td>
|
|
907
|
+
<td>${esc(r.group)}</td>
|
|
908
|
+
</tr>
|
|
909
|
+
`).join('')}
|
|
910
|
+
</tbody>
|
|
911
|
+
</table>
|
|
912
|
+
</div>
|
|
913
|
+
</div>`;
|
|
914
|
+
|
|
915
|
+
// Store results for download
|
|
916
|
+
window._zenSongResults = results;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
function toggleAllZenSongs(master) {
|
|
920
|
+
document.querySelectorAll('.zen-song-cb').forEach(cb => cb.checked = master.checked);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
async function zenDownloadSelected() {
|
|
924
|
+
const checks = document.querySelectorAll('.zen-song-cb:checked');
|
|
925
|
+
if (checks.length === 0) { toast('Select at least one song', 'error'); return; }
|
|
926
|
+
|
|
927
|
+
for (const cb of checks) {
|
|
928
|
+
const r = window._zenSongResults[parseInt(cb.dataset.idx)];
|
|
929
|
+
await api('POST', '/api/zenius/download/song', r);
|
|
930
|
+
}
|
|
931
|
+
toast(`Queued ${checks.length} song download${checks.length > 1 ? 's' : ''}`, 'success');
|
|
932
|
+
checks.forEach(cb => cb.checked = false);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// --- Pack search ---
|
|
936
|
+
let _zenPacks = [];
|
|
937
|
+
let _zenPackGroup = '';
|
|
938
|
+
|
|
939
|
+
async function zenLoadPacks(group) {
|
|
940
|
+
_zenPackGroup = group;
|
|
941
|
+
const area = document.getElementById('zenPackArea');
|
|
942
|
+
area.innerHTML = '<div class="loading-msg"><span class="spinner"></span> Fetching packs...</div>';
|
|
943
|
+
|
|
944
|
+
// Update button states
|
|
945
|
+
document.getElementById('zenPackOfficialBtn').classList.toggle('btn-primary', group === 'OFFICIAL');
|
|
946
|
+
document.getElementById('zenPackUserBtn').classList.toggle('btn-primary', group === 'USER');
|
|
947
|
+
|
|
948
|
+
_zenPacks = await api('GET', `/api/zenius/categories?group=${group}`);
|
|
949
|
+
|
|
950
|
+
renderZenPacks('');
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
function renderZenPacks(query) {
|
|
954
|
+
const area = document.getElementById('zenPackArea');
|
|
955
|
+
const filtered = query ? _zenPacks.filter(p => fuzzyMatch(query, p.title)) : _zenPacks;
|
|
956
|
+
|
|
957
|
+
area.innerHTML = `
|
|
958
|
+
<div class="filter-bar">
|
|
959
|
+
<span class="search-icon">⌕</span>
|
|
960
|
+
<input type="search" id="zenPackFilter" placeholder="Type to filter packs..." oninput="renderZenPacks(this.value)" value="${esc(query)}">
|
|
961
|
+
</div>
|
|
962
|
+
<div class="filter-stats">${filtered.length} of ${_zenPacks.length} packs</div>
|
|
963
|
+
${filtered.length === 0 ? '<div class="empty-msg">No packs match your search</div>' : `
|
|
964
|
+
<div class="results-container">
|
|
965
|
+
<div class="results-header">
|
|
966
|
+
<span>${filtered.length} pack${filtered.length !== 1 ? 's' : ''}</span>
|
|
967
|
+
<button class="btn btn-sm btn-primary" onclick="zenDownloadSelectedPacks()">Download selected</button>
|
|
968
|
+
</div>
|
|
969
|
+
<div class="select-all-row">
|
|
970
|
+
<input type="checkbox" class="cb" onchange="toggleAllZenPacks(this)"> Select all visible
|
|
971
|
+
</div>
|
|
972
|
+
<div class="results-scroll">
|
|
973
|
+
<table class="results-table">
|
|
974
|
+
<thead><tr><th style="width:30px"></th><th>Pack Name</th></tr></thead>
|
|
975
|
+
<tbody>
|
|
976
|
+
${filtered.map(p => `
|
|
977
|
+
<tr>
|
|
978
|
+
<td><input type="checkbox" class="cb zen-pack-cb" data-id="${esc(p.id)}" data-title="${esc(p.title)}"></td>
|
|
979
|
+
<td>${esc(p.title)}</td>
|
|
980
|
+
</tr>
|
|
981
|
+
`).join('')}
|
|
982
|
+
</tbody>
|
|
983
|
+
</table>
|
|
984
|
+
</div>
|
|
985
|
+
</div>`}`;
|
|
986
|
+
|
|
987
|
+
// Re-focus the filter input and restore cursor position
|
|
988
|
+
const input = document.getElementById('zenPackFilter');
|
|
989
|
+
if (input && document.activeElement !== input) {
|
|
990
|
+
input.focus();
|
|
991
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
function toggleAllZenPacks(master) {
|
|
996
|
+
document.querySelectorAll('.zen-pack-cb').forEach(cb => cb.checked = master.checked);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
async function zenDownloadSelectedPacks() {
|
|
1000
|
+
const checks = document.querySelectorAll('.zen-pack-cb:checked');
|
|
1001
|
+
if (checks.length === 0) { toast('Select at least one pack', 'error'); return; }
|
|
1002
|
+
|
|
1003
|
+
for (const cb of checks) {
|
|
1004
|
+
await api('POST', '/api/zenius/download/category', { id: cb.dataset.id, title: cb.dataset.title });
|
|
1005
|
+
}
|
|
1006
|
+
toast(`Queued ${checks.length} pack download${checks.length > 1 ? 's' : ''}`, 'success');
|
|
1007
|
+
checks.forEach(cb => cb.checked = false);
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
// --- Bundle download ---
|
|
1011
|
+
async function zenDownloadGroup(group) {
|
|
1012
|
+
await api('POST', '/api/zenius/download/group', { group });
|
|
1013
|
+
toast(`Queued ${group.toLowerCase()} bundle download`, 'success');
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// ==========================================
|
|
1017
|
+
// STEPMANIAONLINE
|
|
1018
|
+
// ==========================================
|
|
1019
|
+
|
|
1020
|
+
// --- Title / Artist search ---
|
|
1021
|
+
async function smoSearch(category) {
|
|
1022
|
+
const inputId = category === 'title' ? 'smoTitleQuery' : 'smoArtistQuery';
|
|
1023
|
+
const containerId = category === 'title' ? 'smoTitleResults' : 'smoArtistResults';
|
|
1024
|
+
const query = document.getElementById(inputId).value.trim();
|
|
1025
|
+
if (!query) { toast('Enter a search query', 'error'); return; }
|
|
1026
|
+
|
|
1027
|
+
const container = document.getElementById(containerId);
|
|
1028
|
+
container.innerHTML = '<div class="loading-msg"><span class="spinner"></span> Searching...</div>';
|
|
1029
|
+
|
|
1030
|
+
const results = await api('GET', `/api/smonline/search?category=${category}&query=${encodeURIComponent(query)}`);
|
|
1031
|
+
|
|
1032
|
+
if (results.length === 0) {
|
|
1033
|
+
container.innerHTML = '<div class="empty-msg">No results found</div>';
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
const storeKey = `_smoResults_${category}`;
|
|
1038
|
+
window[storeKey] = results;
|
|
1039
|
+
|
|
1040
|
+
container.innerHTML = `
|
|
1041
|
+
<div class="results-container">
|
|
1042
|
+
<div class="results-header">
|
|
1043
|
+
<span>${results.length} result${results.length !== 1 ? 's' : ''}</span>
|
|
1044
|
+
<button class="btn btn-sm btn-primary" onclick="smoDownloadSelected('${category}')">Download selected</button>
|
|
1045
|
+
</div>
|
|
1046
|
+
<div class="select-all-row">
|
|
1047
|
+
<input type="checkbox" class="cb" onchange="document.querySelectorAll('.smo-${category}-cb').forEach(c=>c.checked=this.checked)"> Select all
|
|
1048
|
+
</div>
|
|
1049
|
+
<div class="results-scroll">
|
|
1050
|
+
<table class="results-table">
|
|
1051
|
+
<thead><tr>
|
|
1052
|
+
<th style="width:30px"></th><th>Song</th><th>Artist</th><th>Pack</th>
|
|
1053
|
+
</tr></thead>
|
|
1054
|
+
<tbody>
|
|
1055
|
+
${results.map((r, i) => `
|
|
1056
|
+
<tr>
|
|
1057
|
+
<td><input type="checkbox" class="cb smo-${category}-cb" data-idx="${i}"></td>
|
|
1058
|
+
<td>${esc(r.song_title)}</td>
|
|
1059
|
+
<td>${esc(r.artist)}</td>
|
|
1060
|
+
<td>${esc(r.pack_title)}</td>
|
|
1061
|
+
</tr>
|
|
1062
|
+
`).join('')}
|
|
1063
|
+
</tbody>
|
|
1064
|
+
</table>
|
|
1065
|
+
</div>
|
|
1066
|
+
</div>`;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
async function smoDownloadSelected(category) {
|
|
1070
|
+
const checks = document.querySelectorAll(`.smo-${category}-cb:checked`);
|
|
1071
|
+
if (checks.length === 0) { toast('Select at least one entry', 'error'); return; }
|
|
1072
|
+
|
|
1073
|
+
const results = window[`_smoResults_${category}`];
|
|
1074
|
+
const seen = new Set();
|
|
1075
|
+
let count = 0;
|
|
1076
|
+
for (const cb of checks) {
|
|
1077
|
+
const r = results[parseInt(cb.dataset.idx)];
|
|
1078
|
+
if (seen.has(r.download)) continue;
|
|
1079
|
+
seen.add(r.download);
|
|
1080
|
+
await api('POST', '/api/smonline/download', { pack_title: r.pack_title, download: r.download });
|
|
1081
|
+
count++;
|
|
1082
|
+
}
|
|
1083
|
+
toast(`Queued ${count} pack download${count > 1 ? 's' : ''}`, 'success');
|
|
1084
|
+
checks.forEach(cb => cb.checked = false);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// --- SMO Pack search (cached + fuzzy) ---
|
|
1088
|
+
let _smoPacks = [];
|
|
1089
|
+
let _smoPacksReady = false;
|
|
1090
|
+
|
|
1091
|
+
async function loadSmoPacks() {
|
|
1092
|
+
const area = document.getElementById('smoPackArea');
|
|
1093
|
+
const data = await api('GET', '/api/smonline/packs');
|
|
1094
|
+
|
|
1095
|
+
if (data.building && !data.ready) {
|
|
1096
|
+
area.innerHTML = '<div class="loading-msg"><span class="spinner"></span> Building pack cache... this may take a moment</div>';
|
|
1097
|
+
setTimeout(loadSmoPacks, 2000);
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
_smoPacks = data.packs;
|
|
1102
|
+
_smoPacksReady = true;
|
|
1103
|
+
renderSmoPacks('');
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
function renderSmoPacks(query) {
|
|
1107
|
+
const area = document.getElementById('smoPackArea');
|
|
1108
|
+
const filtered = query ? _smoPacks.filter(p => fuzzyMatch(query, p.pack_title)) : _smoPacks;
|
|
1109
|
+
|
|
1110
|
+
area.innerHTML = `
|
|
1111
|
+
<div class="cache-bar">
|
|
1112
|
+
<span class="dot green"></span>
|
|
1113
|
+
<span>${_smoPacks.length} packs cached</span>
|
|
1114
|
+
<button class="btn btn-sm" onclick="refreshSmoCache()" style="margin-left:auto">Refresh cache</button>
|
|
1115
|
+
</div>
|
|
1116
|
+
<div class="filter-bar">
|
|
1117
|
+
<span class="search-icon">⌕</span>
|
|
1118
|
+
<input type="search" id="smoPackFilter" placeholder="Type to fuzzy-search packs..." oninput="renderSmoPacks(this.value)" value="${esc(query)}">
|
|
1119
|
+
</div>
|
|
1120
|
+
<div class="filter-stats">${filtered.length} of ${_smoPacks.length} packs</div>
|
|
1121
|
+
${filtered.length === 0 ? '<div class="empty-msg">No packs match your search</div>' : `
|
|
1122
|
+
<div class="results-container">
|
|
1123
|
+
<div class="results-header">
|
|
1124
|
+
<span>${filtered.length} pack${filtered.length !== 1 ? 's' : ''}</span>
|
|
1125
|
+
<button class="btn btn-sm btn-primary" onclick="smoDownloadSelectedPacks()">Download selected</button>
|
|
1126
|
+
</div>
|
|
1127
|
+
<div class="select-all-row">
|
|
1128
|
+
<input type="checkbox" class="cb" onchange="document.querySelectorAll('.smo-pack-cb').forEach(c=>c.checked=this.checked)"> Select all visible
|
|
1129
|
+
</div>
|
|
1130
|
+
<div class="results-scroll">
|
|
1131
|
+
<table class="results-table">
|
|
1132
|
+
<thead><tr>
|
|
1133
|
+
<th style="width:30px"></th><th>Pack</th><th>Songs</th><th>Size</th><th>Date</th>
|
|
1134
|
+
</tr></thead>
|
|
1135
|
+
<tbody>
|
|
1136
|
+
${filtered.map(p => `
|
|
1137
|
+
<tr>
|
|
1138
|
+
<td><input type="checkbox" class="cb smo-pack-cb" data-title="${esc(p.pack_title)}" data-url="${esc(p.download)}"></td>
|
|
1139
|
+
<td>${esc(p.pack_title)}</td>
|
|
1140
|
+
<td style="font-family:var(--mono);font-size:12px">${p.songs}</td>
|
|
1141
|
+
<td style="font-family:var(--mono);font-size:12px">${esc(p.size)}</td>
|
|
1142
|
+
<td style="font-family:var(--mono);font-size:12px">${esc(p.created)}</td>
|
|
1143
|
+
</tr>
|
|
1144
|
+
`).join('')}
|
|
1145
|
+
</tbody>
|
|
1146
|
+
</table>
|
|
1147
|
+
</div>
|
|
1148
|
+
</div>`}`;
|
|
1149
|
+
|
|
1150
|
+
const input = document.getElementById('smoPackFilter');
|
|
1151
|
+
if (input && document.activeElement !== input) {
|
|
1152
|
+
input.focus();
|
|
1153
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
async function smoDownloadSelectedPacks() {
|
|
1158
|
+
const checks = document.querySelectorAll('.smo-pack-cb:checked');
|
|
1159
|
+
if (checks.length === 0) { toast('Select at least one pack', 'error'); return; }
|
|
1160
|
+
|
|
1161
|
+
const seen = new Set();
|
|
1162
|
+
let count = 0;
|
|
1163
|
+
for (const cb of checks) {
|
|
1164
|
+
if (seen.has(cb.dataset.url)) continue;
|
|
1165
|
+
seen.add(cb.dataset.url);
|
|
1166
|
+
await api('POST', '/api/smonline/download', { pack_title: cb.dataset.title, download: cb.dataset.url });
|
|
1167
|
+
count++;
|
|
1168
|
+
}
|
|
1169
|
+
toast(`Queued ${count} pack download${count > 1 ? 's' : ''}`, 'success');
|
|
1170
|
+
checks.forEach(cb => cb.checked = false);
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
async function refreshSmoCache() {
|
|
1174
|
+
const area = document.getElementById('smoPackArea');
|
|
1175
|
+
area.innerHTML = '<div class="loading-msg"><span class="spinner"></span> Refreshing pack cache...</div>';
|
|
1176
|
+
await api('POST', '/api/smonline/packs/refresh');
|
|
1177
|
+
_smoPacksReady = false;
|
|
1178
|
+
setTimeout(loadSmoPacks, 1500);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
// --- Init ---
|
|
1182
|
+
refreshJobs();
|
|
1183
|
+
</script>
|
|
1184
|
+
</body>
|
|
1185
|
+
</html>
|