upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-21 13:19:51 +0530
committerYour Name <you@example.com>2026-05-21 13:19:51 +0530
commit5592e194029aafe96d76a0948750b8b43ae74413 (patch)
tree4d1ad0fc23cf98f591becd8b33658fe6efd55e5a /main
parent716daafce3eaa5ebfd246c1ef9915a2972b4c6fd (diff)
cleanup: remove debug code, align mint URL to testnut-nutshell
- Remove DNS resolve test and unused includes from debug endpoint - Reduce mint_health probe logging to DEBUG level - Update default mint URL from testnut.cashu.space to testnut-nutshell.mints.orangesync.tech in config.c, tollgate_platform.c, .env, AGENTS.md
Diffstat (limited to 'main')
-rw-r--r--main/config.c4
-rw-r--r--main/mint_health.c7
-rw-r--r--main/tollgate_api.c16
-rw-r--r--main/tollgate_platform.c2
4 files changed, 4 insertions, 25 deletions
diff --git a/main/config.c b/main/config.c
index 9d0d54c..e3cbf46 100644
--- a/main/config.c
+++ b/main/config.c
@@ -71,8 +71,8 @@ esp_err_t tollgate_config_init(void)
71 "{\"ssid\":\"c03rad0r\",\"password\":\"c03rad0r123\"}" 71 "{\"ssid\":\"c03rad0r\",\"password\":\"c03rad0r123\"}"
72 "]," 72 "],"
73 "\"ap_password\":\"\"," 73 "\"ap_password\":\"\","
74 "\"mint_url\":\"https://testnut.cashu.space\"," 74 "\"mint_url\":\"https://testnut-nutshell.mints.orangesync.tech\","
75 "\"accepted_mints\":[\"https://testnut.cashu.space\"]," 75 "\"accepted_mints\":[\"https://testnut-nutshell.mints.orangesync.tech\"],"
76 "\"price_per_step\":21," 76 "\"price_per_step\":21,"
77 "\"step_size_ms\":60000," 77 "\"step_size_ms\":60000,"
78 "\"nostr_geohash\":\"u281w0dfz\"," 78 "\"nostr_geohash\":\"u281w0dfz\","
diff --git a/main/mint_health.c b/main/mint_health.c
index 26d73a6..a551295 100644
--- a/main/mint_health.c
+++ b/main/mint_health.c
@@ -7,7 +7,6 @@
7#include "freertos/semphr.h" 7#include "freertos/semphr.h"
8#include <string.h> 8#include <string.h>
9#include <stdlib.h> 9#include <stdlib.h>
10#include <errno.h>
11 10
12static const char *TAG = "mint_health"; 11static const char *TAG = "mint_health";
13 12
@@ -64,16 +63,13 @@ static bool probe_mint(const char *url)
64 }; 63 };
65 esp_http_client_handle_t client = esp_http_client_init(&config); 64 esp_http_client_handle_t client = esp_http_client_init(&config);
66 if (!client) { 65 if (!client) {
67 ESP_LOGE(TAG, "probe: init failed for %s", probe_url);
68 s_last_probe_err = -1; 66 s_last_probe_err = -1;
69 return false; 67 return false;
70 } 68 }
71 69
72 esp_err_t err = esp_http_client_open(client, 0); 70 esp_err_t err = esp_http_client_open(client, 0);
73 if (err != ESP_OK) { 71 if (err != ESP_OK) {
74 ESP_LOGE(TAG, "probe: open failed for %s err=0x%x", probe_url, err); 72 ESP_LOGD(TAG, "probe open failed: %s err=0x%x", probe_url, err);
75 int sc = esp_http_client_get_status_code(client);
76 ESP_LOGE(TAG, "probe: status=%d errno=%d(%s)", sc, errno, strerror(errno));
77 s_last_probe_err = err; 73 s_last_probe_err = err;
78 esp_http_client_cleanup(client); 74 esp_http_client_cleanup(client);
79 return false; 75 return false;
@@ -81,7 +77,6 @@ static bool probe_mint(const char *url)
81 77
82 int content_length = esp_http_client_fetch_headers(client); 78 int content_length = esp_http_client_fetch_headers(client);
83 int status = esp_http_client_get_status_code(client); 79 int status = esp_http_client_get_status_code(client);
84 ESP_LOGI(TAG, "probe: %s -> status=%d len=%d", probe_url, status, content_length);
85 s_last_probe_err = 0; 80 s_last_probe_err = 0;
86 81
87 char *resp = NULL; 82 char *resp = NULL;
diff --git a/main/tollgate_api.c b/main/tollgate_api.c
index 5ac0543..80fe6ed 100644
--- a/main/tollgate_api.c
+++ b/main/tollgate_api.c
@@ -6,9 +6,6 @@
6#include "captive_portal.h" 6#include "captive_portal.h"
7#include "firewall.h" 7#include "firewall.h"
8#include "lwip/dns.h" 8#include "lwip/dns.h"
9#include "lwip/netdb.h"
10#include "esp_http_client.h"
11#include "esp_crt_bundle.h"
12#include "esp_heap_caps.h" 9#include "esp_heap_caps.h"
13#include "nucula_wallet.h" 10#include "nucula_wallet.h"
14#include "mint_health.h" 11#include "mint_health.h"
@@ -734,19 +731,6 @@ static esp_err_t api_get_debug(httpd_req_t *req)
734 cJSON_AddStringToObject(root, "sta_ip", sta_ip_str); 731 cJSON_AddStringToObject(root, "sta_ip", sta_ip_str);
735 cJSON_AddStringToObject(root, "sta_gw", sta_gw_str); 732 cJSON_AddStringToObject(root, "sta_gw", sta_gw_str);
736 733
737 struct addrinfo hints = {0}, *res = NULL;
738 hints.ai_family = AF_INET;
739 int dns_rc = getaddrinfo("testnut-compat.mints.orangesync.tech", NULL, &hints, &res);
740 if (dns_rc == 0 && res) {
741 struct sockaddr_in *addr = (struct sockaddr_in *)res->ai_addr;
742 char resolved[16];
743 snprintf(resolved, sizeof(resolved), IPSTR, IP2STR(&(esp_ip4_addr_t){.addr=addr->sin_addr.s_addr}));
744 cJSON_AddStringToObject(root, "dns_resolve", resolved);
745 } else {
746 cJSON_AddStringToObject(root, "dns_resolve", dns_rc == 0 ? "no-addr" : "FAIL");
747 }
748 if (res) freeaddrinfo(res);
749
750 char *json = cJSON_PrintUnformatted(root); 734 char *json = cJSON_PrintUnformatted(root);
751 httpd_resp_set_type(req, "application/json"); 735 httpd_resp_set_type(req, "application/json");
752 httpd_resp_sendstr(req, json); 736 httpd_resp_sendstr(req, json);
diff --git a/main/tollgate_platform.c b/main/tollgate_platform.c
index 4083c4e..fe8ac2d 100644
--- a/main/tollgate_platform.c
+++ b/main/tollgate_platform.c
@@ -22,7 +22,7 @@ static int32_t platform_get_step_ms(void)
22static const char *platform_get_mint_url(void) 22static const char *platform_get_mint_url(void)
23{ 23{
24 const tollgate_config_t *cfg = tollgate_config_get(); 24 const tollgate_config_t *cfg = tollgate_config_get();
25 return cfg ? cfg->mint_url : "https://testnut.cashu.space"; 25 return cfg ? cfg->mint_url : "https://testnut-nutshell.mints.orangesync.tech";
26} 26}
27 27
28static const char *platform_get_metric(void) 28static const char *platform_get_metric(void)