Initial release of Google Opal AI iOS Web Studio
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import http.server
|
||||
import socketserver
|
||||
import socket
|
||||
import os
|
||||
|
||||
PORT = 8080
|
||||
DIRECTORY = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
class Handler(http.server.SimpleHTTPRequestHandler):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, directory=DIRECTORY, **kwargs)
|
||||
|
||||
def get_local_ip():
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
try:
|
||||
s.connect(('8.8.8.8', 80))
|
||||
ip = s.getsockname()[0]
|
||||
except Exception:
|
||||
ip = '127.0.0.1'
|
||||
finally:
|
||||
s.close()
|
||||
return ip
|
||||
|
||||
if __name__ == '__main__':
|
||||
local_ip = get_local_ip()
|
||||
print("=" * 60)
|
||||
print("💎 Google Opal AI - iOS Web Studio Server is Running!")
|
||||
print("=" * 60)
|
||||
print(f"📱 Open this URL in iPhone Safari (Same Wi-Fi network):")
|
||||
print(f" 👉 http://{local_ip}:{PORT}")
|
||||
print(f"💻 Or on this PC: http://localhost:{PORT}")
|
||||
print("=" * 60)
|
||||
print("💡 iPhone Tips: Safari-তে গিয়ে 'Share ➔ Add to Home Screen' দিন।")
|
||||
print("=" * 60)
|
||||
|
||||
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
||||
try:
|
||||
httpd.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print("\nServer stopped.")
|
||||
Reference in New Issue
Block a user