Skip to content

Commit b3cb2b7

Browse files
author
Your Name
committed
EEOR
Debug buttons MORE
1 parent b928528 commit b3cb2b7

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

radxa_stream_manager.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,49 @@ def test_github_connection():
608608
"write_permission": False
609609
}), 500
610610

611+
@app.route("/api/mediamtx/test-config", methods=["POST"])
612+
def test_mediamtx_config():
613+
"""Test MediaMTX configuration without applying it."""
614+
try:
615+
data = request.json or {}
616+
srt_port = data.get("srt_port", 8888)
617+
stream_name = data.get("stream_name", "live")
618+
619+
# Create test configuration
620+
test_config = {
621+
"srt": True,
622+
"srtAddress": f":{srt_port}",
623+
"hls": True,
624+
"hlsAddress": ":8080",
625+
"hlsAllowOrigin": "*",
626+
"paths": {
627+
stream_name: {
628+
"source": "publisher"
629+
}
630+
}
631+
}
632+
633+
# Test the configuration
634+
is_valid = validate_mediamtx_config(test_config)
635+
636+
# Get MediaMTX version info
637+
version = get_mediamtx_version()
638+
639+
return jsonify({
640+
"config_valid": is_valid,
641+
"mediamtx_version": version,
642+
"test_config": test_config,
643+
"mediamtx_binary": MEDIAMTX_BIN,
644+
"config_file": MEDIAMTX_CONFIG
645+
})
646+
647+
except Exception as e:
648+
logging.error(f"Error testing MediaMTX config: {e}")
649+
return jsonify({
650+
"config_valid": False,
651+
"error": str(e)
652+
}), 500
653+
611654
@app.route("/api/tailscale/status")
612655
def tailscale_status():
613656
"""Returns Tailscale connection status."""

templates/index.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ <h2 class="text-xl font-bold mb-4">System Diagnostics</h2>
411411
<button id="run-system-test" class="btn btn-blue">Run System Test</button>
412412
<button id="refresh-log" class="btn btn-blue">Refresh App Log</button>
413413
<button id="refresh-mediamtx-log" class="btn btn-blue">MediaMTX Logs</button>
414+
<button id="test-mediamtx-config" class="btn btn-blue">Test MediaMTX Config</button>
414415
<button id="test-autostart" class="btn btn-blue">Test Auto-Start</button>
415416
<button id="test-update-connection" class="btn btn-blue">Test Update Connection</button>
416417
<button id="check-updates" class="btn btn-green">Check for Updates</button>
@@ -655,6 +656,48 @@ <h3 class="font-bold mb-2">Application Log:</h3>
655656
});
656657
});
657658

659+
$('#test-mediamtx-config').click(function() {
660+
const button = $(this);
661+
button.text('Testing...').prop('disabled', true);
662+
663+
const testData = {
664+
srt_port: $('#srt-port').val() || 8888,
665+
stream_name: $('#stream-name').val() || 'live'
666+
};
667+
668+
$.ajax({
669+
url: '/api/mediamtx/test-config',
670+
type: 'POST',
671+
contentType: 'application/json',
672+
data: JSON.stringify(testData),
673+
success: function(data) {
674+
let message = '🔧 MediaMTX Configuration Test:\n\n';
675+
message += `Configuration Valid: ${data.config_valid ? '✅ Yes' : '❌ No'}\n`;
676+
message += `MediaMTX Version: ${data.mediamtx_version || 'Unknown'}\n`;
677+
message += `Binary Path: ${data.mediamtx_binary}\n`;
678+
message += `Config File: ${data.config_file}\n\n`;
679+
680+
if (data.config_valid) {
681+
message += '✅ Configuration should work with your MediaMTX version.';
682+
} else {
683+
message += '❌ Configuration may have compatibility issues.';
684+
if (data.error) {
685+
message += `\nError: ${data.error}`;
686+
}
687+
}
688+
689+
alert(message);
690+
},
691+
error: function(xhr) {
692+
const errorMessage = xhr.responseJSON ? xhr.responseJSON.error : 'Config test failed';
693+
alert(`❌ MediaMTX config test failed: ${errorMessage}`);
694+
},
695+
complete: function() {
696+
button.text('Test MediaMTX Config').prop('disabled', false);
697+
}
698+
});
699+
});
700+
658701
$('#test-update-connection').click(function() {
659702
const button = $(this);
660703
button.text('Testing...').prop('disabled', true);

0 commit comments

Comments
 (0)