feat(debug): beveilig debug functionaliteit met debug_mode

Debug functionaliteit is nu alleen toegankelijk wanneer debug_mode is ingeschakeld. Dit omvat het omleiden van gebruikers naar de hoofdpagina als debug_mode uitgeschakeld is en het tonen van een foutmelding bij een niet-geautoriseerde API-aanroep. Ook is de debug knop in de UI alleen zichtbaar als debug_mode aan staat. Dit verhoogt de veiligheid en beperkt toegang tot debugging opties.
This commit is contained in:
filoor 2025-05-28 07:33:16 +02:00
parent 95bc835711
commit f4a18ce8b4
4 changed files with 16 additions and 2 deletions

View File

@ -391,6 +391,11 @@ def test_audio():
def debug(): def debug():
"""Debug pagina voor het testen van adhaan functionaliteit""" """Debug pagina voor het testen van adhaan functionaliteit"""
settings = load_settings() settings = load_settings()
# Check of debug mode is ingeschakeld
if not settings.get('debug_mode', False):
return redirect('/')
gebedstijden = {} gebedstijden = {}
try: try:
@ -431,13 +436,16 @@ def debug_adhaan():
"""API endpoint voor debug adhaan testing""" """API endpoint voor debug adhaan testing"""
import time import time
# Check of debug mode is ingeschakeld
settings = load_settings()
if not settings.get('debug_mode', False):
return jsonify({'success': False, 'error': 'Debug mode is niet ingeschakeld'}), 403
try: try:
data = flask_request.get_json() data = flask_request.get_json()
prayer_name = data.get('prayer', 'Test') prayer_name = data.get('prayer', 'Test')
test_time = data.get('time', 'Onbekend') test_time = data.get('time', 'Onbekend')
settings = load_settings()
# Check mute status # Check mute status
if settings.get('mute', False): if settings.get('mute', False):
return jsonify({ return jsonify({

View File

@ -47,7 +47,9 @@
{% endfor %} {% endfor %}
<li><a href="/instellingen" title="Instellingen" class="icoon-link"><span class="material-icons">settings</span></a></li> <li><a href="/instellingen" title="Instellingen" class="icoon-link"><span class="material-icons">settings</span></a></li>
<li><a href="#" id="muteBtn" title="Mute" class="icoon-link"><span id="muteIcon" class="material-icons">volume_off</span></a></li> <li><a href="#" id="muteBtn" title="Mute" class="icoon-link"><span id="muteIcon" class="material-icons">volume_off</span></a></li>
{% if settings.debug_mode %}
<li><a href="/debug" title="Debug Mode" class="icoon-link"><span class="material-icons">bug_report</span></a></li> <li><a href="/debug" title="Debug Mode" class="icoon-link"><span class="material-icons">bug_report</span></a></li>
{% endif %}
<li><a href="/quran" title="Quran Speler" class="icoon-link"><span class="material-icons">menu_book</span></a></li> <li><a href="/quran" title="Quran Speler" class="icoon-link"><span class="material-icons">menu_book</span></a></li>
</ul> </ul>
</div> </div>

View File

@ -91,7 +91,9 @@
{% endfor %} {% endfor %}
<li><a href="/instellingen" title="Instellingen" class="icoon-link"><span class="material-icons">settings</span></a></li> <li><a href="/instellingen" title="Instellingen" class="icoon-link"><span class="material-icons">settings</span></a></li>
<li><a href="#" id="muteBtn" title="Mute" class="icoon-link"><span id="muteIcon" class="material-icons">volume_off</span></a></li> <li><a href="#" id="muteBtn" title="Mute" class="icoon-link"><span id="muteIcon" class="material-icons">volume_off</span></a></li>
{% if settings.debug_mode %}
<li><a href="/debug" title="Debug Mode" class="icoon-link"><span class="material-icons">bug_report</span></a></li> <li><a href="/debug" title="Debug Mode" class="icoon-link"><span class="material-icons">bug_report</span></a></li>
{% endif %}
<li><a href="/" title="Terug naar hoofdpagina" class="icoon-link"><span class="material-icons">home</span></a></li> <li><a href="/" title="Terug naar hoofdpagina" class="icoon-link"><span class="material-icons">home</span></a></li>
</ul> </ul>
</div> </div>

2
done
View File

@ -48,3 +48,5 @@ Sun May 25 22:34:29 CEST 2025: Sonos herstart probleem opgelost - debounce mecha
2025-05-26 21:06:51 - Volume error opgelost in backend - oude volume veld vervangen door volume_day/volume_night 2025-05-26 21:06:51 - Volume error opgelost in backend - oude volume veld vervangen door volume_day/volume_night
Wed May 28 07:22:58 CEST 2025: Automatische navigatie toegevoegd aan adzkaar.html - switcht elke 30 seconden naar volgende dhikr Wed May 28 07:22:58 CEST 2025: Automatische navigatie toegevoegd aan adzkaar.html - switcht elke 30 seconden naar volgende dhikr
Wed May 28 07:27:01 CEST 2025: Centraal kleurenschema geïmplementeerd - alle kleuren nu aanpasbaar via colors.css Wed May 28 07:27:01 CEST 2025: Centraal kleurenschema geïmplementeerd - alle kleuren nu aanpasbaar via colors.css
Wed May 28 07:30:33 CEST 2025: Debug functionaliteit beveiligd - debug knop en routes alleen zichtbaar/toegankelijk als debug_mode=true
Wed May 28 07:32:53 CEST 2025: .gitignore toegevoegd en .lh folder verwijderd uit repository - Local History bestanden worden nu genegeerd