Trigger a manual vulnerability scan using the proper NmapVulnScanner method
()
| 15494 | logger.error(f"Fan mode error: {e}") |
| 15495 | return jsonify({'success': False, 'error': str(e)}), 500 |
| 15496 | |
| 15497 | |
| 15498 | @app.route('/api/fan/test', methods=['POST']) |
| 15499 | def api_fan_test(): |
| 15500 | """Spin the fan at 100 % for a few seconds and read the tachometer.""" |
| 15501 | try: |
| 15502 | import fan_tools |
| 15503 | result = fan_tools.spin_test() |
| 15504 | return jsonify(result), (200 if result.get('success') else 400) |
| 15505 | except Exception as e: |
| 15506 | logger.error(f"Fan spin test error: {e}") |
| 15507 | return jsonify({'success': False, 'error': str(e)}), 500 |
| 15508 | |
| 15509 | |
| 15510 | # --------------------------------------------------------------------------- |
| 15511 | # Cellular uplink fallback (USB-tethered hotspot / phone / LTE modem) |
| 15512 | # --------------------------------------------------------------------------- |
| 15513 | _cellular_monitor = None |
| 15514 | |
| 15515 | |
| 15516 | def cellular_uplink_monitor_loop(): |
| 15517 | """Pin tethered-cellular default routes to the fallback metric and push a |
| 15518 | notification when the uplink fails over to / back from cellular.""" |
| 15519 | global _cellular_monitor |
| 15520 | try: |
| 15521 | import cellular_uplink |
| 15522 | except Exception as exc: # noqa: BLE001 |
| 15523 | logger.warning(f"[cellular] module unavailable: {exc}") |
| 15524 | return |
| 15525 | _cellular_monitor = cellular_uplink.Monitor(log=logger) |
| 15526 | try: |
| 15527 | # Self-provision the NM/dhcpcd hooks so web-updated boxes get them too. |
| 15528 | for change in cellular_uplink.install(shared_data.config): |
| 15529 | logger.info(f"[cellular] {change}") |
| 15530 | except Exception as exc: # noqa: BLE001 |
| 15531 | logger.warning(f"[cellular] hook install failed: {exc}") |
| 15532 | while not getattr(shared_data, 'webapp_should_exit', False): |
| 15533 | try: |
| 15534 | for t in _cellular_monitor.tick(shared_data.config): |
| 15535 | po = _rusense_pushover() |
| 15536 | if po: |
| 15537 | po.notify_cellular_uplink(t['msg'], priority=t.get('priority', 0)) |
| 15538 | except Exception as exc: # noqa: BLE001 |
| 15539 | logger.debug(f"[cellular] tick failed: {exc}") |
| 15540 | time.sleep(10) |
| 15541 | |
| 15542 | |
| 15543 | @app.route('/api/cellular/status', methods=['GET']) |
| 15544 | def api_cellular_status(): |
| 15545 | try: |
| 15546 | import cellular_uplink |
| 15547 | data = cellular_uplink.status(shared_data.config) |
| 15548 | data['events'] = list(_cellular_monitor.events[-20:]) if _cellular_monitor else [] |
| 15549 | data['heartbeat'] = _cellular_monitor.snapshot() if _cellular_monitor else None |
| 15550 | return jsonify(data) |
| 15551 | except Exception as e: |
| 15552 | logger.error(f"Cellular status error: {e}") |
| 15553 | return jsonify({'success': False, 'error': str(e)}), 500 |
nothing calls this directly
no test coverage detected