Moved ota username into newsettings
This commit is contained in:
@ -42,7 +42,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DOTA_USERNAME="allfeatures"
|
||||
# -DFEATURE_DPAD_5WIRESW
|
||||
# -DPINS_DPAD_5WIRESW_OUT=4
|
||||
# -DPINS_DPAD_5WIRESW_IN1=5
|
||||
|
@ -42,7 +42,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DOTA_USERNAME="comred"
|
||||
# -DFEATURE_DPAD_5WIRESW
|
||||
# -DPINS_DPAD_5WIRESW_OUT=4
|
||||
# -DPINS_DPAD_5WIRESW_IN1=5
|
||||
|
@ -42,7 +42,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DOTA_USERNAME="feedc0de"
|
||||
-DFEATURE_DPAD_5WIRESW_2OUT
|
||||
-DPINS_DPAD_5WIRESW_OUT1=18
|
||||
-DPINS_DPAD_5WIRESW_OUT2=19
|
||||
|
@ -42,7 +42,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
# -DFEATURE_WEBSERVER
|
||||
# -DFEATURE_OTA
|
||||
# -DOTA_USERNAME="greyhash"
|
||||
-DFEATURE_DPAD_5WIRESW
|
||||
-DPINS_DPAD_5WIRESW_OUT=4
|
||||
-DPINS_DPAD_5WIRESW_IN1=5
|
||||
|
@ -42,7 +42,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
-DFEATURE_WEBSERVER
|
||||
# -DFEATURE_OTA
|
||||
-DOTA_USERNAME="mick"
|
||||
# -DFEATURE_DPAD_5WIRESW
|
||||
# -DPINS_DPAD_5WIRESW_OUT=4
|
||||
# -DPINS_DPAD_5WIRESW_IN1=5
|
||||
|
@ -42,7 +42,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
# -DFEATURE_WEBSERVER
|
||||
# -DFEATURE_OTA
|
||||
-DOTA_USERNAME="nofeatures"
|
||||
# -DFEATURE_DPAD_5WIRESW
|
||||
# -DPINS_DPAD_5WIRESW_OUT=4
|
||||
# -DPINS_DPAD_5WIRESW_IN1=5
|
||||
|
@ -42,7 +42,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
-DOTA_USERNAME="peter"
|
||||
-DFEATURE_DPAD_5WIRESW_2OUT
|
||||
-DPINS_DPAD_5WIRESW_OUT1=18
|
||||
-DPINS_DPAD_5WIRESW_OUT2=19
|
||||
|
@ -1,20 +1,20 @@
|
||||
#include "buildserver.h"
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <cpputils.h>
|
||||
#include <cleanuphelper.h>
|
||||
// esp-idf
|
||||
#include "esp_http_client.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <asynchttprequest.h>
|
||||
#include <delayedconstruction.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <cpputils.h>
|
||||
#include <cleanuphelper.h>
|
||||
#include "fmt/core.h"
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "esp_log.h"
|
||||
#include "fmt/core.h"
|
||||
|
||||
// esp-idf
|
||||
#include "esp_http_client.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
|
||||
@ -52,7 +52,7 @@ namespace buildserver {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto url = fmt::format("{}/otaDescriptor?username={}&branches", server_base_url, OTA_USERNAME);
|
||||
const auto url = fmt::format("{}/otaDescriptor?username={}&branches", server_base_url, configs.otaUsername.value);
|
||||
ESP_LOGD("BOBBY", "requesting data...");
|
||||
if (const auto result = request->start(url); !result)
|
||||
{
|
||||
@ -168,9 +168,9 @@ namespace buildserver {
|
||||
std::string get_descriptor_url(std::string base_url)
|
||||
{
|
||||
if (stringSettings.otaServerBranch.empty())
|
||||
return fmt::format("{}/otaDescriptor?username={}", base_url, OTA_USERNAME);
|
||||
return fmt::format("{}/otaDescriptor?username={}", base_url, configs.otaUsername.value);
|
||||
else
|
||||
return fmt::format("{}/otaDescriptor?username={}&branch={}", base_url, OTA_USERNAME, stringSettings.otaServerBranch);
|
||||
return fmt::format("{}/otaDescriptor?username={}&branch={}", base_url, configs.otaUsername.value, stringSettings.otaServerBranch);
|
||||
}
|
||||
|
||||
void parse_response_into_variables(std::string response)
|
||||
|
@ -48,7 +48,7 @@ void handle_dns_announce()
|
||||
{
|
||||
dns_lastIpAddress_v4 = curIpAddress;
|
||||
ip_addr_t tmpIpResolved;
|
||||
std::string toLookup = fmt::format("{}__{}.{}.announce.bobbycar.cloud", randDNSName, curIpAddress, OTA_USERNAME);
|
||||
std::string toLookup = fmt::format("{}__{}.{}.announce.bobbycar.cloud", randDNSName, curIpAddress, configs.otaUsername.value);
|
||||
ESP_LOGI("BOBBY", "Trying to look up %s", toLookup.c_str());
|
||||
if (const auto err = dns_gethostbyname(toLookup.c_str(), &tmpIpResolved, NULL, NULL); err != ERR_OK && err != ERR_INPROGRESS)
|
||||
{
|
||||
@ -74,7 +74,7 @@ void handle_dns_announce()
|
||||
{
|
||||
dns_lastIpAddress_v6 = curIpV6Address;
|
||||
ip_addr_t tmpIpResolved;
|
||||
std::string toLookup = fmt::format("{}__{}.{}.announce6.bobbycar.cloud", randDNSName, curIpV6Address, OTA_USERNAME);
|
||||
std::string toLookup = fmt::format("{}__{}.{}.announce6.bobbycar.cloud", randDNSName, curIpV6Address, configs.otaUsername.value);
|
||||
ESP_LOGI("BOBBY", "Trying to look up %s", toLookup.c_str());
|
||||
if (const auto err = dns_gethostbyname(toLookup.c_str(), &tmpIpResolved, NULL, NULL); err != ERR_OK && err != ERR_INPROGRESS)
|
||||
{
|
||||
@ -94,7 +94,7 @@ void handle_dns_announce()
|
||||
dns_lastIpAddress_v6_global = curIpV6Address;
|
||||
std::replace(curIpV6Address.begin(), curIpV6Address.end(), ':', '-');
|
||||
ip_addr_t tmpIpResolved;
|
||||
std::string toLookup = fmt::format("{}global__{}.{}.announce6.bobbycar.cloud", randDNSName, curIpV6Address, OTA_USERNAME);
|
||||
std::string toLookup = fmt::format("{}global__{}.{}.announce6.bobbycar.cloud", randDNSName, curIpV6Address, configs.otaUsername.value);
|
||||
ESP_LOGI("BOBBY", "Trying to look up %s", toLookup.c_str());
|
||||
if (const auto err = dns_gethostbyname(toLookup.c_str(), &tmpIpResolved, NULL, NULL); err != ERR_OK && err != ERR_INPROGRESS)
|
||||
{
|
||||
|
@ -1,9 +1,5 @@
|
||||
constexpr const char * const TAG = "BOBBY";
|
||||
|
||||
#ifndef OTA_USERNAME
|
||||
#error No OTA username!
|
||||
#endif
|
||||
|
||||
// system includes
|
||||
#include <cstdio>
|
||||
|
||||
|
@ -111,6 +111,7 @@ public:
|
||||
ConfigWrapper<std::string> cloudUrl {std::string{}, DoReset, StringOr<StringEmpty, StringValidUrl>, "cloudUrl" };
|
||||
ConfigWrapper<std::string> udpCloudHost {std::string{}, DoReset, {}, "udpCloudHost" };
|
||||
ConfigWrapper<std::string> otaUrl {std::string{}, DoReset, StringOr<StringEmpty, StringValidUrl>, "otaUrl" };
|
||||
ConfigWrapper<std::string> otaUsername {std::string{}, DoReset, {}, "otaUsername" };
|
||||
ConfigWrapper<bool> dns_announce_enabled{true, DoReset, {}, "dnsAnnounceEnab" };
|
||||
ConfigWrapper<std::string> dns_announce_key {std::string{}, DoReset, {}, "dnsAnnounceKey" };
|
||||
ConfigWrapper<std::string> webserverPassword {std::string{}, DoReset, {}, "websPassword" };
|
||||
@ -253,6 +254,7 @@ public:
|
||||
x(cloudUrl) \
|
||||
x(udpCloudHost) \
|
||||
x(otaUrl) \
|
||||
x(otaUsername) \
|
||||
x(dns_announce_enabled) \
|
||||
x(dns_announce_key) \
|
||||
// x(webserverPassword)
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
namespace qrimport {
|
||||
|
||||
@ -109,7 +110,7 @@ tl::expected<void, std::string> start_qr_request()
|
||||
return tl::make_unexpected("request im oarsch");
|
||||
}
|
||||
|
||||
if (const auto res = http_request->start(fmt::format("http://qr.bobbycar.cloud/{}.qr", OTA_USERNAME)); !res)
|
||||
if (const auto res = http_request->start(fmt::format("http://qr.bobbycar.cloud/{}.qr", configs.otaUsername.value)); !res)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user