-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_network.py
More file actions
94 lines (82 loc) · 2.7 KB
/
start_network.py
File metadata and controls
94 lines (82 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
"""
Local Network Server with Chat Support
Starts Pulsefeed with full WebSocket/chat features enabled on your local network.
Usage:
python start_network.py
Access from other devices:
http://<your-local-ip>:5000
"""
import socket
import os
from app import create_app, create_socketio
def get_local_ip():
"""Get the local network IP address"""
try:
# Create a socket to find 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 Exception:
return "localhost"
def get_network_info():
"""Get detailed network information"""
import socket
hostname = socket.gethostname()
local_ip = get_local_ip()
return hostname, local_ip
if __name__ == "__main__":
# Get network info
hostname, local_ip = get_network_info()
port = int(os.environ.get('PORT', 5000))
print("\n" + "="*70)
print(" Pulsefeed - Local Network Server (Full Features)")
print("="*70)
print(f"\n Computer Name: {hostname}")
print(f" Local IP: {local_ip}")
print(f" Port: {port}")
print("\n" + "-"*70)
print(" Access URLs:")
print("-"*70)
print(f"\n From this computer:")
print(f" http://localhost:{port}")
print(f" http://127.0.0.1:{port}")
print(f"\n From other devices on your network:")
print(f" http://{local_ip}:{port}")
print(f"\n All network interfaces:")
print(f" http://0.0.0.0:{port}")
print("\n" + "-"*70)
print(" Features Enabled:")
print("-"*70)
print(" - Real-time chat (WebSocket)")
print(" - Multi-user access")
print(" - Shared calendars")
print(" - All social features")
print("\n" + "-"*70)
print(" Security Notes:")
print("-"*70)
print(" - Anyone on your network can access this app")
print(" - Each user needs their own account")
print(" - Use invite codes to control registration")
print(" - Don't use on untrusted networks")
print("\n" + "-"*70)
print(" Firewall:")
print("-"*70)
print(f" If other devices can't connect, allow Python on port {port}")
print(" Windows: Settings > Privacy & Security > Windows Firewall")
print("\n" + "="*70)
print(" Server starting... Press Ctrl+C to stop")
print("="*70 + "\n")
# Create app and socketio with full features
app = create_app()
socketio = create_socketio(app)
# Run on all network interfaces with WebSocket support
socketio.run(
app,
host='0.0.0.0', # Bind to all network interfaces
port=port,
debug=True,
use_reloader=True, # Auto-reload on code changes
log_output=True
)