mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-31 04:19:15 +03:00
first working version
This commit is contained in:
2
data/.exclude.files
Normal file
2
data/.exclude.files
Normal file
@@ -0,0 +1,2 @@
|
||||
/*.js.gz
|
||||
/.exclude.files
|
||||
BIN
data/ace.js.gz
Normal file
BIN
data/ace.js.gz
Normal file
Binary file not shown.
144
data/config.all.json
Normal file
144
data/config.all.json
Normal file
@@ -0,0 +1,144 @@
|
||||
{
|
||||
"configs": [
|
||||
|
||||
"/config.live.json",
|
||||
"/config.setup.json",
|
||||
"/config.option.json"
|
||||
],
|
||||
"class":"col-sm-offset-1 col-sm-10",
|
||||
"content": [
|
||||
{
|
||||
"type": "h5",
|
||||
"title": "{{SSDP}}",
|
||||
"class":"alert-warning"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Device ID: {{chipID}}"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "IP address: {{ip}}"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "h2",
|
||||
"title": "Конфигурация устройства"
|
||||
},
|
||||
{
|
||||
"type":"file",
|
||||
"state":"config.all.txt",
|
||||
"style":"width:100%;height:400px",
|
||||
"title": "Сохранить",
|
||||
"action": "/all_modules_init",
|
||||
"class":"btn btn-block btn-success"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Инструкция",
|
||||
"action": "https://github.com/DmitryBorisenko33/esp8266_iot-manager_modules_firmware/wiki/Instruction",
|
||||
"class": "btn btn-block btn-primary"
|
||||
},
|
||||
{
|
||||
"type": "h2",
|
||||
"title": "Сценарии"
|
||||
},
|
||||
{
|
||||
"type": "checkbox",
|
||||
"name":"scenario",
|
||||
"title": "Включить сценарии",
|
||||
"action": "/scenario?status=[[scenario]]",
|
||||
"state": "{{scenario}}"
|
||||
},
|
||||
{
|
||||
"type": "h6",
|
||||
"title": ""
|
||||
},
|
||||
{
|
||||
"type":"file",
|
||||
"state":"scenario.all.txt",
|
||||
"style":"width:100%;height:400px",
|
||||
"title": "Сохранить и включить",
|
||||
"action": "/scenario?status=1",
|
||||
"class":"btn btn-block btn-success"
|
||||
},
|
||||
{
|
||||
"type": "h2",
|
||||
"title": "Данные модулей"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Модуль уровня воды (level)",
|
||||
"style": "width:100%"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "h6",
|
||||
"title": "Расстояние от датчика до воды: {{level_in}} см"
|
||||
},
|
||||
{
|
||||
"type": "h6",
|
||||
"title": " Заполнение бака: {{level}} %"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Модуль аналогового входа (analog)",
|
||||
"style": "width:100%"
|
||||
},
|
||||
{
|
||||
"type": "h6",
|
||||
"title": "Прочитанное значение: {{analog_in}}"
|
||||
},
|
||||
{
|
||||
"type": "h6",
|
||||
"title": "Преобразованное значение: {{analog}}"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Модуль температурного датчика (dallas)",
|
||||
"style": "width:100%"
|
||||
},
|
||||
{
|
||||
"type": "h6",
|
||||
"title": "Текущее значение: {{dallas}} °C"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Модуль pH сенсора от df robot (ph)",
|
||||
"style": "width:100%"
|
||||
},
|
||||
{
|
||||
"type": "h6",
|
||||
"title": "Текущее значение: {{ph}}"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Очистить все логи",
|
||||
"action": "/cleanlog",
|
||||
"class": "btn btn-block btn-success"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Главная",
|
||||
"action": "/page.htm?index",
|
||||
"class": "btn btn-block btn-danger btn-sm"
|
||||
}
|
||||
]
|
||||
}
|
||||
19
data/config.all.txt
Normal file
19
data/config.all.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
button 1 na Включить#все Освещение 0 1
|
||||
button 2 13 Прихожая Освещение 0 2
|
||||
button 3 14 Кухня Освещение 0 3
|
||||
pwm 1 3 Яркость#коредор: Освещение 1023 4
|
||||
pwm 2 4 Яркость#ванная: Освещение 510 5
|
||||
analog Аналоговый#вход,#% Датчики text 1 1024 1 1024 6
|
||||
logging analog 1 144 график Датчики 7
|
||||
input value1 20.0 5 порог.#значение Датчики 8
|
||||
button 4 na Вкл#по#analog>20 Датчики 0 11
|
||||
//dallas 2 Водонагреватель,#t°C Датчики termometr 14
|
||||
//level Вода#в#баке,#% Датчики gauge 125 20 15
|
||||
//ph pH Датчики text 0 16
|
||||
input value2 8.0 1 период#сек Таймер 117
|
||||
button 5 na Вкл#обратный#таймер Таймер 0 20
|
||||
button 6 5 Включится#по#таймеру Таймер 0 21
|
||||
switch 1 0 20
|
||||
text 1 Квартира Двери 22
|
||||
button 7 scenario Сценарии Настройки 1 23
|
||||
button 8 line1,line2, 2строки#сценариев Освещение 1 24
|
||||
1
data/config.json
Normal file
1
data/config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"SSDP":"MODULES","chipID":"12884479-1458415","ssidAP":"WiFi","passwordAP":"","ssid":"MGTS_GPON_DC15","password":"HKC4MRE4","timezone":3,"mqttServer":"91.204.228.124","mqttPort":1883,"mqttUser":"rise","mqttPass":"23ri22se32","scenario":"1","timers":"0","pushingbox_id":"v670C4F8A2581A11"}
|
||||
BIN
data/css/build.css.gz
Normal file
BIN
data/css/build.css.gz
Normal file
Binary file not shown.
572
data/edit.htm
Normal file
572
data/edit.htm
Normal file
@@ -0,0 +1,572 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ESP Editor</title>
|
||||
<style type="text/css" media="screen">
|
||||
.contextMenu{z-index:300;position:absolute;left:5px;border:1px solid #444;background-color:#f5f5f5;display:none;box-shadow:0 0 10px rgba(0,0,0,.4);font-size:12px;font-family:sans-serif;font-weight:bold}
|
||||
.contextMenu ul{list-style:none;top:0;left:0;margin:0;padding:0}
|
||||
.contextMenu li{position:relative;min-width:60px;cursor:pointer}
|
||||
.contextMenu span{color:#444;display:inline-block;padding:6px}
|
||||
.contextMenu li:hover{background:#444}
|
||||
.contextMenu li:hover span{color:#EEE}
|
||||
.css-treeview ul,.css-treeview li{padding:0;margin:0;list-style:none}
|
||||
.css-treeview input{position:absolute;opacity:0}
|
||||
.css-treeview{font:normal 11px Verdana,Arial,Sans-serif;-moz-user-select:none;-webkit-user-select:none;user-select:none}
|
||||
.css-treeview span{color:#00f;cursor:pointer}
|
||||
.css-treeview span:hover{text-decoration:underline}
|
||||
.css-treeview input+label+ul{margin:0 0 0 22px}
|
||||
.css-treeview input ~ ul{display:none}
|
||||
.css-treeview label,.css-treeview label::before{cursor:pointer}
|
||||
.css-treeview input:disabled+label{cursor:default;opacity:.6}
|
||||
.css-treeview input:checked:not(:disabled) ~ ul{display:block}
|
||||
.css-treeview label,.css-treeview label::before{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAACgCAYAAAAFOewUAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAApxJREFUeNrslM1u00AQgGdthyalFFOK+ClIIKQKyqUVQvTEE3DmAhLwAhU8QZoH4A2Q2gMSFace4MCtJ8SPBFwAkRuiHKpA6sRN/Lu7zG5i14kctaUqRGhGXnu9O/Pt7MzsMiklvF+9t2kWTDvyIrAsA0aKRRi1T0C/hJ4LUbt5/8rNpWVlp8RSr9J40b48fxFaTQ9+ft8EZ6MJYb0Ok+dnYGpmPgXwKIAvLx8vYXc5GdMAQJgQEkpjRTh36TS2U+DWW/D17WuYgm8pwJyY1npZsZKOxImOV1I/h4+O6vEg5GCZBpgmA6hX8wHKUHDRBXQYicQ4rlc3Tf0VMs8DHBS864F2YFspjgUYjKX/Az3gsdQd2eeBHwmdGWXHcgBGSkZXOXohcEXebRoQcAgjqediNY+AVyu3Z3sAKqfKoGMsewBeEIOPgQxxPJIjcGH6qtL/0AdADzKGnuuD+2tLK7Q8DhHHbOBW+KEzcHLuYc82MkEUekLiwuvVH+guQBQzOG4XdAb8EOcRcqQvDkY2iCLuxECJ43JobMXoutqGgDa2T7UqLKwt9KRyuxKVByqVXXqIoCCUCAqhUOioTWC7G4TQEOD0APy2/7G2Xpu1J4+lxeQ4TXBbITDpoVelRN/BVFbwu5oMMJUBhoXy5tmdRcMwymP2OLQaLjx9/vnBo6V3K6izATmSnMa0Dq7ferIohJhr1p01zrlz49rZF4OMs8JkX23vVQzYp+wbYGV/KpXKjvspl8tsIKCrMNAYFxj2GKS5ZWxg4ewKsJfaGMIY5KXqPz8LBBj6+yDvVP79+yDp/9F9oIx3OisHWwe7Oal0HxCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgwD8E/BZgAP0qhKj3rXO7AAAAAElFTkSuQmCC") no-repeat}
|
||||
.css-treeview label,.css-treeview span,.css-treeview label::before{display:inline-block;height:16px;line-height:16px;vertical-align:middle}
|
||||
.css-treeview label{background-position:18px 0}
|
||||
.css-treeview label::before{content:"";width:16px;margin:0 22px 0 0;vertical-align:middle;background-position:0 -32px}
|
||||
.css-treeview input:checked+label::before{background-position:0 -16px}
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0){.css-treeview{-webkit-animation:webkit-adjacent-element-selector-bugfix infinite 1s}@-webkit-keyframes webkit-adjacent-element-selector-bugfix{from{padding:0}to{padding:0}}}
|
||||
#uploader{position:absolute;top:0;right:0;left:0;height:28px;line-height:24px;padding-left:10px;background-color:#444;color:#EEE}#tree{position:absolute;top:28px;bottom:0;left:0;width:200px;padding:8px}
|
||||
#editor,#preview{position:absolute;top:28px;right:0;bottom:0;left:200px}
|
||||
#preview{background-color:#EEE;padding:5px}
|
||||
</style>
|
||||
<script>
|
||||
|
||||
var urlXXX = 'http://192.168.211.181';//bolt
|
||||
if (window.location.search.substring(1).split("=")[1]) {
|
||||
urlXXX = 'http://'+window.location.search.substring(1).split("=")[1];
|
||||
} else {
|
||||
urlXXX = 'http://'+window.location.hostname;
|
||||
}
|
||||
|
||||
function createFileUploader(element, tree, editor){
|
||||
var xmlHttp;
|
||||
var input = document.createElement("input");
|
||||
input.type = "file";
|
||||
input.multiple = false;
|
||||
input.name = "data";
|
||||
document.getElementById(element).appendChild(input);
|
||||
var path = document.createElement("input");
|
||||
path.id = "upload-path";
|
||||
path.type = "text";
|
||||
path.name = "path";
|
||||
path.defaultValue = "/";
|
||||
document.getElementById(element).appendChild(path);
|
||||
var button = document.createElement("button");
|
||||
button.innerHTML = 'Upload';
|
||||
document.getElementById(element).appendChild(button);
|
||||
var mkdir = document.createElement("button");
|
||||
mkdir.innerHTML = 'MkDir';
|
||||
document.getElementById(element).appendChild(mkdir);
|
||||
var mkfile = document.createElement("button");
|
||||
mkfile.innerHTML = 'MkFile';
|
||||
document.getElementById(element).appendChild(mkfile);
|
||||
|
||||
function httpPostProcessRequest(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
if(xmlHttp.status != 200) alert("ERROR["+xmlHttp.status+"]: "+xmlHttp.responseText);
|
||||
else {
|
||||
tree.refreshPath(path.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createPath(p){
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = httpPostProcessRequest;
|
||||
var formData = new FormData();
|
||||
formData.append("path", p);
|
||||
xmlHttp.open("PUT", urlXXX+"/edit");
|
||||
xmlHttp.send(formData);
|
||||
}
|
||||
|
||||
mkfile.onclick = function(e){
|
||||
if(path.value.indexOf(".") === -1) return;
|
||||
createPath(path.value);
|
||||
editor.loadUrl(path.value);
|
||||
};
|
||||
mkdir.onclick = function(e){
|
||||
if(path.value.length < 2) return;
|
||||
var dir = path.value
|
||||
if(dir.indexOf(".") !== -1){
|
||||
if(dir.lastIndexOf("/") === 0) return;
|
||||
dir = dir.substring(0, dir.lastIndexOf("/"));
|
||||
}
|
||||
createPath(dir);
|
||||
};
|
||||
button.onclick = function(e){
|
||||
if(input.files.length === 0){
|
||||
return;
|
||||
}
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = httpPostProcessRequest;
|
||||
var formData = new FormData();
|
||||
formData.append("data", input.files[0], path.value);
|
||||
xmlHttp.open("POST", urlXXX+"/edit");
|
||||
xmlHttp.send(formData);
|
||||
}
|
||||
input.onchange = function(e){
|
||||
if(input.files.length === 0) return;
|
||||
var filename = input.files[0].name;
|
||||
var ext = /(?:\.([^.]+))?$/.exec(filename)[1];
|
||||
var name = /(.*)\.[^.]+$/.exec(filename)[1];
|
||||
if(typeof name !== undefined){
|
||||
//1197 bolt if(name.length > 8) name = name.substring(0, 8);
|
||||
filename = name;
|
||||
}
|
||||
if(typeof ext !== undefined){
|
||||
if(ext === "html") ext = "htm";
|
||||
else if(ext === "jpeg") ext = "jpg";
|
||||
filename = filename + "." + ext;
|
||||
}
|
||||
if(path.value === "/" || path.value.lastIndexOf("/") === 0){
|
||||
path.value = "/"+filename;
|
||||
} else {
|
||||
path.value = path.value.substring(0, path.value.lastIndexOf("/")+1)+filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createTree(element, editor){
|
||||
var preview = document.getElementById("preview");
|
||||
var treeRoot = document.createElement("div");
|
||||
treeRoot.className = "css-treeview";
|
||||
document.getElementById(element).appendChild(treeRoot);
|
||||
|
||||
function loadDownload(path){
|
||||
document.getElementById('download-frame').src = path+"?download=true";
|
||||
}
|
||||
|
||||
function loadPreview(path){
|
||||
document.getElementById("editor").style.display = "none";
|
||||
preview.style.display = "block";
|
||||
preview.innerHTML = '<img src="'+ urlXXX +path+'" style="max-width:100%; max-height:100%; margin:auto; display:block;" />';
|
||||
}
|
||||
|
||||
function fillFolderMenu(el, path){
|
||||
var list = document.createElement("ul");
|
||||
el.appendChild(list);
|
||||
var action = document.createElement("li");
|
||||
list.appendChild(action);
|
||||
var isChecked = document.getElementById(path).checked;
|
||||
var expnd = document.createElement("li");
|
||||
list.appendChild(expnd);
|
||||
if(isChecked){
|
||||
expnd.innerHTML = "<span>Collapse</span>";
|
||||
expnd.onclick = function(e){
|
||||
document.getElementById(path).checked = false;
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
var refrsh = document.createElement("li");
|
||||
list.appendChild(refrsh);
|
||||
refrsh.innerHTML = "<span>Refresh</span>";
|
||||
refrsh.onclick = function(e){
|
||||
var leaf = document.getElementById(path).parentNode;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
} else {
|
||||
expnd.innerHTML = "<span>Expand</span>";
|
||||
expnd.onclick = function(e){
|
||||
document.getElementById(path).checked = true;
|
||||
var leaf = document.getElementById(path).parentNode;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
}
|
||||
var upload = document.createElement("li");
|
||||
list.appendChild(upload);
|
||||
upload.innerHTML = "<span>Upload</span>";
|
||||
upload.onclick = function(e){
|
||||
var pathEl = document.getElementById("upload-path");
|
||||
if(pathEl){
|
||||
var subPath = pathEl.value;
|
||||
if(subPath.lastIndexOf("/") < 1) pathEl.value = path+subPath;
|
||||
else pathEl.value = path.substring(subPath.lastIndexOf("/"))+subPath;
|
||||
}
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
var delFile = document.createElement("li");
|
||||
list.appendChild(delFile);
|
||||
delFile.innerHTML = "<span>Delete</span>";
|
||||
delFile.onclick = function(e){
|
||||
httpDelete(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
}
|
||||
|
||||
function fillFileMenu(el, path){
|
||||
var list = document.createElement("ul");
|
||||
el.appendChild(list);
|
||||
var action = document.createElement("li");
|
||||
list.appendChild(action);
|
||||
if(isTextFile(path)){
|
||||
action.innerHTML = "<span>Edit</span>";
|
||||
action.onclick = function(e){
|
||||
editor.loadUrl(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
} else if(isImageFile(path)){
|
||||
action.innerHTML = "<span>Preview</span>";
|
||||
action.onclick = function(e){
|
||||
loadPreview(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
}
|
||||
var download = document.createElement("li");
|
||||
list.appendChild(download);
|
||||
download.innerHTML = "<span>Download</span>";
|
||||
download.onclick = function(e){
|
||||
loadDownload(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
var delFile = document.createElement("li");
|
||||
list.appendChild(delFile);
|
||||
delFile.innerHTML = "<span>Delete</span>";
|
||||
delFile.onclick = function(e){
|
||||
httpDelete(path);
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(el);
|
||||
};
|
||||
}
|
||||
|
||||
function showContextMenu(e, path, isfile){
|
||||
var divContext = document.createElement("div");
|
||||
var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
|
||||
var scrollLeft = document.body.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft;
|
||||
var left = e.clientX + scrollLeft;
|
||||
var top = e.clientY + scrollTop;
|
||||
divContext.className = 'contextMenu';
|
||||
divContext.style.display = 'block';
|
||||
divContext.style.left = left + 'px';
|
||||
divContext.style.top = top + 'px';
|
||||
if(isfile) fillFileMenu(divContext, path);
|
||||
else fillFolderMenu(divContext, path);
|
||||
document.body.appendChild(divContext);
|
||||
var width = divContext.offsetWidth;
|
||||
var height = divContext.offsetHeight;
|
||||
divContext.onmouseout = function(e){
|
||||
if(e.clientX < left || e.clientX > (left + width) || e.clientY < top || e.clientY > (top + height)){
|
||||
if(document.body.getElementsByClassName('contextMenu').length > 0) document.body.removeChild(divContext);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function createTreeLeaf(path, name, size){
|
||||
var leaf = document.createElement("li");
|
||||
leaf.id = (((path == "/")?"":path)+"/"+name).toLowerCase();
|
||||
var label = document.createElement("span");
|
||||
label.textContent = name.toLowerCase();
|
||||
leaf.appendChild(label);
|
||||
leaf.onclick = function(e){
|
||||
if(isTextFile(leaf.id)){
|
||||
editor.loadUrl(leaf.id);
|
||||
} else if(isImageFile(leaf.id)){
|
||||
loadPreview(leaf.id);
|
||||
}
|
||||
};
|
||||
leaf.oncontextmenu = function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
showContextMenu(e, leaf.id, true);
|
||||
};
|
||||
return leaf;
|
||||
}
|
||||
|
||||
function createTreeBranch(path, name, disabled){
|
||||
var leaf = document.createElement("li");
|
||||
var check = document.createElement("input");
|
||||
check.type = "checkbox";
|
||||
check.id = (((path == "/")?"":path)+"/"+name).toLowerCase();
|
||||
if(typeof disabled !== "undefined" && disabled) check.disabled = "disabled";
|
||||
leaf.appendChild(check);
|
||||
var label = document.createElement("label");
|
||||
label.for = check.id;
|
||||
label.textContent = name.toLowerCase();
|
||||
leaf.appendChild(label);
|
||||
check.onchange = function(e){
|
||||
if(check.checked){
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, check.id);
|
||||
}
|
||||
};
|
||||
label.onclick = function(e){
|
||||
if(!check.checked){
|
||||
check.checked = true;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, check.id);
|
||||
} else {
|
||||
check.checked = false;
|
||||
}
|
||||
};
|
||||
leaf.oncontextmenu = function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
showContextMenu(e, check.id, false);
|
||||
}
|
||||
return leaf;
|
||||
}
|
||||
|
||||
function addList(parent, path, items){
|
||||
var list = document.createElement("ul");
|
||||
parent.appendChild(list);
|
||||
var ll = items.length;
|
||||
//Сортировка файлов
|
||||
items.sort(function(a,b){return (a.name < b.name) ? 1 : ((b.name < a.name) ? -1 : 0);});
|
||||
for(var i = 0; i < ll; i++){
|
||||
var item = items[i];
|
||||
var itemEl;
|
||||
if(item.type === "file"){
|
||||
itemEl = createTreeLeaf(path, item.name, item.size);
|
||||
} else {
|
||||
itemEl = createTreeBranch(path, item.name);
|
||||
}
|
||||
list.appendChild(itemEl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function isTextFile(path){
|
||||
var ext = /(?:\.([^.]+))?$/.exec(path)[1];
|
||||
if(typeof ext !== undefined){
|
||||
switch(ext){
|
||||
case "txt":
|
||||
case "htm":
|
||||
case "html":
|
||||
case "js":
|
||||
case "json":
|
||||
case "c":
|
||||
case "h":
|
||||
case "cpp":
|
||||
case "css":
|
||||
case "xml":
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isImageFile(path){
|
||||
var ext = /(?:\.([^.]+))?$/.exec(path)[1];
|
||||
if(typeof ext !== undefined){
|
||||
switch(ext){
|
||||
case "png":
|
||||
case "jpg":
|
||||
case "gif":
|
||||
case "ico":
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.refreshPath = function(path){
|
||||
if(path.lastIndexOf('/') < 1){
|
||||
path = '/';
|
||||
treeRoot.removeChild(treeRoot.childNodes[0]);
|
||||
httpGet(treeRoot, "/");
|
||||
} else {
|
||||
path = path.substring(0, path.lastIndexOf('/'));
|
||||
var leaf = document.getElementById(path).parentNode;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, path);
|
||||
}
|
||||
};
|
||||
|
||||
function delCb(path){
|
||||
return function(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
if(xmlHttp.status != 200){
|
||||
alert("ERROR["+xmlHttp.status+"]: "+xmlHttp.responseText);
|
||||
} else {
|
||||
if(path.lastIndexOf('/') < 1){
|
||||
path = '/';
|
||||
treeRoot.removeChild(treeRoot.childNodes[0]);
|
||||
httpGet(treeRoot, "/");
|
||||
} else {
|
||||
path = path.substring(0, path.lastIndexOf('/'));
|
||||
var leaf = document.getElementById(path).parentNode;
|
||||
if(leaf.childNodes.length == 3) leaf.removeChild(leaf.childNodes[2]);
|
||||
httpGet(leaf, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function httpDelete(filename){
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = delCb(filename);
|
||||
var formData = new FormData();
|
||||
formData.append("path", filename);
|
||||
xmlHttp.open("DELETE", urlXXX+"/edit");
|
||||
xmlHttp.send(formData);
|
||||
}
|
||||
|
||||
function getCb(parent, path){
|
||||
return function(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
//clear loading
|
||||
if(xmlHttp.status == 200) addList(parent, path, JSON.parse(xmlHttp.responseText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function httpGet(parent, path){
|
||||
xmlHttp = new XMLHttpRequest(parent, path);
|
||||
xmlHttp.onreadystatechange = getCb(parent, path);
|
||||
//Для отключения кэша random() иначе будут старые данные
|
||||
xmlHttp.open("GET", urlXXX+"/edit?list=" + path +"&rand="+Math.random(), true);
|
||||
xmlHttp.send(null);
|
||||
//start loading
|
||||
}
|
||||
|
||||
httpGet(treeRoot, "/");
|
||||
return this;
|
||||
}
|
||||
|
||||
function createEditor(element, file, lang, theme, type){
|
||||
function getLangFromFilename(filename){
|
||||
var lang = "plain";
|
||||
var ext = /(?:\.([^.]+))?$/.exec(filename)[1];
|
||||
if(typeof ext !== undefined){
|
||||
switch(ext){
|
||||
case "txt": lang = "plain"; break;
|
||||
case "htm": lang = "html"; break;
|
||||
case "js": lang = "javascript"; break;
|
||||
case "c": lang = "c_cpp"; break;
|
||||
case "cpp": lang = "c_cpp"; break;
|
||||
case "css":
|
||||
case "scss":
|
||||
case "php":
|
||||
case "html":
|
||||
case "json":
|
||||
case "xml":
|
||||
lang = ext;
|
||||
}
|
||||
}
|
||||
return lang;
|
||||
}
|
||||
|
||||
if(typeof file === "undefined") file = "/index.htm";
|
||||
|
||||
if(typeof lang === "undefined"){
|
||||
lang = getLangFromFilename(file);
|
||||
}
|
||||
|
||||
if(typeof theme === "undefined") theme = "textmate";
|
||||
|
||||
if(typeof type === "undefined"){
|
||||
type = "text/"+lang;
|
||||
if(lang === "c_cpp") type = "text/plain";
|
||||
}
|
||||
|
||||
var xmlHttp = null;
|
||||
var editor = ace.edit(element);
|
||||
|
||||
//post
|
||||
function httpPostProcessRequest(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
if(xmlHttp.status != 200) alert("ERROR["+xmlHttp.status+"]: "+xmlHttp.responseText);
|
||||
}
|
||||
}
|
||||
function httpPost(filename, data, type){
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = httpPostProcessRequest;
|
||||
var formData = new FormData();
|
||||
formData.append("data", new Blob([data], { type: type }), filename);
|
||||
xmlHttp.open("POST", urlXXX + "/edit");
|
||||
xmlHttp.send(formData);
|
||||
}
|
||||
//get
|
||||
function httpGetProcessRequest(){
|
||||
if (xmlHttp.readyState == 4){
|
||||
document.getElementById("preview").style.display = "none";
|
||||
document.getElementById("editor").style.display = "block";
|
||||
if(xmlHttp.status == 200) editor.setValue(xmlHttp.responseText);
|
||||
else editor.setValue("");
|
||||
editor.clearSelection();
|
||||
}
|
||||
}
|
||||
function httpGet(theUrl){
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = httpGetProcessRequest;
|
||||
if (theUrl.indexOf("/") == 0)
|
||||
theUrl = urlXXX + theUrl;//bolt
|
||||
xmlHttp.open("GET", theUrl+"?rand="+Math.random(), true);
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
|
||||
if(lang !== "plain") editor.getSession().setMode("ace/mode/"+lang);
|
||||
editor.setTheme("ace/theme/"+theme);
|
||||
editor.$blockScrolling = Infinity;
|
||||
editor.getSession().setUseSoftTabs(true);
|
||||
editor.getSession().setTabSize(2);
|
||||
editor.setHighlightActiveLine(true);
|
||||
editor.setShowPrintMargin(false);
|
||||
editor.commands.addCommand({
|
||||
name: 'saveCommand',
|
||||
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
|
||||
exec: function(editor) {
|
||||
httpPost(file, editor.getValue()+"", type);
|
||||
},
|
||||
readOnly: false
|
||||
});
|
||||
editor.commands.addCommand({
|
||||
name: 'undoCommand',
|
||||
bindKey: {win: 'Ctrl-Z', mac: 'Command-Z'},
|
||||
exec: function(editor) {
|
||||
editor.getSession().getUndoManager().undo(false);
|
||||
},
|
||||
readOnly: false
|
||||
});
|
||||
editor.commands.addCommand({
|
||||
name: 'redoCommand',
|
||||
bindKey: {win: 'Ctrl-Shift-Z', mac: 'Command-Shift-Z'},
|
||||
exec: function(editor) {
|
||||
editor.getSession().getUndoManager().redo(false);
|
||||
},
|
||||
readOnly: false
|
||||
});
|
||||
httpGet(file);
|
||||
editor.loadUrl = function(filename){
|
||||
file = filename;
|
||||
lang = getLangFromFilename(file);
|
||||
type = "text/"+lang;
|
||||
if(lang !== "plain") editor.getSession().setMode("ace/mode/"+lang);
|
||||
httpGet(file);
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
function onBodyLoad(){
|
||||
var vars = {};
|
||||
// var s = "http://192.168.211.180/edit/index.htm";
|
||||
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; });
|
||||
// var parts = s.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; });
|
||||
if (typeof vars.url !== "undefined" && vars.url != "")
|
||||
urlXXX = "http://" + vars.url;/**/
|
||||
var editor = createEditor("editor", vars.file, vars.lang, vars.theme);
|
||||
var tree = createTree("tree", editor);
|
||||
createFileUploader("uploader", tree, editor);
|
||||
};
|
||||
</script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
(function() {
|
||||
window.require(["ace/ace"], function(a) {
|
||||
a && a.config.init(true);
|
||||
if (!window.ace)
|
||||
window.ace = a;
|
||||
for (var key in a) if (a.hasOwnProperty(key))
|
||||
window.ace[key] = a[key];
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onBodyLoad();">
|
||||
<div id="uploader"></div>
|
||||
<div id="tree"></div>
|
||||
<div id="editor"></div>
|
||||
<div id="preview" style="display:none;"></div>
|
||||
<iframe id=download-frame style='display:none;'></iframe>
|
||||
</body>
|
||||
</html>
|
||||
BIN
data/edit.htm.gz
Normal file
BIN
data/edit.htm.gz
Normal file
Binary file not shown.
BIN
data/favicon.ico
Normal file
BIN
data/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
75
data/index.htm
Normal file
75
data/index.htm
Normal file
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
Web Developer: Renats Kevrels (ex. Zozula)
|
||||
Site: http://www.onclick.lv
|
||||
Contact: info [at] onclick.lv
|
||||
Skype: renat2985
|
||||
Twitter: @Ramzies
|
||||
Facebook: http://www.facebook.com/renat2985
|
||||
GitHub: https://github.com/renat2985
|
||||
From: Latvia, Valmiera
|
||||
-->
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
|
||||
<script defer src="js/build.chart.js?v07.04.2018" charset="utf-8"></script>
|
||||
<!-- <link rel="stylesheet" type="text/css" href="css/chartist.min.css">
|
||||
<script src="js/chartist.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="js/chart.js"></script> -->
|
||||
<link rel="stylesheet" type="text/css" href="css/build.css?v07.04.2018">
|
||||
<!-- <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css"> -->
|
||||
<script defer type="text/javascript" src="js/function.js?v07.04.2018"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title></title>
|
||||
<script type="text/javascript">
|
||||
var jsonResponse;
|
||||
|
||||
//function selectTextareaLine(tarea,lineNum) {
|
||||
// lineNum--;
|
||||
// var lines = tarea.value.split("\n");
|
||||
// var startPos = 0, endPos = tarea.value.length;
|
||||
// for(var x = 0; x < lines.length; x++) {
|
||||
// if(x == lineNum) {break;}
|
||||
// startPos += (lines[x].length+1);
|
||||
// }
|
||||
// var endPos = lines[lineNum].length+startPos;
|
||||
// if(typeof(tarea.selectionStart) != "undefined") {
|
||||
// tarea.focus();
|
||||
// tarea.selectionStart = startPos;
|
||||
// tarea.selectionEnd = endPos;
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
|
||||
window.onload = function() {
|
||||
setContent('first');
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container loader-bg">
|
||||
|
||||
<ul id="url-content" class="hidden" onclick="document.getElementById('content').style.zIndex=0;"></ul>
|
||||
<div id="headers"></div>
|
||||
<div class="row hidden" id="container_column">
|
||||
<h1 id="title"></h1>
|
||||
<div id="content" onclick="this.style.zIndex=10"></div>
|
||||
</div>
|
||||
<div id="footer"></div>
|
||||
<div id="edit-content" class="hidden" onclick="document.getElementById('content').style.zIndex=0;">
|
||||
<a target="_blank" style="position:fixed;right:0;color:#000;" href="https://github.com/tretyakovsa/Sonoff_WiFi_switch/wiki/%D0%92%D0%BE%D0%B7%D0%BC%D0%BE%D0%B6%D0%BD%D0%BE%D1%81%D1%82%D0%B8-page.htm%3F*" title="Github wiki"><i class="help-img"></i>wiki</a>
|
||||
<textarea class="form-control" onkeyup="isValidJson(this.value,'edit-json')" spellcheck="false" id="edit-json"></textarea>
|
||||
<div id="error-json"></div>
|
||||
<div class="btn-group btn-block">
|
||||
<input class="btn btn-success" style="width:40%" id="edit-view" onclick="setContent('edit');this.value='Loading...';html('url-content', ' ');" value="View" type="button">
|
||||
<input class="btn btn-danger" style="width:40%" id="edit-save" onclick="var urlPages=window.location.search.substring(1).split('&')[0];httpDelete('/'+urlPages+'.json.gz');send_request_edit(this, val('edit-json'),(urlPages?urlPages:'index')+'.json');toggle('edit-content');toggle('url-content');" value="Save" type="button">
|
||||
<a class="btn btn-info" style="width:20%" href="#" id="download-json" download="" title="Save to PC"><i class="download-img"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
data/index.htm.gz
Normal file
BIN
data/index.htm.gz
Normal file
Binary file not shown.
56
data/index.json
Normal file
56
data/index.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"configs": [
|
||||
"/config.live.json",
|
||||
"/config.setup.json"
|
||||
],
|
||||
"title": "Главная",
|
||||
"class": "col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6",
|
||||
"content": [
|
||||
{
|
||||
"type": "h5",
|
||||
"title": "{{SSDP}}",
|
||||
"class": "alert-warning"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Device ID: {{chipID}}"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "IP address: {{ip}}"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Конфигурация устройства",
|
||||
"action": "/page.htm?config.all",
|
||||
"class": "btn btn-block btn-primary"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Конфигурация WIFI",
|
||||
"action": "/page.htm?setup",
|
||||
"class": "btn btn-block btn-success"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Конфигурация MQTT",
|
||||
"action": "/page.htm?mqtt",
|
||||
"class": "btn btn-block btn-success"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Конфигурация push",
|
||||
"action": "/page.htm?pushingbox",
|
||||
"class": "btn btn-block btn-success"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Скачать приложение IoT Manager",
|
||||
"action": "https://github.com/DmitryBorisenko33/esp8266_iot-manager_modules_firmware/raw/master/iot_manager/IoT%20Manager%201.5.5.apk",
|
||||
"class": "btn btn-block btn-success"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
data/js/build.chart.js.gz
Normal file
BIN
data/js/build.chart.js.gz
Normal file
Binary file not shown.
BIN
data/js/function.js.gz
Normal file
BIN
data/js/function.js.gz
Normal file
Binary file not shown.
BIN
data/lang/lang.en.json.gz
Normal file
BIN
data/lang/lang.en.json.gz
Normal file
Binary file not shown.
BIN
data/lang/lang.lv.json.gz
Normal file
BIN
data/lang/lang.lv.json.gz
Normal file
Binary file not shown.
BIN
data/lang/lang.ru.json.gz
Normal file
BIN
data/lang/lang.ru.json.gz
Normal file
Binary file not shown.
BIN
data/lang/lang.ua.json.gz
Normal file
BIN
data/lang/lang.ua.json.gz
Normal file
Binary file not shown.
BIN
data/mode-html.js.gz
Normal file
BIN
data/mode-html.js.gz
Normal file
Binary file not shown.
73
data/mqtt.json
Normal file
73
data/mqtt.json
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"configs": [
|
||||
"/config.setup.json"
|
||||
],
|
||||
"class":"col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6",
|
||||
"content": [
|
||||
{
|
||||
"type": "h5",
|
||||
"title": "{{SSDP}}",
|
||||
"class":"alert-warning"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Server name:"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "",
|
||||
"name":"1",
|
||||
"state": "{{mqttServer}}"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Port:"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "",
|
||||
"name":"2",
|
||||
"state": "{{mqttPort}}"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "User name:"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "",
|
||||
"name":"3",
|
||||
"state": "{{mqttUser}}"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Password:"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "",
|
||||
"name":"4",
|
||||
"state": "{{mqttPass}}"
|
||||
},
|
||||
{
|
||||
"type":"h3",
|
||||
"name":"my-block",
|
||||
"style":"position:fixed;top:30%;left:50%;width:400px;margin-left:-200px;text-align:center;",
|
||||
"class":"hidden"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"title":"Сохранить и проверить соединение",
|
||||
"action": "mqttSave?mqttServer=[[1]]&mqttPort=[[2]]&mqttUser=[[3]]&mqttPass=[[4]]",
|
||||
"response":"[[my-block]]",
|
||||
"class": "btn btn-block btn-success",
|
||||
"style": "width:100%;display:inline"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Главная",
|
||||
"action": "/page.htm?index",
|
||||
"class": "btn btn-block btn-danger btn-sm"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
data/page.htm.gz
Normal file
BIN
data/page.htm.gz
Normal file
Binary file not shown.
92
data/push.json
Normal file
92
data/push.json
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"configs": [
|
||||
"/config.setup.json"
|
||||
],
|
||||
"class":"col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6",
|
||||
"content": [
|
||||
{
|
||||
"type": "h5",
|
||||
"title": "{{SSDP}}",
|
||||
"class":"alert-warning"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Host name:"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "",
|
||||
"name":"1",
|
||||
"state": "{{pushHost}}"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Port:"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "",
|
||||
"name":"2",
|
||||
"state": "{{pushPort}}"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Fingerprint:"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "",
|
||||
"name":"3",
|
||||
"state": "{{pushFingerprint}}"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Access Token:"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "",
|
||||
"name":"4",
|
||||
"state": "{{pushAccessToken}}"
|
||||
},
|
||||
{
|
||||
"type":"h3",
|
||||
"name":"my-block",
|
||||
"style":"position:fixed;top:30%;left:50%;width:400px;margin-left:-200px;text-align:center;",
|
||||
"class":"hidden"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"title":"Сохранить и проверить соединение",
|
||||
"action": "pushDate?pushHost=[[1]]&pushPort=[[2]]&pushFingerprint=[[3]]&pushAccessToken=[[4]]",
|
||||
"response":"[[my-block]]",
|
||||
"class": "btn btn-block btn-success",
|
||||
"style": "width:100%;display:inline"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "checkbox",
|
||||
"name":"start-push",
|
||||
"title": "Отправлять push при включении устройства",
|
||||
"action": "startPush?status=[[start-push]]",
|
||||
"state": "{{startPush}}"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Перезагрузить устройство",
|
||||
"action": "javascript:if(confirm(renameBlock(jsonResponse,'Перезагрузить?'))){send_request(this,'/restart?device=ok');}",
|
||||
"class": "btn btn-block btn-warning"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Главная",
|
||||
"action": "/page.htm?index",
|
||||
"class": "btn btn-block btn-danger btn-sm"
|
||||
}
|
||||
]
|
||||
}
|
||||
46
data/pushingbox.json
Normal file
46
data/pushingbox.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"configs": [
|
||||
"/config.setup.json"
|
||||
],
|
||||
"class":"col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6",
|
||||
"content": [
|
||||
{
|
||||
"type": "h5",
|
||||
"title": "{{SSDP}}",
|
||||
"class":"alert-warning"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Device id:"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "",
|
||||
"name":"1",
|
||||
"state": "{{pushingbox_id}}"
|
||||
},
|
||||
|
||||
{
|
||||
"type": "button",
|
||||
"title":"Сохранить",
|
||||
"action": "pushingboxDate?pushingbox_id=[[1]]",
|
||||
"class": "btn btn-block btn-success",
|
||||
"style": "width:100%;display:inline"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Перезагрузить устройство",
|
||||
"action": "javascript:if(confirm(renameBlock(jsonResponse,'Перезагрузить?'))){send_request(this,'/restart?device=ok');}",
|
||||
"class": "btn btn-block btn-warning"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Главная",
|
||||
"action": "/page.htm?index",
|
||||
"class": "btn btn-block btn-danger btn-sm"
|
||||
}
|
||||
]
|
||||
}
|
||||
31
data/scenario.all.txt
Normal file
31
data/scenario.all.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
button1 = 1
|
||||
buttonSet 2 1
|
||||
buttonSet 3 1
|
||||
pwmSet 2 1024
|
||||
end
|
||||
button1 = 0
|
||||
buttonSet 2 0
|
||||
buttonSet 3 0
|
||||
pwmSet 2 0
|
||||
end
|
||||
analog > value1
|
||||
buttonSet 4 1
|
||||
end
|
||||
button5 = 1
|
||||
timerStart 1 value2 sec
|
||||
end
|
||||
button5 = 0
|
||||
timerStart 2 value2 sec
|
||||
end
|
||||
timer1 = 0
|
||||
buttonSet 6 1
|
||||
end
|
||||
timer2 = 0
|
||||
buttonSet 6 0
|
||||
end
|
||||
switch1 = 1
|
||||
textSet 1 закрыто-time
|
||||
end
|
||||
switch1 = 0
|
||||
textSet 1 открыто-time
|
||||
end
|
||||
154
data/setup.json
Normal file
154
data/setup.json
Normal file
@@ -0,0 +1,154 @@
|
||||
{
|
||||
"configs": [
|
||||
"/config.setup.json"
|
||||
],
|
||||
"title": "Конфигурация",
|
||||
"class":"col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6",
|
||||
"content": [
|
||||
{
|
||||
"type": "h5",
|
||||
"title": "{{SSDP}}",
|
||||
"class":"alert-warning"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Главная",
|
||||
"action": "/",
|
||||
"class": "btn btn-block btn-danger"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "h2",
|
||||
"title": "Имя устройства"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "Имя устройства",
|
||||
"name":"ssdp",
|
||||
"state": "{{SSDP}}",
|
||||
"pattern": "[0-9a-zA-Zа-яА-Я.\\- ]{1,20}"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"title": "Сохранить",
|
||||
"action": "ssdp?ssdp=[[ssdp]]",
|
||||
"class": "btn btn-block btn-success"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "h2",
|
||||
"title": "Подключение к Wi-Fi роутеру"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title":"Сеть",
|
||||
"name":"ssid",
|
||||
"state": "{{ssid}}"
|
||||
},
|
||||
{
|
||||
"type": "password",
|
||||
"title": "Введите пароль",
|
||||
"name":"ssidPass",
|
||||
"state": "{{password}}",
|
||||
"pattern": ".{8,20}"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"title": "Сохранить",
|
||||
"class": "btn btn-block btn-success",
|
||||
"action": "ssid?ssid=[[ssid]]&password=[[ssidPass]]"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "h2",
|
||||
"title": "Временная зона GMT"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "{{LangSpace}}",
|
||||
"name":"timeZone",
|
||||
"state": "{{timezone}}",
|
||||
"pattern": "[0-9-]{1,3}"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"module":"",
|
||||
"title": "Сохранить",
|
||||
"class": "btn btn-block btn-success",
|
||||
"action": "timeZone?timeZone=[[timeZone]]"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Автоопределение зоны",
|
||||
"action": "javascript:set_time_zone(this);",
|
||||
"class": "btn btn-block btn-primary"
|
||||
},
|
||||
{
|
||||
"type": "time",
|
||||
"name":"times1",
|
||||
"title": "На устройстве сейчас",
|
||||
"state":"{{time}}"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"response":"[[times1]]",
|
||||
"title": "Синхронизировать",
|
||||
"class": "btn btn-block btn-primary",
|
||||
"action": "Time"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "h2",
|
||||
"title": "Точка доступа"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"title": "После того как устройство подключается к роутеру, его Wi-Fi исчезнет.",
|
||||
"class": "alert alert-warning",
|
||||
"style": "width:45%;float:right;"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"title": "Имя WI-FI сети",
|
||||
"name":"ssidap",
|
||||
"state": "{{ssidAP}}",
|
||||
"style": "width:50%;display:inline",
|
||||
"pattern": ".{1,20}"
|
||||
},
|
||||
{
|
||||
"type": "password",
|
||||
"title": "Пароль",
|
||||
"name":"ssidApPass",
|
||||
"state": "{{passwordAP}}",
|
||||
"style": "width:50%;display:inline",
|
||||
"pattern": ".{8,20}"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"title": "Сохранить",
|
||||
"action": "ssidap?ssidAP=[[ssidap]]&passwordAP=[[ssidApPass]]",
|
||||
"class": "btn btn-block btn-success",
|
||||
"style": "width:50%;display:inline"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "hr"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Перезагрузить устройство",
|
||||
"action": "javascript:if(confirm(renameBlock(jsonResponse,'Перезагрузить?'))){send_request(this,'/restart?device=ok');}",
|
||||
"class": "btn btn-block btn-warning"
|
||||
}
|
||||
]
|
||||
}
|
||||
57
data/soket.json
Normal file
57
data/soket.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"configs": [
|
||||
|
||||
"/config.live.json",
|
||||
"/config.option.json",
|
||||
"/config.setup.json",
|
||||
"/lang/lang.ru.json",
|
||||
"socket {{ip}}:81/"
|
||||
|
||||
],
|
||||
"title": "Главная",
|
||||
"class":"col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6",
|
||||
"content": [
|
||||
{
|
||||
"type": "h5",
|
||||
"title": "{{SSDP}}",
|
||||
"class":"alert-warning"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Module tank level:",
|
||||
"style": "width:80%;float:left;"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "{{module_tank_level_s}}",
|
||||
"style": "width:20%;float:right;"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Module analog:",
|
||||
"style": "width:80%;float:left;"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "{{module_analog_s}}",
|
||||
"style": "width:20%;float:right;"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "Module ds18b20:",
|
||||
"style": "width:80%;float:left;"
|
||||
},
|
||||
{
|
||||
"type": "h4",
|
||||
"title": "{{module_ds18b20_s}}",
|
||||
"style": "width:20%;float:right;"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"title": "Главная",
|
||||
"action": "/page.htm?index",
|
||||
"class": "btn btn-block btn-danger btn-sm",
|
||||
"style": "width:100%;float:right;"
|
||||
}
|
||||
]
|
||||
}
|
||||
12
data/vigets/viget.alertbg.json
Normal file
12
data/vigets/viget.alertbg.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id" : "",
|
||||
"page" : "",
|
||||
"widget" : "anydata",
|
||||
"class1": "col-xs-4 text-center",
|
||||
"class2": "stable",
|
||||
"style2": "font-size:12px;float:center;",
|
||||
"class3":"stable",
|
||||
"style3": "font-size:25px;float:center;font-weight:bold;",
|
||||
"descr" : "",
|
||||
"topic" : ""
|
||||
}
|
||||
12
data/vigets/viget.alertsm.json
Normal file
12
data/vigets/viget.alertsm.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id" : "",
|
||||
"page" : "",
|
||||
"widget" : "anydata",
|
||||
"class1" : "item col-xs-12 text-center",
|
||||
"class2": "ballanced",
|
||||
"style2": "font-size:20px;float:left;font-weight:bold;",
|
||||
"class3":"ballanced",
|
||||
"style3": "font-size:17px;float:right;",
|
||||
"descr" : "",
|
||||
"topic" : ""
|
||||
}
|
||||
18
data/vigets/viget.button.json
Normal file
18
data/vigets/viget.button.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"id": "",
|
||||
"pageId":"",
|
||||
"page": "",
|
||||
"widget": "simple-btn",
|
||||
"class1": "col-xs-4 text-center",
|
||||
"class2": "ballanced",
|
||||
"style2": "font-size:15px;float:left;font-weight:bold;",
|
||||
"topic": "",
|
||||
"class3": "button button-block",
|
||||
"style3": "float:right;",
|
||||
"widgetConfig": {
|
||||
"fill": "#F5F5F5",
|
||||
"fillPressed": "#4169E1",
|
||||
"title": "-",
|
||||
"delay":500
|
||||
}
|
||||
}
|
||||
13
data/vigets/viget.chart.json
Normal file
13
data/vigets/viget.chart.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"id" : "",
|
||||
"pageId": "",
|
||||
"widget" : "chart",
|
||||
"topic" : "",
|
||||
"widgetConfig": {
|
||||
|
||||
"maxCount": 200,
|
||||
"type": "line",
|
||||
"height": 200
|
||||
|
||||
}
|
||||
}
|
||||
23
data/vigets/viget.fillgauge.json
Normal file
23
data/vigets/viget.fillgauge.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": "",
|
||||
"page": "",
|
||||
"pageId": "",
|
||||
"widget": "fillgauge",
|
||||
"descr": "",
|
||||
"class2": "text-center ballanced",
|
||||
"style2": "font-size:25px;font-weight:bold;padding-top:10px;padding-bottom:10px;",
|
||||
"class3" : "text-center",
|
||||
"style3": "padding-top:10px;padding-bottom:10px;",
|
||||
"topic": "",
|
||||
"width": "250px",
|
||||
"height": "250px",
|
||||
"widgetConfig": {
|
||||
"circleColor": "#228B22",
|
||||
"textColor": "#FFFFFF",
|
||||
"waveTextColor": "#050000",
|
||||
"waveColor": "#40E0D0",
|
||||
"circleThickness": 0.05,
|
||||
"textVertPosition": 0.5,
|
||||
"waveAnimateTime": 500
|
||||
}
|
||||
}
|
||||
18
data/vigets/viget.gauge.json
Normal file
18
data/vigets/viget.gauge.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"id" : "",
|
||||
"pageId": "",
|
||||
"widget" : "gauge",
|
||||
"topic" : "",
|
||||
"class1" : "item no-border no-padding text-center",
|
||||
"descr" : "",
|
||||
"widgetConfig" : {
|
||||
"type" : "full",
|
||||
"cap" : "round",
|
||||
"append" : "",
|
||||
"size" : 300,
|
||||
"thick" : 20,
|
||||
"maximum": 1024,
|
||||
"color" : "#11c1f3",
|
||||
"backgroundColor": "rgba(0,0,0, 0.2)"
|
||||
}
|
||||
}
|
||||
16
data/vigets/viget.led.json
Normal file
16
data/vigets/viget.led.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"id": "",
|
||||
"pageId": "",
|
||||
"descr": "",
|
||||
"class1": "col-xs-3 text-center",
|
||||
"page": "",
|
||||
"widget": "steel",
|
||||
"topic": "",
|
||||
"widgetConfig": {
|
||||
"width": 60,
|
||||
"height": 60,
|
||||
"type": "Led",
|
||||
"blink": false,
|
||||
"LedColor": "RED_LED"
|
||||
}
|
||||
}
|
||||
13
data/vigets/viget.range.json
Normal file
13
data/vigets/viget.range.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"id": "",
|
||||
"page": "",
|
||||
"descr": "",
|
||||
"widget": "range",
|
||||
"class3": "ballanced",
|
||||
"style3": "font-size:25px;float:left;font-weight:bold;",
|
||||
"topic": "",
|
||||
"widgetConfig": {
|
||||
"maxValue": 1023,
|
||||
"minValue": 0
|
||||
}
|
||||
}
|
||||
13
data/vigets/viget.status.json
Normal file
13
data/vigets/viget.status.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"id" : "1",
|
||||
"page" : "",
|
||||
"pageId":"",
|
||||
"widget" : "anydata",
|
||||
"class1" : "item rounded text-center no-padding",
|
||||
"class2": "ballanced",
|
||||
"style2": "",
|
||||
"class3":"ballanced",
|
||||
"style3": "font-size:10px;float:right;",
|
||||
"descr" : "",
|
||||
"topic" : ""
|
||||
}
|
||||
15
data/vigets/viget.termometr.json
Normal file
15
data/vigets/viget.termometr.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"id": "",
|
||||
"page": "",
|
||||
"pageId": "",
|
||||
"widget": "steel",
|
||||
"topic": "/DS",
|
||||
"widgetConfig": {
|
||||
"width": "auto",
|
||||
"height": 150,
|
||||
"type": "Linear",
|
||||
"titleString": "Спальня",
|
||||
"unitString": "°C",
|
||||
"threshold": 30
|
||||
}
|
||||
}
|
||||
11
data/vigets/viget.toggle.json
Normal file
11
data/vigets/viget.toggle.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "",
|
||||
"page": "",
|
||||
"pageId": "",
|
||||
"widget": "toggle",
|
||||
"descrStyle": "font-size:20px;float:left;font-weight:bold;",
|
||||
"descrStyleOff": "font-size:20px;float:left;",
|
||||
"color": "#8997ff",
|
||||
"descr": "",
|
||||
"topic": ""
|
||||
}
|
||||
BIN
data/worker-html.js.gz
Normal file
BIN
data/worker-html.js.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user