|
|
|
#ifndef _XD0OTA_H
|
|
|
|
#define _XD0OTA_H
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
#include <ESP8266HTTPClient.h>
|
|
|
|
#include <ESP8266httpUpdate.h>
|
|
|
|
|
|
|
|
//const int FW_VERSION = 13; // see main.h
|
|
|
|
|
|
|
|
class XD0OTA {
|
|
|
|
public:
|
|
|
|
XD0OTA();
|
|
|
|
void update(void);
|
|
|
|
int checkForUpdates();
|
|
|
|
private:
|
|
|
|
const char* fwUrlBase = "https://fwupdate.xd0.de:444/fota/";
|
|
|
|
const char* httpsFingerprint = "37 42 61 B9 E6 EE 22 36 D1 59 67 7D 55 53 6E A4 C7 AA 60 26";
|
|
|
|
String getMAC();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _XD0OTA_H */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
MAKE SURE TO RESET THE ESP8266 ONCE AFTER NORMAL FLASHING! OTHERWISE OTA WON'T WORK!
|
|
|
|
|
|
|
|
|
|
|
|
openssl req -x509 -nodes -days 18263 -newkey rsa:2048 -keyout /etc/ssl/private/xd0-fwupdate-selfsigned.key -out /etc/ssl/certs/xd0-fwupdate-selfsigned.crt
|
|
|
|
|
|
|
|
openssl x509 -noout -fingerprint -sha1 -inform pem -in /etc/ssl/certs/xd0-fwupdate-selfsigned.crt
|
|
|
|
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 444 ssl;
|
|
|
|
listen [::]:444 ssl;
|
|
|
|
server_name fwupdate.xd0.de;
|
|
|
|
|
|
|
|
# SSL configuration
|
|
|
|
ssl_certificate /etc/ssl/certs/xd0-fwupdate-selfsigned.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/private/xd0-fwupdate-selfsigned.key;
|
|
|
|
ssl_buffer_size 4k;
|
|
|
|
|
|
|
|
root /var/www/fwupdate;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
# First attempt to serve request as file, then
|
|
|
|
# as directory, then fall back to displaying a 404.
|
|
|
|
try_files $uri $uri/ =404;
|
|
|
|
}
|
|
|
|
|
|
|
|
access_log /var/log/nginx/fwupdate_access.log;
|
|
|
|
error_log /var/log/nginx/fwupdate_error.log;
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|