Handle captive portal detection requests from mobile devices
()
| 4802 | return jsonify({'success': False, 'error': 'Sensing backend is not installed.'}), 400 |
| 4803 | cmd = (['systemctl', 'restart', SENSING_UNIT] if os.geteuid() == 0 |
| 4804 | else ['sudo', '-n', 'systemctl', 'restart', SENSING_UNIT]) |
| 4805 | try: |
| 4806 | proc = subprocess.run(cmd, capture_output=True, text=True, timeout=30) |
| 4807 | except Exception as exc: |
| 4808 | return jsonify({'success': False, 'error': f'restart failed: {exc}'}), 500 |
| 4809 | if proc.returncode != 0: |
| 4810 | return jsonify({'success': False, |
| 4811 | 'error': (proc.stderr or proc.stdout or 'systemctl restart failed').strip()}), 500 |
| 4812 | _, active = _sensing_unit_state() |
| 4813 | return jsonify({'success': True, 'active': active, |
| 4814 | 'message': 'Sensing service restarted' + ('' if active else ' (not active — check logs)')}) |
nothing calls this directly
no test coverage detected