import socket

def get_local_ip():
    """Get the local IP address of this machine"""
    try:
        # Connect to a remote server to get local IP
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(("8.8.8.8", 80))
        local_ip = s.getsockname()[0]
        s.close()
        return local_ip
    except:
        return "Unable to determine IP"

if __name__ == "__main__":
    local_ip = get_local_ip()
    
    print("🌐 Try-English HTTPS Access Information")
    print("=" * 50)
    print(f"🔒 Local HTTPS URL: https://localhost:5003")
    print(f"📱 Mobile/Network HTTPS URL: https://{local_ip}:5003")
    print()
    print("📋 How to access from mobile devices:")
    print("1. Make sure your mobile device is on the same WiFi network")
    print(f"2. Open your mobile browser and go to: https://{local_ip}:5003")
    print("3. You'll see a security warning - click 'Advanced' then 'Proceed'")
    print("4. The microphone will work perfectly with HTTPS!")
    print()
    print("⚠️  Note: Self-signed certificates will show security warnings")
    print("   This is normal and safe for local development")
    print("=" * 50)