enable download of beta releases via webui

This commit is contained in:
proddy
2019-10-30 22:45:54 +01:00
parent 8570a707ae
commit e5920151b7
4 changed files with 72 additions and 62 deletions

View File

@@ -62,9 +62,9 @@ deploy:
file: "*.bin"
name: latest development build
release_notes:
Automatic firmware builds of the current EMS-ESP branch for version $FIRMWARE_VERSION.
This is work in progress and not fully tested. Use at your own risk.
Built by Travis CI on $(date +'%F %T %Z') from commit $TRAVIS_COMMIT.
Version $FIRMWARE_VERSION.
Automatic firmware builds of the current EMS-ESP branch built on $(date +'%F %T %Z') from commit $TRAVIS_COMMIT.
Warning, this is a development build and not fully tested. Use at your own risk.
cleanup: false
prerelease: true
overwrite: true

View File

@@ -194,7 +194,10 @@
</div>
<div class="modal-body">
<div>
<h4>Latest Stable Release</h4>
<div>
<button id="updateb" onclick="switchfirmware()" type="submit" class="btn btn-success btn-sm pull-right">Official Release</button>
</div>
<div id="onlineupdate">
<h5 id=releasehead></h5>
<div style="clear:both;">

View File

@@ -8,6 +8,24 @@ var ajaxobj;
var custom_config = {};
var xDown = null;
var yDown = null;
var page = 1;
var haspages;
var file = {};
var backupstarted = false;
var updateurl = "";
var updateurl_dev = "";
var use_beta_firmware = false;
var myespcontent;
var formData = new FormData();
var nextIsNotJson = false;
var config = {
"command": "configfile",
"network": {
@@ -40,14 +58,6 @@ var config = {
}
};
var page = 1;
var haspages;
var file = {};
var backupstarted = false;
var updateurl = "";
var myespcontent;
function browserTime() {
var d = new Date(0);
var c = new Date();
@@ -209,8 +219,6 @@ function savenetwork() {
saveconfig();
}
var formData = new FormData();
function inProgress(callback) {
$("body").load("myesp.html #progresscontent", function (responseTxt, statusTxt, xhr) {
if (statusTxt === "success") {
@@ -510,6 +518,7 @@ function getContent(contentname) {
$("#appurl2").text(ajaxobj.appurl);
updateurl = ajaxobj.updateurl;
updateurl_dev = ajaxobj.updateurl_dev;
listCustomStats();
break;
default:
@@ -734,8 +743,6 @@ function initMQTTLogTable() {
});
}
var nextIsNotJson = false;
function socketMessageListener(evt) {
var obj = JSON.parse(evt.data);
if (obj.hasOwnProperty("command")) {
@@ -814,46 +821,6 @@ function restart() {
inProgress("restart");
}
$("#dismiss, .overlay").on("click", function () {
$("#sidebar").removeClass("active");
$(".overlay").fadeOut();
});
$("#sidebarCollapse").on("click", function () {
$("#sidebar").addClass("active");
$(".overlay").fadeIn();
$(".collapse.in").toggleClass("in");
$("a[aria-expanded=true]").attr("aria-expanded", "false");
});
$("#custom_status").click(function () {
websock.send("{\"command\":\"custom_status\"}");
return false;
});
$("#status").click(function () {
websock.send("{\"command\":\"status\"}");
return false;
});
$("#custom").click(function () { getContent("#customcontent"); return false; });
$("#network").on("click", (function () { getContent("#networkcontent"); return false; }));
$("#general").click(function () { getContent("#generalcontent"); return false; });
$("#mqtt").click(function () { getContent("#mqttcontent"); return false; });
$("#ntp").click(function () { getContent("#ntpcontent"); return false; });
$("#backup").click(function () { getContent("#backupcontent"); return false; });
$("#reset").click(function () { $("#destroy").modal("show"); return false; });
$("#restart").click(function () { $("#reboot").modal("show"); return false; });
$("#eventlog").click(function () { getContent("#eventcontent"); return false; });
$(".noimp").on("click", function () {
$("#noimp").modal("show");
});
var xDown = null;
var yDown = null;
function handleTouchStart(evt) {
xDown = evt.touches[0].clientX;
yDown = evt.touches[0].clientY;
@@ -953,8 +920,26 @@ function login() {
}
}
function switchfirmware() {
if (use_beta_firmware) {
use_beta_firmware = false;
document.getElementById("updateb").innerHTML = "Official Release";
} else {
use_beta_firmware = true;
document.getElementById("updateb").innerHTML = "Beta Build";
}
getLatestReleaseInfo();
}
function getLatestReleaseInfo() {
$.getJSON(updateurl).done(function (release) {
if (use_beta_firmware) {
var url = updateurl_dev;
} else {
var url = updateurl;
}
$.getJSON(url).done(function (release) {
var asset = release.assets[0];
var downloadCount = 0;
for (var i = 0; i < release.assets.length; i++) {
@@ -978,10 +963,6 @@ function getLatestReleaseInfo() {
}).error(function () { $("#onlineupdate").html("<h5>Couldn't get release details. Make sure there is an Internet connection.</h5>"); });
}
$("#update").on("shown.bs.modal", function (e) {
getLatestReleaseInfo();
});
function allowUpload() {
$("#upbtn").prop("disabled", false);
}
@@ -1014,5 +995,31 @@ function refreshStatus() {
websock.send("{\"command\":\"status\"}");
}
$("#dismiss, .overlay").on("click", function () {
$("#sidebar").removeClass("active");
$(".overlay").fadeOut();
});
$("#sidebarCollapse").on("click", function () {
$("#sidebar").addClass("active");
$(".overlay").fadeIn();
$(".collapse.in").toggleClass("in");
$("a[aria-expanded=true]").attr("aria-expanded", "false");
});
$("#custom_status").click(function () { websock.send("{\"command\":\"custom_status\"}"); return false; });
$("#status").click(function () { websock.send("{\"command\":\"status\"}"); return false; });
$("#custom").click(function () { getContent("#customcontent"); return false; });
$("#network").on("click", (function () { getContent("#networkcontent"); return false; }));
$("#general").click(function () { getContent("#generalcontent"); return false; });
$("#mqtt").click(function () { getContent("#mqttcontent"); return false; });
$("#ntp").click(function () { getContent("#ntpcontent"); return false; });
$("#backup").click(function () { getContent("#backupcontent"); return false; });
$("#reset").click(function () { $("#destroy").modal("show"); return false; });
$("#restart").click(function () { $("#reboot").modal("show"); return false; });
$("#eventlog").click(function () { getContent("#eventcontent"); return false; });
$(".noimp").on("click", function () { $("#noimp").modal("show"); });
$("#update").on("shown.bs.modal", function (e) { getLatestReleaseInfo(); });
document.addEventListener("touchstart", handleTouchStart, false);
document.addEventListener("touchmove", handleTouchMove, false);

View File

@@ -1,6 +1,6 @@
#!/bin/sh
node $PWD/../webfilesbuilder/node_modules/gulp/bin/gulp.js --silent --cwd $PWD/../webfilesbuilder
node $PWD/../webfilesbuilder/node_modules/gulp/bin/gulp.js --cwd $PWD/../webfilesbuilder
open -na Google\ Chrome --args --disable-web-security --remote-debugging-port=9222 --user-data-dir="/tmp/chrome_dev" $PWD/../../src/websrc/temp/index.html