Fix bitcoin halving countdown and add EUR fetch price

This commit is contained in:
Djuri 2023-11-13 17:14:11 +01:00
parent 3f49b3ef4e
commit 6dfc15832b
9 changed files with 72 additions and 19 deletions

View file

@ -71,7 +71,7 @@
<div>
<p>Uptime: {{#if uptime.h }}{{ uptime.h }}h {{/if}}{{ uptime.m }}m {{ uptime.s }}s</p>
<p>
Price connection:
WS Price connection:
<span>
{{#if connectionStatus.price}}
&#9989;
@ -80,14 +80,15 @@
{{/if}}
</span>
-
Mempool.space connection:
WS Mempool.space connection:
<span>
{{#if connectionStatus.blocks}}
&#9989;
{{else}}
&#10060;
{{/if}}
</span>
</span><br>
<small>If you use "Fetch &euro; price" the WS Price connection will show &#10060; since it uses another data source.</small>
</p>
</div>
</div>
@ -262,7 +263,16 @@
<label class="form-check-label" for="mdnsEnabled">mDNS (restart required)</label>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="fetchEurPrice" name="fetchEurPrice" value="1">
<label class="form-check-label" for="fetchEurPrice">Fetch &euro; price (restart required)</label>
</div>
</div>
</div>
<div>
<script id="screens-template" type="text/x-handlebars-template">
<div class="row">
<div class="col-sm-6">

View file

@ -5,7 +5,7 @@ Handlebars.registerHelper('splitText', function (aString) {
var c = aString.split("/").map((el) => { return "<div class=\"flex-items\">" + el + "</div>"; }).join('');
return "<div class=\"splitText\">" + c + "</div>";
}
if (aString.length > 1) {
if (aString.length > 1 && !aString.startsWith("&")) {
return "<div class=\"mediumText\">" + aString + "</div>";
}
if (aString.length == 0 || aString === " ") {

View file

@ -23,6 +23,13 @@ let processStatusData = (jsonData) => {
var source = document.getElementById("entry-template").innerHTML;
var template = Handlebars.compile(source);
let index = jsonData.data.findIndex(d => d === '[');
if (index !== -1) {
jsonData.data[index] = '&euro;';
}
var context = {
timerRunning: jsonData.timerRunning,
memFreePercent: Math.round(jsonData.espFreeHeap / jsonData.espHeapSize * 100),
@ -46,7 +53,7 @@ if (!!window.EventSource) {
const connectEventSource = () => {
let source = new EventSource('/events');
source.addEventListener('open', (e) => {
source.addEventListener('open', (e) => {
console.log("Status EventSource Connected");
if (e.data) {
processStatusData(JSON.parse(e.data));
@ -128,6 +135,9 @@ fetch('/api/settings', {
if (jsonData.ledTestOnPower)
document.getElementById('ledTestOnPower').checked = true;
if (jsonData.fetchEurPrice)
document.getElementById('fetchEurPrice').checked = true;
// let nodeFields = ["rpcHost", "rpcPort", "rpcUser", "tzOffset"];
// for (let n of nodeFields) {