index.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <!DOCTYPE html>
  2. <html lang="el">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>SpeedTest Node</title>
  7. <script src="speedtest.js"></script>
  8. <style>
  9. @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');
  10. * { box-sizing: border-box; margin: 0; padding: 0; }
  11. body {
  12. background-color: #0b0c10;
  13. color: #c5c6c7;
  14. font-family: 'Poppins', sans-serif;
  15. display: flex;
  16. align-items: center;
  17. justify-content: center;
  18. min-height: 100vh;
  19. padding: 20px;
  20. }
  21. .container {
  22. background: #1f2833;
  23. padding: 40px 30px;
  24. border-radius: 24px;
  25. box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  26. text-align: center;
  27. width: 100%;
  28. max-width: 450px;
  29. }
  30. h1 {
  31. color: #66fcf1;
  32. font-size: 24px;
  33. margin-bottom: 30px;
  34. letter-spacing: 1px;
  35. text-transform: uppercase;
  36. }
  37. /* SpeedTest Metrics */
  38. .metrics { display: flex; justify-content: space-between; margin-bottom: 40px; gap: 15px; }
  39. .metric { background: #0b0c10; padding: 15px 10px; border-radius: 16px; flex: 1; box-shadow: inset 0 2px 5px rgba(0,0,0,0.5); transition: transform 0.3s ease, box-shadow 0.3s ease; }
  40. .metric.active-dl { box-shadow: inset 0 0 15px rgba(102, 252, 241, 0.3); border: 1px solid #45a29e; }
  41. .metric.active-ul { box-shadow: inset 0 0 15px rgba(195, 7, 63, 0.3); border: 1px solid #c3073f; }
  42. .metric span { display: block; font-size: 11px; text-transform: uppercase; color: #45a29e; letter-spacing: 1px; margin-bottom: 5px; }
  43. .metric strong { font-size: 22px; color: #ffffff; font-weight: 600; }
  44. .metric small { font-size: 12px; color: #66fcf1; margin-left: 2px; }
  45. /* Gauge */
  46. .gauge-container { position: relative; width: 220px; height: 220px; margin: 0 auto 40px; }
  47. .gauge { width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(#1f2833 100%, #0b0c10 0); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 30px rgba(102, 252, 241, 0.1); transition: background 0.1s linear; }
  48. .gauge-inner { width: 190px; height: 190px; background: #1f2833; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); }
  49. .current-status { font-size: 14px; color: #45a29e; text-transform: uppercase; letter-spacing: 2px; margin-bottom: -5px; height: 20px; }
  50. .current-speed { font-size: 48px; font-weight: 600; color: #66fcf1; text-shadow: 0 0 10px rgba(102, 252, 241, 0.4); }
  51. .speed-unit { font-size: 14px; color: #c5c6c7; }
  52. /* Button */
  53. button { background: linear-gradient(135deg, #66fcf1, #45a29e); border: none; padding: 16px 50px; border-radius: 30px; color: #0b0c10; font-size: 18px; font-weight: 600; cursor: pointer; text-transform: uppercase; width: 100%; transition: all 0.3s ease; }
  54. button:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(102, 252, 241, 0.4); }
  55. button:disabled { background: #45a29e; opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
  56. </style>
  57. </head>
  58. <body>
  59. <div class="container">
  60. <h1>WiSpeed Network Node</h1>
  61. <div class="metrics">
  62. <div class="metric" id="box-ping"><span>Ping</span><strong id="ping-val">--</strong><small>ms</small></div>
  63. <div class="metric" id="box-dl"><span>Download</span><strong id="dl-val">--</strong><small>Mb/s</small></div>
  64. <div class="metric" id="box-ul"><span>Upload</span><strong id="ul-val">--</strong><small>Mb/s</small></div>
  65. </div>
  66. <div class="gauge-container">
  67. <div class="gauge" id="gauge">
  68. <div class="gauge-inner">
  69. <div class="current-status" id="status-text">Ready</div>
  70. <div class="current-speed" id="main-val">0</div>
  71. <div class="speed-unit" id="speed-unit">Mbps</div>
  72. </div>
  73. </div>
  74. </div>
  75. <button id="start-btn" onclick="startTest()">Έναρξη</button>
  76. </div>
  77. <script>
  78. let s = null;
  79. function updateGauge(percentage, color) {
  80. const gauge = document.getElementById('gauge');
  81. let safePercentage = Math.min(percentage, 100);
  82. gauge.style.background = `conic-gradient(${color} ${safePercentage}%, #0b0c10 0)`;
  83. }
  84. function startTest() {
  85. if (s !== null) return;
  86. s = new Speedtest();
  87. // --- ΡΥΘΜΙΣΕΙΣ URL (Τοπικά) ---
  88. // Αν χρησιμοποιείς το στατικό garbage.dat άλλαξε το "garbage.php" σε "garbage.dat"
  89. s.setParameter("url_dl", "garbage.dat");
  90. s.setParameter("url_ul", "empty.php");
  91. s.setParameter("url_ping", "empty.php");
  92. s.setParameter("url_getIp", "getIP.php");
  93. // UI Setup
  94. document.getElementById('start-btn').disabled = true;
  95. document.getElementById('start-btn').innerText = "Σε εξελιξη...";
  96. document.getElementById('ping-val').innerText = "--";
  97. document.getElementById('dl-val').innerText = "--";
  98. document.getElementById('ul-val').innerText = "--";
  99. document.getElementById('main-val').innerText = "0";
  100. document.getElementById('speed-unit').innerText = "Mbps";
  101. document.getElementById('status-text').innerText = "Εκκίνηση...";
  102. updateGauge(0, '#1f2833');
  103. // Λήψη δεδομένων
  104. s.onupdate = function(data) {
  105. if (data.pingStatus) {
  106. document.getElementById('ping-val').innerText = data.pingStatus;
  107. }
  108. if (data.testState === 1) {
  109. document.getElementById('status-text').innerText = "Download";
  110. document.getElementById('box-ping').classList.remove('active-dl');
  111. document.getElementById('box-dl').classList.add('active-dl');
  112. if (data.dlStatus && data.dlStatus !== "Fail") {
  113. document.getElementById('dl-val').innerText = data.dlStatus;
  114. document.getElementById('main-val').innerText = data.dlStatus;
  115. updateGauge((data.dlStatus / 1000) * 100, '#66fcf1');
  116. }
  117. }
  118. if (data.testState === 3) {
  119. document.getElementById('status-text').innerText = "Upload";
  120. document.getElementById('box-dl').classList.remove('active-dl');
  121. document.getElementById('box-ul').classList.add('active-ul');
  122. if (data.ulStatus && data.ulStatus !== "Fail") {
  123. document.getElementById('ul-val').innerText = data.ulStatus;
  124. document.getElementById('main-val').innerText = data.ulStatus;
  125. updateGauge((data.ulStatus / 1000) * 100, '#c3073f');
  126. }
  127. }
  128. };
  129. // Τέλος Test
  130. s.onend = function(aborted) {
  131. document.getElementById('status-text').innerText = aborted ? "Ακυρώθηκε" : "Ολοκληρώθηκε";
  132. document.getElementById('main-val').innerText = "✓";
  133. document.getElementById('speed-unit').innerText = "";
  134. document.getElementById('box-ul').classList.remove('active-ul');
  135. updateGauge(0, '#1f2833');
  136. document.getElementById('start-btn').innerText = "Επαναληψη";
  137. document.getElementById('start-btn').disabled = false;
  138. s = null;
  139. };
  140. s.start();
  141. }
  142. </script>
  143. </body>
  144. </html>