diff --git a/luci-app-store/Makefile b/luci-app-store/Makefile index a2fcbb0bf..93fccd6cb 100644 --- a/luci-app-store/Makefile +++ b/luci-app-store/Makefile @@ -11,13 +11,13 @@ LUCI_DEPENDS:=+curl +opkg +luci-base +tar +coreutils +coreutils-stat +libuci-lua LUCI_EXTRA_DEPENDS:=luci-lib-taskd (>=1.0.17) LUCI_PKGARCH:=all -PKG_VERSION:=0.1.13-3 +PKG_VERSION:=0.1.14-1 # PKG_RELEASE MUST be empty for luci.mk PKG_RELEASE:= -ISTORE_UI_VERSION:=0.1.13 -ISTORE_UI_RELEASE:=3 -PKG_HASH:=edae8745fdc88c954d0be8ee563232410547546280345a61df9d4951658a1f29 +ISTORE_UI_VERSION:=0.1.14 +ISTORE_UI_RELEASE:=1 +PKG_HASH:=4ec3c8ecbba6f1cc205bbba1ee9c8b804ded8fe743150a7c32fc966fc254b50c PKG_SOURCE_URL_FILE:=v$(ISTORE_UI_VERSION)-$(ISTORE_UI_RELEASE).tar.gz PKG_SOURCE:=istore-ui-$(PKG_SOURCE_URL_FILE) @@ -30,6 +30,7 @@ TARGET_CONFIGURE_OPTS+= SED="$(SED)" define Package/luci-app-store/conffiles /etc/.app_store.id +/etc/config/istore endef include $(TOPDIR)/feeds/luci/luci.mk diff --git a/luci-app-store/luasrc/controller/store.lua b/luci-app-store/luasrc/controller/store.lua index ba6de60e7..bbde9e2eb 100644 --- a/luci-app-store/luasrc/controller/store.lua +++ b/luci-app-store/luasrc/controller/store.lua @@ -24,6 +24,7 @@ function index() entry({"admin", "store", "upload"}, post("store_upload")) entry({"admin", "store", "check_self_upgrade"}, call("check_self_upgrade")) entry({"admin", "store", "do_self_upgrade"}, post("do_self_upgrade")) + entry({"admin", "store", "toggle_docker"}, post("toggle_docker")) for _, action in ipairs({"update", "install", "upgrade", "remove"}) do store_api(action, true) @@ -67,6 +68,16 @@ local function user_id() return id end +local function user_config() + local uci = require "luci.model.uci".cursor() + + local data = { + hide_docker = uci:get("istore", "istore", "hide_docker") == "1", + channel = uci:get("istore", "istore", "channel") + } + return data +end + local function vue_lang() local i18n = require("luci.i18n") local lang = i18n.translate("istore_vue_lang") @@ -131,11 +142,14 @@ function store_index() if luci.sys.call("[ -d /ext_overlay ] >/dev/null 2>&1") == 0 then features[#features+1] = "sandbox" end - luci.template.render("store/main", {prefix=luci.dispatcher.build_url(unpack(page_index)),id=user_id(),lang=vue_lang(),features=features}) + if luci.sys.call("[ -f /www/luci-static/resources/luci.js ] >/dev/null 2>&1") == 0 then + features[#features+1] = "luci-js" + end + luci.template.render("store/main", {prefix=luci.dispatcher.build_url(unpack(page_index)),id=user_id(),lang=vue_lang(),user_config=user_config(),features=features}) end function store_dev() - luci.template.render("store/main_dev", {prefix=luci.dispatcher.build_url(unpack({"admin", "store", "dev"})),id=user_id(),lang=vue_lang()}) + luci.template.render("store/main_dev", {prefix=luci.dispatcher.build_url(unpack({"admin", "store", "dev"})),id=user_id(),lang=vue_lang(),user_config=user_config()}) end function store_log() @@ -259,7 +273,7 @@ function store_action(param) code, out, err = _action(myopkg, action, unpack(pkgs)) else -- remove for _, dep in ipairs(meta.depends) do - if dep ~= "docker-deps" then + if dep ~= "docker-deps" and dep ~= "luci-js-deps" then pkgs[#pkgs+1] = dep end end @@ -437,7 +451,7 @@ local function update_local_backup_path(path) if path ~= local_backup_path then -- set uci config x:set("istore","istore","local_backup_path",path) - x:commit("istore") + x:commit("istore") end end @@ -612,7 +626,7 @@ end -- post set_local_backup_dir_path function set_local_backup_dir_path() local path = luci.http.formvalue("path") - local success_ret = {code = 200,msg = "Success"} + local success_ret = {code = 200, msg = "Success"} local error_ret = {code = 500, msg = "Unknown"} if path ~= "" then @@ -715,3 +729,12 @@ function get_block_devices() luci.http.write_json(error_ret) end end + +function toggle_docker() + local uci = require "luci.model.uci".cursor() + local hide = luci.http.formvalue("hide") + uci:set("istore", "istore", "hide_docker", hide == "true" and "1" or "0") + uci:commit("istore") + luci.http.prepare_content("application/json") + luci.http.write_json({code = 200, msg = "Success"}) +end diff --git a/luci-app-store/luasrc/view/store/main.htm b/luci-app-store/luasrc/view/store/main.htm index 8a23fad95..007abfda3 100644 --- a/luci-app-store/luasrc/view/store/main.htm +++ b/luci-app-store/luasrc/view/store/main.htm @@ -20,6 +20,7 @@ window.token = "<%=token%>"; window.device_id = {arch:"<%=id.arch%>",uid:"<%=id.uid%>",version:"<%=id.version%>"}; window.istore_features = <%=jsonc.stringify(features)%>.filter(f => f !== '_lua_force_array_'); + window.istore_config = <%=jsonc.stringify(user_config or {})%>; })();

<%:iStore%> diff --git a/luci-app-store/root/etc/config/istore b/luci-app-store/root/etc/config/istore new file mode 100644 index 000000000..f04d42d16 --- /dev/null +++ b/luci-app-store/root/etc/config/istore @@ -0,0 +1,3 @@ +config istore 'istore' + option hide_docker '0' +# option channel 'istore' diff --git a/luci-app-store/root/usr/share/rpcd/acl.d/luci-app-store.json b/luci-app-store/root/usr/share/rpcd/acl.d/luci-app-store.json new file mode 100644 index 000000000..4be4f3fb9 --- /dev/null +++ b/luci-app-store/root/usr/share/rpcd/acl.d/luci-app-store.json @@ -0,0 +1,11 @@ +{ + "luci-app-store": { + "description": "Grant UCI access for luci-app-store", + "read": { + "uci": [ "istore" ] + }, + "write": { + "uci": [ "istore" ] + } + } +}