firmware: v4 — fix OTA repo privado
- Añadido token de autenticacion a todas las peticiones Gitea - version.txt y firmware.bin se solicitan con ?token=... - Sin token el repo privado devuelve 404 y el OTA no arrancaba Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,11 +7,12 @@
|
||||
// ================================================================
|
||||
// OTA CONFIG
|
||||
// ================================================================
|
||||
#define FW_VERSION 3
|
||||
#define FW_VERSION 4
|
||||
#define GITEA_HOST "https://git.nacho.myds.me"
|
||||
#define GITEA_OWNER "Natxo"
|
||||
#define GITEA_REPO "Arduino-Car"
|
||||
#define GITEA_BRANCH "main"
|
||||
#define GITEA_TOKEN "d3b0b32eb0311c9b4ef569f22c8392c373ff3f9f"
|
||||
// WiFi — mismas credenciales que usa el ESP32-CAM
|
||||
#define WIFI_SSID "Natxo"
|
||||
#define WIFI_PASS "Suprak1llm1ndS23S"
|
||||
@@ -60,10 +61,11 @@ static void checkOTA() {
|
||||
client.setInsecure(); // cert Let's Encrypt/autofirmado — OK para LAN privada
|
||||
HTTPClient http;
|
||||
|
||||
String base = String(GITEA_HOST) + "/" + GITEA_OWNER + "/" + GITEA_REPO
|
||||
+ "/raw/branch/" + GITEA_BRANCH + "/firmware/esp8266/";
|
||||
String base = String(GITEA_HOST) + "/" + GITEA_OWNER + "/" + GITEA_REPO
|
||||
+ "/raw/branch/" + GITEA_BRANCH + "/firmware/esp8266/";
|
||||
String token = "?token=" + String(GITEA_TOKEN);
|
||||
|
||||
http.begin(client, base + "version.txt");
|
||||
http.begin(client, base + "version.txt" + token);
|
||||
http.setTimeout(10000);
|
||||
int code = http.GET();
|
||||
String body;
|
||||
@@ -88,7 +90,7 @@ static void checkOTA() {
|
||||
updateClient.setInsecure();
|
||||
ESPhttpUpdate.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
|
||||
ESPhttpUpdate.rebootOnUpdate(true);
|
||||
ESPhttpUpdate.update(updateClient, base + "firmware.bin");
|
||||
ESPhttpUpdate.update(updateClient, base + "firmware.bin" + token);
|
||||
// Si llega aquí, el update falló — continúa arranque normal
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
// ================================================================
|
||||
// OTA CONFIG
|
||||
// ================================================================
|
||||
#define FW_VERSION 3
|
||||
#define FW_VERSION 4
|
||||
#define GITEA_HOST "https://git.nacho.myds.me"
|
||||
#define GITEA_OWNER "Natxo"
|
||||
#define GITEA_REPO "Arduino-Car"
|
||||
#define GITEA_BRANCH "main"
|
||||
#define GITEA_TOKEN "d3b0b32eb0311c9b4ef569f22c8392c373ff3f9f"
|
||||
// ================================================================
|
||||
|
||||
const char *ssid = "Natxo";
|
||||
@@ -29,10 +30,11 @@ static void checkOTA() {
|
||||
client.setInsecure(); // cert Let's Encrypt/autofirmado — OK para LAN privada
|
||||
HTTPClient http;
|
||||
|
||||
String base = String(GITEA_HOST) + "/" + GITEA_OWNER + "/" + GITEA_REPO
|
||||
+ "/raw/branch/" + GITEA_BRANCH + "/firmware/esp32cam/";
|
||||
String base = String(GITEA_HOST) + "/" + GITEA_OWNER + "/" + GITEA_REPO
|
||||
+ "/raw/branch/" + GITEA_BRANCH + "/firmware/esp32cam/";
|
||||
String token = "?token=" + String(GITEA_TOKEN);
|
||||
|
||||
http.begin(client, base + "version.txt");
|
||||
http.begin(client, base + "version.txt" + token);
|
||||
http.setTimeout(10000);
|
||||
int code = http.GET();
|
||||
String body;
|
||||
@@ -59,7 +61,7 @@ static void checkOTA() {
|
||||
updateClient.setInsecure();
|
||||
httpUpdate.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
|
||||
httpUpdate.rebootOnUpdate(true);
|
||||
httpUpdate.update(updateClient, base + "firmware.bin");
|
||||
httpUpdate.update(updateClient, base + "firmware.bin" + token);
|
||||
// Si llega aquí, el update falló — continúa arranque normal
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
3
|
||||
4
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
3
|
||||
4
|
||||
Reference in New Issue
Block a user