Get server capabilities and feature availability
()
| 16726 | } |
| 16727 | |
| 16728 | return jsonify(response_data) |
| 16729 | except Exception as e: |
| 16730 | logger.error(f"Error getting netkb JSON: {e}") |
| 16731 | return jsonify({'error': str(e)}), 500 |
| 16732 | |
| 16733 | |
| 16734 | # ============================================================================ |
| 16735 | # WEBSOCKET EVENTS |
| 16736 | # ============================================================================ |
| 16737 | |
| 16738 | # ============================================================================ |
| 16739 | # WEB TERMINAL (interactive PTY over Socket.IO, /terminal namespace) |
| 16740 | # |
| 16741 | # Off by default (config 'terminal_enabled'). Runs a shell as the non-root |
| 16742 | # 'ragnar' user in the repo dir. Gated by login AND the config flag; the |
| 16743 | # service runs as root only to drop to 'ragnar' via `su`. |
| 16744 | # ============================================================================ |
| 16745 | |
| 16746 | _TERM_USER = 'ragnar' |
| 16747 | _TERM_CWD = '/home/ragnar/Ragnar' |
| 16748 | _term_sessions = {} # socket sid -> {'fd': int, 'pid': int} |
| 16749 | _term_lock = threading.Lock() |
| 16750 | |
| 16751 | |
| 16752 | def _terminal_enabled(): |
| 16753 | try: |
| 16754 | return bool(shared_data.config.get('terminal_enabled', False)) |
| 16755 | except Exception: |
| 16756 | return False |
| 16757 | |
| 16758 |
nothing calls this directly
no test coverage detected