-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
697 lines (658 loc) · 33.1 KB
/
Copy pathindex.html
File metadata and controls
697 lines (658 loc) · 33.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Yaprax Downloader - A WGET Based Download Manager</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.animate-spin {
animation: spin 1s linear infinite;
}
.dark-mode {
background: #0f172a;
color: #e2e8f0;
}
.dark-mode .bg-white {
background: #1e293b !important;
}
.dark-mode .text-gray-900 {
color: #f1f5f9 !important;
}
.dark-mode .text-gray-700 {
color: #cbd5e1 !important;
}
.dark-mode .text-gray-600 {
color: #94a3b8 !important;
}
.dark-mode .text-gray-500 {
color: #64748b !important;
}
.dark-mode .border-gray-100 {
border-color: #334155 !important;
}
.dark-mode .border-gray-200 {
border-color: #475569 !important;
}
.dark-mode .bg-gray-50 {
background: #1e293b !important;
}
.dark-mode .bg-gray-100 {
background: #334155 !important;
}
.dark-mode .bg-gray-200 {
background: #475569 !important;
}
.dark-mode .hover\:bg-gray-50:hover {
background: #1e293b !important;
}
.dark-mode .hover\:bg-gray-100:hover {
background: #334155 !important;
}
.context-menu {
position: fixed;
background: white;
border: 1px solid #e5e7eb;
border-radius: 8px;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
z-index: 1000;
min-width: 200px;
}
.dark-mode .context-menu {
background: #1e293b;
border-color: #475569;
}
.context-menu-item {
padding: 10px 16px;
cursor: pointer;
display: flex;
align-items: center;
gap: 10px;
font-size: 14px;
}
.context-menu-item:hover {
background: #f3f4f6;
}
.dark-mode .context-menu-item:hover {
background: #334155;
}
</style>
</head>
<body>
<div id="root"></div>
<div id="context-menu"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<script>
const { useState, useEffect, useRef } = React;
const Icons = {
Download: ({size = 20, className = ''}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2, className},
React.createElement('path', {d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'}),
React.createElement('polyline', {points: '7 10 12 15 17 10'}),
React.createElement('line', {x1: 12, y1: 15, x2: 12, y2: 3})
),
History: ({size = 20}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('circle', {cx: 12, cy: 12, r: 10}),
React.createElement('polyline', {points: '12 6 12 12 16 14'})
),
Queue: ({size = 20}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('line', {x1: 8, y1: 6, x2: 21, y2: 6}),
React.createElement('line', {x1: 8, y1: 12, x2: 21, y2: 12}),
React.createElement('line', {x1: 8, y1: 18, x2: 21, y2: 18}),
React.createElement('line', {x1: 3, y1: 6, x2: 3.01, y2: 6}),
React.createElement('line', {x1: 3, y1: 12, x2: 3.01, y2: 12}),
React.createElement('line', {x1: 3, y1: 18, x2: 3.01, y2: 18})
),
Settings: ({size = 16}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('circle', {cx: 12, cy: 12, r: 3}),
React.createElement('path', {d: 'M12 1v6m0 6v6m5.2-13.2l-4.2 4.2m0 6l4.2 4.2M1 12h6m6 0h6m-13.2 5.2l4.2-4.2m0-6l-4.2-4.2'})
),
Link: ({size = 16}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('path', {d: 'M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'}),
React.createElement('path', {d: 'M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'})
),
Folder: ({size = 16}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('path', {d: 'M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z'})
),
CheckCircle: ({size = 18}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('path', {d: 'M22 11.08V12a10 10 0 1 1-5.93-9.14'}),
React.createElement('polyline', {points: '22 4 12 14.01 9 11.01'})
),
XCircle: ({size = 18}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('circle', {cx: 12, cy: 12, r: 10}),
React.createElement('line', {x1: 15, y1: 9, x2: 9, y2: 15}),
React.createElement('line', {x1: 9, y1: 9, x2: 15, y2: 15})
),
Loader: () => React.createElement('svg', {width: 20, height: 20, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2, className: 'animate-spin'},
React.createElement('line', {x1: 12, y1: 2, x2: 12, y2: 6}),
React.createElement('line', {x1: 12, y1: 18, x2: 12, y2: 22}),
React.createElement('line', {x1: 4.93, y1: 4.93, x2: 7.76, y2: 7.76}),
React.createElement('line', {x1: 16.24, y1: 16.24, x2: 19.07, y2: 19.07}),
React.createElement('line', {x1: 2, y1: 12, x2: 6, y2: 12}),
React.createElement('line', {x1: 18, y1: 12, x2: 22, y2: 12}),
React.createElement('line', {x1: 4.93, y1: 19.07, x2: 7.76, y2: 16.24}),
React.createElement('line', {x1: 16.24, y1: 7.76, x2: 19.07, y2: 4.93})
),
Trash: ({size = 18}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('polyline', {points: '3 6 5 6 21 6'}),
React.createElement('path', {d: 'M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'})
),
AlertCircle: () => React.createElement('svg', {width: 20, height: 20, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('circle', {cx: 12, cy: 12, r: 10}),
React.createElement('line', {x1: 12, y1: 8, x2: 12, y2: 12}),
React.createElement('line', {x1: 12, y1: 16, x2: 12.01, y2: 16})
),
X: ({size = 20}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('line', {x1: 18, y1: 6, x2: 6, y2: 18}),
React.createElement('line', {x1: 6, y1: 6, x2: 18, y2: 18})
),
Moon: () => React.createElement('svg', {width: 20, height: 20, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('path', {d: 'M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'})
),
Sun: () => React.createElement('svg', {width: 20, height: 20, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('circle', {cx: 12, cy: 12, r: 5}),
React.createElement('line', {x1: 12, y1: 1, x2: 12, y2: 3}),
React.createElement('line', {x1: 12, y1: 21, x2: 12, y2: 23}),
React.createElement('line', {x1: 4.22, y1: 4.22, x2: 5.64, y2: 5.64}),
React.createElement('line', {x1: 18.36, y1: 18.36, x2: 19.78, y2: 19.78}),
React.createElement('line', {x1: 1, y1: 12, x2: 3, y2: 12}),
React.createElement('line', {x1: 21, y1: 12, x2: 23, y2: 12}),
React.createElement('line', {x1: 4.22, y1: 19.78, x2: 5.64, y2: 18.36}),
React.createElement('line', {x1: 18.36, y1: 5.64, x2: 19.78, y2: 4.22})
),
FolderOpen: ({size = 18}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('path', {d: 'M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z'}),
React.createElement('polyline', {points: '2 11 7 11 12 16 22 16'})
),
MoreVertical: ({size = 18}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('circle', {cx: 12, cy: 12, r: 1}),
React.createElement('circle', {cx: 12, cy: 5, r: 1}),
React.createElement('circle', {cx: 12, cy: 19, r: 1})
),
Play: ({size = 18}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('polygon', {points: '5 3 19 12 5 21 5 3'})
),
Plus: ({size = 20}) => React.createElement('svg', {width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2},
React.createElement('line', {x1: 12, y1: 5, x2: 12, y2: 19}),
React.createElement('line', {x1: 5, y1: 12, x2: 19, y2: 12})
)
};
function App() {
const [activeTab, setActiveTab] = useState('download');
const [url, setUrl] = useState('');
const [outputPath, setOutputPath] = useState('/home/');
const [options, setOptions] = useState({
continue: true,
recursive: false,
timestamping: false,
noCache: false,
userAgent: false,
limitRate: false,
rateLimit: '1M'
});
const [downloadHistory, setDownloadHistory] = useState([]);
const [downloadQueue, setDownloadQueue] = useState([]);
const [activeDownloads, setActiveDownloads] = useState([]);
const [wgetInstalled, setWgetInstalled] = useState(true);
const [error, setError] = useState(null);
const [darkMode, setDarkMode] = useState(false);
const [contextMenu, setContextMenu] = useState(null);
useEffect(() => {
// Check wget
window.electronAPI.checkWget().then(installed => {
setWgetInstalled(installed);
});
// Load preferences
window.electronAPI.getPreferences().then(prefs => {
setDarkMode(prefs.darkMode || false);
});
// Load history
loadHistory();
loadQueue();
// Set up listeners
window.electronAPI.onDownloadProgress((data) => {
setActiveDownloads(prev =>
prev.map(d => d.id === data.id ? {...d, ...data} : d)
);
});
window.electronAPI.onDownloadComplete((data) => {
if (data.success) {
window.electronAPI.saveToHistory({
url: data.url,
filename: data.filename,
size: data.totalSize,
status: 'completed',
time: 'just now',
fullPath: data.fullPath
});
loadHistory();
}
setActiveDownloads(prev => prev.filter(d => d.id !== data.id));
loadQueue();
});
window.electronAPI.onDownloadError((data) => {
setError(data.error);
setActiveDownloads(prev => prev.filter(d => d.id !== data.id));
loadQueue();
});
window.electronAPI.onQueueUpdated((data) => {
setDownloadQueue(data.queue);
setActiveDownloads(data.active);
});
// Close context menu on click
document.addEventListener('click', () => setContextMenu(null));
return () => {
window.electronAPI.removeDownloadListeners();
};
}, []);
useEffect(() => {
document.body.className = darkMode ? 'dark-mode' : '';
}, [darkMode]);
const loadHistory = async () => {
const history = await window.electronAPI.getHistory();
setDownloadHistory(history);
};
const loadQueue = async () => {
const queue = await window.electronAPI.getQueue();
setDownloadQueue(queue.queue);
setActiveDownloads(queue.active);
};
const selectDirectory = async () => {
const dir = await window.electronAPI.selectDirectory();
if (dir) {
setOutputPath(dir);
}
};
const handleAddToQueue = async () => {
if (!url) return;
setError(null);
await window.electronAPI.addToQueue({
url,
outputPath,
options
});
setUrl('');
loadQueue();
};
const handleCancelDownload = async (id) => {
await window.electronAPI.cancelDownload(id);
loadQueue();
};
const handleClearQueue = async () => {
await window.electronAPI.clearQueue();
loadQueue();
};
const clearHistory = async () => {
await window.electronAPI.clearHistory();
setDownloadHistory([]);
};
const toggleDarkMode = async () => {
const newMode = !darkMode;
setDarkMode(newMode);
await window.electronAPI.savePreferences({ darkMode: newMode });
};
const showContextMenu = (e, item) => {
e.preventDefault();
setContextMenu({
x: e.clientX,
y: e.clientY,
item
});
};
const handleOpenFile = async (filePath) => {
await window.electronAPI.openFile(filePath);
setContextMenu(null);
};
const handleOpenFileLocation = async (filePath) => {
await window.electronAPI.openFileLocation(filePath);
setContextMenu(null);
};
const handleDeleteHistoryItem = async (id) => {
await window.electronAPI.deleteHistoryItem(id);
loadHistory();
setContextMenu(null);
};
const handleRetryDownload = async (item) => {
setUrl(item.url);
setActiveTab('download');
setContextMenu(null);
};
if (!wgetInstalled) {
return React.createElement('div', {className: 'min-h-screen bg-gradient-to-br from-red-50 to-orange-50 flex items-center justify-center p-6'},
React.createElement('div', {className: 'bg-white rounded-xl shadow-lg p-8 max-w-md text-center'},
React.createElement('div', {className: 'mb-4'}, React.createElement(Icons.AlertCircle)),
React.createElement('h2', {className: 'text-2xl font-bold text-gray-900 mb-2'}, 'wget Not Installed'),
React.createElement('p', {className: 'text-gray-600 mb-4'}, 'This application requires wget to be installed on your system.'),
React.createElement('div', {className: 'bg-gray-100 rounded-lg p-4 text-left'},
React.createElement('p', {className: 'text-sm font-mono text-gray-700'},
'Ubuntu/Debian: sudo apt install wget',
React.createElement('br'),
'Fedora: sudo dnf install wget',
React.createElement('br'),
'Arch: sudo pacman -S wget'
)
)
)
);
}
return React.createElement('div', {className: `min-h-screen ${darkMode ? 'bg-slate-900' : 'bg-gradient-to-br from-blue-50 via-white to-purple-50'}`},
React.createElement('div', {className: 'max-w-7xl mx-auto p-6'},
// Header
React.createElement('div', {className: 'mb-8 flex justify-between items-start'},
React.createElement('div', {className: 'flex items-center gap-3'},
React.createElement('div', {className: 'p-3 bg-gradient-to-br from-blue-600 to-purple-600 rounded-xl shadow-lg'},
React.createElement(Icons.Download, {size: 28})
),
React.createElement('div', {},
React.createElement('h1', {className: 'text-3xl font-bold text-gray-900'}, 'Yaprax Downloader'),
React.createElement('p', {className: 'text-gray-600'}, 'A WGET Based Download Manager'),
React.createElement('p', {className: 'text-xs text-gray-500 mt-1'}, 'By Aga Ismael Abdalla • www.linux.krd')
)
),
React.createElement('button', {
onClick: toggleDarkMode,
className: 'p-3 bg-white rounded-xl shadow-lg hover:shadow-xl transition-shadow border border-gray-100'
}, darkMode ? React.createElement(Icons.Sun) : React.createElement(Icons.Moon))
),
// Error Alert
error && React.createElement('div', {className: 'mb-6 bg-red-50 border border-red-200 rounded-xl p-4 flex items-start justify-between'},
React.createElement('div', {className: 'flex items-start gap-3'},
React.createElement(Icons.AlertCircle, {className: 'text-red-600 flex-shrink-0'}),
React.createElement('div', {},
React.createElement('p', {className: 'font-semibold text-red-900'}, 'Download Error'),
React.createElement('p', {className: 'text-sm text-red-700'}, error)
)
),
React.createElement('button', {onClick: () => setError(null), className: 'text-red-600 hover:text-red-800'},
React.createElement(Icons.X)
)
),
// Tabs
React.createElement('div', {className: 'flex gap-2 mb-6 bg-white rounded-xl p-1 shadow-sm'},
['download', 'queue', 'history'].map(tab =>
React.createElement('button', {
key: tab,
onClick: () => setActiveTab(tab),
className: `flex items-center gap-2 px-6 py-3 rounded-lg font-medium transition-all ${
activeTab === tab
? 'bg-gradient-to-r from-blue-600 to-purple-600 text-white shadow-md'
: 'text-gray-600 hover:bg-gray-50'
}`
},
React.createElement(tab === 'download' ? Icons.Download : tab === 'queue' ? Icons.Queue : Icons.History),
tab.charAt(0).toUpperCase() + tab.slice(1),
tab === 'queue' && downloadQueue.length > 0 && React.createElement('span', {className: 'px-2 py-0.5 bg-white text-blue-600 rounded-full text-xs font-bold'}, downloadQueue.length)
)
)
),
// Download Tab
activeTab === 'download' && React.createElement('div', {className: 'space-y-6'},
React.createElement('div', {className: 'bg-white rounded-xl shadow-lg p-6 border border-gray-100'},
React.createElement('label', {className: 'flex items-center gap-2 text-sm font-semibold text-gray-700 mb-3'},
React.createElement(Icons.Link),
'Download URL'
),
React.createElement('div', {className: 'flex gap-2'},
React.createElement('input', {
type: 'text',
value: url,
onChange: (e) => setUrl(e.target.value),
onKeyPress: (e) => e.key === 'Enter' && handleAddToQueue(),
placeholder: 'https://example.com/file.zip',
className: 'flex-1 px-4 py-3 border-2 border-gray-200 rounded-lg focus:border-blue-500 focus:outline-none transition-colors'
}),
React.createElement('button', {
onClick: handleAddToQueue,
disabled: !url,
className: 'px-6 py-3 bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 disabled:from-gray-300 disabled:to-gray-400 text-white rounded-lg font-medium transition-all disabled:cursor-not-allowed flex items-center gap-2'
},
React.createElement(Icons.Plus),
'Add to Queue'
)
)
),
React.createElement('div', {className: 'bg-white rounded-xl shadow-lg p-6 border border-gray-100'},
React.createElement('label', {className: 'flex items-center gap-2 text-sm font-semibold text-gray-700 mb-3'},
React.createElement(Icons.Folder),
'Save Location'
),
React.createElement('div', {className: 'flex gap-2'},
React.createElement('input', {
type: 'text',
value: outputPath,
onChange: (e) => setOutputPath(e.target.value),
className: 'flex-1 px-4 py-3 border-2 border-gray-200 rounded-lg focus:border-blue-500 focus:outline-none transition-colors'
}),
React.createElement('button', {
onClick: selectDirectory,
className: 'px-6 py-3 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg font-medium transition-colors'
}, 'Browse')
)
),
React.createElement('div', {className: 'bg-white rounded-xl shadow-lg p-6 border border-gray-100'},
React.createElement('label', {className: 'flex items-center gap-2 text-sm font-semibold text-gray-700 mb-4'},
React.createElement(Icons.Settings),
'Download Options'
),
React.createElement('div', {className: 'grid grid-cols-2 gap-4'},
Object.entries({
continue: 'Continue partial downloads (-c)',
recursive: 'Recursive download (-r)',
timestamping: 'Use timestamping (-N)',
noCache: 'Bypass cache (--no-cache)',
userAgent: 'Custom user agent',
limitRate: 'Limit download speed'
}).map(([key, label]) =>
React.createElement('label', {key, className: 'flex items-center gap-3 cursor-pointer group'},
React.createElement('input', {
type: 'checkbox',
checked: options[key],
onChange: (e) => setOptions({...options, [key]: e.target.checked}),
className: 'w-5 h-5 text-blue-600 rounded focus:ring-2 focus:ring-blue-500 cursor-pointer'
}),
React.createElement('span', {className: 'text-sm text-gray-700 group-hover:text-gray-900'}, label)
)
)
),
options.limitRate && React.createElement('div', {className: 'mt-4'},
React.createElement('input', {
type: 'text',
value: options.rateLimit,
onChange: (e) => setOptions({...options, rateLimit: e.target.value}),
placeholder: '1M (e.g., 500k, 1M, 2M)',
className: 'w-full px-4 py-2 border-2 border-gray-200 rounded-lg focus:border-blue-500 focus:outline-none transition-colors text-sm'
})
)
)
),
// Queue Tab
activeTab === 'queue' && React.createElement('div', {className: 'space-y-6'},
// Active Downloads
activeDownloads.length > 0 && React.createElement('div', {},
React.createElement('h3', {className: 'text-lg font-bold text-gray-900 mb-4 flex items-center gap-2'},
React.createElement(Icons.Download, {size: 20}),
'Active Downloads (',
activeDownloads.length,
')'
),
React.createElement('div', {className: 'space-y-3'},
activeDownloads.map(download =>
React.createElement('div', {key: download.id, className: 'bg-white rounded-xl shadow-lg p-6 border border-gray-100'},
React.createElement('div', {className: 'flex items-center justify-between mb-4'},
React.createElement('div', {className: 'flex items-center gap-3 flex-1 min-w-0'},
React.createElement(Icons.Loader),
React.createElement('span', {className: 'font-semibold text-gray-900 truncate'}, download.filename || 'Preparing...')
),
React.createElement('button', {
onClick: () => handleCancelDownload(download.id),
className: 'px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded-lg text-sm font-medium transition-colors'
}, 'Cancel')
),
React.createElement('div', {className: 'space-y-3'},
React.createElement('div', {className: 'text-sm text-gray-600 truncate'}, download.url),
React.createElement('div', {className: 'w-full bg-gray-200 rounded-full h-3 overflow-hidden'},
React.createElement('div', {
className: 'bg-gradient-to-r from-blue-600 to-purple-600 h-full rounded-full transition-all duration-300',
style: {width: `${download.progress || 0}%`}
})
),
React.createElement('div', {className: 'flex justify-between text-sm text-gray-600'},
React.createElement('span', {}, `${Math.round(download.progress || 0)}%`),
React.createElement('div', {className: 'flex gap-4'},
download.speed && React.createElement('span', {}, `${download.speed}`),
download.eta && React.createElement('span', {}, `ETA: ${download.eta}`)
)
)
)
)
)
)
),
// Queued Downloads
React.createElement('div', {},
React.createElement('div', {className: 'flex justify-between items-center mb-4'},
React.createElement('h3', {className: 'text-lg font-bold text-gray-900 flex items-center gap-2'},
React.createElement(Icons.Queue, {size: 20}),
'Queued Downloads (',
downloadQueue.length,
')'
),
downloadQueue.length > 0 && React.createElement('button', {
onClick: handleClearQueue,
className: 'px-4 py-2 bg-red-50 hover:bg-red-100 text-red-600 rounded-lg text-sm font-medium transition-colors flex items-center gap-2'
},
React.createElement(Icons.Trash, {size: 16}),
'Clear Queue'
)
),
downloadQueue.length === 0 ?
React.createElement('div', {className: 'bg-white rounded-xl shadow-lg p-12 text-center text-gray-500 border border-gray-100'},
React.createElement(Icons.Queue, {size: 48, className: 'mx-auto mb-3 opacity-30'}),
React.createElement('p', {}, 'No downloads in queue')
) :
React.createElement('div', {className: 'space-y-3'},
downloadQueue.map((item, index) =>
React.createElement('div', {key: item.id, className: 'bg-white rounded-xl shadow-lg p-4 border border-gray-100 hover:border-blue-300 transition-colors'},
React.createElement('div', {className: 'flex items-center justify-between'},
React.createElement('div', {className: 'flex items-center gap-3 flex-1 min-w-0'},
React.createElement('span', {className: 'px-2 py-1 bg-gray-100 rounded text-xs font-bold text-gray-600'}, `#${index + 1}`),
React.createElement('span', {className: 'text-sm text-gray-700 truncate'}, item.url)
),
React.createElement('button', {
onClick: () => handleCancelDownload(item.id),
className: 'p-2 text-red-600 hover:bg-red-50 rounded-lg transition-colors'
},
React.createElement(Icons.X, {size: 16})
)
)
)
)
)
)
),
// History Tab
activeTab === 'history' && React.createElement('div', {className: 'bg-white rounded-xl shadow-lg border border-gray-100'},
React.createElement('div', {className: 'p-6 border-b border-gray-100 flex justify-between items-center'},
React.createElement('div', {},
React.createElement('h2', {className: 'text-xl font-bold text-gray-900'}, 'Download History'),
React.createElement('p', {className: 'text-sm text-gray-600 mt-1'}, `${downloadHistory.length} downloads`)
),
downloadHistory.length > 0 && React.createElement('button', {
onClick: clearHistory,
className: 'px-4 py-2 bg-red-50 hover:bg-red-100 text-red-600 rounded-lg text-sm font-medium transition-colors flex items-center gap-2'
},
React.createElement(Icons.Trash, {size: 16}),
'Clear All'
)
),
React.createElement('div', {className: 'divide-y divide-gray-100'},
downloadHistory.length === 0 ?
React.createElement('div', {className: 'p-12 text-center text-gray-500'},
React.createElement(Icons.History, {size: 48, className: 'mx-auto mb-3 opacity-30'}),
React.createElement('p', {}, 'No downloads yet')
) :
downloadHistory.map((item) =>
React.createElement('div', {
key: item.id,
className: 'p-6 hover:bg-gray-50 transition-colors cursor-pointer',
onContextMenu: (e) => showContextMenu(e, item)
},
React.createElement('div', {className: 'flex items-start justify-between gap-4'},
React.createElement('div', {className: 'flex-1 min-w-0'},
React.createElement('div', {className: 'flex items-center gap-2 mb-1'},
item.status === 'completed' ?
React.createElement(Icons.CheckCircle, {size: 18, className: 'text-green-600 flex-shrink-0'}) :
React.createElement(Icons.XCircle, {size: 18, className: 'text-red-600 flex-shrink-0'}),
React.createElement('span', {className: 'text-sm font-medium text-gray-900 truncate'},
item.filename || item.url.split('/').pop() || item.url
)
),
React.createElement('p', {className: 'text-sm text-gray-600 truncate mb-1'}, item.url),
React.createElement('div', {className: 'flex items-center gap-3 text-xs text-gray-500'},
React.createElement('span', {}, item.time),
item.size && React.createElement(React.Fragment, {},
React.createElement('span', {}, '•'),
React.createElement('span', {}, item.size)
)
)
),
React.createElement('button', {
onClick: (e) => {
e.stopPropagation();
showContextMenu(e, item);
},
className: 'p-2 hover:bg-gray-100 rounded-lg transition-colors'
},
React.createElement(Icons.MoreVertical, {size: 18})
)
)
)
)
)
)
),
// Context Menu
contextMenu && React.createElement('div', {
className: 'context-menu',
style: {left: `${contextMenu.x}px`, top: `${contextMenu.y}px`}
},
contextMenu.item.fullPath && React.createElement('div', {
className: 'context-menu-item',
onClick: () => handleOpenFile(contextMenu.item.fullPath)
},
React.createElement(Icons.Play, {size: 16}),
'Open File'
),
contextMenu.item.fullPath && React.createElement('div', {
className: 'context-menu-item',
onClick: () => handleOpenFileLocation(contextMenu.item.fullPath)
},
React.createElement(Icons.FolderOpen, {size: 16}),
'Open File Location'
),
React.createElement('div', {
className: 'context-menu-item',
onClick: () => handleRetryDownload(contextMenu.item)
},
React.createElement(Icons.Download, {size: 16}),
'Download Again'
),
React.createElement('div', {
className: 'context-menu-item text-red-600',
onClick: () => handleDeleteHistoryItem(contextMenu.item.id)
},
React.createElement(Icons.Trash, {size: 16}),
'Delete from History'
)
)
);
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(React.createElement(App));
</script>
</body>
</html>