From 41fd8beabbcf9ef362e57d0e67e87edc65211cc5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 23:36:39 +0800 Subject: [PATCH] update 2023-07-31 23:36:39 --- luci-app-store/Makefile | 9 ++--- luci-app-store/luasrc/controller/store.lua | 33 ++++++++++++++++--- luci-app-store/luasrc/view/store/main.htm | 1 + luci-app-store/root/etc/config/istore | 3 ++ .../usr/share/rpcd/acl.d/luci-app-store.json | 11 +++++++ 5 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 luci-app-store/root/etc/config/istore create mode 100644 luci-app-store/root/usr/share/rpcd/acl.d/luci-app-store.json 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 {})%>; })();