Send relevant active client info to FE
All checks were successful
release-image / release-image (push) Successful in 2m53s
All checks were successful
release-image / release-image (push) Successful in 2m53s
This commit is contained in:
@@ -199,7 +199,7 @@ def find_token_in_active_clients(target_token: str) -> bool:
|
||||
"""
|
||||
for client_id in current_app.active_clients:
|
||||
try:
|
||||
if current_app.active_clients[client_id].active_token.token == target_token:
|
||||
if current_app.active_clients[client_id].active_token == target_token:
|
||||
return True
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
@@ -22,6 +22,7 @@ async def register_client(websocket, client_id, client_nickname, active_token):
|
||||
current_app.active_clients[client_id].websocket = websocket
|
||||
current_app.active_clients[client_id].nickname = client_nickname
|
||||
current_app.active_clients[client_id].active_token = active_token
|
||||
current_app.active_clients[client_id].client_id = client_id
|
||||
print(f"Client {client_id} connected.")
|
||||
|
||||
# Create a JWT for the client
|
||||
@@ -150,7 +151,7 @@ async def send_command_to_all_clients(command_name, *args):
|
||||
@role_required(UserRoles.USER)
|
||||
async def get_nodes():
|
||||
"""API endpoint to list currently connected client IDs."""
|
||||
return jsonify(list(current_app.active_clients.keys()))
|
||||
return jsonify([client.json() for client in current_app.active_clients])
|
||||
|
||||
|
||||
@nodes_bp.route("/online", methods=['GET'])
|
||||
|
||||
Reference in New Issue
Block a user