diff options
-rw-r--r-- | applications/luci-app-attendedsysupgrade/Makefile | 2 | ||||
-rw-r--r-- | applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm | 36 | ||||
-rw-r--r-- | applications/luci-app-samba/luasrc/model/cbi/samba.lua | 3 | ||||
-rw-r--r-- | modules/luci-base/Makefile | 1 | ||||
-rw-r--r-- | modules/luci-base/luasrc/dispatcher.lua | 17 |
5 files changed, 41 insertions, 18 deletions
diff --git a/applications/luci-app-attendedsysupgrade/Makefile b/applications/luci-app-attendedsysupgrade/Makefile index 32992e19df..8d7a6163de 100644 --- a/applications/luci-app-attendedsysupgrade/Makefile +++ b/applications/luci-app-attendedsysupgrade/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=LuCI support for attended sysupgrades -LUCI_DEPENDS:=+luci-base +rpcd-mod-attendedsysupgrade +LUCI_DEPENDS:=+luci-base +uhttpd-mod-ubus +rpcd-mod-attendedsysupgrade include ../../luci.mk diff --git a/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm b/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm index 4f8bf7cc9a..9160674e58 100644 --- a/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm +++ b/applications/luci-app-attendedsysupgrade/luasrc/view/attendedsysupgrade.htm @@ -1,12 +1,17 @@ <%+header%> <h2 name="content"><%:Attended Sysupgrade%></h2> -<div class="container"> - <div style="display: none" id="update_info" class="alert-message info"> - </div> - <div style="display: none" id="update_error" class="alert-message danger"> - </div> +<div class="container"> + <div style="display: none" id="update_info" class="alert-message info"></div> + <div style="display: none" id="update_error" class="alert-message danger"></div> </div> <input class="cbi-button" value="search for updates" onclick="update_request()" type="button" id="update_button"> +<div style="display: none" id="packages" class="alert-message success"></div> +<div class="cbi-value" id="keep_container" style="display: none"> + <label class="cbi-value-title" for="keep">keep settings:</label> + <div class="cbi-value-field"> + <input type="checkbox" name="keep" id="keep" checked="checked" /> + </div> +</div> <script type="text/javascript"> @@ -22,7 +27,6 @@ function server_request(request_dict, path, callback) { request_dict.distro = data.release.distribution; request_dict.target = data.release.target.split("\/")[0]; request_dict.subtarget = data.release.target.split("\/")[1]; - request_dict.packages = data.packagelist; var xmlhttp = new XMLHttpRequest(); xmlhttp.open("POST", url, true); xmlhttp.setRequestHeader("Content-type", "application/json"); @@ -37,7 +41,6 @@ function server_request(request_dict, path, callback) { // requests ubus via rpcd function ubus_request(command, argument, params, callback) { - // perform login if ubus_rpc_session is empty var request_data = '{ "jsonrpc": "2.0", "id": ' + ubus_counter + ', "method": "call", "params": [ "'+ data["ubus_rpc_session"] +'", "' + command + '", "' + argument + '", ' + params + ' ] }' ubus_counter++ var xmlhttp = new XMLHttpRequest(); @@ -107,6 +110,7 @@ function update_request() { console.log("update_request") request_dict = {} request_dict.version = data.release.version; + request_dict.packages = data.packagelist; server_request(request_dict, "update-request", update_request_callback) } @@ -161,11 +165,16 @@ function back_online_callback(response_object) { function update_request_200(response_content) { info_output = "" if(response_content.version != undefined) { - info_output += "new update available. from " + data.release.version + " to " + response_content.version + info_output += "<h3>new update available</h3>" + info_output += data.release.version + " to " + response_content.version latest_version = response_content.version; } - if(response_content.packages != undefined) { - info_output += "package updates available" + if(response_content.updates != undefined) { + info_output += "<h3>package updates available</h3>" + for (update in response_content.updates) { + info_output += "<b>" + update + "</b>: " + response_content.updates[update][1] + " to " + response_content.updates[update][0] + "</br>" + } + data.packages = response_content.packages } update_info(info_output) document.getElementById("update_button").value = "request image"; @@ -178,6 +187,7 @@ function image_request() { request_dict = {} request_dict.version = latest_version; request_dict.board = data.board_name + request_dict.packages = data.packages; server_request(request_dict, "image-request", image_request_handler) } @@ -211,8 +221,9 @@ function image_request_handler(response) { // ready to download response_content = JSON.parse(response.responseText) update_info("image created") - document.getElementById("update_button").value = "download and flash" + document.getElementById("update_button").value = "sysupgrade" document.getElementById("update_button").onclick = function() {download_image(response_content.url); } + document.getElementById("keep_container").style.display = "block"; } } @@ -230,7 +241,8 @@ function upload_image(blob) { upload_request.addEventListener('load', function(event) { // this checksum should be parsed document.getElementById("update_info").innerHTML = "flashing... please wait" // show fancy indicator http://www.ajaxload.info/ - ubus_request("attendedsysupgrade", "sysupgrade", '{ }', 'done'); + + ubus_request("attendedsysupgrade", "sysupgrade", '{ "keep_settings": ' + document.getElementById("keep").checked + ' }', 'done'); }); upload_request.addEventListener('error', function(event) { diff --git a/applications/luci-app-samba/luasrc/model/cbi/samba.lua b/applications/luci-app-samba/luasrc/model/cbi/samba.lua index 68a5b3a9bc..2e533c3f57 100644 --- a/applications/luci-app-samba/luasrc/model/cbi/samba.lua +++ b/applications/luci-app-samba/luasrc/model/cbi/samba.lua @@ -36,7 +36,8 @@ function tmpl.write(self, section, value) end -s = m:section(TypedSection, "sambashare", translate("Shared Directories")) +s = m:section(TypedSection, "sambashare", translate("Shared Directories") + , translate("Please add directories to share. Each directory refers to a folder on a mounted device.")) s.anonymous = true s.addremove = true s.template = "cbi/tblsection" diff --git a/modules/luci-base/Makefile b/modules/luci-base/Makefile index cc57ce8ee1..291789cb64 100644 --- a/modules/luci-base/Makefile +++ b/modules/luci-base/Makefile @@ -26,6 +26,7 @@ include $(INCLUDE_DIR)/host-build.mk define Package/luci-base/conffiles /etc/luci-uploads /etc/config/luci +/etc/config/ucitrack endef include ../../luci.mk diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua index 1b684aa79c..e4f77f18d8 100644 --- a/modules/luci-base/luasrc/dispatcher.lua +++ b/modules/luci-base/luasrc/dispatcher.lua @@ -219,10 +219,19 @@ function dispatch(request) local lang = conf.main.lang or "auto" if lang == "auto" then local aclang = http.getenv("HTTP_ACCEPT_LANGUAGE") or "" - for lpat in aclang:gmatch("[%w-]+") do - lpat = lpat and lpat:gsub("-", "_") - if conf.languages[lpat] then - lang = lpat + for aclang in aclang:gmatch("[%w_-]+") do + local country, culture = aclang:match("^([a-z][a-z])[_-]([a-zA-Z][a-zA-Z])$") + if country and culture then + local cc = "%s_%s" %{ country, culture:lower() } + if conf.languages[cc] then + lang = cc + break + elseif conf.languages[country] then + lang = country + break + end + elseif conf.languages[aclang] then + lang = aclang break end end |