only include crypto stuff if we need it

This commit is contained in:
Franzi 2021-12-05 14:39:59 +01:00
parent 777164f48b
commit 8d20b46a8c
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 11 additions and 7 deletions

View file

@ -17,6 +17,5 @@ upload_protocol = esptool
lib_deps = lib_deps =
bblanchon/ArduinoJson@^6.17.3 bblanchon/ArduinoJson@^6.17.3
fastled/FastLED@^3.4.0 fastled/FastLED@^3.4.0
rweather/Crypto@^0.2.0
agdl/Base64@^1.0.0 agdl/Base64@^1.0.0
links2004/WebSockets@^2.3.6 links2004/WebSockets@^2.3.6

View file

@ -1,9 +1,7 @@
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include <Hash.h>
#include <WebSocketsClient.h> #include <WebSocketsClient.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <FastLED.h> #include <FastLED.h>
#include <SHA256.h>
#include <Base64.h> #include <Base64.h>
// BEGIN CONFIGURATION // BEGIN CONFIGURATION
@ -17,17 +15,21 @@
#define OBS_HOST "" #define OBS_HOST ""
#define OBS_PORT 4444 #define OBS_PORT 4444
#define OBS_PASS "" //#define OBS_PASS ""
#define OBS_SOURCE "" #define OBS_SOURCE ""
// END CONFIGURATION // END CONFIGURATION
#define HASH_SIZE 32
CRGB leds[LED_COUNT]; CRGB leds[LED_COUNT];
WebSocketsClient webSocket; WebSocketsClient webSocket;
#ifdef OBS_PASS
#include <SHA256.h>
#define HASH_SIZE 32
SHA256 sha256; SHA256 sha256;
#endif
bool is_currently_live = false; bool is_currently_live = false;
bool is_currently_preview = false; bool is_currently_preview = false;
@ -86,6 +88,7 @@ void handleWebSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
break; break;
} }
#ifdef OBS_PASS
if (doc.containsKey("authRequired")) { if (doc.containsKey("authRequired")) {
Serial.println("[OBS] auth requested"); Serial.println("[OBS] auth requested");
@ -135,7 +138,9 @@ void handleWebSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
set_error(); set_error();
} }
break; break;
} else if (doc.containsKey("update-type")) { }
# endif
if (doc.containsKey("update-type")) {
bool my_source_in_current_event = false; bool my_source_in_current_event = false;
for (uint8_t i = 0; i < doc["sources"].size(); i++) { for (uint8_t i = 0; i < doc["sources"].size(); i++) {