GithubDownloader.h 912 B

1234567891011121314151617181920212223242526272829
  1. #include <Arduino.h>
  2. #include <WiFiClientSecure.h>
  3. #ifndef _GITHUB_DOWNLOADER
  4. #define _GITHUB_DOWNLOADER
  5. #define GITHUB_DOWNLOADER_BUFFER_SIZE 100
  6. #define GITHUB_SSL_FINGERPRINT "21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58"
  7. #define GITHUB_RAW_DOMAIN "raw.githubusercontent.com"
  8. class GithubDownloader {
  9. public:
  10. Stream& streamFile(const String& path);
  11. Stream& streamFile(const String& username, const String& repo, const String& path);
  12. bool downloadFile(const String& path, Stream& dest);
  13. bool downloadFile(const String& username, const String& repo, const String& path, Stream& dest);
  14. bool downloadFile(const String& username, const String& repo, const String& path, const String& fsPath);
  15. uint8_t buffer[GITHUB_DOWNLOADER_BUFFER_SIZE];
  16. private:
  17. WiFiClientSecure client;
  18. String buildPath(const String& username, const String& repo, const String& path);
  19. };
  20. #endif