123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211<!DOCTYPE html><html lang="zh-CN"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>GOST 服务监控</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <style> :root { --primary-color: #4285f4; --success-color: #34a853; --error-color: #ea4335; --bg-color: #f8f9fa; --card-bg: #ffffff; --text-color: #202124; } body { font-family: 'Roboto', 'Segoe UI', Arial, sans-serif; background-color: var(--bg-color); color: var(--text-color); margin: 0; padding: 20px; min-height: 100vh; display: flex; flex-direction: column; align-items: center; } .container { max-width: 800px; width: 100%; margin: 0 auto; } .header { text-align: center; margin-bottom: 30px; } .card { background-color: var(--card-bg); border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); padding: 25px; margin-bottom: 20px; } .status-card { display: flex; flex-direction: column; margin-bottom: 20px; } .status { display: flex; align-items: center; justify-content: space-between; } .status-indicator { width: 12px; height: 12px; border-radius: 50%; margin-right: 10px; } .status-indicator.active { background-color: var(--success-color); animation: pulse 2s infinite; } .status-indicator.inactive { background-color: var(--error-color); } .latency { font-size: 1.2em; font-weight: 500; } .latency-value { color: var(--primary-color); font-weight: bold; } .content-card { min-height: 200px; margin-top: 20px; } .url { color: var(--primary-color); font-weight: 500; word-break: break-all; } .refresh-info { color: #5f6368; font-size: 0.9em; margin-top: 20px; text-align: center; } @keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } } h1 { color: var(--primary-color); margin-bottom: 10px; } .timestamp { color: #5f6368; font-size: 0.9em; margin-bottom: 5px; } </style></head><body> <div class="container"> <div class="header"> <h1>GOST 服务监控</h1> </div> <div id="status-cards"></div> <div class="refresh-info"> 页面每4分钟自动刷新内容 | 最后更新: <span id="last-update"></span> </div> </div> <script> const urls = [ 'https://gost-web.glitch.me', 'https://new-gost.glitch.me' ]; function createStatusCard(url) { const card = document.createElement('div'); card.className = 'card status-card'; card.innerHTML = ` <div class="status"> <div class="status-indicator" id="status-indicator-${url}"></div> <div> <div>服务状态: <span id="status-text-${url}">检测中...</span></div> <div class="timestamp" id="timestamp-${url}"></div> </div> <div class="latency"> 延迟: <span class="latency-value" id="latency-value-${url}">-</span> ms </div> </div> <div class="content-card"> <div>监控地址: <span class="url">${url}</span></div> <div id="content-${url}" style="margin-top: 20px;"></div> </div> `; document.getElementById('status-cards').appendChild(card); } function fetchContent(url) { const startTime = performance.now(); const timestamp = new Date().toLocaleString(); document.getElementById(`status-text-${url}`).textContent = '连接中...'; document.getElementById(`status-indicator-${url}`).className = 'status-indicator'; document.getElementById(`timestamp-${url}`).textContent = timestamp; document.getElementById('last-update').textContent = timestamp; fetch(url) .then(response => { if (!response.ok) throw new Error('网络响应不正常'); return response.text(); }) .then(data => { const endTime = performance.now(); const delayTime = (endTime - startTime).toFixed(2); // 更新状态显示 document.getElementById(`status-indicator-${url}`).className = 'status-indicator active'; document.getElementById(`status-text-${url}`).textContent = '运行正常'; document.getElementById(`latency-value-${url}`).textContent = delayTime; document.getElementById(`content-${url}`).innerHTML = data; }) .catch(error => { console.error('请求失败:', error); document.getElementById(`status-indicator-${url}`).className = 'status-indicator inactive'; document.getElementById(`status-text-${url}`).textContent = '连接失败'; document.getElementById(`latency-value-${url}`).textContent = '-'; document.getElementById(`content-${url}`).innerHTML = '无法获取内容: ' + error.message; }) .finally(() => { // 每隔4分钟(240000毫秒)重新加载内容 setTimeout(() => fetchContent(url), 240000); }); } window.onload = () => { urls.forEach(url => { createStatusCard(url); fetchContent(url); }); }; </script></body></html>