mirror of
https://github.com/smittix/intercept.git
synced 2026-07-19 06:48:11 -07:00
Fix review issues: profiles, imports, clear reset, frequencies, VDL2 enrichment
- Remove profiles: [basic] from intercept service so docker compose up -d works without --profile flag (fixes breaking change for existing deployments) - Add missing Any import to routes/acars.py and routes/vdl2.py - Reset last_message_time to None in ACARS and VDL2 clear endpoints - Restore 131.725 and 131.825 to default ACARS frequencies (major US carriers) - Copy VDL2 ACARS enrichment fields to top-level data dict instead of mutating nested acars_payload (consistent with ACARS route pattern) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,8 +16,6 @@ services:
|
|||||||
image: ${INTERCEPT_IMAGE:-intercept:latest}
|
image: ${INTERCEPT_IMAGE:-intercept:latest}
|
||||||
build: .
|
build: .
|
||||||
container_name: intercept
|
container_name: intercept
|
||||||
profiles:
|
|
||||||
- basic
|
|
||||||
ports:
|
ports:
|
||||||
- "5050:5050"
|
- "5050:5050"
|
||||||
# Uncomment for HTTPS support (set INTERCEPT_HTTPS=true below)
|
# Uncomment for HTTPS support (set INTERCEPT_HTTPS=true below)
|
||||||
|
|||||||
+7
-4
@@ -13,7 +13,7 @@ import subprocess
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Generator
|
from typing import Any, Generator
|
||||||
|
|
||||||
from flask import Blueprint, jsonify, request, Response
|
from flask import Blueprint, jsonify, request, Response
|
||||||
|
|
||||||
@@ -35,9 +35,11 @@ acars_bp = Blueprint('acars', __name__, url_prefix='/acars')
|
|||||||
|
|
||||||
# Default VHF ACARS frequencies (MHz) - North America primary
|
# Default VHF ACARS frequencies (MHz) - North America primary
|
||||||
DEFAULT_ACARS_FREQUENCIES = [
|
DEFAULT_ACARS_FREQUENCIES = [
|
||||||
'131.550', # North America primary
|
'131.550', # Primary worldwide / North America
|
||||||
'130.025', # North America secondary
|
'130.025', # North America secondary
|
||||||
'129.125', # North America tertiary
|
'129.125', # North America tertiary
|
||||||
|
'131.725', # North America (major US carriers)
|
||||||
|
'131.825', # North America (major US carriers)
|
||||||
]
|
]
|
||||||
|
|
||||||
# Message counter for statistics
|
# Message counter for statistics
|
||||||
@@ -456,10 +458,11 @@ def get_acars_messages() -> Response:
|
|||||||
@acars_bp.route('/clear', methods=['POST'])
|
@acars_bp.route('/clear', methods=['POST'])
|
||||||
def clear_acars_messages() -> Response:
|
def clear_acars_messages() -> Response:
|
||||||
"""Clear stored ACARS messages and reset counter."""
|
"""Clear stored ACARS messages and reset counter."""
|
||||||
global acars_message_count
|
global acars_message_count, acars_last_message_time
|
||||||
from utils.flight_correlator import get_flight_correlator
|
from utils.flight_correlator import get_flight_correlator
|
||||||
get_flight_correlator().clear_acars()
|
get_flight_correlator().clear_acars()
|
||||||
acars_message_count = 0
|
acars_message_count = 0
|
||||||
|
acars_last_message_time = None
|
||||||
return jsonify({'status': 'cleared'})
|
return jsonify({'status': 'cleared'})
|
||||||
|
|
||||||
|
|
||||||
@@ -469,7 +472,7 @@ def get_frequencies() -> Response:
|
|||||||
return jsonify({
|
return jsonify({
|
||||||
'default': DEFAULT_ACARS_FREQUENCIES,
|
'default': DEFAULT_ACARS_FREQUENCIES,
|
||||||
'regions': {
|
'regions': {
|
||||||
'north_america': ['131.550', '130.025', '129.125'],
|
'north_america': ['131.550', '130.025', '129.125', '131.725', '131.825'],
|
||||||
'europe': ['131.525', '131.725', '131.550'],
|
'europe': ['131.525', '131.725', '131.550'],
|
||||||
'asia_pacific': ['131.550', '131.450'],
|
'asia_pacific': ['131.550', '131.450'],
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-6
@@ -13,7 +13,7 @@ import subprocess
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Generator
|
from typing import Any, Generator
|
||||||
|
|
||||||
from flask import Blueprint, jsonify, request, Response
|
from flask import Blueprint, jsonify, request, Response
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ def stream_vdl2_output(process: subprocess.Popen, is_text_mode: bool = False) ->
|
|||||||
data['type'] = 'vdl2'
|
data['type'] = 'vdl2'
|
||||||
data['timestamp'] = datetime.utcnow().isoformat() + 'Z'
|
data['timestamp'] = datetime.utcnow().isoformat() + 'Z'
|
||||||
|
|
||||||
# Enrich embedded ACARS payload with translated label
|
# Enrich with translated ACARS label at top level (consistent with ACARS route)
|
||||||
try:
|
try:
|
||||||
vdl2_inner = data.get('vdl2', data)
|
vdl2_inner = data.get('vdl2', data)
|
||||||
acars_payload = (vdl2_inner.get('avlc') or {}).get('acars')
|
acars_payload = (vdl2_inner.get('avlc') or {}).get('acars')
|
||||||
@@ -89,9 +89,9 @@ def stream_vdl2_output(process: subprocess.Popen, is_text_mode: bool = False) ->
|
|||||||
'label': acars_payload.get('label'),
|
'label': acars_payload.get('label'),
|
||||||
'text': acars_payload.get('msg_text', ''),
|
'text': acars_payload.get('msg_text', ''),
|
||||||
})
|
})
|
||||||
acars_payload['label_description'] = translation['label_description']
|
data['label_description'] = translation['label_description']
|
||||||
acars_payload['message_type'] = translation['message_type']
|
data['message_type'] = translation['message_type']
|
||||||
acars_payload['parsed'] = translation['parsed']
|
data['parsed'] = translation['parsed']
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -399,10 +399,11 @@ def get_vdl2_messages() -> Response:
|
|||||||
@vdl2_bp.route('/clear', methods=['POST'])
|
@vdl2_bp.route('/clear', methods=['POST'])
|
||||||
def clear_vdl2_messages() -> Response:
|
def clear_vdl2_messages() -> Response:
|
||||||
"""Clear stored VDL2 messages and reset counter."""
|
"""Clear stored VDL2 messages and reset counter."""
|
||||||
global vdl2_message_count
|
global vdl2_message_count, vdl2_last_message_time
|
||||||
from utils.flight_correlator import get_flight_correlator
|
from utils.flight_correlator import get_flight_correlator
|
||||||
get_flight_correlator().clear_vdl2()
|
get_flight_correlator().clear_vdl2()
|
||||||
vdl2_message_count = 0
|
vdl2_message_count = 0
|
||||||
|
vdl2_last_message_time = None
|
||||||
return jsonify({'status': 'cleared'})
|
return jsonify({'status': 'cleared'})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user