From c8c68dcc0dc4b897519105faec64994e820af0c2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 18 May 2026 19:20:35 +0530 Subject: fix: build-verify tollgate_core component extraction - Remove display/cvm/font deps from CMakeLists (not yet merged branches) - Add tollgate_platform.h include to session header - Add tollgate_core_session_set_platform declaration - Remove duplicate tollgate_core_dns_stop wrapper (dns module has own impl) - Update captive_portal.c to use tollgate_core_* API - Remove display/cvm calls from tollgate_main.c - Add tollgate_get_platform declaration to config.h - Fix nucula wallet.hpp submodule (save_proofs visibility) - Add tollgate_core include paths to test Makefile - Build passes, all unit tests pass (61/61) --- main/CMakeLists.txt | 5 +---- main/captive_portal.c | 15 ++++++++------- main/config.h | 3 +++ main/tollgate_main.c | 16 ---------------- main/tollgate_platform.c | 1 - 5 files changed, 12 insertions(+), 28 deletions(-) (limited to 'main') diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 5f195c3..c3f8019 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -12,12 +12,9 @@ idf_component_register(SRCS "tollgate_main.c" "lightning_payout.c" "nip04.c" "mcp_handler.c" - "cvm_server.c" - "display.c" - "font.c" INCLUDE_DIRS "." REQUIRES esp_wifi esp_event esp_netif nvs_flash esp_http_server lwip json esp_http_client mbedtls esp-tls log spiffs - nucula_lib secp256k1 axs15231b qrcode + nucula_lib secp256k1 tollgate_core PRIV_REQUIRES esp-tls) diff --git a/main/captive_portal.c b/main/captive_portal.c index 1a3d5ce..98dc637 100644 --- a/main/captive_portal.c +++ b/main/captive_portal.c @@ -1,6 +1,7 @@ #include "captive_portal.h" -#include "firewall.h" -#include "session.h" +#include "tollgate_core.h" +#include "tollgate_core_firewall.h" +#include "tollgate_core_session.h" #include "config.h" #include "esp_log.h" #include "esp_wifi.h" @@ -182,7 +183,7 @@ static esp_err_t grant_access_handler(httpd_req_t *req) { uint32_t client_ip; if (get_client_ip(req, &client_ip) == ESP_OK) { - firewall_grant_access(client_ip); + tollgate_core_fw_grant(client_ip); } const char *resp = "{\"status\":\"granted\"}"; httpd_resp_set_type(req, "application/json"); @@ -211,7 +212,7 @@ static esp_err_t whoami_handler(httpd_req_t *req) if (get_client_ip(req, &client_ip) == ESP_OK) { char mac[18] = {0}; esp_ip4_addr_t ip = { .addr = client_ip }; - if (firewall_get_mac_for_ip(client_ip, mac, sizeof(mac)) == ESP_OK) { + if (tollgate_core_fw_get_mac_for_ip(client_ip, mac, sizeof(mac)) == ESP_OK) { snprintf(resp, sizeof(resp), "ip=" IPSTR " mac=%s", IP2STR(&ip), mac); } else { snprintf(resp, sizeof(resp), "ip=" IPSTR " mac=unknown", IP2STR(&ip)); @@ -233,7 +234,7 @@ static esp_err_t usage_handler(httpd_req_t *req) return ESP_OK; } - session_t *session = session_find_by_ip(client_ip); + tg_session_t *session = tollgate_core_session_find_by_ip(client_ip); if (!session || !session->active) { httpd_resp_set_type(req, "text/plain"); httpd_resp_send(req, "-1/-1", 5); @@ -261,8 +262,8 @@ static esp_err_t usage_handler(httpd_req_t *req) static esp_err_t reset_auth_handler(httpd_req_t *req) { - session_revoke_all(); - firewall_revoke_all(); + tollgate_core_session_revoke_all(); + tollgate_core_fw_revoke_all(); const char *resp = "{\"status\":\"reset\"}"; httpd_resp_set_type(req, "application/json"); httpd_resp_send(req, resp, strlen(resp)); diff --git a/main/config.h b/main/config.h index fa4d95c..b8a3136 100644 --- a/main/config.h +++ b/main/config.h @@ -4,6 +4,7 @@ #include "esp_err.h" #include "esp_wifi.h" #include "esp_netif.h" +#include "tollgate_platform.h" #include #include "lightning_payout.h" @@ -72,4 +73,6 @@ const tollgate_config_t *tollgate_config_get(void); esp_err_t tollgate_config_get_wifi(wifi_config_t *wifi_config); esp_err_t tollgate_config_get_next_wifi(wifi_config_t *wifi_config); +const tollgate_platform_t *tollgate_get_platform(void); + #endif diff --git a/main/tollgate_main.c b/main/tollgate_main.c index 697dae3..f8998bd 100644 --- a/main/tollgate_main.c +++ b/main/tollgate_main.c @@ -20,8 +20,6 @@ #include "wifistr.h" #include "tollgate_client.h" #include "lightning_payout.h" -#include "cvm_server.h" -#include "display.h" #define MAX_STA_RETRY 5 static const char *TAG = "tollgate_main"; @@ -152,19 +150,9 @@ static void start_services(void) xTaskCreate(publish_wifistr_task, "wifistr_init", 16384, NULL, 3, NULL); - if (cfg->cvm_enabled) { - cvm_server_init(); - cvm_server_start(); - } - s_services_running = true; if (s_services_mutex) xSemaphoreGive(s_services_mutex); ESP_LOGI(TAG, "=== TollGate services started ==="); - - display_set_state(DISPLAY_READY); - char portal_url[128]; - snprintf(portal_url, sizeof(portal_url), "http://%s/", cfg->ap_ip_str); - display_update(cfg->ap_ssid, 0, 0, portal_url); } static void stop_services(void) @@ -178,7 +166,6 @@ static void stop_services(void) captive_portal_stop(); tollgate_api_stop(); tollgate_core_dns_stop(); - cvm_server_stop(); s_services_running = false; if (s_services_mutex) xSemaphoreGive(s_services_mutex); ESP_LOGI(TAG, "=== TollGate services stopped ==="); @@ -244,9 +231,6 @@ void app_main(void) { ESP_LOGI(TAG, "=== TollGate ESP32 Starting ==="); - display_init(); - display_set_state(DISPLAY_BOOT); - esp_err_t ret = nvs_flash_init(); if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { ESP_ERROR_CHECK(nvs_flash_erase()); diff --git a/main/tollgate_platform.c b/main/tollgate_platform.c index c992ea1..4083c4e 100644 --- a/main/tollgate_platform.c +++ b/main/tollgate_platform.c @@ -2,7 +2,6 @@ #include "tollgate_core.h" #include "config.h" #include "esp_log.h" -#include "esp_timer.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" -- cgit v1.2.3