fix(githubsync): skip download if file already exists on device
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include <HalStorage.h>
|
#include <HalStorage.h>
|
||||||
#include <Logging.h>
|
#include <Logging.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
#include <WiFiClientSecure.h>
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -74,8 +75,11 @@ void saveLocalSha(const std::string& filename, const std::string& sha) {
|
|||||||
bool downloadFile(const std::string& downloadUrl, const std::string& pat,
|
bool downloadFile(const std::string& downloadUrl, const std::string& pat,
|
||||||
const std::string& destPath, const std::string& name,
|
const std::string& destPath, const std::string& name,
|
||||||
const std::string& sha) {
|
const std::string& sha) {
|
||||||
|
WiFiClientSecure client;
|
||||||
|
client.setInsecure();
|
||||||
|
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
http.begin(downloadUrl.c_str());
|
http.begin(client, downloadUrl.c_str());
|
||||||
http.setTimeout(30000);
|
http.setTimeout(30000);
|
||||||
http.addHeader("Authorization", ("token " + pat).c_str());
|
http.addHeader("Authorization", ("token " + pat).c_str());
|
||||||
http.addHeader("User-Agent", "CrossPoint-GitHubSync/1.0");
|
http.addHeader("User-Agent", "CrossPoint-GitHubSync/1.0");
|
||||||
|
|||||||
Reference in New Issue
Block a user