Test endpoint to verify robust tracking logic is working
()
| 7650 | 'pan_connected': safe_bool(shared_data.pan_connected), |
| 7651 | 'usb_active': safe_bool(shared_data.usb_active), |
| 7652 | 'manual_mode': safe_bool(shared_data.config.get('manual_mode', False)), |
| 7653 | 'headless_mode': safe_bool(getattr(shared_data, 'headless_mode', False)), |
| 7654 | 'pwnagotchi_mode': shared_data.config.get('pwnagotchi_mode', 'ragnar'), |
| 7655 | 'pwnagotchi_installed': safe_bool(shared_data.config.get('pwnagotchi_installed', False)), |
| 7656 | 'release_gate': _build_release_gate_payload(), |
| 7657 | 'timestamp': datetime.now().isoformat() |
| 7658 | } |
| 7659 | |
| 7660 | # Add cache headers for quick responses |
| 7661 | response = jsonify(status_data) |
| 7662 | response.headers['Cache-Control'] = 'public, max-age=5' # Cache for 5 seconds |
| 7663 | return response |
| 7664 | except Exception as e: |
| 7665 | logger.error(f"Error getting status: {e}") |
| 7666 | return jsonify({'error': str(e)}), 500 |
| 7667 | |
| 7668 | |
| 7669 | @app.route('/api/config', methods=['GET']) |
| 7670 | def get_config(): |
| 7671 | """Get current configuration""" |
| 7672 | try: |
| 7673 | return jsonify(shared_data.config) |
| 7674 | except Exception as e: |
| 7675 | logger.error(f"Error getting config: {e}") |
| 7676 | return jsonify({'error': str(e)}), 500 |
| 7677 | |
| 7678 | |
| 7679 | @app.route('/api/config', methods=['POST']) |
| 7680 | def update_config(): |
| 7681 | """Update configuration""" |
| 7682 | try: |
| 7683 | data = request.get_json() |
| 7684 | if not data: |
| 7685 | return jsonify({'error': 'No data provided'}), 400 |
| 7686 | |
| 7687 | ai_reload_success = None |
| 7688 | ai_reload_error = None |
| 7689 | epd_type_changed = 'epd_type' in data |
| 7690 | |
| 7691 | # Capture pre-update kiosk state so we can detect toggles after save. |
| 7692 | prev_kiosk_enabled = bool(shared_data.config.get('kiosk_enabled', False)) |
| 7693 | # Refuse to even record kiosk_enabled on hardware that cannot host |
| 7694 | # Chromium — persisting it would leave a box permanently trying (and |
| 7695 | # failing) to install a kiosk on every boot. |
| 7696 | if data.get('kiosk_enabled'): |
| 7697 | kiosk_ok, kiosk_reason = _kiosk_capability() |
| 7698 | if not kiosk_ok: |
nothing calls this directly
no test coverage detected