28 lines
950 B
C++
28 lines
950 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <atomic>
|
|
|
|
namespace navegator {
|
|
|
|
// Inicia un servidor HTTP local en 127.0.0.1:port en un thread detached.
|
|
// Idempotente — si ya esta corriendo, no hace nada.
|
|
//
|
|
// Endpoints v1:
|
|
// GET /health -> "ok"
|
|
// GET /browsers -> JSON array
|
|
// POST /spawn?profile=X&port=N&headless=0|1 -> JSON {ok,pid,port}
|
|
// POST /kill?user_data_dir=... -> JSON {killed:N}
|
|
// POST /kill?profile=NAME -> JSON {killed:N}
|
|
//
|
|
// El servidor solo bindea a 127.0.0.1 (loopback), no expone fuera del PC.
|
|
// WSL2 con mirrored networking ya alcanza este bind desde WSL.
|
|
void start_api_server(int port = 19333);
|
|
|
|
// Estado para mostrar en la UI (panel Info).
|
|
extern std::atomic<bool> g_api_running;
|
|
extern std::atomic<int> g_api_port;
|
|
extern std::atomic<int> g_api_request_count;
|
|
|
|
} // namespace navegator
|