wop commited on
Commit
2e33767
·
verified ·
1 Parent(s): 6fb06ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -28,8 +28,10 @@ def check_pc(name):
28
  return "Online"
29
  return "Offline"
30
 
31
- # Send command
32
  def send_command(name, password, command):
 
 
33
  with open(status_file, "r") as f:
34
  status = json.load(f)
35
  if name in status and status[name]["password"] == password:
@@ -38,7 +40,7 @@ def send_command(name, password, command):
38
  return f"Command '{command}' sent to {name}."
39
  return "Authentication failed."
40
 
41
- # Get command (PC side)
42
  def get_command():
43
  with open(command_file, "r") as f:
44
  cmd_data = json.load(f)
 
28
  return "Online"
29
  return "Offline"
30
 
31
+ # Send command or register if command is "REGISTER"
32
  def send_command(name, password, command):
33
+ if command == "REGISTER":
34
+ return register_pc(name, password)
35
  with open(status_file, "r") as f:
36
  status = json.load(f)
37
  if name in status and status[name]["password"] == password:
 
40
  return f"Command '{command}' sent to {name}."
41
  return "Authentication failed."
42
 
43
+ # Get command (for PC side polling)
44
  def get_command():
45
  with open(command_file, "r") as f:
46
  cmd_data = json.load(f)