-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathweb_app.py
More file actions
53 lines (42 loc) · 1.26 KB
/
web_app.py
File metadata and controls
53 lines (42 loc) · 1.26 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
import platform
import socket
import psutil
from flask import Flask, render_template
from flask_socketio import SocketIO
app = Flask(__name__)
# 允许所有来源跨域,确保手机能连上
socketio = SocketIO(app, cors_allowed_origins="*")
def get_all_ip_addresses():
ip_list = []
for interface, addrs in psutil.net_if_addrs().items():
for addr in addrs:
if addr.family == socket.AF_INET and not addr.address.startswith("127."):
ip_list.append((interface, addr.address))
return ip_list
@app.route('/')
def index():
return render_template('dashboard.html')
@app.route('/touchpad')
def touchpad_page():
return render_template('index.html')
@app.route('/k')
def keyboard_page():
return render_template('keyboard.html')
@app.route('/v')
def voice_page():
return render_template('voice.html')
@app.route('/test')
def vibe_test():
return render_template('vibe_test.html')
@app.route('/t')
def air_mouse_test():
return render_template('t.html')
@app.route('/r')
def real_mouse_page():
return render_template('realmouse.html')
@app.route('/b')
def buttons_page():
return render_template('buttons.html')
@app.route('/controller')
def controller_page():
return render_template('controller.html')