-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtext.html
More file actions
660 lines (598 loc) · 41.9 KB
/
text.html
File metadata and controls
660 lines (598 loc) · 41.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Stricter CSP: scripts only from self and trusted CDNs, no unsafe-inline for logic -->
<!-- FIX: Added 'wasm-unsafe-eval' and 'blob:' to support future features and consistency -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval' blob: https://cdn.tailwindcss.com https://cdnjs.cloudflare.com; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdnjs.cloudflare.com; font-src 'self' https://fonts.gstatic.com https://cdnjs.cloudflare.com; connect-src 'self' https://* blob:; img-src 'self' data: https:; media-src 'self' blob:;">
<title>Web VM Emulator</title>
<!-- App Icon & Manifest -->
<link rel="icon" href="IMG_1074.png">
<link rel="apple-touch-icon" href="IMG_1074.png">
<link rel="manifest" href="manifest.json">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
body { font-family: 'Inter', sans-serif; }
/* Custom Scrollbar for dark theme */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1f2937; }
::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #6b7280; }
.source-type-card.border-indigo-500 { box-shadow: 0 0 0 2px #6366f1; }
/* --- Premium Notification System --- */
#toast-container {
position: fixed;
z-index: 10000;
display: flex;
flex-direction: column;
gap: 0.75rem;
pointer-events: none; /* Let clicks pass through empty areas */
}
/* Responsive Positioning */
@media (min-width: 768px) {
#toast-container {
top: 1.5rem;
right: 1.5rem;
width: 380px;
align-items: flex-end; /* Stack to right */
}
}
@media (max-width: 767px) {
#toast-container {
top: 1rem;
left: 1rem;
right: 1rem;
width: auto;
align-items: stretch; /* Full width on mobile */
}
}
.toast {
pointer-events: auto;
position: relative;
overflow: hidden;
border-radius: 12px;
background: rgba(23, 23, 23, 0.95); /* Extremely dark grey, almost black */
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow:
0 4px 6px -1px rgba(0, 0, 0, 0.1),
0 2px 4px -1px rgba(0, 0, 0, 0.06),
0 20px 25px -5px rgba(0, 0, 0, 0.5); /* Deep shadow */
padding: 1rem;
color: #e5e7eb;
display: flex;
align-items: start;
transform-origin: top center;
animation: toastSlideIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
transition: all 0.3s ease;
}
.toast:hover {
transform: translateY(-2px);
box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.6);
}
.toast.hiding {
animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes toastSlideIn {
0% { transform: translateY(-20px) scale(0.95); opacity: 0; }
100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes toastSlideOut {
0% { transform: translateY(0) scale(1); opacity: 1; }
100% { transform: translateY(-20px) scale(0.95); opacity: 0; }
}
/* Types */
.toast-info { border-left: 4px solid #3b82f6; }
.toast-info .toast-icon { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.toast-success { border-left: 4px solid #10b981; }
.toast-success .toast-icon { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-error .toast-icon { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-warning .toast-icon { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.toast-update { border-left: 4px solid #8b5cf6; }
.toast-update .toast-icon { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.toast-icon {
width: 32px;
height: 32px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-right: 1rem;
font-size: 1rem;
}
/* Progress Bar */
.toast-progress {
position: absolute;
bottom: 0;
left: 0;
height: 3px;
background: rgba(255, 255, 255, 0.2);
width: 100%;
transform-origin: left;
animation: progress linear forwards;
}
@keyframes progress {
from { transform: scaleX(1); }
to { transform: scaleX(0); }
}
/* Potato Mode Styles */
body.potato-mode * {
animation: none !important;
transition: none !important;
box-shadow: none !important;
backdrop-filter: none !important;
}
</style>
</head>
<body class="bg-gray-900 text-gray-100 h-screen flex overflow-hidden">
<!-- Toast Container -->
<div id="toast-container"></div>
<!-- Mobile Sidebar Overlay -->
<div id="overlay" class="fixed inset-0 bg-black/50 z-20 hidden lg:hidden backdrop-blur-sm transition-opacity"></div>
<!-- Sidebar -->
<aside id="sidebar" class="w-72 bg-gray-800 border-r border-gray-700 flex flex-col fixed lg:static h-full z-30 transition-transform transform -translate-x-full lg:translate-x-0 shadow-2xl lg:shadow-none">
<div class="p-6 border-b border-gray-700 flex items-center justify-between">
<h1 class="text-2xl font-bold flex items-center gap-3">
<div class="w-8 h-8 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-lg flex items-center justify-center shadow-lg">
<i class="fas fa-cube text-white text-sm"></i>
</div>
Web<span class="text-indigo-400">VM</span>
</h1>
<button id="menu-close-btn" class="lg:hidden text-gray-400 hover:text-white p-2">
<i class="fas fa-times text-xl"></i>
</button>
</div>
<div class="flex-1 overflow-y-auto p-4 space-y-6">
<!-- System Stats Card -->
<div class="bg-gray-700/50 rounded-xl p-4 border border-gray-600">
<div class="flex items-center justify-between mb-2">
<span class="text-xs font-medium text-gray-400 uppercase tracking-wider">System Status</span>
<span id="low-end-badge" class="hidden bg-yellow-500/20 text-yellow-300 text-[10px] px-2 py-0.5 rounded border border-yellow-500/30">Low Spec</span>
</div>
<div class="flex items-center gap-3 mb-2">
<i class="fas fa-microchip text-indigo-400"></i>
<span id="system-ram-display" class="text-sm font-mono">Detecting...</span>
</div>
<div class="flex items-center gap-3">
<i class="fas fa-hdd text-emerald-400"></i>
<span id="storage-display" class="text-sm font-mono">Storage: ...</span>
</div>
<!-- Ghost File Warning -->
<div id="storage-doctor-panel" class="hidden mt-3 pt-3 border-t border-gray-600">
<div class="flex items-center gap-2 text-red-400 text-xs mb-2">
<i class="fas fa-exclamation-triangle"></i>
<span><span id="ghost-file-count">0</span> Orphaned Files Found</span>
</div>
<button id="nuke-ghosts-btn" class="w-full text-xs bg-red-900/30 hover:bg-red-900/50 text-red-300 border border-red-800 rounded py-1.5 transition-colors">
Clean Up
</button>
</div>
</div>
<!-- Main Actions -->
<button id="create-vm-btn" class="w-full bg-indigo-600 hover:bg-indigo-500 text-white font-bold py-3 px-4 rounded-xl shadow-lg shadow-indigo-500/20 transition-all flex items-center justify-center gap-2 group">
<i class="fas fa-plus group-hover:rotate-90 transition-transform"></i> Create New Machine
</button>
<button id="load-snapshot-btn" class="w-full bg-gray-700 hover:bg-gray-600 text-gray-200 font-bold py-3 px-4 rounded-xl border border-gray-600 transition-all flex items-center justify-center gap-2">
<i class="fas fa-upload"></i> Import Snapshot
</button>
<input type="file" id="snapshot-upload" accept=".bin,.v86state,.86state" class="hidden" />
<div class="pt-4 border-t border-gray-700">
<button id="storage-manager-btn" class="w-full flex items-center gap-3 px-4 py-3 rounded-lg text-gray-400 hover:text-white hover:bg-gray-700 transition-colors">
<i class="fas fa-database"></i> Storage Manager
</button>
<button id="reset-app-btn" class="w-full flex items-center gap-3 px-4 py-3 rounded-lg text-red-400 hover:text-red-300 hover:bg-red-900/20 transition-colors mt-2">
<i class="fas fa-trash-alt"></i> Factory Reset
</button>
</div>
</div>
<div class="p-4 border-t border-gray-700 text-center text-xs text-gray-500">
v2.0 • Local Execution • <a href="#" id="help-btn" class="hover:text-indigo-400">Help</a>
</div>
</aside>
<!-- Main Content -->
<main class="flex-1 flex flex-col h-full relative">
<!-- Header -->
<header class="h-16 bg-gray-800/50 border-b border-gray-700 flex items-center justify-between px-6 backdrop-blur-sm lg:hidden">
<span class="font-bold text-lg">My Machines</span>
<button id="menu-open-btn" class="text-white p-2">
<i class="fas fa-bars"></i>
</button>
</header>
<div class="flex-1 overflow-y-auto p-4 lg:p-8">
<div class="max-w-5xl mx-auto">
<div class="flex items-center justify-between mb-6">
<h2 class="text-2xl font-bold hidden lg:block">My Machines</h2>
<span id="vm-count-badge" class="bg-gray-700 text-gray-300 px-2 py-1 rounded text-xs font-mono border border-gray-600">0 Machines</span>
</div>
<div id="vm-list" class="space-y-3">
<!-- VM Items injected here -->
</div>
<!-- Empty State -->
<div id="empty-list-placeholder" class="hidden flex flex-col items-center justify-center py-20 text-gray-500 opacity-60">
<i class="fas fa-microchip text-6xl mb-4"></i>
<p class="text-lg">No machines created yet.</p>
<p class="text-sm">Click "Create New Machine" to start.</p>
</div>
</div>
</div>
</main>
<!-- Create VM Modal -->
<div id="create-vm-modal" class="fixed inset-0 z-50 hidden bg-black/80 backdrop-blur-sm flex items-center justify-center p-4">
<div class="bg-gray-800 w-full max-w-2xl rounded-2xl shadow-2xl border border-gray-700 flex flex-col max-h-[90vh]">
<div class="p-6 border-b border-gray-700 flex justify-between items-center">
<div>
<h3 class="text-xl font-bold text-white">Create Virtual Machine</h3>
<p class="text-sm text-gray-400 mt-1">Configure your hardware environment</p>
</div>
<button id="close-modal-btn" class="text-gray-400 hover:text-white transition-colors">
<i class="fas fa-times text-xl"></i>
</button>
</div>
<div class="p-6 overflow-y-auto custom-scrollbar">
<!-- Stepper -->
<div class="flex items-center justify-center mb-8">
<div id="step-indicator-1" class="flex flex-col items-center gap-2 text-indigo-400">
<div class="w-8 h-8 rounded-full bg-indigo-600 flex items-center justify-center text-white font-bold border-2 border-indigo-400">1</div>
<span class="text-xs font-medium">Media</span>
</div>
<div class="w-16 h-0.5 bg-gray-600 mx-2"></div>
<div id="step-indicator-2" class="flex flex-col items-center gap-2 text-gray-500">
<div class="w-8 h-8 rounded-full bg-gray-700 flex items-center justify-center text-white font-bold border-2 border-gray-600">2</div>
<span class="text-xs font-medium">Hardware</span>
</div>
<div class="w-16 h-0.5 bg-gray-600 mx-2"></div>
<div id="step-indicator-3" class="flex flex-col items-center gap-2 text-gray-500">
<div class="w-8 h-8 rounded-full bg-gray-700 flex items-center justify-center text-white font-bold border-2 border-gray-600">3</div>
<span class="text-xs font-medium">Finish</span>
</div>
</div>
<!-- Step 1: Media Selection -->
<div id="modal-step-1" class="space-y-6">
<div>
<label class="block text-sm font-medium text-gray-300 mb-2">Boot Media Source</label>
<div class="grid grid-cols-3 gap-3">
<label class="cursor-pointer">
<input type="radio" name="source-type" value="cd" class="peer hidden" checked onchange="document.getElementById('boot-drive-type').value='cd'">
<div class="source-type-card bg-gray-700/50 hover:bg-gray-700 p-4 rounded-xl border border-gray-600 peer-checked:border-indigo-500 peer-checked:bg-indigo-900/20 text-center transition-all">
<i class="fas fa-compact-disc text-2xl mb-2 text-indigo-400"></i>
<div class="text-sm font-medium">CD-ROM (ISO)</div>
</div>
</label>
<label class="cursor-pointer">
<input type="radio" name="source-type" value="floppy" class="peer hidden" onchange="document.getElementById('boot-drive-type').value='floppy'">
<div class="source-type-card bg-gray-700/50 hover:bg-gray-700 p-4 rounded-xl border border-gray-600 peer-checked:border-indigo-500 peer-checked:bg-indigo-900/20 text-center transition-all">
<i class="fas fa-floppy-disk text-2xl mb-2 text-yellow-500"></i>
<div class="text-sm font-medium">Floppy (IMG)</div>
</div>
</label>
<label class="cursor-pointer">
<input type="radio" name="source-type" value="hda" class="peer hidden" onchange="document.getElementById('boot-drive-type').value='hda'">
<div class="source-type-card bg-gray-700/50 hover:bg-gray-700 p-4 rounded-xl border border-gray-600 peer-checked:border-indigo-500 peer-checked:bg-indigo-900/20 text-center transition-all">
<i class="fas fa-hard-drive text-2xl mb-2 text-blue-500"></i>
<div class="text-sm font-medium">HDD Image</div>
</div>
</label>
</div>
<input type="hidden" id="boot-drive-type" value="cd">
</div>
<div class="bg-gray-700/30 p-4 rounded-xl border border-dashed border-gray-600 text-center hover:border-indigo-500 transition-colors relative group">
<input type="file" id="primary-upload" class="absolute inset-0 opacity-0 cursor-pointer w-full h-full z-10" />
<div class="pointer-events-none">
<i class="fas fa-cloud-upload-alt text-3xl text-gray-400 mb-2 group-hover:text-indigo-400 transition-colors"></i>
<p class="text-sm font-medium text-white" id="primary-name-display">Tap to browse files</p>
<p class="text-xs text-gray-500 mt-1">Supports .iso, .img, .bin</p>
</div>
</div>
<details class="group bg-gray-700/20 rounded-lg border border-gray-700">
<summary class="p-3 cursor-pointer text-sm font-medium text-gray-300 hover:text-white select-none flex justify-between items-center">
<span>Advanced Media Options</span>
<i class="fas fa-chevron-down group-open:rotate-180 transition-transform"></i>
</summary>
<div class="p-4 space-y-4 border-t border-gray-700">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-xs text-gray-400 mb-1">Floppy Drive B</label>
<input type="file" id="fdb-upload" class="w-full text-xs text-gray-300 file:mr-2 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:font-semibold file:bg-gray-700 file:text-indigo-300 hover:file:bg-gray-600" />
</div>
<div>
<label class="block text-xs text-gray-400 mb-1">Hard Drive B</label>
<input type="file" id="hdb-upload" class="w-full text-xs text-gray-300 file:mr-2 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:font-semibold file:bg-gray-700 file:text-indigo-300 hover:file:bg-gray-600" />
</div>
</div>
<div class="pt-2 border-t border-gray-700/50">
<p class="text-xs text-orange-400 font-bold mb-2">Direct Kernel Boot (Linux)</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-xs text-gray-400 mb-1">bzImage</label>
<input type="file" id="bzimage-upload" class="w-full text-xs text-gray-300 file:mr-2 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:font-semibold file:bg-gray-700 file:text-orange-300 hover:file:bg-gray-600" />
</div>
<div>
<label class="block text-xs text-gray-400 mb-1">initrd</label>
<input type="file" id="initrd-upload" class="w-full text-xs text-gray-300 file:mr-2 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:font-semibold file:bg-gray-700 file:text-orange-300 hover:file:bg-gray-600" />
</div>
<div class="col-span-2">
<label class="block text-xs text-gray-400 mb-1">Command Line (cmdline)</label>
<input type="text" id="cmdline-input" placeholder="e.g. console=ttyS0 root=/dev/sda1" class="w-full bg-gray-900 border border-gray-600 rounded px-3 py-1.5 text-xs text-white focus:outline-none focus:border-indigo-500">
</div>
</div>
</div>
<div class="pt-2 border-t border-gray-700/50">
<p class="text-xs text-purple-400 font-bold mb-2">Custom BIOS/Firmware</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-xs text-gray-400 mb-1">System BIOS</label>
<input type="file" id="bios-upload" class="w-full text-xs text-gray-300 file:mr-2 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:font-semibold file:bg-gray-700 file:text-purple-300 hover:file:bg-gray-600" />
</div>
<div>
<label class="block text-xs text-gray-400 mb-1">VGA BIOS</label>
<input type="file" id="vga-bios-upload" class="w-full text-xs text-gray-300 file:mr-2 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:font-semibold file:bg-gray-700 file:text-purple-300 hover:file:bg-gray-600" />
</div>
</div>
</div>
</div>
</details>
</div>
<!-- Step 2: Hardware -->
<div id="modal-step-2" class="space-y-6 hidden">
<div>
<div class="flex justify-between items-center mb-2">
<label class="text-sm font-medium text-gray-300">Memory (RAM)</label>
<span id="ram-value" class="text-sm font-bold text-indigo-400">64 MB</span>
</div>
<input type="range" id="ram-slider" min="16" max="1024" step="16" value="64" class="w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-indigo-500">
<div class="flex justify-between text-[10px] text-gray-500 mt-1">
<span>16MB</span>
<span id="ram-max-label">1024MB</span>
</div>
</div>
<div>
<div class="flex justify-between items-center mb-2">
<label class="text-sm font-medium text-gray-300">Video Memory (VRAM)</label>
<span id="vram-value" class="text-sm font-bold text-indigo-400">4 MB</span>
</div>
<input type="range" id="vram-slider" min="1" max="64" step="1" value="4" class="w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-indigo-500">
</div>
<div class="grid grid-cols-2 gap-4">
<div class="bg-gray-700/30 p-3 rounded-lg border border-gray-600">
<label class="flex items-center cursor-pointer">
<input type="checkbox" id="network-toggle" class="sr-only peer">
<div class="w-9 h-5 bg-gray-600 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-indigo-600 relative"></div>
<span class="ml-3 text-sm font-medium text-gray-300">Networking</span>
</label>
<p class="text-[10px] text-gray-500 mt-1 ml-12 leading-tight">Requires WebSocket relay</p>
</div>
<div class="bg-gray-700/30 p-3 rounded-lg border border-gray-600">
<label class="flex items-center cursor-pointer">
<input type="checkbox" id="acpi-toggle" class="sr-only peer" checked>
<div class="w-9 h-5 bg-gray-600 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-green-600 relative"></div>
<span class="ml-3 text-sm font-medium text-gray-300">ACPI</span>
</label>
<p class="text-[10px] text-gray-500 mt-1 ml-12 leading-tight">Power management</p>
</div>
</div>
<details class="group bg-gray-700/20 rounded-lg border border-gray-700">
<summary class="p-3 cursor-pointer text-sm font-medium text-gray-300 hover:text-white select-none flex justify-between items-center">
<span>Boot & CPU Options</span>
<i class="fas fa-chevron-down group-open:rotate-180 transition-transform"></i>
</summary>
<div class="p-4 space-y-4 border-t border-gray-700">
<div>
<label class="block text-xs text-gray-400 mb-1">Boot Order (Hex)</label>
<select id="boot-order-select" class="w-full bg-gray-900 border border-gray-600 rounded px-2 py-1.5 text-xs text-white">
<option value="531">CD / HDD / Floppy (0x213)</option>
<option value="1144219">HDD / CD / Floppy (0x11759B)</option>
<option value="213">Floppy / CD / HDD (0xD5)</option>
</select>
</div>
<div>
<label class="block text-xs text-gray-400 mb-1">CPU Emulation Speed</label>
<select id="cpu-profile-select" class="w-full bg-gray-900 border border-gray-600 rounded px-2 py-1.5 text-xs text-white">
<option value="balanced">Balanced (Recommended)</option>
<option value="potato">Potato Mode (Low End)</option>
<option value="high">High Performance (Desktop)</option>
</select>
</div>
<div>
<label class="block text-xs text-gray-400 mb-1">Graphics Scaling</label>
<select id="graphics-scale-select" class="w-full bg-gray-900 border border-gray-600 rounded px-2 py-1.5 text-xs text-white">
<option value="pixelated">Crisp (Pixelated)</option>
<option value="smooth">Smooth (Blur)</option>
</select>
</div>
</div>
</details>
</div>
<!-- Step 3: Finish -->
<div id="modal-step-3" class="space-y-6 hidden">
<div class="bg-gray-700/50 p-6 rounded-xl border border-gray-600 text-center">
<div class="w-16 h-16 bg-indigo-900/50 rounded-full flex items-center justify-center mx-auto mb-4 border border-indigo-500/30">
<i class="fas fa-rocket text-2xl text-indigo-400"></i>
</div>
<h4 class="text-lg font-bold text-white mb-1">Ready to Launch</h4>
<p class="text-gray-400 text-sm mb-6">Review your configuration</p>
<div class="text-left bg-gray-800/50 p-4 rounded-lg border border-gray-700 space-y-2 mb-6 text-sm">
<div class="flex justify-between">
<span class="text-gray-500">Source:</span>
<span class="text-white truncate max-w-[150px]" id="summary-source">-</span>
</div>
<div class="flex justify-between">
<span class="text-gray-500">Memory:</span>
<span class="text-white" id="summary-ram">64 MB</span>
</div>
</div>
<label class="block text-left text-sm font-medium text-gray-300 mb-2">Machine Name</label>
<input type="text" id="vm-name-input" placeholder="e.g. Alpine Linux, Win98" class="w-full bg-gray-900 border border-gray-600 rounded-lg px-4 py-3 text-white focus:outline-none focus:border-indigo-500 transition-colors">
</div>
</div>
</div>
<div class="p-6 border-t border-gray-700 flex justify-between bg-gray-800/50">
<button id="modal-back-btn" class="px-6 py-2 rounded-lg text-gray-400 hover:text-white hover:bg-gray-700 transition-colors disabled:opacity-30 disabled:cursor-not-allowed">
Back
</button>
<div class="flex gap-3">
<button id="modal-next-btn" class="bg-indigo-600 hover:bg-indigo-500 text-white px-6 py-2 rounded-lg font-bold shadow-lg shadow-indigo-500/20 transition-all disabled:opacity-50 disabled:cursor-not-allowed">
Next Step
</button>
<button id="modal-create-btn" class="hidden bg-green-600 hover:bg-green-500 text-white px-8 py-2 rounded-lg font-bold shadow-lg shadow-green-500/20 transition-all disabled:opacity-50 disabled:cursor-not-allowed">
Create Machine
</button>
</div>
</div>
</div>
</div>
<!-- Edit VM Modal -->
<div id="edit-vm-modal" class="fixed inset-0 z-50 hidden bg-black/80 backdrop-blur-sm flex items-center justify-center p-4">
<div class="bg-gray-800 w-full max-w-md rounded-2xl shadow-2xl border border-gray-700 p-6">
<h3 class="text-lg font-bold text-white mb-4">Edit Configuration</h3>
<input type="hidden" id="edit-vm-id">
<div class="space-y-4">
<div>
<label class="block text-sm text-gray-400 mb-1">Name</label>
<input type="text" id="edit-vm-name-input" class="w-full bg-gray-900 border border-gray-600 rounded px-3 py-2 text-white">
</div>
<div>
<div class="flex justify-between items-center mb-1">
<label class="text-sm text-gray-400">Memory (RAM)</label>
<span id="edit-ram-value" class="text-xs text-indigo-400 font-bold">64 MB</span>
</div>
<input type="range" id="edit-ram-slider" min="16" max="1024" step="16" class="w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-indigo-500">
<div class="flex justify-between text-[10px] text-gray-500">
<span>16MB</span>
<span id="edit-ram-max-label">1024MB</span>
</div>
</div>
<div class="flex items-center gap-3">
<input type="checkbox" id="edit-network-toggle" class="w-4 h-4 rounded bg-gray-700 border-gray-600 text-indigo-600 focus:ring-indigo-500">
<label for="edit-network-toggle" class="text-sm text-gray-300">Enable Networking</label>
</div>
</div>
<div class="mt-6 flex justify-end gap-3">
<button id="close-edit-modal-btn" class="hidden"></button>
<button id="cancel-edit-btn" class="px-4 py-2 rounded-lg text-gray-400 hover:bg-gray-700 text-sm">Cancel</button>
<button id="save-changes-btn" class="bg-indigo-600 hover:bg-indigo-500 text-white px-4 py-2 rounded-lg text-sm font-bold">Save Changes</button>
</div>
</div>
</div>
<!-- Storage Manager Modal -->
<div id="storage-manager-modal" class="fixed inset-0 z-50 hidden bg-black/90 backdrop-blur-md flex items-center justify-center p-4">
<div class="bg-gray-800 w-full max-w-4xl rounded-2xl shadow-2xl border border-gray-700 flex flex-col h-[80vh]">
<div class="p-6 border-b border-gray-700 flex justify-between items-start">
<div>
<h3 class="text-2xl font-bold text-white">Storage Manager</h3>
<p class="text-sm text-gray-400 mt-1">Manage local database and storage quota</p>
</div>
<button id="close-storage-manager-btn" class="text-gray-400 hover:text-white bg-gray-700 hover:bg-gray-600 w-8 h-8 rounded-full flex items-center justify-center transition-colors">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6 bg-gray-800/50 border-b border-gray-700">
<div id="storage-manager-summary">
<!-- Injected via JS -->
<div class="animate-pulse flex space-x-4">
<div class="flex-1 space-y-4 py-1">
<div class="h-4 bg-gray-700 rounded w-3/4"></div>
<div class="h-4 bg-gray-700 rounded"></div>
</div>
</div>
</div>
</div>
<div class="flex-1 overflow-auto p-0">
<table class="w-full text-left border-collapse">
<thead class="bg-gray-900/50 sticky top-0 backdrop-blur-sm z-10">
<tr>
<th class="p-4 text-xs font-semibold text-gray-400 uppercase tracking-wider">Item Name</th>
<th class="p-4 text-xs font-semibold text-gray-400 uppercase tracking-wider">Type</th>
<th class="p-4 text-xs font-semibold text-gray-400 uppercase tracking-wider">Size</th>
<th class="p-4 text-xs font-semibold text-gray-400 uppercase tracking-wider text-right">Actions</th>
</tr>
</thead>
<tbody id="storage-items-list" class="divide-y divide-gray-700">
<!-- Items injected here -->
</tbody>
</table>
</div>
</div>
</div>
<!-- Help Modal -->
<div id="help-modal" class="fixed inset-0 z-50 hidden bg-black/80 backdrop-blur-sm flex items-center justify-center p-4">
<div class="bg-gray-800 w-full max-w-2xl rounded-2xl shadow-2xl border border-gray-700 flex flex-col max-h-[90vh]">
<div class="p-6 border-b border-gray-700 flex justify-between items-center">
<h3 class="text-xl font-bold text-white">Help & FAQ</h3>
<button id="close-help-btn" class="text-gray-400 hover:text-white transition-colors">
<i class="fas fa-times text-xl"></i>
</button>
</div>
<div class="p-6 overflow-y-auto text-sm">
<div class="space-y-3">
<details class="group bg-gray-700/50 p-3 rounded-lg border border-gray-700 open:bg-gray-700/80 transition-colors" open>
<summary class="font-semibold text-white cursor-pointer list-none flex justify-between items-center">
<span><i class="fas fa-question-circle text-indigo-400 w-6 text-center"></i> What is this?</span>
<i class="fas fa-chevron-down group-open:rotate-180 transition-transform"></i>
</summary>
<p class="text-gray-300 mt-3 pt-3 border-t border-gray-600/50 leading-relaxed">
WebVM lets you run virtual machines (like old operating systems) directly in your browser. It uses a technology called WebAssembly to emulate a computer's hardware. All files and data are stored locally on your device, never sent to a server.
</p>
</details>
<details class="group bg-gray-700/50 p-3 rounded-lg border border-gray-700 open:bg-gray-700/80 transition-colors">
<summary class="font-semibold text-white cursor-pointer list-none flex justify-between items-center">
<span><i class="fas fa-rocket text-indigo-400 w-6 text-center"></i> Getting Started</span>
<i class="fas fa-chevron-down group-open:rotate-180 transition-transform"></i>
</summary>
<div class="text-gray-300 mt-3 pt-3 border-t border-gray-600/50 leading-relaxed space-y-2">
<p>1. Click <strong>"Create New Machine"</strong>.</p>
<p>2. Select a source type (e.g., CD-ROM for a <strong>.iso</strong> file).</p>
<p>3. Upload your bootable image file. Lightweight Linux distributions like Alpine Linux, TinyCore, or Arch Linux work best.</p>
<p>4. Configure RAM and other hardware settings, then give it a name and click Create!</p>
</div>
</details>
<details class="group bg-gray-700/50 p-3 rounded-lg border border-gray-700 open:bg-gray-700/80 transition-colors">
<summary class="font-semibold text-white cursor-pointer list-none flex justify-between items-center">
<span><i class="fas fa-gamepad text-indigo-400 w-6 text-center"></i> Controls & Features</span>
<i class="fas fa-chevron-down group-open:rotate-180 transition-transform"></i>
</summary>
<div class="text-gray-300 mt-3 pt-3 border-t border-gray-600/50 leading-relaxed space-y-2">
<p><strong><i class="fas fa-hand-pointer"></i> Assistive Touch:</strong> While a VM is running, use the floating button (bottom-right) to access key controls like Fullscreen, Virtual Keyboard, Ctrl+Alt+Del, and Save State.</p>
<p><strong><i class="fas fa-save"></i> Saving Progress:</strong> Click the "Save" icon in the Assistive Touch menu to save a complete snapshot of the VM's current state. You can then close the window and resume later by starting the same machine.</p>
</div>
</details>
<details class="group bg-gray-700/50 p-3 rounded-lg border border-gray-700 open:bg-gray-700/80 transition-colors">
<summary class="font-semibold text-white cursor-pointer list-none flex justify-between items-center">
<span><i class="fas fa-bug text-indigo-400 w-6 text-center"></i> Troubleshooting</span>
<i class="fas fa-chevron-down group-open:rotate-180 transition-transform"></i>
</summary>
<ul class="list-disc list-inside text-gray-300 mt-3 pt-3 border-t border-gray-600/50 leading-relaxed space-y-2">
<li><strong>Black Screen?</strong> The most common cause is not enough memory. Try creating the machine again with less RAM (e.g., 64MB or 128MB). Some operating systems also take a while to boot.</li>
<li><strong>Slow Performance?</strong> This is emulation, so it will be slower than a real computer. For low-spec devices, use the "Potato Mode" CPU profile in the advanced hardware options.</li>
<li><strong>No Internet?</strong> Networking is experimental and requires a public WebSocket relay. It may not always be reliable.</li>
</ul>
</details>
<details class="group bg-gray-700/50 p-3 rounded-lg border border-gray-700 open:bg-gray-700/80 transition-colors">
<summary class="font-semibold text-white cursor-pointer list-none flex justify-between items-center">
<span><i class="fas fa-database text-indigo-400 w-6 text-center"></i> Data & Reset</span>
<i class="fas fa-chevron-down group-open:rotate-180 transition-transform"></i>
</summary>
<div class="text-gray-300 mt-3 pt-3 border-t border-gray-600/50 leading-relaxed space-y-2">
<p>All your machines and snapshots are stored in your browser's local <strong>IndexedDB</strong>. No data is ever uploaded.</p>
<p>You can manage individual files using the <strong>Storage Manager</strong>.</p>
<p class="p-2 bg-red-900/20 text-red-300 border border-red-500/30 rounded-md">
<strong>Factory Reset:</strong> This option will completely wipe the app's database, deleting ALL machines and snapshots. This is permanent and cannot be undone.
</p>
</div>
</details>
</div>
</div>
<div class="p-4 border-t border-gray-700 bg-gray-800/50 text-center">
<p class="text-xs text-gray-500">WebVM v2.0 • Powered by libv86</p>
</div>
</div>
</div>
<script src="dashboard.js"></script>
</body>
</html>