| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <!DOCTYPE html>
- <html lang="el">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>SpeedTest Node</title>
- <script src="speedtest.js"></script>
- <style>
- @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');
-
- * { box-sizing: border-box; margin: 0; padding: 0; }
-
- body {
- background-color: #0b0c10;
- color: #c5c6c7;
- font-family: 'Poppins', sans-serif;
- display: flex;
- align-items: center;
- justify-content: center;
- min-height: 100vh;
- padding: 20px;
- }
-
- .container {
- background: #1f2833;
- padding: 40px 30px;
- border-radius: 24px;
- box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
- text-align: center;
- width: 100%;
- max-width: 450px;
- }
-
- h1 {
- color: #66fcf1;
- font-size: 24px;
- margin-bottom: 30px;
- letter-spacing: 1px;
- text-transform: uppercase;
- }
-
- /* SpeedTest Metrics */
- .metrics { display: flex; justify-content: space-between; margin-bottom: 40px; gap: 15px; }
- .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; }
- .metric.active-dl { box-shadow: inset 0 0 15px rgba(102, 252, 241, 0.3); border: 1px solid #45a29e; }
- .metric.active-ul { box-shadow: inset 0 0 15px rgba(195, 7, 63, 0.3); border: 1px solid #c3073f; }
- .metric span { display: block; font-size: 11px; text-transform: uppercase; color: #45a29e; letter-spacing: 1px; margin-bottom: 5px; }
- .metric strong { font-size: 22px; color: #ffffff; font-weight: 600; }
- .metric small { font-size: 12px; color: #66fcf1; margin-left: 2px; }
-
- /* Gauge */
- .gauge-container { position: relative; width: 220px; height: 220px; margin: 0 auto 40px; }
- .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; }
- .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); }
- .current-status { font-size: 14px; color: #45a29e; text-transform: uppercase; letter-spacing: 2px; margin-bottom: -5px; height: 20px; }
- .current-speed { font-size: 48px; font-weight: 600; color: #66fcf1; text-shadow: 0 0 10px rgba(102, 252, 241, 0.4); }
- .speed-unit { font-size: 14px; color: #c5c6c7; }
-
- /* Button */
- 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; }
- button:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(102, 252, 241, 0.4); }
- button:disabled { background: #45a29e; opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
- </style>
- </head>
- <body>
- <div class="container">
- <h1>WiSpeed Network Node</h1>
- <div class="metrics">
- <div class="metric" id="box-ping"><span>Ping</span><strong id="ping-val">--</strong><small>ms</small></div>
- <div class="metric" id="box-dl"><span>Download</span><strong id="dl-val">--</strong><small>Mb/s</small></div>
- <div class="metric" id="box-ul"><span>Upload</span><strong id="ul-val">--</strong><small>Mb/s</small></div>
- </div>
- <div class="gauge-container">
- <div class="gauge" id="gauge">
- <div class="gauge-inner">
- <div class="current-status" id="status-text">Ready</div>
- <div class="current-speed" id="main-val">0</div>
- <div class="speed-unit" id="speed-unit">Mbps</div>
- </div>
- </div>
- </div>
- <button id="start-btn" onclick="startTest()">Έναρξη</button>
- </div>
- <script>
- let s = null;
- function updateGauge(percentage, color) {
- const gauge = document.getElementById('gauge');
- let safePercentage = Math.min(percentage, 100);
- gauge.style.background = `conic-gradient(${color} ${safePercentage}%, #0b0c10 0)`;
- }
- function startTest() {
- if (s !== null) return;
- s = new Speedtest();
-
- // --- ΡΥΘΜΙΣΕΙΣ URL (Τοπικά) ---
- // Αν χρησιμοποιείς το στατικό garbage.dat άλλαξε το "garbage.php" σε "garbage.dat"
- s.setParameter("url_dl", "garbage.dat");
- s.setParameter("url_ul", "empty.php");
- s.setParameter("url_ping", "empty.php");
- s.setParameter("url_getIp", "getIP.php");
-
- // UI Setup
- document.getElementById('start-btn').disabled = true;
- document.getElementById('start-btn').innerText = "Σε εξελιξη...";
- document.getElementById('ping-val').innerText = "--";
- document.getElementById('dl-val').innerText = "--";
- document.getElementById('ul-val').innerText = "--";
- document.getElementById('main-val').innerText = "0";
- document.getElementById('speed-unit').innerText = "Mbps";
- document.getElementById('status-text').innerText = "Εκκίνηση...";
- updateGauge(0, '#1f2833');
- // Λήψη δεδομένων
- s.onupdate = function(data) {
- if (data.pingStatus) {
- document.getElementById('ping-val').innerText = data.pingStatus;
- }
- if (data.testState === 1) {
- document.getElementById('status-text').innerText = "Download";
- document.getElementById('box-ping').classList.remove('active-dl');
- document.getElementById('box-dl').classList.add('active-dl');
-
- if (data.dlStatus && data.dlStatus !== "Fail") {
- document.getElementById('dl-val').innerText = data.dlStatus;
- document.getElementById('main-val').innerText = data.dlStatus;
- updateGauge((data.dlStatus / 1000) * 100, '#66fcf1');
- }
- }
- if (data.testState === 3) {
- document.getElementById('status-text').innerText = "Upload";
- document.getElementById('box-dl').classList.remove('active-dl');
- document.getElementById('box-ul').classList.add('active-ul');
-
- if (data.ulStatus && data.ulStatus !== "Fail") {
- document.getElementById('ul-val').innerText = data.ulStatus;
- document.getElementById('main-val').innerText = data.ulStatus;
- updateGauge((data.ulStatus / 1000) * 100, '#c3073f');
- }
- }
- };
- // Τέλος Test
- s.onend = function(aborted) {
- document.getElementById('status-text').innerText = aborted ? "Ακυρώθηκε" : "Ολοκληρώθηκε";
- document.getElementById('main-val').innerText = "✓";
- document.getElementById('speed-unit').innerText = "";
- document.getElementById('box-ul').classList.remove('active-ul');
- updateGauge(0, '#1f2833');
-
- document.getElementById('start-btn').innerText = "Επαναληψη";
- document.getElementById('start-btn').disabled = false;
- s = null;
- };
- s.start();
- }
- </script>
- </body>
- </html>
|