OrbitMC commited on
Commit
202d0a1
·
verified ·
1 Parent(s): a7fec23

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +92 -171
index.html CHANGED
@@ -1,3 +1,4 @@
 
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
@@ -40,7 +41,6 @@ body {
40
  opacity: 0.9;
41
  }
42
 
43
- /* Server Status Card */
44
  .server-card {
45
  background: rgba(255, 255, 255, 0.1);
46
  backdrop-filter: blur(10px);
@@ -92,6 +92,12 @@ body {
92
  height: 10px;
93
  border-radius: 50%;
94
  background: white;
 
 
 
 
 
 
95
  }
96
 
97
  .server-info {
@@ -118,7 +124,6 @@ body {
118
  font-weight: bold;
119
  }
120
 
121
- /* Rotation Card */
122
  .rotation-card {
123
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
124
  border-radius: 20px;
@@ -209,7 +214,55 @@ button.primary:hover {
209
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
210
  }
211
 
212
- /* Bot Grid */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  .bot-grid {
214
  display: grid;
215
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
@@ -340,54 +393,30 @@ button.primary:hover {
340
  color: #f093fb;
341
  }
342
 
343
- /* Queue Section */
344
- .queue-section {
345
- background: rgba(255, 255, 255, 0.1);
346
- backdrop-filter: blur(10px);
347
- border-radius: 20px;
348
- padding: 25px;
349
- margin-bottom: 25px;
350
- border: 1px solid rgba(255, 255, 255, 0.2);
351
- }
352
-
353
- .queue-title {
354
- font-size: 20px;
355
- font-weight: bold;
356
- margin-bottom: 20px;
357
- text-align: center;
358
- }
359
-
360
- .queue-list {
361
  display: flex;
362
- justify-content: center;
363
- align-items: center;
364
- gap: 15px;
365
- flex-wrap: wrap;
366
  }
367
 
368
- .queue-item {
369
  background: rgba(255, 255, 255, 0.1);
370
- padding: 15px 25px;
371
- border-radius: 15px;
372
- font-weight: bold;
373
- transition: all 0.3s;
374
- border: 2px solid transparent;
375
- }
376
-
377
- .queue-item.active {
378
- background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
379
- transform: scale(1.15);
380
- box-shadow: 0 5px 20px rgba(240, 147, 251, 0.4);
381
  }
382
 
383
- .queue-item.next {
384
- border-color: rgba(245, 158, 11, 0.6);
385
- background: rgba(245, 158, 11, 0.2);
 
386
  }
387
 
388
- .queue-arrow {
389
- font-size: 24px;
390
- opacity: 0.5;
 
391
  }
392
 
393
  .msg {
@@ -433,7 +462,6 @@ button.primary:hover {
433
  <p>OrbitMC Server Monitor & Bot Rotation System</p>
434
  </div>
435
 
436
- <!-- Server Status -->
437
  <div class="server-card">
438
  <div class="server-header">
439
  <div class="server-title">📡 Server Status</div>
@@ -462,7 +490,6 @@ button.primary:hover {
462
  </div>
463
  </div>
464
 
465
- <!-- Current Rotation -->
466
  <div class="rotation-card">
467
  <div class="rotation-title">🔄 CURRENT ACTIVE BOT</div>
468
  <div class="current-bot" id="current-bot">-</div>
@@ -482,116 +509,30 @@ button.primary:hover {
482
  </div>
483
  </div>
484
 
485
- <!-- Queue -->
486
  <div class="queue-section">
487
  <div class="queue-title">📋 Rotation Queue</div>
488
  <div class="queue-list" id="queue-list"></div>
489
  </div>
490
 
491
- <!-- Bot Grid -->
492
  <div class="bot-grid" id="bot-grid"></div>
493
 
494
  <div id="msg-container"></div>
495
  </div>
496
 
497
  <script>
498
- // Simulated data for demo (replace with actual API calls)
499
- let data = {};
500
- let updateTimer;
501
- let serverCheckTimer;
502
- let simulatedTime = 0;
503
- let currentBotIndex = 0;
504
-
505
- const BOT_NAMES = ["moderator_1", "moderator_2", "moderator_3", "moderator_4", "moderator_5"];
506
- const ROTATION_DURATION = 3600; // 1 hour
507
-
508
- // Initialize with demo data
509
- function initializeDemoData() {
510
- data = {
511
- server_info: {
512
- host: "orbitmc.progamer.me",
513
- port: 40675,
514
- version: "1.21.1"
515
- },
516
- server_status: {
517
- online: true,
518
- players: "12/100",
519
- latency: 45,
520
- last_check: new Date()
521
- },
522
- rotation: {
523
- current_bot: BOT_NAMES[currentBotIndex],
524
- next_bot: BOT_NAMES[(currentBotIndex + 1) % BOT_NAMES.length],
525
- elapsed: simulatedTime,
526
- remaining: ROTATION_DURATION - simulatedTime,
527
- queue: BOT_NAMES
528
- },
529
- bots: BOT_NAMES.map((name, index) => ({
530
- name: name,
531
- status: index === currentBotIndex ? 'online' : 'offline',
532
- is_active: index === currentBotIndex,
533
- uptime: index === currentBotIndex ? simulatedTime : 0,
534
- deaths: Math.floor(Math.random() * 5),
535
- reconnects: Math.floor(Math.random() * 3),
536
- position: index === currentBotIndex ? `${Math.floor(Math.random() * 100)}, 64, ${Math.floor(Math.random() * 100)}` : '0, 0, 0'
537
- }))
538
- };
539
- }
540
-
541
- // Simulate time passing
542
- function updateSimulation() {
543
- simulatedTime++;
544
-
545
- if (simulatedTime >= ROTATION_DURATION) {
546
- simulatedTime = 0;
547
- currentBotIndex = (currentBotIndex + 1) % BOT_NAMES.length;
548
- showMsg('🔄 Rotated to next bot!', 'success');
549
- }
550
-
551
- // Update data
552
- data.rotation.elapsed = simulatedTime;
553
- data.rotation.remaining = ROTATION_DURATION - simulatedTime;
554
- data.rotation.current_bot = BOT_NAMES[currentBotIndex];
555
- data.rotation.next_bot = BOT_NAMES[(currentBotIndex + 1) % BOT_NAMES.length];
556
-
557
- // Update bots
558
- data.bots = BOT_NAMES.map((name, index) => ({
559
- name: name,
560
- status: index === currentBotIndex ? 'online' : 'offline',
561
- is_active: index === currentBotIndex,
562
- uptime: index === currentBotIndex ? simulatedTime : 0,
563
- deaths: data.bots[index]?.deaths || 0,
564
- reconnects: data.bots[index]?.reconnects || 0,
565
- position: index === currentBotIndex ? `${100 + Math.floor(Math.random() * 10)}, 64, ${100 + Math.floor(Math.random() * 10)}` : '0, 0, 0'
566
- }));
567
-
568
- // Simulate random server status changes
569
- if (Math.random() > 0.98) {
570
- data.server_status.online = !data.server_status.online;
571
- }
572
-
573
- if (data.server_status.online) {
574
- data.server_status.latency = 30 + Math.floor(Math.random() * 30);
575
- data.server_status.players = `${10 + Math.floor(Math.random() * 20)}/100`;
576
- }
577
- }
578
 
579
- // For production, use this instead:
580
  async function fetchStatus() {
581
  try {
582
  const r = await fetch('/api/status');
583
- data = await r.json();
584
- renderStatus();
585
  } catch(e) {
586
  console.error('Failed to fetch status', e);
587
- // Fallback to demo mode
588
- initializeDemoData();
589
- renderStatus();
590
  }
591
  }
592
 
593
- function renderStatus() {
594
- // Server Status
595
  const server = data.server_status;
596
  const badge = document.getElementById('server-badge');
597
 
@@ -608,21 +549,16 @@ function renderStatus() {
608
  document.getElementById('server-latency').textContent = server.latency > 0 ? `${server.latency}ms` : 'N/A';
609
  document.getElementById('server-version').textContent = data.server_info.version;
610
 
611
- // Rotation Info
612
  const rotation = data.rotation;
613
  document.getElementById('current-bot').textContent = rotation.current_bot || '-';
614
  document.getElementById('rotation-timer').textContent = formatTime(rotation.elapsed);
615
  document.getElementById('next-bot').textContent = rotation.next_bot || '-';
616
  document.getElementById('time-until-next').textContent = formatTime(rotation.remaining);
617
 
618
- // Progress Bar
619
  const progress = (rotation.elapsed / 3600) * 100;
620
  document.getElementById('progress-fill').style.width = progress + '%';
621
 
622
- // Queue
623
  renderQueue(rotation.queue, rotation.current_bot, rotation.next_bot);
624
-
625
- // Bot Grid
626
  renderBots(data.bots);
627
  }
628
 
@@ -669,6 +605,8 @@ function renderBots(bots) {
669
  const statusClass = bot.is_active ? 'active' : bot.status;
670
  const statusText = bot.is_active ? '⚡ ACTIVE & ONLINE' : bot.status.toUpperCase();
671
 
 
 
672
  card.innerHTML = `
673
  <div class="bot-header">
674
  <div class="bot-name">${bot.name}</div>
@@ -689,7 +627,17 @@ function renderBots(bots) {
689
  </div>
690
  <div class="stat-item">
691
  <div class="stat-label">Position</div>
692
- <div class="stat-value">${bot.position}</div>
 
 
 
 
 
 
 
 
 
 
693
  </div>
694
  </div>
695
  <div class="bot-status-text ${statusClass}">${statusText}</div>
@@ -718,14 +666,6 @@ function formatTimeShort(seconds) {
718
  async function forceRotation() {
719
  if (!confirm('Switch to the next bot now?')) return;
720
 
721
- // For demo mode
722
- simulatedTime = ROTATION_DURATION;
723
- updateSimulation();
724
- renderStatus();
725
- showMsg('✅ Switching to next bot...', 'success');
726
-
727
- // For production, uncomment this:
728
- /*
729
  try {
730
  const r = await fetch('/api/next_rotation', {method: 'POST'});
731
  const res = await r.json();
@@ -734,16 +674,15 @@ async function forceRotation() {
734
  showMsg('✅ Switching to next bot...', 'success');
735
  setTimeout(fetchStatus, 1000);
736
  } else {
737
- showMsg('❌ ' + (res.error || 'Failed to rotate'), 'error');
738
  }
739
  } catch(e) {
740
  showMsg('❌ Failed to switch bot', 'error');
741
  }
742
- */
743
  }
744
 
745
  function refreshStatus() {
746
- renderStatus();
747
  showMsg('🔄 Refreshing...', 'success');
748
  }
749
 
@@ -759,26 +698,8 @@ function showMsg(text, type = 'success') {
759
  }, 3000);
760
  }
761
 
762
- function startAutoUpdate() {
763
- if (updateTimer) clearInterval(updateTimer);
764
-
765
- // Update every second for demo
766
- updateTimer = setInterval(() => {
767
- updateSimulation();
768
- renderStatus();
769
- }, 1000);
770
- }
771
-
772
- // Initialize
773
- initializeDemoData();
774
- renderStatus();
775
- startAutoUpdate();
776
-
777
- // For production with backend API, use this instead:
778
- /*
779
  fetchStatus();
780
- setInterval(fetchStatus, 2000); // Update every 2 seconds
781
- */
782
  </script>
783
  </body>
784
  </html>
 
1
+ <!-- index.html -->
2
  <!DOCTYPE html>
3
  <html>
4
  <head>
 
41
  opacity: 0.9;
42
  }
43
 
 
44
  .server-card {
45
  background: rgba(255, 255, 255, 0.1);
46
  backdrop-filter: blur(10px);
 
92
  height: 10px;
93
  border-radius: 50%;
94
  background: white;
95
+ animation: blink 1s infinite;
96
+ }
97
+
98
+ @keyframes blink {
99
+ 0%, 100% { opacity: 1; }
100
+ 50% { opacity: 0.3; }
101
  }
102
 
103
  .server-info {
 
124
  font-weight: bold;
125
  }
126
 
 
127
  .rotation-card {
128
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
129
  border-radius: 20px;
 
214
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
215
  }
216
 
217
+ .queue-section {
218
+ background: rgba(255, 255, 255, 0.1);
219
+ backdrop-filter: blur(10px);
220
+ border-radius: 20px;
221
+ padding: 25px;
222
+ margin-bottom: 25px;
223
+ border: 1px solid rgba(255, 255, 255, 0.2);
224
+ }
225
+
226
+ .queue-title {
227
+ font-size: 20px;
228
+ font-weight: bold;
229
+ margin-bottom: 20px;
230
+ text-align: center;
231
+ }
232
+
233
+ .queue-list {
234
+ display: flex;
235
+ justify-content: center;
236
+ align-items: center;
237
+ gap: 15px;
238
+ flex-wrap: wrap;
239
+ }
240
+
241
+ .queue-item {
242
+ background: rgba(255, 255, 255, 0.1);
243
+ padding: 15px 25px;
244
+ border-radius: 15px;
245
+ font-weight: bold;
246
+ transition: all 0.3s;
247
+ border: 2px solid transparent;
248
+ }
249
+
250
+ .queue-item.active {
251
+ background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
252
+ transform: scale(1.15);
253
+ box-shadow: 0 5px 20px rgba(240, 147, 251, 0.4);
254
+ }
255
+
256
+ .queue-item.next {
257
+ border-color: rgba(245, 158, 11, 0.6);
258
+ background: rgba(245, 158, 11, 0.2);
259
+ }
260
+
261
+ .queue-arrow {
262
+ font-size: 24px;
263
+ opacity: 0.5;
264
+ }
265
+
266
  .bot-grid {
267
  display: grid;
268
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
 
393
  color: #f093fb;
394
  }
395
 
396
+ .health-bar {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  display: flex;
398
+ gap: 5px;
399
+ margin-top: 10px;
 
 
400
  }
401
 
402
+ .health-item {
403
  background: rgba(255, 255, 255, 0.1);
404
+ padding: 8px;
405
+ border-radius: 8px;
406
+ flex: 1;
407
+ text-align: center;
 
 
 
 
 
 
 
408
  }
409
 
410
+ .health-item small {
411
+ display: block;
412
+ font-size: 10px;
413
+ opacity: 0.7;
414
  }
415
 
416
+ .health-item strong {
417
+ display: block;
418
+ font-size: 16px;
419
+ margin-top: 3px;
420
  }
421
 
422
  .msg {
 
462
  <p>OrbitMC Server Monitor & Bot Rotation System</p>
463
  </div>
464
 
 
465
  <div class="server-card">
466
  <div class="server-header">
467
  <div class="server-title">📡 Server Status</div>
 
490
  </div>
491
  </div>
492
 
 
493
  <div class="rotation-card">
494
  <div class="rotation-title">🔄 CURRENT ACTIVE BOT</div>
495
  <div class="current-bot" id="current-bot">-</div>
 
509
  </div>
510
  </div>
511
 
 
512
  <div class="queue-section">
513
  <div class="queue-title">📋 Rotation Queue</div>
514
  <div class="queue-list" id="queue-list"></div>
515
  </div>
516
 
 
517
  <div class="bot-grid" id="bot-grid"></div>
518
 
519
  <div id="msg-container"></div>
520
  </div>
521
 
522
  <script>
523
+ let updateInterval;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
 
 
525
  async function fetchStatus() {
526
  try {
527
  const r = await fetch('/api/status');
528
+ const data = await r.json();
529
+ renderStatus(data);
530
  } catch(e) {
531
  console.error('Failed to fetch status', e);
 
 
 
532
  }
533
  }
534
 
535
+ function renderStatus(data) {
 
536
  const server = data.server_status;
537
  const badge = document.getElementById('server-badge');
538
 
 
549
  document.getElementById('server-latency').textContent = server.latency > 0 ? `${server.latency}ms` : 'N/A';
550
  document.getElementById('server-version').textContent = data.server_info.version;
551
 
 
552
  const rotation = data.rotation;
553
  document.getElementById('current-bot').textContent = rotation.current_bot || '-';
554
  document.getElementById('rotation-timer').textContent = formatTime(rotation.elapsed);
555
  document.getElementById('next-bot').textContent = rotation.next_bot || '-';
556
  document.getElementById('time-until-next').textContent = formatTime(rotation.remaining);
557
 
 
558
  const progress = (rotation.elapsed / 3600) * 100;
559
  document.getElementById('progress-fill').style.width = progress + '%';
560
 
 
561
  renderQueue(rotation.queue, rotation.current_bot, rotation.next_bot);
 
 
562
  renderBots(data.bots);
563
  }
564
 
 
605
  const statusClass = bot.is_active ? 'active' : bot.status;
606
  const statusText = bot.is_active ? '⚡ ACTIVE & ONLINE' : bot.status.toUpperCase();
607
 
608
+ const pos = bot.position;
609
+
610
  card.innerHTML = `
611
  <div class="bot-header">
612
  <div class="bot-name">${bot.name}</div>
 
627
  </div>
628
  <div class="stat-item">
629
  <div class="stat-label">Position</div>
630
+ <div class="stat-value">${pos.x}, ${pos.y}, ${pos.z}</div>
631
+ </div>
632
+ </div>
633
+ <div class="health-bar">
634
+ <div class="health-item">
635
+ <small>❤️ Health</small>
636
+ <strong>${bot.health}</strong>
637
+ </div>
638
+ <div class="health-item">
639
+ <small>🍖 Food</small>
640
+ <strong>${bot.food}</strong>
641
  </div>
642
  </div>
643
  <div class="bot-status-text ${statusClass}">${statusText}</div>
 
666
  async function forceRotation() {
667
  if (!confirm('Switch to the next bot now?')) return;
668
 
 
 
 
 
 
 
 
 
669
  try {
670
  const r = await fetch('/api/next_rotation', {method: 'POST'});
671
  const res = await r.json();
 
674
  showMsg('✅ Switching to next bot...', 'success');
675
  setTimeout(fetchStatus, 1000);
676
  } else {
677
+ showMsg('❌ Failed to rotate', 'error');
678
  }
679
  } catch(e) {
680
  showMsg('❌ Failed to switch bot', 'error');
681
  }
 
682
  }
683
 
684
  function refreshStatus() {
685
+ fetchStatus();
686
  showMsg('🔄 Refreshing...', 'success');
687
  }
688
 
 
698
  }, 3000);
699
  }
700
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
701
  fetchStatus();
702
+ updateInterval = setInterval(fetchStatus, 1000);
 
703
  </script>
704
  </body>
705
  </html>