Get or set serial ESP32 listener configuration. Supports multiple companions.
()
| 8347 | task = _kiosk_task_get() |
| 8348 | return jsonify({ |
| 8349 | # Hardware gate: the Settings UI hides the whole card when the |
| 8350 | # board cannot host Chromium (Pi Zero class / <2GB). |
| 8351 | 'capable': kiosk_ok, |
| 8352 | 'capability_reason': kiosk_reason, |
| 8353 | 'installed': mode != 'not_installed', |
| 8354 | 'mode': mode, |
| 8355 | # Whether `journalctl -u ragnar-kiosk` can possibly have anything in |
| 8356 | # it. In autostart mode, and whenever the install failed, no unit is |
| 8357 | # ever created - pointing people at that journal sent them to "-- No |
| 8358 | # entries --" and a dead end. |
| 8359 | 'unit_exists': os.path.exists(KIOSK_SERVICE_FILE), |
| 8360 | 'enabled': bool(shared_data.config.get('kiosk_enabled', False)), |
| 8361 | 'service_state': state, |
| 8362 | # Background install/teardown progress. 'busy' tells the UI to keep |
| 8363 | # waiting instead of declaring a timeout; 'task_error' carries the |
| 8364 | # real reason a job failed, which for an installer failure never |
| 8365 | # reaches the systemd journal because the unit does not exist yet. |
| 8366 | 'busy': bool(task.get('busy')), |
| 8367 | 'phase': task.get('phase') or 'idle', |
| 8368 | 'task_error': task.get('error'), |
| 8369 | 'elapsed': round(max(0.0, time.time() - task['started']), 1) if task.get('started') else 0, |
| 8370 | 'url': shared_data.config.get('kiosk_url', 'http://localhost:8000'), |
| 8371 | 'rotation': shared_data.config.get('kiosk_rotation', 0), |
| 8372 | 'hide_cursor': bool(shared_data.config.get('kiosk_hide_cursor', True)), |
| 8373 | }) |
| 8374 | except Exception as exc: |
| 8375 | logger.error(f"Error getting kiosk status: {exc}") |
| 8376 | return jsonify({'error': str(exc)}), 500 |
| 8377 | |
| 8378 | |
| 8379 | @app.route('/api/kiosk/repair', methods=['POST']) |
| 8380 | def kiosk_repair(): |
| 8381 | """Re-run the kiosk installer and start it, whatever the current state. |
| 8382 | |
| 8383 | The toggle only acts on a *change*, so a box whose config already says |
nothing calls this directly
no test coverage detected