senku21230 commited on
Commit
484bbca
·
verified ·
1 Parent(s): ed53ea2

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +309 -17
server.js CHANGED
@@ -455,34 +455,326 @@ app.get('/latest-frame', async (req, res) => {
455
  });
456
 
457
  // The actual HTML page you will view or embed
 
 
 
458
  app.get('/live', (req, res) => {
459
  res.send(`
460
  <!DOCTYPE html>
461
  <html lang="en">
462
  <head>
463
  <meta charset="UTF-8">
464
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
465
- <title>AI God-Mode Live Tracker</title>
 
466
  <style>
467
- body { margin: 0; background-color: #0f172a; display: flex; justify-content: center; align-items: center; height: 100vh; overflow: hidden; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
468
- .container { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; background-image: radial-gradient(#1e293b 1px, transparent 1px); background-size: 20px 20px; }
469
- img { max-width: 95%; max-height: 90%; object-fit: contain; border-radius: 12px; box-shadow: 0 10px 40px rgba(16, 185, 129, 0.2); border: 2px solid #10b981; transition: opacity 0.2s; }
470
- .status-bar { position: absolute; top: 20px; left: 20px; color: #10b981; font-weight: bold; font-size: 15px; background: rgba(15, 23, 42, 0.8); padding: 8px 15px; border-radius: 8px; border: 1px solid #1e293b; display: flex; align-items: center; gap: 10px; backdrop-filter: blur(5px); }
471
- .dot { width: 12px; height: 12px; background-color: #10b981; border-radius: 50%; animation: pulse 1.5s infinite; }
472
- @keyframes pulse { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
  </style>
474
  </head>
475
  <body>
476
- <div class="container">
477
- <div class="status-bar"><div class="dot"></div> LIVE AI TRACKING</div>
478
- <img id="stream" src="" alt="Connecting to AI Browser..." />
479
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  <script>
481
- const img = document.getElementById('stream');
482
- // Fetch a fresh frame from the browser every 500ms
483
- setInterval(() => {
484
- img.src = '/latest-frame?t=' + new Date().getTime();
485
- }, 500);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  </script>
487
  </body>
488
  </html>
 
455
  });
456
 
457
  // The actual HTML page you will view or embed
458
+ // ==========================================
459
+ // PREMIUM LIVE STREAM DASHBOARD (UI/UX)
460
+ // ==========================================
461
  app.get('/live', (req, res) => {
462
  res.send(`
463
  <!DOCTYPE html>
464
  <html lang="en">
465
  <head>
466
  <meta charset="UTF-8">
467
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
468
+ <title>AI GOD-MODE | Live Engine</title>
469
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
470
  <style>
471
+ :root {
472
+ --bg-main: #0b0f19;
473
+ --accent-primary: #10b981;
474
+ --accent-glow: rgba(16, 185, 129, 0.4);
475
+ --glass-bg: rgba(15, 23, 42, 0.65);
476
+ --glass-border: rgba(255, 255, 255, 0.08);
477
+ --text-main: #f8fafc;
478
+ --text-muted: #94a3b8;
479
+ }
480
+
481
+ * {
482
+ margin: 0;
483
+ padding: 0;
484
+ box-sizing: border-box;
485
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
486
+ }
487
+
488
+ body {
489
+ background-color: var(--bg-main);
490
+ background-image:
491
+ radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.05), transparent 25%),
492
+ radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.05), transparent 25%);
493
+ color: var(--text-main);
494
+ height: 100vh;
495
+ display: flex;
496
+ flex-direction: column;
497
+ overflow: hidden;
498
+ }
499
+
500
+ /* --- Header Navigation --- */
501
+ header {
502
+ background: var(--glass-bg);
503
+ backdrop-filter: blur(12px);
504
+ -webkit-backdrop-filter: blur(12px);
505
+ border-bottom: 1px solid var(--glass-border);
506
+ padding: 1rem 1.5rem;
507
+ display: flex;
508
+ justify-content: space-between;
509
+ align-items: center;
510
+ z-index: 10;
511
+ }
512
+
513
+ .brand {
514
+ display: flex;
515
+ align-items: center;
516
+ gap: 12px;
517
+ font-weight: 700;
518
+ letter-spacing: 1px;
519
+ font-size: 1.1rem;
520
+ }
521
+
522
+ .brand i {
523
+ color: var(--accent-primary);
524
+ font-size: 1.4rem;
525
+ filter: drop-shadow(0 0 8px var(--accent-glow));
526
+ }
527
+
528
+ .status-badges {
529
+ display: flex;
530
+ gap: 10px;
531
+ }
532
+
533
+ .badge {
534
+ background: rgba(16, 185, 129, 0.1);
535
+ border: 1px solid rgba(16, 185, 129, 0.2);
536
+ color: var(--accent-primary);
537
+ padding: 4px 10px;
538
+ border-radius: 6px;
539
+ font-size: 0.75rem;
540
+ font-weight: 600;
541
+ display: flex;
542
+ align-items: center;
543
+ gap: 6px;
544
+ text-transform: uppercase;
545
+ letter-spacing: 0.5px;
546
+ }
547
+
548
+ .live-dot {
549
+ width: 8px;
550
+ height: 8px;
551
+ background-color: var(--accent-primary);
552
+ border-radius: 50%;
553
+ animation: pulse 1.5s infinite;
554
+ }
555
+
556
+ /* --- Main Stage --- */
557
+ main {
558
+ flex: 1;
559
+ display: flex;
560
+ justify-content: center;
561
+ align-items: center;
562
+ padding: 1.5rem;
563
+ position: relative;
564
+ }
565
+
566
+ .stream-container {
567
+ position: relative;
568
+ width: 100%;
569
+ max-width: 1600px;
570
+ height: 100%;
571
+ background: #000;
572
+ border-radius: 16px;
573
+ border: 1px solid var(--glass-border);
574
+ box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.02);
575
+ overflow: hidden;
576
+ display: flex;
577
+ justify-content: center;
578
+ align-items: center;
579
+ }
580
+
581
+ #stream {
582
+ width: 100%;
583
+ height: 100%;
584
+ object-fit: contain;
585
+ z-index: 2;
586
+ transition: opacity 0.3s ease;
587
+ opacity: 0; /* Hidden until loaded */
588
+ }
589
+
590
+ .loading-state {
591
+ position: absolute;
592
+ display: flex;
593
+ flex-direction: column;
594
+ align-items: center;
595
+ gap: 15px;
596
+ color: var(--text-muted);
597
+ z-index: 1;
598
+ }
599
+
600
+ .spinner {
601
+ width: 40px;
602
+ height: 40px;
603
+ border: 3px solid rgba(255,255,255,0.1);
604
+ border-top-color: var(--accent-primary);
605
+ border-radius: 50%;
606
+ animation: spin 1s linear infinite;
607
+ }
608
+
609
+ /* --- Bottom Controls --- */
610
+ .controls {
611
+ position: absolute;
612
+ bottom: 20px;
613
+ left: 50%;
614
+ transform: translateX(-50%);
615
+ background: var(--glass-bg);
616
+ backdrop-filter: blur(16px);
617
+ border: 1px solid var(--glass-border);
618
+ padding: 10px 20px;
619
+ border-radius: 12px;
620
+ display: flex;
621
+ gap: 20px;
622
+ z-index: 10;
623
+ box-shadow: 0 10px 30px rgba(0,0,0,0.5);
624
+ opacity: 0;
625
+ transition: opacity 0.3s ease, transform 0.3s ease;
626
+ }
627
+
628
+ .stream-container:hover .controls {
629
+ opacity: 1;
630
+ transform: translateX(-50%) translateY(0);
631
+ }
632
+
633
+ .control-btn {
634
+ background: transparent;
635
+ border: none;
636
+ color: var(--text-main);
637
+ font-size: 1.2rem;
638
+ cursor: pointer;
639
+ transition: color 0.2s, transform 0.2s;
640
+ display: flex;
641
+ align-items: center;
642
+ justify-content: center;
643
+ width: 40px;
644
+ height: 40px;
645
+ border-radius: 8px;
646
+ }
647
+
648
+ .control-btn:hover {
649
+ background: rgba(255,255,255,0.1);
650
+ color: var(--accent-primary);
651
+ transform: scale(1.05);
652
+ }
653
+
654
+ /* --- Animations --- */
655
+ @keyframes pulse {
656
+ 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
657
+ 70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
658
+ 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
659
+ }
660
+
661
+ @keyframes spin {
662
+ to { transform: rotate(360deg); }
663
+ }
664
+
665
+ /* --- Responsive Mobile Tweaks --- */
666
+ @media (max-width: 768px) {
667
+ header { padding: 1rem; }
668
+ .brand { font-size: 0.9rem; }
669
+ .badge span { display: none; } /* Hide text, keep dot on mobile */
670
+ main { padding: 0.5rem; }
671
+ .stream-container { border-radius: 8px; border: none; }
672
+ .controls { opacity: 1; bottom: 10px; padding: 8px 15px; } /* Always show controls on mobile */
673
+ }
674
  </style>
675
  </head>
676
  <body>
677
+
678
+ <header>
679
+ <div class="brand">
680
+ <i class="fa-solid fa-microchip"></i>
681
+ AI GOD-MODE
682
+ </div>
683
+ <div class="status-badges">
684
+ <div class="badge">
685
+ <i class="fa-solid fa-shield-halved"></i>
686
+ <span>Secure</span>
687
+ </div>
688
+ <div class="badge">
689
+ <div class="live-dot"></div>
690
+ <span>Live Tracking</span>
691
+ </div>
692
+ </div>
693
+ </header>
694
+
695
+ <main>
696
+ <div class="stream-container" id="streamContainer">
697
+
698
+ <div class="loading-state" id="loadingState">
699
+ <div class="spinner"></div>
700
+ <div style="font-size: 0.9rem; letter-spacing: 1px;">WAITING FOR AI ENGINE...</div>
701
+ </div>
702
+
703
+ <img id="stream" src="" alt="AI Stream" />
704
+
705
+ <div class="controls">
706
+ <button class="control-btn" id="refreshBtn" title="Force Refresh">
707
+ <i class="fa-solid fa-rotate-right"></i>
708
+ </button>
709
+ <button class="control-btn" id="fullscreenBtn" title="Toggle Fullscreen">
710
+ <i class="fa-solid fa-expand"></i>
711
+ </button>
712
+ </div>
713
+ </div>
714
+ </main>
715
+
716
  <script>
717
+ const streamImg = document.getElementById('stream');
718
+ const loadingState = document.getElementById('loadingState');
719
+ const streamContainer = document.getElementById('streamContainer');
720
+ const fullscreenBtn = document.getElementById('fullscreenBtn');
721
+ const refreshBtn = document.getElementById('refreshBtn');
722
+
723
+ let errorCount = 0;
724
+ let streamInterval;
725
+
726
+ function fetchFrame() {
727
+ const newUrl = '/latest-frame?t=' + new Date().getTime();
728
+
729
+ // Preload image to avoid flickering
730
+ const tempImg = new Image();
731
+ tempImg.onload = () => {
732
+ streamImg.src = newUrl;
733
+ streamImg.style.opacity = '1';
734
+ loadingState.style.display = 'none';
735
+ errorCount = 0;
736
+ };
737
+ tempImg.onerror = () => {
738
+ errorCount++;
739
+ if(errorCount > 3) {
740
+ streamImg.style.opacity = '0';
741
+ loadingState.style.display = 'flex';
742
+ loadingState.innerHTML = '<i class="fa-solid fa-triangle-exclamation" style="font-size: 2rem; color: #ef4444;"></i><div style="font-size: 0.9rem;">CONNECTION LOST. RETRYING...</div>';
743
+ }
744
+ };
745
+ tempImg.src = newUrl;
746
+ }
747
+
748
+ // Start fetching frames
749
+ streamInterval = setInterval(fetchFrame, 500);
750
+
751
+ // Manual Refresh
752
+ refreshBtn.addEventListener('click', () => {
753
+ loadingState.style.display = 'flex';
754
+ loadingState.innerHTML = '<div class="spinner"></div><div style="font-size: 0.9rem;">RECONNECTING...</div>';
755
+ streamImg.style.opacity = '0';
756
+ fetchFrame();
757
+ });
758
+
759
+ // Fullscreen Logic
760
+ fullscreenBtn.addEventListener('click', () => {
761
+ if (!document.fullscreenElement) {
762
+ streamContainer.requestFullscreen().catch(err => {
763
+ console.error(\`Error attempting to enable fullscreen: \${err.message}\`);
764
+ });
765
+ fullscreenBtn.innerHTML = '<i class="fa-solid fa-compress"></i>';
766
+ } else {
767
+ document.exitFullscreen();
768
+ fullscreenBtn.innerHTML = '<i class="fa-solid fa-expand"></i>';
769
+ }
770
+ });
771
+
772
+ // Handle ESC key or system back button exiting fullscreen
773
+ document.addEventListener('fullscreenchange', () => {
774
+ if (!document.fullscreenElement) {
775
+ fullscreenBtn.innerHTML = '<i class="fa-solid fa-expand"></i>';
776
+ }
777
+ });
778
  </script>
779
  </body>
780
  </html>