battery-minus

Pebble activity tracker that records battery events
git clone https://git.instinctive.eu/battery-minus.git
Log | Files | Refs | README | LICENSE

commit 86df1cf0106fccda62c89c23c859bf63d31bf451
parent a30eed8db8ac78b8921c183a5a7950321dddec67
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date:   Sat, 14 May 2016 17:12:40 +0000

Add configuration fields for CSV data signature
Diffstat:
Mconfig.html | 75++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 72 insertions(+), 3 deletions(-)

diff --git a/config.html b/config.html @@ -51,9 +51,15 @@ function onSubmit() { // Set the return URL depending on the runtime environment var return_to = getQueryParam("return_to", "pebblejs://close#"); + var sign_enabled = document.getElementById("signEnable").checked; var options = { "url": document.getElementById("url").value, "dataField": document.getElementById("dataField").value, + "signAlgorithm": document.getElementById("signAlgorithm").value, + "signFieldFormat": document.getElementById("signFieldFormat").value, + "signFieldName": document.getElementById("signFieldName").value, + "signKey": document.getElementById("signKey").value, + "signKeyFormat": document.getElementById("signKeyFormat").value, "extraFields" : readAndEncodeList("extraFields").join(","), } @@ -63,6 +69,12 @@ document.location = return_to + encodeURIComponent(JSON.stringify(options)); } + + function updateSignVisibility() { + document.getElementById("signFields").style.display + = document.getElementById("signEnable").checked + ? "block" : "none"; + } </script> </head> <body> @@ -93,6 +105,58 @@ </div> <div class="item-container"> + <div class="item-container-header">Data Signature</div> + <div class="item-container-content"> + <label class="item"> + Enable + <input type="checkbox" class="item-toggle" name="signEnable" id="signEnable" onchange="updateSignVisibility();"> + </label> + <div id=signFields> + <label class="item"> + Algorithm + <select id="signAlgorithm" class="item-select"> + <option class="item-select-option">SHA-1</option> + <option class="item-select-option">SHA-224</option> + <option class="item-select-option">SHA-256</option> + <option class="item-select-option">SHA-384</option> + <option class="item-select-option">SHA-512</option> + </select> + </label> + <label class="item"> + Field Format + <select id="signFieldFormat" class="item-select"> + <option class="item-select-option" value="HEX">Hex</option> + <option class="item-select-option" value="B64">Base-64</option> + <option class="item-select-option" value="TEXT">Text</option> + <option class="item-select-option" value="BYTES">Bytes</option> + </select> + </label> + <label class="item"> + Signature Field Name + <div class="item-input-wrapper"> + <input type="text" class="item-input" name="signFieldName" id="signFieldName" value=""> + </div> + </label> + <label class="item"> + Private Key + <div class="item-input-wrapper"> + <input type="text" class="item-input" name="signKey" id="signKey"> + </div> + </label> + <label class="item"> + Private Key Format + <select id="signKeyFormat" class="item-select"> + <option class="item-select-option" value="HEX">Hex</option> + <option class="item-select-option" value="B64">Base-64</option> + <option class="item-select-option" value="TEXT">Text</option> + <option class="item-select-option" value="BYTES">Bytes</option> + </select> + </label> + </div> + </div> + </div> + + <div class="item-container"> <div class="item-container-header">Extra Form Fields</div> <div class="item-container-content"> <div class="item-dynamic-list" id="extraFields"> @@ -121,11 +185,16 @@ document.getElementsByTagName("h1")[0].childNodes[0].nodeValue = "Battery- " + versionTag; } - var initBundleSize = parseInt(getQueryParam("bundle_max", "1"), 10); - if (!(initBundleSize >= 1)) initBundleSize = 1; - document.getElementById("url").value = getQueryParam("url", ""); document.getElementById("dataField").value = getQueryParam("data_field", ""); + document.getElementById("signAlgorithm").value = getQueryParam("s_algo", "SHA-1"); + document.getElementById("signFieldFormat").value = getQueryParam("s_fieldf", "HEX"); + document.getElementById("signFieldName").value = getQueryParam("s_field", ""); + document.getElementById("signKey").value = getQueryParam("s_key", ""); + document.getElementById("signKeyFormat").value = getQueryParam("s_keyf", "HEX"); + document.getElementById("signEnable").checked = (getQueryParam("s_field", "") !== ""); + + updateSignVisibility(); var initExtraFields = ("," + getRawQueryParam("extra", "")).split(","); initExtraFields.shift();