Safely convert value to boolean, supporting common string inputs.
(value, default=False)
| 3827 | 'installing': installing, 'arch': arch, 'has_prebuilt': has_prebuilt, |
| 3828 | }) |
| 3829 | |
| 3830 | |
| 3831 | @app.route('/api/sensing/install', methods=['POST']) |
| 3832 | def sensing_install(): |
| 3833 | """Install (or rebuild) the bundled sensing backend in the background.""" |
| 3834 | global _sensing_installing |
| 3835 | with _sensing_install_lock: |
| 3836 | if _sensing_installing: |
| 3837 | return jsonify({'success': True, 'message': 'Install already in progress', 'installing': True}) |
| 3838 | _sensing_installing = True |
| 3839 | rebuild = bool((request.get_json(silent=True) or {}).get('rebuild')) |
| 3840 | open(SENSING_INSTALL_LOG, 'w').close() # fresh log per run |
| 3841 | threading.Thread(target=_run_sensing_script, |
| 3842 | args=(SENSING_INSTALL_SCRIPT, '--rebuild' if rebuild else None), |
| 3843 | daemon=True, name='sensing-install').start() |
| 3844 | return jsonify({'success': True, 'message': 'Sensing backend install started', 'installing': True}) |
| 3845 | |
| 3846 | |
| 3847 | @app.route('/api/sensing/uninstall', methods=['POST']) |
| 3848 | def sensing_uninstall(): |
| 3849 | """Stop and remove the bundled sensing backend.""" |
| 3850 | threading.Thread(target=_run_sensing_script, args=(SENSING_UNINSTALL_SCRIPT,), |
no outgoing calls
no test coverage detected