diff --git a/data/src/index.html b/data/src/index.html index 17bf54a..b010f67 100644 --- a/data/src/index.html +++ b/data/src/index.html @@ -62,6 +62,7 @@
@@ -186,7 +187,7 @@

Screens

- + diff --git a/data/src/js/script.ts b/data/src/js/script.ts index 4467aa3..2d9ec73 100644 --- a/data/src/js/script.ts +++ b/data/src/js/script.ts @@ -80,11 +80,17 @@ settingsForm.onsubmit = (event) => { method: "post" }).then(() => { console.log('Submitted'); + document.getElementById('saveSettingsBtn')?.classList.add('btn-success'); }); return false; } +document.getElementById('restartBtn').onclick = (event) => { + fetch('/api/restart'); + return false; +} + var ledsForm = document.querySelector('#ledsForm'); ledsForm.onsubmit = (event) => { diff --git a/src/tasks/blocknotify.cpp b/src/tasks/blocknotify.cpp index 28daf0b..ea1ea6c 100644 --- a/src/tasks/blocknotify.cpp +++ b/src/tasks/blocknotify.cpp @@ -35,6 +35,8 @@ void checkBitcoinBlock(void *pvParameters) http.begin(preferences.getString("rpcHost", BITCOIND_HOST).c_str(), preferences.getUInt("rpcPort", BITCOIND_PORT)); http.addHeader("Content-Type", "application/json"); + http.addHeader("User-Agent", "BTClock/1.0"); + String payload = "{\"jsonrpc\":\"1.0\",\"id\":\"current_block_height\",\"method\":\"getblockcount\",\"params\":[]}"; String auth = preferences.getString("rpcUser", BITCOIND_RPC_USER) + ":" + preferences.getString("rpcPass", BITCOIND_RPC_PASS); String authEncoded = base64::encode(auth); @@ -57,6 +59,7 @@ void checkBitcoinBlock(void *pvParameters) else { http.begin("https://mempool.bitcoin.nl/api/blocks/tip/height"); + http.addHeader("User-Agent", "BTClock/1.0"); int httpCode = http.GET(); if (httpCode > 0 && httpCode == HTTP_CODE_OK) diff --git a/src/tasks/get_price.cpp b/src/tasks/get_price.cpp index a8845a3..ce4efcf 100644 --- a/src/tasks/get_price.cpp +++ b/src/tasks/get_price.cpp @@ -18,6 +18,8 @@ void taskGetPrice(void *pvParameters) { // Send HTTP request to CoinDesk API http.begin(apiUrl); + http.addHeader("User-Agent", "BTClock/1.0"); + int httpCode = http.GET(); // Parse JSON response and extract average price