File size: 41,567 Bytes
6242366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI Server Production Engine</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .server-card {
            transition: all 0.3s ease;
        }
        .server-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .progress-bar {
            height: 6px;
            transition: width 0.5s ease;
        }
        .config-tab {
            display: none;
        }
        .config-tab.active {
            display: block;
        }
        .animated-bg {
            background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
            background-size: 400% 400%;
            animation: gradient 15s ease infinite;
        }
        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        .blink {
            animation: blink-animation 1.5s infinite;
        }
        @keyframes blink-animation {
            0% { opacity: 1; }
            50% { opacity: 0.5; }
            100% { opacity: 1; }
        }
    </style>
</head>
<body class="bg-gray-100">
    <div class="min-h-screen">
        <!-- Header -->
        <header class="animated-bg text-white">
            <div class="container mx-auto px-4 py-8">
                <div class="flex justify-between items-center">
                    <div>
                        <h1 class="text-3xl font-bold">AI Server Production Engine</h1>
                        <p class="mt-2">Automated server configuration generator with hardening</p>
                    </div>
                    <div class="flex items-center space-x-4">
                        <div class="bg-white bg-opacity-20 p-2 rounded-full">
                            <i class="fas fa-server text-2xl"></i>
                        </div>
                    </div>
                </div>
            </div>
        </header>

        <!-- Main Content -->
        <main class="container mx-auto px-4 py-8">
            <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
                <!-- Input Form -->
                <div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6">
                    <h2 class="text-xl font-semibold mb-4">Server Specifications</h2>
                    <form id="serverForm">
                        <div class="mb-4">
                            <label class="block text-gray-700 mb-2" for="serverName">Server Name</label>
                            <input type="text" id="serverName" class="w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="e.g., CORTEX" required>
                        </div>
                        
                        <div class="mb-4">
                            <label class="block text-gray-700 mb-2" for="serverType">Server Type</label>
                            <select id="serverType" class="w-full px-3 py-2 border border-gray-300 rounded-md" required>
                                <option value="">Select server type</option>
                                <option value="windows-dc">Windows Datacenter (Domain Controller)</option>
                                <option value="windows-iis">Windows Server with IIS</option>
                                <option value="docker">Docker Container</option>
                                <option value="ubuntu">Ubuntu Server</option>
                                <option value="proxmox">Proxmox VM</option>
                            </select>
                        </div>
                        
                        <div class="mb-4">
                            <label class="block text-gray-700 mb-2" for="ipAddress">IP Address</label>
                            <input type="text" id="ipAddress" class="w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="e.g., 10.239.165.102" required>
                        </div>
                        
                        <div class="mb-4">
                            <label class="block text-gray-700 mb-2" for="domain">Domain (if applicable)</label>
                            <input type="text" id="domain" class="w-full px-3 py-2 border border-gray-300 rounded-md" placeholder="e.g., wrp.io">
                        </div>
                        
                        <div class="mb-4">
                            <label class="block text-gray-700 mb-2" for="service">Service to Deploy</label>
                            <select id="service" class="w-full px-3 py-2 border border-gray-300 rounded-md" required>
                                <option value="">Select service</option>
                                <option value="web">Web Server</option>
                                <option value="db">Database Server</option>
                                <option value="app">Application Server</option>
                                <option value="file">File Server</option>
                                <option value="auth">Authentication Server</option>
                            </select>
                        </div>
                        
                        <div class="mb-4">
                            <label class="block text-gray-700 mb-2">Hardening Options</label>
                            <div class="space-y-2">
                                <label class="flex items-center">
                                    <input type="checkbox" class="form-checkbox" id="firewall" checked>
                                    <span class="ml-2">Firewall Configuration</span>
                                </label>
                                <label class="flex items-center">
                                    <input type="checkbox" class="form-checkbox" id="ssl" checked>
                                    <span class="ml-2">SSL/TLS Setup</span>
                                </label>
                                <label class="flex items-center">
                                    <input type="checkbox" class="form-checkbox" id="backup" checked>
                                    <span class="ml-2">Backup Configuration</span>
                                </label>
                                <label class="flex items-center">
                                    <input type="checkbox" class="form-checkbox" id="monitoring" checked>
                                    <span class="ml-2">Monitoring Setup</span>
                                </label>
                            </div>
                        </div>
                        
                        <div class="mb-4">
                            <label class="block text-gray-700 mb-2" for="notes">Additional Notes</label>
                            <textarea id="notes" class="w-full px-3 py-2 border border-gray-300 rounded-md" rows="3" placeholder="Any special requirements..."></textarea>
                        </div>
                        
                        <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-md transition duration-300 flex items-center justify-center">
                            <i class="fas fa-cogs mr-2"></i> Generate Configurations
                        </button>
                    </form>
                </div>
                
                <!-- Results Section -->
                <div class="lg:col-span-2">
                    <div id="processingSection" class="hidden bg-white rounded-xl shadow-md p-6 mb-6">
                        <div class="flex items-center justify-between mb-4">
                            <h2 class="text-xl font-semibold">Generating Configurations</h2>
                            <div class="blink">
                                <i class="fas fa-circle-notch fa-spin text-blue-500"></i>
                            </div>
                        </div>
                        
                        <div class="mb-4">
                            <div class="flex justify-between text-sm text-gray-600 mb-1">
                                <span>Progress</span>
                                <span id="progressPercent">0%</span>
                            </div>
                            <div class="w-full bg-gray-200 rounded-full h-2.5">
                                <div id="progressBar" class="progress-bar bg-blue-600 rounded-full h-2.5" style="width: 0%"></div>
                            </div>
                        </div>
                        
                        <div class="space-y-4">
                            <div class="flex items-center">
                                <div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-check text-blue-500 text-sm"></i>
                                </div>
                                <div>
                                    <p class="font-medium">Analyzing server specifications</p>
                                    <p class="text-sm text-gray-500">Determining optimal configuration approach</p>
                                </div>
                            </div>
                            
                            <div class="flex items-center opacity-50" id="step2">
                                <div class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-cog text-gray-400 text-sm"></i>
                                </div>
                                <div>
                                    <p class="font-medium">Generating base configuration</p>
                                    <p class="text-sm text-gray-500">Creating initial setup files</p>
                                </div>
                            </div>
                            
                            <div class="flex items-center opacity-50" id="step3">
                                <div class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-cog text-gray-400 text-sm"></i>
                                </div>
                                <div>
                                    <p class="font-medium">Applying security hardening</p>
                                    <p class="text-sm text-gray-500">Implementing firewall rules, permissions, etc.</p>
                                </div>
                            </div>
                            
                            <div class="flex items-center opacity-50" id="step4">
                                <div class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-cog text-gray-400 text-sm"></i>
                                </div>
                                <div>
                                    <p class="font-medium">Testing configurations</p>
                                    <p class="text-sm text-gray-500">Validating in sandbox environment</p>
                                </div>
                            </div>
                            
                            <div class="flex items-center opacity-50" id="step5">
                                <div class="w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center mr-3">
                                    <i class="fas fa-cog text-gray-400 text-sm"></i>
                                </div>
                                <div>
                                    <p class="font-medium">Preparing download packages</p>
                                    <p class="text-sm text-gray-500">Creating one-click deploy solutions</p>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div id="resultsSection" class="hidden bg-white rounded-xl shadow-md p-6">
                        <div class="flex justify-between items-center mb-6">
                            <h2 class="text-xl font-semibold">Generated Configurations</h2>
                            <div class="flex space-x-2">
                                <button id="refreshBtn" class="px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-md text-sm flex items-center">
                                    <i class="fas fa-sync-alt mr-1 text-gray-600"></i> Refresh
                                </button>
                                <button id="newConfigBtn" class="px-3 py-1 bg-blue-100 hover:bg-blue-200 text-blue-600 rounded-md text-sm flex items-center">
                                    <i class="fas fa-plus mr-1"></i> New Config
                                </button>
                            </div>
                        </div>
                        
                        <div class="mb-4 border-b border-gray-200">
                            <ul class="flex flex-wrap -mb-px" id="configTabs">
                                <li class="mr-2">
                                    <button class="inline-block p-4 border-b-2 border-blue-600 rounded-t-lg text-blue-600" data-tab="tab1">Option 1</button>
                                </li>
                                <li class="mr-2">
                                    <button class="inline-block p-4 border-b-2 border-transparent rounded-t-lg hover:text-gray-600 hover:border-gray-300" data-tab="tab2">Option 2</button>
                                </li>
                                <li class="mr-2">
                                    <button class="inline-block p-4 border-b-2 border-transparent rounded-t-lg hover:text-gray-600 hover:border-gray-300" data-tab="tab3">Option 3</button>
                                </li>
                            </ul>
                        </div>
                        
                        <div id="tab1" class="config-tab active">
                            <div class="bg-gray-50 p-4 rounded-lg mb-4">
                                <div class="flex justify-between items-start">
                                    <div>
                                        <h3 class="font-medium">Standard Configuration</h3>
                                        <p class="text-sm text-gray-500">Balanced between performance and security</p>
                                    </div>
                                    <span class="bg-green-100 text-green-800 text-xs font-medium px-2.5 py-0.5 rounded">Recommended</span>
                                </div>
                            </div>
                            
                            <div class="mb-4">
                                <h4 class="font-medium mb-2">Configuration Details</h4>
                                <div class="bg-gray-800 text-gray-100 p-4 rounded-lg overflow-x-auto">
                                    <pre id="configContent1" class="text-sm font-mono"></pre>
                                </div>
                            </div>
                            
                            <div class="mb-4">
                                <h4 class="font-medium mb-2">Placeholders to Replace</h4>
                                <ul class="list-disc pl-5 text-sm text-gray-600 space-y-1">
                                    <li><code>%%SERVER_IP%%</code> - Replace with your server's IP address</li>
                                    <li><code>%%DOMAIN_NAME%%</code> - Replace with your domain name</li>
                                    <li><code>%%ADMIN_EMAIL%%</code> - Replace with admin contact email</li>
                                </ul>
                            </div>
                            
                            <div class="flex flex-wrap gap-3">
                                <button class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md flex items-center">
                                    <i class="fas fa-download mr-2"></i> Download Config
                                </button>
                                <button class="px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-md flex items-center">
                                    <i class="fas fa-terminal mr-2"></i> Deploy Script
                                </button>
                                <button class="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-md flex items-center">
                                    <i class="fas fa-code mr-2"></i> View Dockerfile
                                </button>
                            </div>
                        </div>
                        
                        <div id="tab2" class="config-tab">
                            <div class="bg-gray-50 p-4 rounded-lg mb-4">
                                <div class="flex justify-between items-start">
                                    <div>
                                        <h3 class="font-medium">High Security Configuration</h3>
                                        <p class="text-sm text-gray-500">Maximum security with potential performance impact</p>
                                    </div>
                                    <span class="bg-yellow-100 text-yellow-800 text-xs font-medium px-2.5 py-0.5 rounded">Strict</span>
                                </div>
                            </div>
                            
                            <div class="mb-4">
                                <h4 class="font-medium mb-2">Configuration Details</h4>
                                <div class="bg-gray-800 text-gray-100 p-4 rounded-lg overflow-x-auto">
                                    <pre id="configContent2" class="text-sm font-mono"></pre>
                                </div>
                            </div>
                            
                            <div class="flex flex-wrap gap-3">
                                <button class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md flex items-center">
                                    <i class="fas fa-download mr-2"></i> Download Config
                                </button>
                                <button class="px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-md flex items-center">
                                    <i class="fas fa-terminal mr-2"></i> Deploy Script
                                </button>
                            </div>
                        </div>
                        
                        <div id="tab3" class="config-tab">
                            <div class="bg-gray-50 p-4 rounded-lg mb-4">
                                <div class="flex justify-between items-start">
                                    <div>
                                        <h3 class="font-medium">Performance-Optimized</h3>
                                        <p class="text-sm text-gray-500">Maximum performance with basic security</p>
                                    </div>
                                    <span class="bg-purple-100 text-purple-800 text-xs font-medium px-2.5 py-0.5 rounded">Fast</span>
                                </div>
                            </div>
                            
                            <div class="mb-4">
                                <h4 class="font-medium mb-2">Configuration Details</h4>
                                <div class="bg-gray-800 text-gray-100 p-4 rounded-lg overflow-x-auto">
                                    <pre id="configContent3" class="text-sm font-mono"></pre>
                                </div>
                            </div>
                            
                            <div class="flex flex-wrap gap-3">
                                <button class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md flex items-center">
                                    <i class="fas fa-download mr-2"></i> Download Config
                                </button>
                                <button class="px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-md flex items-center">
                                    <i class="fas fa-terminal mr-2"></i> Deploy Script
                                </button>
                            </div>
                        </div>
                    </div>
                    
                    <div id="serverCards" class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-6">
                        <!-- Server cards will be added here dynamically -->
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const form = document.getElementById('serverForm');
            const processingSection = document.getElementById('processingSection');
            const resultsSection = document.getElementById('resultsSection');
            const progressBar = document.getElementById('progressBar');
            const progressPercent = document.getElementById('progressPercent');
            const configContent1 = document.getElementById('configContent1');
            const configContent2 = document.getElementById('configContent2');
            const configContent3 = document.getElementById('configContent3');
            const serverCards = document.getElementById('serverCards');
            const refreshBtn = document.getElementById('refreshBtn');
            const newConfigBtn = document.getElementById('newConfigBtn');
            
            // Tab switching
            document.querySelectorAll('[data-tab]').forEach(tab => {
                tab.addEventListener('click', function() {
                    const tabId = this.getAttribute('data-tab');
                    
                    // Hide all tabs
                    document.querySelectorAll('.config-tab').forEach(t => {
                        t.classList.remove('active');
                    });
                    
                    // Show selected tab
                    document.getElementById(tabId).classList.add('active');
                    
                    // Update tab buttons
                    document.querySelectorAll('[data-tab]').forEach(t => {
                        t.classList.remove('border-blue-600', 'text-blue-600');
                        t.classList.add('border-transparent');
                    });
                    
                    this.classList.add('border-blue-600', 'text-blue-600');
                    this.classList.remove('border-transparent');
                });
            });
            
            // Form submission
            form.addEventListener('submit', function(e) {
                e.preventDefault();
                
                // Get form values
                const serverName = document.getElementById('serverName').value;
                const serverType = document.getElementById('serverType').value;
                const ipAddress = document.getElementById('ipAddress').value;
                const domain = document.getElementById('domain').value;
                const service = document.getElementById('service').value;
                const firewall = document.getElementById('firewall').checked;
                const ssl = document.getElementById('ssl').checked;
                const backup = document.getElementById('backup').checked;
                const monitoring = document.getElementById('monitoring').checked;
                const notes = document.getElementById('notes').value;
                
                // Show processing section
                processingSection.classList.remove('hidden');
                resultsSection.classList.add('hidden');
                
                // Simulate processing
                simulateProcessing(serverName, serverType, ipAddress, domain, service, firewall, ssl, backup, monitoring, notes);
            });
            
            // Refresh button
            refreshBtn.addEventListener('click', function() {
                // In a real app, this would fetch updated configurations
                alert('Configurations refreshed with latest optimizations');
            });
            
            // New config button
            newConfigBtn.addEventListener('click', function() {
                processingSection.classList.add('hidden');
                resultsSection.classList.add('hidden');
                form.reset();
            });
            
            function simulateProcessing(serverName, serverType, ipAddress, domain, service, firewall, ssl, backup, monitoring, notes) {
                let progress = 0;
                const interval = setInterval(() => {
                    progress += 5;
                    if (progress > 100) progress = 100;
                    
                    progressBar.style.width = `${progress}%`;
                    progressPercent.textContent = `${progress}%`;
                    
                    // Update steps
                    if (progress >= 20) document.getElementById('step2').classList.remove('opacity-50');
                    if (progress >= 40) document.getElementById('step3').classList.remove('opacity-50');
                    if (progress >= 60) document.getElementById('step4').classList.remove('opacity-50');
                    if (progress >= 80) document.getElementById('step5').classList.remove('opacity-50');
                    
                    if (progress === 100) {
                        clearInterval(interval);
                        setTimeout(() => {
                            processingSection.classList.add('hidden');
                            resultsSection.classList.remove('hidden');
                            generateConfigurations(serverName, serverType, ipAddress, domain, service, firewall, ssl, backup, monitoring, notes);
                            addServerCard(serverName, serverType, ipAddress, domain);
                        }, 500);
                    }
                }, 200);
            }
            
            function generateConfigurations(serverName, serverType, ipAddress, domain, service, firewall, ssl, backup, monitoring, notes) {
                // Generate different configuration options based on server type
                let config1, config2, config3;
                
                if (serverType === 'windows-dc') {
                    // Domain Controller configuration
                    config1 = `# Windows Server Domain Controller Configuration
# Server: ${serverName}
# IP: ${ipAddress}
# Domain: ${domain}

Import-Module ActiveDirectory

# Promote server to domain controller
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
Install-ADDSForest -DomainName "${domain}" -DomainNetbiosName "${serverName}" -InstallDns -Force

# Basic hardening
if (${firewall}) {
    Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True
    # Add firewall rules...
}

if (${ssl}) {
    # SSL certificate configuration
    # Replace %%ADMIN_EMAIL%% with actual admin email
    $cert = New-SelfSignedCertificate -DnsName "${domain}", "${serverName}.${domain}" -CertStoreLocation "cert:\\LocalMachine\\My" -NotAfter (Get-Date).AddYears(2)
    # Configure IIS or other services to use cert...
}

if (${backup}) {
    # Backup configuration
    # Replace %%BACKUP_LOCATION%% with your backup path
    $backupScript = @'
    # Daily backup script
    # Backup AD, DNS, etc.
'@
    Set-Content -Path "C:\\Scripts\\ADBackup.ps1" -Value $backupScript
}

if (${monitoring}) {
    # Monitoring setup
    Install-WindowsFeature -Name "RSAT-SMTP" -IncludeAllSubFeature
    # Configure monitoring agent...
}`;

                    config2 = `# Strict Security Domain Controller Configuration
# Additional security measures that may impact functionality

# Enhanced security policies
secedit /configure /cfg C:\\Windows\\inf\\defltbase.inf /db defltbase.sdb /verbose

# Disable legacy protocols
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
Set-SmbServerConfiguration -EncryptData $true -Force

# Advanced audit policies
auditpol /set /category:"Account Logon","Logon/Logoff","Object Access","Policy Change","Privilege Use","Detailed Tracking","System","Account Management" /success:enable /failure:enable

# Restricted firewall rules
New-NetFirewallRule -DisplayName "Block All Inbound" -Direction Inbound -Action Block
New-NetFirewallRule -DisplayName "Allow Specific" -Direction Inbound -Action Allow -RemoteAddress 10.0.0.0/8 -Protocol TCP -LocalPort 53,88,389,636,3268,3269

# Additional notes:
# - Consider implementing LAPS for local admin passwords
# - Enable Credential Guard if supported by hardware
# - Configure JEA for administrative tasks`;

                    config3 = `# Performance-Optimized Domain Controller
# Focused on reducing overhead while maintaining security

# Optimize AD database
ntdsutil "ac i ntds" "files" "compact to c:\\temp" q q

# Tune performance parameters
Set-ADDomainController -Identity ${serverName} -DynamicDnsUpdateEnabled $true -IsGlobalCatalog $true -AllowPasswordReplicationAccountName ""

# Reduced logging
auditpol /set /category:"System" /success:disable /failure:disable
Set-ItemProperty -Path "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Lsa" -Name "LsaDbExtPtTimeout" -Value 30000

# Notes:
# - Consider increasing AD garbage collection interval
# - Adjust tombstone lifetime based on your environment
# - Optimize DNS scavenging settings`;
                }
                else if (serverType === 'docker') {
                    // Docker configuration
                    config1 = `# Docker Web Server Configuration
# Server: ${serverName}
# IP: ${ipAddress}

version: '3.8'

services:
  web:
    image: nginx:latest
    container_name: ${serverName}-web
    restart: unless-stopped
    ports:
      - "80:80"
      ${ssl ? '- "443:443"' : ''}
    volumes:
      - ./html:/usr/share/nginx/html
      ${ssl ? '- ./certs:/etc/nginx/certs' : ''}
      - ./nginx.conf:/etc/nginx/nginx.conf
    environment:
      - NGINX_HOST=${domain || ipAddress}
    networks:
      - webnet

${backup ? `  backup:
    image: alpine
    container_name: ${serverName}-backup
    restart: on-failure
    volumes:
      - ./html:/source
      - ./backups:/backup
    command: sh -c "tar czf /backup/backup-$$(date +%Y%m%d).tar.gz /source"
    networks:
      - webnet` : ''}

${monitoring ? `  monitor:
    image: prom/prometheus:latest
    container_name: ${serverName}-monitor
    restart: unless-stopped
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    networks:
      - webnet` : ''}

networks:
  webnet:
    driver: bridge

# Placeholders to replace:
# - Configure ./nginx.conf with your specific web server settings
# - For SSL, place certificates in ./certs directory
# - For monitoring, configure ./prometheus.yml`;

                    config2 = `# High Security Docker Configuration
# Additional security measures

version: '3.8'

services:
  web:
    image: nginx:latest
    container_name: ${serverName}-web-secure
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    read_only: true
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    cap_add:
      - NET_BIND_SERVICE
    volumes:
      - ./html:/usr/share/nginx/html:ro
      - ./certs:/etc/nginx/certs:ro
      - ./nginx-secure.conf:/etc/nginx/nginx.conf:ro
    environment:
      - NGINX_HOST=${domain || ipAddress}
    networks:
      - securenet
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

  apparmor:
    image: busybox
    container_name: ${serverName}-apparmor
    command: sh -c "echo 'Applying AppArmor profile...' && sleep infinity"
    security_opt:
      - apparmor=docker-nginx

networks:
  securenet:
    driver: bridge
    internal: true

# Additional security recommendations:
# 1. Enable user namespace remapping in Docker daemon
# 2. Implement image signing with Docker Content Trust
# 3. Use seccomp profiles for additional restrictions
# 4. Consider network segmentation with multiple networks`;

                    config3 = `# Performance-Optimized Docker Setup
# Focused on maximizing throughput

version: '3.8'

services:
  web:
    image: nginx:alpine
    container_name: ${serverName}-web-fast
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./html:/usr/share/nginx/html
      - ./certs:/etc/nginx/certs
      - ./nginx-perf.conf:/etc/nginx/nginx.conf
    environment:
      - NGINX_WORKER_PROCESSES=auto
      - NGINX_WORKER_CONNECTIONS=4096
      - NGINX_KEEPALIVE_TIMEOUT=65
    networks:
      - perfnet
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 2G
        reservations:
          cpus: '0.5'
          memory: 512M

networks:
  perfnet:
    driver: bridge
    driver_opts:
      com.docker.network.driver.mtu: 1500
      com.docker.network.bridge.enable_icc: "true"

# Performance tuning recommendations:
# 1. Adjust worker_processes and worker_connections in nginx.conf
# 2. Consider HTTP/2 and gzip compression
# 3. Enable kernel-level tuning (sysctl) on host
# 4. For high traffic, consider load balancing across multiple containers`;
                }
                else {
                    // Default configuration (Ubuntu)
                    config1 = `# Ubuntu Server Configuration
# Server: ${serverName}
# IP: ${ipAddress}

#!/bin/bash

# Update system
apt-get update && apt-get upgrade -y

# Install web server
apt-get install -y nginx

${firewall ? `# Configure firewall
ufw allow ssh
ufw allow http
${ssl ? 'ufw allow https' : ''}
ufw --force enable` : ''}

${ssl ? `# SSL configuration
apt-get install -y certbot python3-certbot-nginx
certbot --nginx -d ${domain || ipAddress} --non-interactive --agree-tos --email %%ADMIN_EMAIL%%` : ''}

${backup ? `# Backup setup
apt-get install -y cron
echo "0 3 * * * root tar czf /var/backups/website-$(date +\%Y\%m\%d).tar.gz /var/www/html" > /etc/cron.d/website-backup` : ''}

${monitoring ? `# Monitoring setup
apt-get install -y prometheus-node-exporter
systemctl enable prometheus-node-exporter` : ''}

# Basic hardening
sed -i 's/^PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
systemctl restart sshd

# Placeholders to replace:
# %%ADMIN_EMAIL%% - Replace with admin email for SSL certificates`;

                    config2 = `# High Security Ubuntu Configuration
# Additional security measures

#!/bin/bash

# Install security tools
apt-get update && apt-get install -y unattended-upgrades fail2ban rkhunter aide

# Configure automatic security updates
echo 'APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::AutocleanInterval "7";' > /etc/apt/apt.conf.d/20auto-upgrades

# Enhanced SSH security
echo "AllowUsers %%ADMIN_USER%%
Protocol 2
PermitRootLogin no
MaxAuthTries 3
LoginGraceTime 60
ClientAliveInterval 300
ClientAliveCountMax 2
X11Forwarding no
PrintMotd yes
TCPKeepAlive no
AllowAgentForwarding no
AllowTcpForwarding no
PermitTunnel no" > /etc/ssh/sshd_config.d/security.conf

# Kernel hardening
echo "kernel.kptr_restrict=2
kernel.dmesg_restrict=1
kernel.perf_event_paranoid=3
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.default.rp_filter=1
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_rfc1337=1
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv6.conf.all.accept_redirects=0
net.ipv6.conf.default.accept_redirects=0" > /etc/sysctl.d/99-security.conf

# Additional recommendations:
# 1. Implement 2FA for SSH
# 2. Configure auditd for comprehensive logging
# 3. Consider SELinux or AppArmor profiles
# 4. Set up file integrity monitoring with aide`;

                    config3 = `# Performance-Optimized Ubuntu Setup
# Focused on maximizing server performance

#!/bin/bash

# Performance tuning
echo "vm.swappiness=10
vm.vfs_cache_pressure=50
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.core.somaxconn=4096
net.ipv4.tcp_fastopen=3" > /etc/sysctl.d/99-performance.conf

# Install tuned
apt-get update && apt-get install -y tuned
tuned-adm profile throughput-performance

# Nginx performance tuning
sed -i 's/worker_processes auto;/worker_processes 4;/' /etc/nginx/nginx.conf
echo "worker_rlimit_nofile 100000;
events {
    worker_connections 4000;
    multi_accept on;
    use epoll;
}" >> /etc/nginx/nginx.conf

# Database performance (if applicable)
# echo "innodb_buffer_pool_size = 4G
# innodb_log_file_size = 256M
# innodb_flush_log_at_trx_commit = 2" >> /etc/mysql/my.cnf

# Recommendations:
# 1. Adjust worker_processes based on CPU cores (nproc)
# 2. Consider using a more performant filesystem like XFS
# 3. For database servers, tune memory parameters
# 4. Enable HTTP/2 and brotli compression`;
                }
                
                // Set the configuration content
                configContent1.textContent = config1;
                configContent2.textContent = config2;
                configContent3.textContent = config3;
            }
            
            function addServerCard(serverName, serverType, ipAddress, domain) {
                const typeMap = {
                    'windows-dc': { name: 'Windows DC', icon: 'windows', color: 'blue' },
                    'windows-iis': { name: 'Windows IIS', icon: 'microsoft', color: 'green' },
                    'docker': { name: 'Docker', icon: 'docker', color: 'indigo' },
                    'ubuntu': { name: 'Ubuntu', icon: 'ubuntu', color: 'orange' },
                    'proxmox': { name: 'Proxmox', icon: 'server', color: 'red' }
                };
                
                const serverTypeInfo = typeMap[serverType] || { name: 'Server', icon: 'server', color: 'gray' };
                
                const card = document.createElement('div');
                card.className = 'server-card bg-white rounded-lg shadow p-4';
                card.innerHTML = `
                    <div class="flex items-start justify-between">
                        <div class="flex items-center">
                            <div class="bg-${serverTypeInfo.color}-100 p-3 rounded-full mr-4">
                                <i class="fab fa-${serverTypeInfo.icon} text-${serverTypeInfo.color}-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="font-bold text-lg">${serverName}</h3>
                                <p class="text-sm text-gray-500">${serverTypeInfo.name} Server</p>
                            </div>
                        </div>
                        <span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">Active</span>
                    </div>
                    <div class="mt-4 pt-4 border-t border-gray-100">
                        <div class="grid grid-cols-2 gap-4 text-sm">
                            <div>
                                <p class="text-gray-500">IP Address</p>
                                <p class="font-medium">${ipAddress}</p>
                            </div>
                            <div>
                                <p class="text-gray-500">Domain</p>
                                <p class="font-medium">${domain || 'N/A'}</p>
                            </div>
                        </div>
                    </div>
                    <div class="mt-4 flex justify-between items-center">
                        <button class="text-sm text-blue-600 hover:text-blue-800 flex items-center">
                            <i class="fas fa-eye mr-1"></i> View
                        </button>
                        <div class="flex space-x-2">
                            <button class="text-sm text-gray-500 hover:text-gray-700 flex items-center">
                                <i class="fas fa-edit mr-1"></i> Edit
                            </button>
                            <button class="text-sm text-red-500 hover:text-red-700 flex items-center">
                                <i class="fas fa-trash-alt mr-1"></i> Delete
                            </button>
                        </div>
                    </div>
                `;
                
                serverCards.prepend(card);
            }
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=wrpadmn/morph" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>