mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
@@ -418,7 +418,7 @@ def api_devices_search():
|
|||||||
|
|
||||||
if is_mac(query):
|
if is_mac(query):
|
||||||
device_data = get_device_data(query)
|
device_data = get_device_data(query)
|
||||||
if device_data:
|
if device_data.status_code == 200:
|
||||||
return jsonify({"success": True, "devices": [device_data.get_json()]})
|
return jsonify({"success": True, "devices": [device_data.get_json()]})
|
||||||
else:
|
else:
|
||||||
return jsonify({"success": False, "error": "Device not found"}), 404
|
return jsonify({"success": False, "error": "Device not found"}), 404
|
||||||
@@ -574,7 +574,7 @@ def api_trigger_scan():
|
|||||||
@app.route('/mcp/sse/openapi.json', methods=['GET'])
|
@app.route('/mcp/sse/openapi.json', methods=['GET'])
|
||||||
def api_openapi_spec():
|
def api_openapi_spec():
|
||||||
if not is_authorized():
|
if not is_authorized():
|
||||||
return jsonify({"Success": False, "error": "Unauthorized"}), 401
|
return jsonify({"success": False, "error": "Unauthorized"}), 401
|
||||||
return openapi_spec()
|
return openapi_spec()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -57,16 +57,13 @@ def openapi_spec():
|
|||||||
|
|
||||||
|
|
||||||
# Sessions for SSE
|
# Sessions for SSE
|
||||||
_sessions = {}
|
|
||||||
_sessions_lock = __import__('threading').Lock()
|
|
||||||
_openapi_spec_cache = None
|
_openapi_spec_cache = None
|
||||||
API_BASE_URL = f"http://localhost:{get_setting_value('GRAPHQL_PORT')}"
|
API_BASE_URL = f"http://localhost:{get_setting_value('GRAPHQL_PORT')}"
|
||||||
|
|
||||||
|
|
||||||
def get_openapi_spec():
|
def get_openapi_spec():
|
||||||
global _openapi_spec_cache
|
global _openapi_spec_cache
|
||||||
# Clear cache on each call for now to ensure fresh spec
|
|
||||||
_openapi_spec_cache = None
|
|
||||||
if _openapi_spec_cache:
|
if _openapi_spec_cache:
|
||||||
return _openapi_spec_cache
|
return _openapi_spec_cache
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class EventInstance:
|
|||||||
ORDER BY eve_DateTime DESC
|
ORDER BY eve_DateTime DESC
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
""", (n,)).fetchall()
|
""", (n,)).fetchall()
|
||||||
|
conn.close()
|
||||||
return self._rows_to_list(rows)
|
return self._rows_to_list(rows)
|
||||||
|
|
||||||
# --- Specific helper for last 10 ---
|
# --- Specific helper for last 10 ---
|
||||||
|
|||||||
Reference in New Issue
Block a user