From 9a3f194de999cbc0e4dacb893a1ac401bfa05866 Mon Sep 17 00:00:00 2001 From: action Date: Thu, 27 Aug 2026 14:50:16 +0800 Subject: [PATCH] update 2026-08-27 14:50:16 --- dae/Makefile | 4 +- luci-app-dockermanager/Makefile | 18 +++ .../luasrc/controller/dockermanager.lua | 129 ++++++++++++++++++ .../luasrc/model/cbi/dockermanager.lua | 28 ++++ .../luasrc/view/dockermanager_status.htm | 28 ++++ .../model/cbi/passwall/client/rule_list.lua | 19 ++- .../luasrc/view/passwall/cbi/footer.htm | 1 - .../view/passwall/rule_list/geoview.htm | 3 +- .../luasrc/view/passwall/rule_list/js.htm | 3 +- shadowsocks-rust/Makefile | 16 +-- 10 files changed, 223 insertions(+), 26 deletions(-) create mode 100644 luci-app-dockermanager/Makefile create mode 100644 luci-app-dockermanager/luasrc/controller/dockermanager.lua create mode 100644 luci-app-dockermanager/luasrc/model/cbi/dockermanager.lua create mode 100644 luci-app-dockermanager/luasrc/view/dockermanager_status.htm diff --git a/dae/Makefile b/dae/Makefile index 7e9d9848..00b4d845 100644 --- a/dae/Makefile +++ b/dae/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dae -PKG_VERSION:=2026.08.26 +PKG_VERSION:=2026.08.27 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=04137361d599099d9b1aa390785137adec72e372 +PKG_SOURCE_VERSION:=bc8b33524b959af90b6fe2d56df4ebbdab1eea8c PKG_SOURCE_URL:=https://github.com/olicesx/dae.git PKG_MIRROR_HASH:=skip diff --git a/luci-app-dockermanager/Makefile b/luci-app-dockermanager/Makefile new file mode 100644 index 00000000..2bae4d5d --- /dev/null +++ b/luci-app-dockermanager/Makefile @@ -0,0 +1,18 @@ +# +# Copyright (C) 2026 LinkEase Contributors +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for Docker Manager +LUCI_DEPENDS:=+dockermanager +luci-lib-linkeaseauth +LUCI_PKGARCH:=all + +PKG_VERSION:=0.1.1 +PKG_RELEASE:=1 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-dockermanager/luasrc/controller/dockermanager.lua b/luci-app-dockermanager/luasrc/controller/dockermanager.lua new file mode 100644 index 00000000..58be67a3 --- /dev/null +++ b/luci-app-dockermanager/luasrc/controller/dockermanager.lua @@ -0,0 +1,129 @@ +module("luci.controller.dockermanager", package.seeall) + +local APPS_PROXY_PREFIX = "/apps=http://127.0.0.1:19290" + +function index() + entry({"admin", "services", "dockermanager_status"}, call("dockermanager_status")) + local open = entry({"admin", "services", "dockermanager", "open"}, call("dockermanager_open")) + open.leaf = true + open.dependent = false + open.sysauth = "root" + open.sysauth_authenticator = "htmlauth" + + if not nixio.fs.access("/etc/config/dockermanager") then + return + end + + entry({"admin", "services", "dockermanager"}, cbi("dockermanager"), _("Docker Manager"), 22).dependent = true +end + +local function uhttpd_has_apps_proxy_prefix() + local uci = require "luci.model.uci".cursor() + local mappings = uci:get_list("uhttpd", "main", "proxy_prefix") or {} + + for _, mapping in ipairs(mappings) do + if mapping == APPS_PROXY_PREFIX then + return true + end + end + return false +end + +local function uhttpd_supports_proxy_prefix() + local sys = require "luci.sys" + return sys.call("grep -qr 'proxy_prefix' /etc/init.d/uhttpd /lib/functions /usr/share/uhttpd 2>/dev/null") == 0 +end + +local function uhttpd_apps_proxy_available() + return uhttpd_supports_proxy_prefix() and uhttpd_has_apps_proxy_prefix() +end + +local function normalized_base_path(path) + path = path or "/apps/dockermanager/" + if path:sub(1, 1) ~= "/" then + path = "/" .. path + end + if path:sub(-1) ~= "/" then + path = path .. "/" + end + return path +end + +local function cookie_encode(value) + return tostring(value or ""):gsub("([^A-Za-z0-9._~-])", function(char) + return string.format("%%%02X", char:byte()) + end) +end + +local function authority_host(authority) + if not authority or authority == "" then + return "" + end + if authority:sub(1, 1) == "[" then + return authority:match("^%[([^%]]+)%]") or "" + end + return authority:match("^([^:]+)") or authority +end + +local function url_authority(host, port) + if not host or host == "" then + host = "127.0.0.1" + end + if host:find(":") and host:sub(1, 1) ~= "[" then + host = "[" .. host .. "]" + end + return host .. ":" .. tostring(port) +end + +local function request_or_lan_host() + local http = require "luci.http" + local uci = require "luci.model.uci".cursor() + local host = authority_host(http.getenv("HTTP_HOST") or "") + if host ~= "" then + return host + end + return uci:get("network", "lan", "ipaddr") or "127.0.0.1" +end + +local function linkease_auth_url(name) + local dispatcher = require "luci.dispatcher" + return dispatcher.build_url("admin", "services", "linkease_auth", name) +end + +local function dockermanager_config() + local uci = require "luci.model.uci".cursor() + local port = uci:get_first("dockermanager", "dockermanager", "port") or "8192" + local base_path = normalized_base_path(uci:get_first("dockermanager", "dockermanager", "base_path")) + return port, base_path +end + +local function dockermanager_entry_url() + local port, base_path = dockermanager_config() + if uhttpd_apps_proxy_available() then + return base_path + end + return "http://" .. url_authority(request_or_lan_host(), port) .. base_path +end + +function dockermanager_status() + local sys = require "luci.sys" + local uci = require "luci.model.uci".cursor() + local port, base_path = dockermanager_config() + + local status = { + running = (sys.call("pidof docker-manager >/dev/null") == 0), + port = port, + base_path = base_path, + lan_ip = uci:get("network", "lan", "ipaddr") or "", + proxy_prefix_supported = uhttpd_supports_proxy_prefix(), + proxy_prefix_enabled = uhttpd_apps_proxy_available() + } + + luci.http.prepare_content("application/json") + luci.http.write_json(status) +end + +function dockermanager_open() + local http = require "luci.http" + http.redirect(linkease_auth_url("auth") .. "?return=" .. cookie_encode(dockermanager_entry_url())) +end diff --git a/luci-app-dockermanager/luasrc/model/cbi/dockermanager.lua b/luci-app-dockermanager/luasrc/model/cbi/dockermanager.lua new file mode 100644 index 00000000..48e1e043 --- /dev/null +++ b/luci-app-dockermanager/luasrc/model/cbi/dockermanager.lua @@ -0,0 +1,28 @@ +local m, s + +m = Map("dockermanager", translate("Docker Manager"), translate("Docker Manager provides a LinkEase Desktop web module and HTTP API for Docker management.")) +m:section(SimpleSection).template = "dockermanager_status" + +s = m:section(TypedSection, "dockermanager", translate("Global settings")) +s.addremove = false +s.anonymous = true + +s:option(Flag, "enabled", translate("Enable")).rmempty = false + +local data_dir = s:option(Value, "data_dir", translate("Data directory")) +data_dir.rmempty = false + +local port = s:option(Value, "port", translate("Listen port")) +port.default = "8192" +port.rmempty = false +port.datatype = "port" + +local bind_addr = s:option(Value, "bind_addr", translate("Bind address")) +bind_addr.default = "0.0.0.0" +bind_addr.rmempty = false + +local base_path = s:option(Value, "base_path", translate("Base path")) +base_path.default = "/apps/dockermanager/" +base_path.rmempty = false + +return m diff --git a/luci-app-dockermanager/luasrc/view/dockermanager_status.htm b/luci-app-dockermanager/luasrc/view/dockermanager_status.htm new file mode 100644 index 00000000..fffad8c5 --- /dev/null +++ b/luci-app-dockermanager/luasrc/view/dockermanager_status.htm @@ -0,0 +1,28 @@ + + +
+ <%:Docker Manager Status%> +

+ <%:Collecting data...%> +

+
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua index 2c08a24c..9cd2194b 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua @@ -1,16 +1,13 @@ local api = require "luci.passwall.api" local fs = api.fs local sys = api.sys -local uci = api.uci local datatypes = api.datatypes -local path = string.format("/usr/share/%s/rules/", api.c_config) -local gfwlist_path = "/usr/share/passwall/rules/gfwlist" -local chnlist_path = "/usr/share/passwall/rules/chnlist" -local chnroute_path = "/usr/share/passwall/rules/chnroute" +local path = string.format("/usr/share/%s/rules/", api.appname) +local gfwlist_path = path .. "gfwlist" +local chnlist_path = path .. "chnlist" +local chnroute_path = path .. "chnroute" -api.set_default_cbi() - -m = Map() +m = Map(api.appname) function clean_text(text) local nbsp = string.char(0xC2, 0xA0) -- 不间断空格(U+00A0) @@ -317,7 +314,7 @@ if fs.access(chnroute_path) then ]], translate("Read List")) end -m:appendTemplate("/rule_list/js") +m:append(Template(api.appname .. "/rule_list/js")) local geo_dir = (api.uci_get_c("@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/") local geosite_path = geo_dir .. "/geosite.dat" @@ -327,7 +324,7 @@ if api.finded_com("geoview") and fs.access(geosite_path) and fs.access(geoip_pat s:tab("geoview", translate("Geo View")) o = s:taboption("geoview", DummyValue, "_geoview_fieldset") o.rawhtml = true - o.template = m:template_path("/rule_list/geoview") + o.template = api.appname .. "/rule_list/geoview" end end @@ -335,4 +332,4 @@ m.on_before_save = function(self) m:set("@global[0]", "flush_set", "1") end -return api.return_map(m) +return m diff --git a/luci-app-passwall/luasrc/view/passwall/cbi/footer.htm b/luci-app-passwall/luasrc/view/passwall/cbi/footer.htm index cd358275..3e780819 100644 --- a/luci-app-passwall/luasrc/view/passwall/cbi/footer.htm +++ b/luci-app-passwall/luasrc/view/passwall/cbi/footer.htm @@ -20,7 +20,6 @@ local map = self.map }); - <% if luci.http.formvalue("cbi.apply") == "1" and map.is_js_luci then -%>