feat: enhance IP reporter response with HTML formatting and styling

This commit is contained in:
Nik Afiq 2026-05-12 23:06:33 +09:00
parent 30fa7aa9ce
commit d674fa9ddc

View File

@ -103,10 +103,17 @@ spec:
ip = urllib.request.urlopen('https://ipinfo.io/ip').read().decode().strip()
except Exception as e:
ip = f'error: {e}'
body = ip.encode()
body = f'''<!DOCTYPE html>
<html>
<body style="margin:0;display:flex;align-items:center;justify-content:center;height:100vh;
background:transparent;font-family:monospace;font-size:1.1rem;color:#ccc;">
<span>🌐 VPN IP: <strong style="color:#7eb8f7">{ip}</strong></span>
</body>
</html>'''.encode()
self.send_response(200)
self.send_header('Content-Type', 'text/plain')
self.send_header('Content-Type', 'text/html')
self.send_header('Content-Length', len(body))
self.send_header('X-Frame-Options', 'SAMEORIGIN')
self.end_headers()
self.wfile.write(body)
def log_message(self, *a): pass