Merge pull request #763 from paxexpress/master

Migrate OTA source bintray -> paxexpress
This commit is contained in:
Verkehrsrot 2021-03-20 22:43:41 +01:00 committed by GitHub
commit bae079a93f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 10 deletions

View File

@ -118,7 +118,7 @@ def publish_bintray(source, target, env):
firmware_path = str(source[0]) firmware_path = str(source[0])
firmware_name = basename(firmware_path) firmware_name = basename(firmware_path)
url = "/".join([ url = "/".join([
"https://api.bintray.com", "content", "https://pax.express", "content",
user, repository, package, version, firmware_name user, repository, package, version, firmware_name
]) ])

View File

@ -24,12 +24,9 @@
BintrayClient::BintrayClient(const String &user, const String &repository, const String &package) BintrayClient::BintrayClient(const String &user, const String &repository, const String &package)
: m_user(user), m_repo(repository), m_package(package), : m_user(user), m_repo(repository), m_package(package),
m_storage_host("dl.bintray.com"), m_storage_host("pax.express"),
m_api_host("api.bintray.com") m_api_host("pax.express")
{ {
m_certificates.emplace_back("cloudfront.net", CLOUDFRONT_API_ROOT_CA);
m_certificates.emplace_back("akamai.bintray.com", BINTRAY_AKAMAI_ROOT_CA);
m_certificates.emplace_back("bintray.com", BINTRAY_API_ROOT_CA);
} }
String BintrayClient::getUser() const String BintrayClient::getUser() const
@ -83,7 +80,7 @@ String BintrayClient::requestHTTPContent(const String &url) const
{ {
String payload; String payload;
HTTPClient http; HTTPClient http;
http.begin(url, getCertificate(url)); http.begin(url);
int httpCode = http.GET(); int httpCode = http.GET();
if (httpCode > 0) if (httpCode > 0)

View File

@ -150,9 +150,8 @@ int do_ota_update() {
WiFiClientSecure client; WiFiClientSecure client;
client.setCACert(bintray.getCertificate(currentHost));
client.setTimeout(RESPONSE_TIMEOUT_MS); client.setTimeout(RESPONSE_TIMEOUT_MS);
client.setInsecure();
if (!client.connect(currentHost.c_str(), port)) { if (!client.connect(currentHost.c_str(), port)) {
ESP_LOGI(TAG, "Cannot connect to %s", currentHost.c_str()); ESP_LOGI(TAG, "Cannot connect to %s", currentHost.c_str());
ota_display(3, " E", "connection lost"); ota_display(3, " E", "connection lost");
@ -162,7 +161,6 @@ int do_ota_update() {
while (redirect) { while (redirect) {
if (currentHost != prevHost) { if (currentHost != prevHost) {
client.stop(); client.stop();
client.setCACert(bintray.getCertificate(currentHost));
if (!client.connect(currentHost.c_str(), port)) { if (!client.connect(currentHost.c_str(), port)) {
ESP_LOGI(TAG, "Redirect detected, but cannot connect to %s", ESP_LOGI(TAG, "Redirect detected, but cannot connect to %s",
currentHost.c_str()); currentHost.c_str());