From 7bfc46af0fd221fe0c089afd8d844cf3a1faf848 Mon Sep 17 00:00:00 2001 From: Christian Herzog Date: Thu, 26 Sep 2019 19:37:51 +0200 Subject: [PATCH] make FW URL editable --- components/wifi-manager/code.js | 21 +++++++++++--------- components/wifi-manager/index.html | 2 ++ components/wifi-manager/style.css | 31 +----------------------------- 3 files changed, 15 insertions(+), 39 deletions(-) diff --git a/components/wifi-manager/code.js b/components/wifi-manager/code.js index 447834b4..75e205b1 100644 --- a/components/wifi-manager/code.js +++ b/components/wifi-manager/code.js @@ -213,6 +213,15 @@ $(document).ready(function(){ }); $("#recovery").on("click", function() { + var url = $("#fwurl").val(); + $.ajax({ + url: '/config.json', + dataType: 'json', + method: 'POST', + cache: false, + headers: { "X-Custom-fwurl": url }, + data: { 'timestamp': Date.now() } + }); $.ajax({ url: '/recovery.json', dataType: 'json', @@ -305,14 +314,8 @@ $(document).ready(function(){ function setURL(button) { var url = button.dataset.url; - $.ajax({ - url: '/config.json', - dataType: 'json', - method: 'POST', - cache: false, - headers: { "X-Custom-fwurl": url }, - data: { 'timestamp': Date.now() } - }); + $("#fwurl").val(url); + $('[data-url^="http"]').addClass("btn-success").removeClass("btn-danger"); $('[data-url="'+url+'"]').addClass("btn-danger").removeClass("btn-success"); } @@ -491,7 +494,7 @@ function getConfig() { if (data.hasOwnProperty('recovery')) { if (data["recovery"] === 1) { recovery = true; - $("#recoverydiv").hide(); + //$("#recoverydiv").hide(); $("#otadiv").show(); } else { recovery = false; diff --git a/components/wifi-manager/index.html b/components/wifi-manager/index.html index 18ab0b72..fb1e9625 100644 --- a/components/wifi-manager/index.html +++ b/components/wifi-manager/index.html @@ -217,6 +217,8 @@ +

Firmware URL:

+

Reboot to recovery system to perform firmware upgrade

diff --git a/components/wifi-manager/style.css b/components/wifi-manager/style.css index 00ce8ccc..85cc4937 100644 --- a/components/wifi-manager/style.css +++ b/components/wifi-manager/style.css @@ -213,8 +213,6 @@ input[type='text'], input[type='password'], textarea { padding: 4px; } - - .custom-switch, .custom-radio { padding-left: 2.25rem; margin-left: 12px; @@ -263,14 +261,7 @@ input[type='text'], input[type='password'], textarea { transform: translateX(1.5rem); //translateX(0.75rem); } - - - - - - - -textarea#autoexec1 { +textarea#autoexec1, textarea#fwurl { width: 80%; } @@ -299,23 +290,3 @@ input, textarea { font-family: monospace, monospace; font-size: 70%; } - -/* -.toggle-buttons input[type="radio"] { - visibility: hidden; - width: 3px; - margin-top: 10px; -} - -.toggle-buttons label { - border: 1px solid #000; - border-radius: 0.5em; - padding: 0.5em; -} - -.toggle-buttons input:checked + label { - background: #5a9900; - box-shadow: none; -} - -*/