feat: enhance IP reporter response with HTML formatting and styling
This commit is contained in:
parent
30fa7aa9ce
commit
d674fa9ddc
@ -103,10 +103,17 @@ spec:
|
|||||||
ip = urllib.request.urlopen('https://ipinfo.io/ip').read().decode().strip()
|
ip = urllib.request.urlopen('https://ipinfo.io/ip').read().decode().strip()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
ip = f'error: {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_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('Content-Length', len(body))
|
||||||
|
self.send_header('X-Frame-Options', 'SAMEORIGIN')
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(body)
|
self.wfile.write(body)
|
||||||
def log_message(self, *a): pass
|
def log_message(self, *a): pass
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user