Skip to content

Commit

Permalink
Merge pull request #76 from omersiar/dev
Browse files Browse the repository at this point in the history
Merge changes
  • Loading branch information
omersiar committed Mar 9, 2018
2 parents 2768abd + ec1e744 commit 3ff96cb
Show file tree
Hide file tree
Showing 10 changed files with 331 additions and 269 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
# Change Log
All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.5.4] - 2018-03-09
#### Added
- [webui] colorize event logs based on severity.
- [webui] progress bar on saving settings.
- [dev tools] event log for websocket emulator

#### Fixed
- [firmware] Fix #75 Scan of wifi returns more columns of the same wifi.
- [webui] Fix #74 #33 completely New user with incorrect validity.
- [webui] New user with incorrect date.
- [webui] Editing user results non parsed values.

#### Changed
- [webui] event table breakpoints.

## [0.5.3] - 2018-03-08
#### Added
- [webui] Firmware Update is now live with latest version check on GitHub.

#### Fixed
- [firmware] Update was possible with an unauthorized HTTP Post.

## [0.5hotfix2] - 2018-03-07
#### Added
- [webui] Factory reset within Web UI.
Expand Down
Binary file modified bin/firmware.bin
Binary file not shown.
5 changes: 2 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ void printScanResult(int networksFound) {
JsonObject& root = jsonBuffer78.createObject();
root["command"] = "ssidlist";
JsonArray& scan = root.createNestedArray("list");
for (int i = 0; i < 5; ++i) {
for (int i = 0; i < 5 && i < networksFound ; ++i) {
JsonObject& item = scan.createNestedObject();
// Print SSID for each network found
item["ssid"] = WiFi.SSID(indices[i]);
Expand Down Expand Up @@ -1116,12 +1116,11 @@ void setupWebServer() {
void setup() {
// Populate the last modification date based on build datetime
sprintf(last_modified, "%s %s GMT", __DATE__, __TIME__);
pinMode(FRESETPIN, INPUT_PULLUP);
delay(2000);
Serial.begin(115200);
Serial.println();
Serial.println(F("[ INFO ] ESP RFID v0.5"));

pinMode(FRESETPIN, INPUT_PULLUP);
// Start SPIFFS filesystem
if (!SPIFFS.begin() || digitalRead(FRESETPIN) == LOW) {
#ifdef DEBUG
Expand Down
14 changes: 7 additions & 7 deletions src/webh/esprfid.htm.gz.h

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/webh/esprfid.js.gz.h

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/webh/index.html.gz.h

Large diffs are not rendered by default.

30 changes: 14 additions & 16 deletions src/websrc/esprfid.htm
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,23 @@ <h4 class="modal-title">Please wait while restoring user data...</h4>
<br>
<br>
<div class="container">
<div class="row">
<div class="row">
<br>
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Please wait while your ESP restarts...</h3>
</div>
<div class="panel-body">
<div class="progress">
<div id="updateprog" class="progress-bar progress-bar-striped active" role="progressbar"
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
0%
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Please wait while your ESP restarts...</h3>
</div>
<div class="panel-body">
<div class="progress">
<div id="updateprog" class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">0%
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="generalcontent">
<br>
Expand Down
2 changes: 1 addition & 1 deletion src/websrc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ <h4 class="modal-title">Please review changes</h4>
<h4 class="modal-title">Are you absolutely sure?</h4>
</div>
<div class="alert alert-warning">
<h4><strong>Warning!</strong> Unexpected bad things will happen if you don’t read this!</h4>
<h5><strong>Warning!</strong> Unexpected bad things will happen if you don’t read this!</h5>
</div>
<div class="modal-body">
<h5>
Expand Down
75 changes: 44 additions & 31 deletions src/websrc/js/esprfid.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var config = {
"hostnm": "esp-rfid",
"restart": "0",
"pswd": "admin",
"version": "v0.5.3"
"version": "v0.5.4"
},
"mqtt": {
"enabled": "0",
Expand All @@ -53,6 +53,7 @@ var slot = 0;
var completed = false;
var file = {};
var backupstarted = false;
var restorestarted = false;



Expand Down Expand Up @@ -187,7 +188,7 @@ function revcommit() {

function commit() {
websock.send(JSON.stringify(config));
location.reload();
inProgress();
}

function uncommited() {
Expand Down Expand Up @@ -447,6 +448,7 @@ function restore1by1(i, len, data) {
document.getElementById("dynamic").className = "progress-bar progress-bar-success";
document.getElementById("dynamic").innerHTML = "Completed";
document.getElementById("dynamic").style.width = "100%";
restorestarted = false;
completed = true;
document.getElementById("restoreclose").style.display = "block";
}
Expand All @@ -472,6 +474,7 @@ function restoreUser() {
if (x) {
recordstorestore = json.list.length;
data = json.list;
restorestarted = true;
$("#restoremodal").modal({ backdrop: "static", keyboard: false });
restore1by1(slot, recordstorestore, data);
}
Expand All @@ -486,7 +489,25 @@ function initEventTable() {
var newlist = [];
for (var i = 0; i < data.length; i++) {
var dup = JSON.parse(data[i]);
newlist[i] = dup;
newlist[i] = {};
newlist[i].options = {};
newlist[i].value = {};
newlist[i].value = dup;
var c = dup.type;
switch (c) {
case "WARN":
newlist[i].options.classes = "warning";
break;
case "INFO":
newlist[i].options.classes = "info";
break;
case "ERRO":
newlist[i].options.classes = "danger";
break;
default:
break;
}

}
$("#dismiss").click();
jQuery(function($) {
Expand All @@ -502,8 +523,7 @@ function initEventTable() {
},
{
"name": "desc",
"title": "Description",
"breakpoints": "xs sm"
"title": "Description"
},
{
"name": "data",
Expand All @@ -524,7 +544,8 @@ function initEventTable() {
return formatted;
},
"sorted": true,
"direction": "DESC"
"direction": "DESC",
"breakpoints": "xs sm"
}
],
rows: newlist
Expand Down Expand Up @@ -566,11 +587,11 @@ function initLogTable() {
"title": "Access",
"breakpoints": "xs sm",
"parser": function(value) {
if (value == 1) {
if (value === 1) {
return "Granted";
} else if (value == 99) {
return "GrantedAdmin";
} else if (value == 0) {
} else if (value === 99) {
return "Admin";
} else if (value === 0) {
return "Disabled";
} else {
return "Unknown";
Expand Down Expand Up @@ -615,9 +636,10 @@ function initUserTable() {
return "Active";
} else if (value === 99) {
return "Admin";
} else {
} else if (value === 0) {
return "Disabled";
}
return value;
},
},
{
Expand Down Expand Up @@ -682,11 +704,13 @@ function initUserTable() {
values = {
uid: $editor.find("#uid").val(),
username: $editor.find("#username").val(),
acctype: acctypeparser(),
validuntil: $editor.find("#validuntil").val()
acctype: parseInt($editor.find("#acctype").val()),
validuntil: (new Date($editor.find("#validuntil").val()).getTime() / 1000)
};
if (row instanceof FooTable.Row) {
row.val(values);
row.delete();
values.id = uid++;
ft.rows.add(values);
} else {
values.id = uid++;
ft.rows.add(values);
Expand All @@ -695,9 +719,9 @@ function initUserTable() {
datatosend.command = "userfile";
datatosend.uid = $editor.find("#uid").val();
datatosend.user = $editor.find("#username").val();
datatosend.acctype = $editor.find("#acctype").val();
datatosend.acctype = parseInt($editor.find("#acctype").val());
var validuntil = $editor.find("#validuntil").val();
var vuepoch = (new Date(validuntil).getTime() / 1000) + (timezone * 60 * 60);
var vuepoch = (new Date(validuntil).getTime() / 1000);
datatosend.validuntil = vuepoch;
websock.send(JSON.stringify(datatosend));
$modal.modal("hide");
Expand All @@ -717,17 +741,6 @@ function acctypefinder() {
}
}

function acctypeparser() {
var $editor = $("#editor");
if ($editor.find("#acctype option:selected").val() === 1) {
return "Active";
} else if ($editor.find("#acctype option:selected").val() === 99) {
return "Admin";
} else {
return "Disabled";
}
}




Expand Down Expand Up @@ -820,7 +833,6 @@ function socketMessageListener(evt) {
config = obj;
break;
default:
console.log("[ WARN ] Unknown command " + JSON.stringify(obj));
break;
}
}
Expand Down Expand Up @@ -864,14 +876,15 @@ function socketMessageListener(evt) {
}
break;
case "userfile":
if (!completed && obj.result === true) {
restore1by1(slot, recordstorestore, data);
if (restorestarted) {
if (!completed && obj.result === true) {
restore1by1(slot, recordstorestore, data);
}
}
break;


default:
console.log("[ WARN ] Unknown type " + JSON.stringify(obj));
break;
}
}
Expand Down

0 comments on commit 3ff96cb

Please sign in to comment.