From ce997339e77b08c983e30468d935da471cf9aabc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 08:30:37 +0800 Subject: [PATCH] update-09.28 --- aliyundrive-webdav/Makefile | 2 +- cups/Makefile | 80 ++++++++++++++++--- cups/files/cupsd.init | 20 ++--- cups/files/etc/cups/cupsd.conf | 4 +- cups/patches/150-64bit_host_fix.patch | 33 -------- luci-app-aliyundrive-webdav/Makefile | 2 +- luci-app-netspeedtest/Makefile | 19 ++--- .../root/etc/init.d/speedtest | 55 +++++++------ .../usr/share/netspeedtest/netspeedtest.txt | 1 + .../rpcd/acl.d/luci-app-netspeedtest.json | 11 +++ luci-app-passwall/Makefile | 4 +- .../model/cbi/passwall/api/gen_v2ray.lua | 43 +++++----- .../model/cbi/passwall/client/global.lua | 4 +- .../model/cbi/passwall/client/haproxy.lua | 4 + .../model/cbi/passwall/client/node_config.lua | 14 ++-- .../model/cbi/passwall/client/shunt_rules.lua | 2 +- .../luasrc/model/cbi/passwall/server/user.lua | 2 +- luci-app-passwall/po/zh-cn/passwall.po | 4 +- .../root/usr/share/passwall/0_default_config | 22 +++-- .../root/usr/share/passwall/subscribe.lua | 61 ++++++-------- luci-app-ssr-plus/Makefile | 4 +- 21 files changed, 214 insertions(+), 177 deletions(-) delete mode 100644 cups/patches/150-64bit_host_fix.patch create mode 100644 luci-app-netspeedtest/root/usr/share/rpcd/acl.d/luci-app-netspeedtest.json diff --git a/aliyundrive-webdav/Makefile b/aliyundrive-webdav/Makefile index d9e727f24..1fe2e1adf 100644 --- a/aliyundrive-webdav/Makefile +++ b/aliyundrive-webdav/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=aliyundrive-webdav -PKG_VERSION:=0.3.0 +PKG_VERSION:=0.3.1 PKG_RELEASE:=1 PKG_LICENSE:=MIT diff --git a/cups/Makefile b/cups/Makefile index c1c43e105..7d410ca77 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -9,11 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cups -PKG_VERSION:=2.3.0 -PKG_RELEASE:=2 +PKG_VERSION:=2.3.3 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-source.tar.gz PKG_SOURCE_URL:=https://github.com/apple/cups/releases/download/v$(PKG_VERSION) +#PKG_SOURCE_URL:=http://www.cups.org/software/$(PKG_VERSION) PKG_MD5SUM:=skip TARGET_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib @@ -29,7 +30,7 @@ define Package/cups $(call Package/cups/Default) SECTION:=net CATEGORY:=Network - DEPENDS:=+libcups +libusb-1.0 +libstdcpp + DEPENDS:=+libcups +libcupsmime +libcupscgi +libcupsppdc +libusb-1.0 TITLE:=Common UNIX Printing System (daemon) endef @@ -59,7 +60,7 @@ define Package/cups-client $(call Package/cups/Default) SECTION:=net CATEGORY:=Network - DEPENDS:=+libcups +libcupsimage + DEPENDS:=+libcups +libcupsimage +libcupsmime TITLE:=Common UNIX Printing System - Client commands endef @@ -87,7 +88,7 @@ define Package/cups-ppdc $(call Package/cups/Default) SECTION:=net CATEGORY:=Network - DEPENDS:=+libcups +zlib +libpthread +libpng +libjpeg +libstdcpp + DEPENDS:=+libcupsppdc TITLE:=Common UNIX Printing System - PPDC utils endef @@ -106,6 +107,18 @@ endef define Package/libcups/description Common UNIX Printing System - Core library endef + + define Package/libcupscgi +$(call Package/cups/Default) + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+libcups + TITLE:=Common UNIX Printing System - CGI library +endef + +define Package/libcupscgi/description + Common UNIX Printing System - CGI library +endef define Package/libcupsimage $(call Package/cups/Default) @@ -119,6 +132,30 @@ define Package/libcupsimage/description Common UNIX Printing System - Image library endef +define Package/libcupsmime +$(call Package/cups/Default) + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+libcups + TITLE:=Common UNIX Printing System - MIME library +endef + +define Package/libcupsmime/description + Common UNIX Printing System - MIME library +endef + +define Package/libcupsppdc +$(call Package/cups/Default) + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+libcups +libstdcpp + TITLE:=Common UNIX Printing System - PPDC library +endef + +define Package/libcupsppdc/description + Common UNIX Printing System - PPDC library +endef + define Build/Configure $(call Build/Configure/Default, \ --with-cups-user="nobody" \ @@ -172,6 +209,10 @@ define Package/cups/install $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/daemon $(1)/usr/lib/cups $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/driver $(1)/usr/lib/cups $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/monitor $(1)/usr/lib/cups + $(INSTALL_DIR) $(1)/usr/lib/cups/filter +### $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/filter/{commandtops,pstops} \ + $(PKG_INSTALL_DIR)/usr/lib/cups/filter/gziptoany \ + $(1)/usr/lib/cups/filter $(INSTALL_DIR) $(1)/usr/share/cups/templates $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/templates/*.tmpl \ $(1)/usr/share/cups/templates/ @@ -219,14 +260,11 @@ define Package/cups-client/install $(PKG_INSTALL_DIR)/usr/sbin/{lpadmin,lpinfo,lpmove} \ $(1)/usr/sbin/ (cd $(1)/usr/sbin; ln -sf cupsaccept accept; ln -sf cupsaccept cupsenable; ln -sf cupsaccept cupsdisable; ln -sf cupsaccept reject; ln -sf cupsaccept cupsreject;) - $(INSTALL_DIR) $(1)/usr/share/cups/ipptool - $(CP) $(PKG_INSTALL_DIR)/usr/share/cups/ipptool/* \ - $(1)/usr/share/cups/ipptool endef define Package/cups-filters/install $(INSTALL_DIR) $(1)/usr/lib/cups/filter - $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/filter/{commandtops,gziptoany,pstops,rastertoepson,rastertohp,rastertolabel,rastertopwg} \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/cups/filter/{rastertoepson,rastertohp,rastertolabel,rastertopwg} \ $(1)/usr/lib/cups/filter (cd $(1)/usr/lib/cups/filter; ln -sf rastertolabel rastertodymo;) endef @@ -240,12 +278,27 @@ endef define Package/libcups/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcups.so* $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/cups/libcups.so* $(1)/usr/lib/ +endef + +define Package/libcupscgi/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/cgi-bin/libcupscgi.a $(1)/usr/lib/ endef define Package/libcupsimage/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcupsimage.so* $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/cups/libcupsimage.so* $(1)/usr/lib/ +endef + +define Package/libcupsmime/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/scheduler/libcupsmime.a $(1)/usr/lib/ +endef + +define Package/libcupsppdc/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/ppdc/libcupsppdc.a $(1)/usr/lib/ endef define Build/InstallDev @@ -254,12 +307,15 @@ define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/cups $(1)/usr/include/ $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcups*.so* $(1)/usr/lib/ + $(CP) $(PKG_BUILD_DIR)/cups/libcups*.so* $(1)/usr/lib/ endef $(eval $(call BuildPackage,cups)) $(eval $(call BuildPackage,libcups)) +$(eval $(call BuildPackage,libcupscgi)) $(eval $(call BuildPackage,libcupsimage)) +$(eval $(call BuildPackage,libcupsmime)) +$(eval $(call BuildPackage,libcupsppdc)) $(eval $(call BuildPackage,cups-bsd)) $(eval $(call BuildPackage,cups-client)) $(eval $(call BuildPackage,cups-filters)) diff --git a/cups/files/cupsd.init b/cups/files/cupsd.init index 5e278a97d..e5f00da9a 100644 --- a/cups/files/cupsd.init +++ b/cups/files/cupsd.init @@ -4,24 +4,16 @@ START=50 start() { - enable=$(uci get cupsd.config.enabled 2>/dev/null) - if [ $enable -eq 1 ]; then - sed -i 's/Port [0-9]*/Port '"$(uci get cupsd.config.port)"'/g' /etc/cups/cupsd.conf - mkdir -m 0755 -p /var/cache/cups - mkdir -m 0755 -p /var/cups - mkdir -m 0755 -p /var/spool/cups/tmp - service_start /usr/sbin/cupsd - fi + mkdir -m 0755 -p /var/cache/cups + mkdir -m 0755 -p /var/cups + mkdir -m 0755 -p /var/spool/cups/tmp + service_start /usr/sbin/cupsd } stop() { service_stop /usr/sbin/cupsd - kill $(pidof cupsd) >/dev/null 2>&1 || killall -9 cupsd >/dev/null 2>&1 } -reload(){ - stop - sleep 2 - start - echo "cupsd Server has restarted." +reload() { + service_reload /usr/sbin/cupsd } diff --git a/cups/files/etc/cups/cupsd.conf b/cups/files/etc/cups/cupsd.conf index 219404545..92857c4e7 100644 --- a/cups/files/etc/cups/cupsd.conf +++ b/cups/files/etc/cups/cupsd.conf @@ -46,7 +46,7 @@ ServerAlias * Order Allow,Deny Allow From 127.0.0.1 -Allow From 192.168.0.0/16 +Allow From 192.168.1.0/24 @@ -54,5 +54,5 @@ AuthType Basic AuthClass System Order Allow,Deny Allow From 127.0.0.1 -Allow From 192.168.0.0/16 +Allow From 192.168.1.0/24 diff --git a/cups/patches/150-64bit_host_fix.patch b/cups/patches/150-64bit_host_fix.patch deleted file mode 100644 index 1d41bf95a..000000000 --- a/cups/patches/150-64bit_host_fix.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/config-scripts/cups-directories.m4 -+++ b/config-scripts/cups-directories.m4 -@@ -102,7 +102,7 @@ if test "$libdir" = "\${exec_prefix}/lib"; then - case "$host_os_name" in - linux*) - if test -d /usr/lib64 -a ! -d /usr/lib64/fakeroot; then -- libdir="$exec_prefix/lib64" -+ libdir="$exec_prefix/lib" - fi - ;; - esac ---- "a/configure" -+++ "b/configure" -@@ -6188,7 +6188,7 @@ if test "$libdir" = "\${exec_prefix}/lib"; then - case "$host_os_name" in - linux*) - if test -d /usr/lib64 -a ! -d /usr/lib64/fakeroot; then -- libdir="$exec_prefix/lib64" -+ libdir="$exec_prefix/lib" - fi - ;; - esac ---- a/cups-config.in -+++ b/cups-config.in -@@ -48,7 +48,7 @@ else - CFLAGS="$CFLAGS -I$includedir" - fi - -- if test $libdir != /usr/lib -a $libdir != /usr/lib32 -a $libdir != /usr/lib64; then -+ if test $libdir != /usr/lib -a $libdir != /usr/lib -a $libdir != /usr/lib; then - LDFLAGS="$LDFLAGS -L$libdir" - fi - fi diff --git a/luci-app-aliyundrive-webdav/Makefile b/luci-app-aliyundrive-webdav/Makefile index 383a6cc95..e1ec70de3 100644 --- a/luci-app-aliyundrive-webdav/Makefile +++ b/luci-app-aliyundrive-webdav/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-aliyundrive-webdav -PKG_VERSION:=0.3.0 +PKG_VERSION:=0.3.1 PKG_RELEASE:=1 PKG_PO_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE) diff --git a/luci-app-netspeedtest/Makefile b/luci-app-netspeedtest/Makefile index 40d4c2577..4d29ae52d 100644 --- a/luci-app-netspeedtest/Makefile +++ b/luci-app-netspeedtest/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-netspeedtest PKG_VERSION:=1.6 -PKG_RELEASE:=20210415 +PKG_RELEASE:=20210511 PKG_LICENSE:=GPLv2 PKG_MAINTAINER:=sirpdboy @@ -19,20 +19,15 @@ define Package/$(PKG_NAME) CATEGORY:=LuCI SUBMENU:=3. Applications TITLE:=LuCI Support for netspeedtest - DEPENDS:=+python3 +iperf3 - DESCRIPTION:=LuCI support Network speed test intranet and Extranet - PKGARCH:=all + DEPENDS:=+python3 +iperf3 + DESCRIPTION:=LuCI support Network speed test intranet and Extranet + PKGARCH:=all endef define Package/$(PKG_NAME)/description Luci Support for netspeedtest. endef -define Build/Prepare - $(foreach po,$(wildcard ${CURDIR}/po/zh-cn/*.po), \ - po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));) -endef - define Build/Compile endef @@ -46,10 +41,8 @@ define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/ cp -pR ./root/* $(1)/ $(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n - $(INSTALL_DATA) $(PKG_BUILD_DIR)/netspeedtest.lmo $(1)/usr/lib/lua/luci/i18n/ + po2lmo ./po/zh-cn/netspeedtest.po $(1)/usr/lib/lua/luci/i18n/netspeedtest.lmo endef -include $(TOPDIR)/feeds/luci/luci.mk - -# call BuildPackage - OpenWrt buildroot signature +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/luci-app-netspeedtest/root/etc/init.d/speedtest b/luci-app-netspeedtest/root/etc/init.d/speedtest index a33296d3a..186b52929 100644 --- a/luci-app-netspeedtest/root/etc/init.d/speedtest +++ b/luci-app-netspeedtest/root/etc/init.d/speedtest @@ -15,18 +15,18 @@ # License for the specific language governing permissions and limitations # under the License. -import os -import re import csv -import sys -import math +import datetime import errno +import math +import os +import platform +import re import signal import socket -import timeit -import datetime -import platform +import sys import threading +import timeit import xml.parsers.expat try: @@ -36,7 +36,7 @@ except ImportError: gzip = None GZIP_BASE = object -__version__ = '2.1.3' +__version__ = '2.1.4b1' class FakeShutdownEvent(object): @@ -49,6 +49,8 @@ class FakeShutdownEvent(object): "Dummy method to always return false""" return False + is_set = isSet + # Some global variables we use DEBUG = False @@ -56,6 +58,7 @@ _GLOBAL_DEFAULT_TIMEOUT = object() PY25PLUS = sys.version_info[:2] >= (2, 5) PY26PLUS = sys.version_info[:2] >= (2, 6) PY32PLUS = sys.version_info[:2] >= (3, 2) +PY310PLUS = sys.version_info[:2] >= (3, 10) # Begin import game to handle Python 2 and Python 3 try: @@ -266,17 +269,6 @@ else: write(arg) write(end) -if PY32PLUS: - etree_iter = ET.Element.iter -elif PY25PLUS: - etree_iter = ET_Element.getiterator - -if PY26PLUS: - thread_is_alive = threading.Thread.is_alive -else: - thread_is_alive = threading.Thread.isAlive - - # Exception "constants" to support Python 2 through Python 3 try: import ssl @@ -293,6 +285,23 @@ except ImportError: ssl = None HTTP_ERRORS = (HTTPError, URLError, socket.error, BadStatusLine) +if PY32PLUS: + etree_iter = ET.Element.iter +elif PY25PLUS: + etree_iter = ET_Element.getiterator + +if PY26PLUS: + thread_is_alive = threading.Thread.is_alive +else: + thread_is_alive = threading.Thread.isAlive + + +def event_is_set(event): + try: + return event.is_set() + except AttributeError: + return event.isSet() + class SpeedtestException(Exception): """Base exception for this module""" @@ -769,7 +778,7 @@ def print_dots(shutdown_event): status """ def inner(current, total, start=False, end=False): - if shutdown_event.isSet(): + if event_is_set(shutdown_event): return sys.stdout.write('.') @@ -808,7 +817,7 @@ class HTTPDownloader(threading.Thread): try: if (timeit.default_timer() - self.starttime) <= self.timeout: f = self._opener(self.request) - while (not self._shutdown_event.isSet() and + while (not event_is_set(self._shutdown_event) and (timeit.default_timer() - self.starttime) <= self.timeout): self.result.append(len(f.read(10240))) @@ -864,7 +873,7 @@ class HTTPUploaderData(object): def read(self, n=10240): if ((timeit.default_timer() - self.start) <= self.timeout and - not self._shutdown_event.isSet()): + not event_is_set(self._shutdown_event)): chunk = self.data.read(n) self.total.append(len(chunk)) return chunk @@ -902,7 +911,7 @@ class HTTPUploader(threading.Thread): request = self.request try: if ((timeit.default_timer() - self.starttime) <= self.timeout and - not self._shutdown_event.isSet()): + not event_is_set(self._shutdown_event)): try: f = self._opener(request) except TypeError: diff --git a/luci-app-netspeedtest/root/usr/share/netspeedtest/netspeedtest.txt b/luci-app-netspeedtest/root/usr/share/netspeedtest/netspeedtest.txt index e69de29bb..0519ecba6 100644 --- a/luci-app-netspeedtest/root/usr/share/netspeedtest/netspeedtest.txt +++ b/luci-app-netspeedtest/root/usr/share/netspeedtest/netspeedtest.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/luci-app-netspeedtest/root/usr/share/rpcd/acl.d/luci-app-netspeedtest.json b/luci-app-netspeedtest/root/usr/share/rpcd/acl.d/luci-app-netspeedtest.json new file mode 100644 index 000000000..3e1fcab6b --- /dev/null +++ b/luci-app-netspeedtest/root/usr/share/rpcd/acl.d/luci-app-netspeedtest.json @@ -0,0 +1,11 @@ +{ + "luci-app-netspeedtest": { + "description": "Grant UCI access for luci-app-netspeedtest", + "read": { + "uci": [ "netspeedtest" ] + }, + "write": { + "uci": [ "netspeedtest" ] + } + } +} diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 2efe787a6..ad9d04fc8 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -6,9 +6,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=4.35 +PKG_VERSION:=4.36 PKG_RELEASE:=1 -#20210921 +#20210928 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Brook \ diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_v2ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_v2ray.lua index 8d44d5c44..f6a66fe09 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_v2ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_v2ray.lua @@ -43,7 +43,13 @@ local function get_new_port() return new_port end -function gen_outbound(node, tag, is_proxy, proxy_tag) +function gen_outbound(node, tag, proxy_table) + local proxy = 0 + local proxy_tag = "nil" + if proxy_table ~= nil and type(proxy_table) == "table" then + proxy = proxy_table.proxy or 0 + proxy_tag = proxy_table.tag or "nil" + end local result = nil if node and node ~= "nil" then local node_id = node[".name"] @@ -52,8 +58,8 @@ function gen_outbound(node, tag, is_proxy, proxy_tag) end if node.type == "V2ray" or node.type == "Xray" then - is_proxy = nil - if proxy_tag then + proxy = 0 + if proxy_tag ~= "nil" then node.proxySettings = { tag = proxy_tag, transportLayer = true @@ -78,7 +84,7 @@ function gen_outbound(node, tag, is_proxy, proxy_tag) "127.0.0.1", --bind new_port, --socks port string.format("/var/etc/%s/v2_%s_%s_%s.json", appname, node_type, node_id, new_port), --config file - (is_proxy and is_proxy == "1" and relay_port) and tostring(relay_port) or "" --relay port + (proxy == 1 and proxy_tag ~= "nil" and relay_port) and tostring(relay_port) or "" --relay port ) ) ) @@ -98,7 +104,8 @@ function gen_outbound(node, tag, is_proxy, proxy_tag) result = { _flag_tag = node_id, - _flag_is_proxy = (is_proxy and is_proxy == "1") and "1" or "0", + _flag_proxy = proxy, + _flag_proxy_tag = proxy_tag, tag = tag, proxySettings = node.proxySettings or nil, protocol = node.protocol, @@ -286,7 +293,7 @@ if node_section then else local default_node = uci:get_all(appname, default_node_id) local main_node_id = node.main_node or "nil" - local is_proxy = "0" + local proxy = 0 local proxy_tag if main_node_id ~= "nil" then local main_node = uci:get_all(appname, main_node_id) @@ -294,7 +301,7 @@ if node_section then local main_node_outbound = gen_outbound(main_node, "main") if main_node_outbound then table.insert(outbounds, main_node_outbound) - is_proxy = "1" + proxy = 1 proxy_tag = "main" if default_node.type ~= "V2ray" and default_node.type ~= "Xray" then proxy_tag = nil @@ -321,7 +328,7 @@ if node_section then end end if default_node and api.is_normal_node(default_node) then - local default_outbound = gen_outbound(default_node, "default", is_proxy, proxy_tag) + local default_outbound = gen_outbound(default_node, "default", { proxy = proxy, tag = proxy_tag }) if default_outbound then table.insert(outbounds, default_outbound) default_outboundTag = "default" @@ -332,7 +339,7 @@ if node_section then uci:foreach(appname, "shunt_rules", function(e) local name = e[".name"] local _node_id = node[name] or "nil" - local is_proxy = node[name .. "_proxy"] or "0" + local proxy_tag = node[name .. "_proxy_tag"] or "nil" local outboundTag if _node_id == "_direct" then outboundTag = "direct" @@ -344,20 +351,20 @@ if node_section then if _node_id ~= "nil" then local _node = uci:get_all(appname, _node_id) if _node and api.is_normal_node(_node) then - local has_outbound + local new_outbound for index, value in ipairs(outbounds) do - if value["_flag_tag"] == _node_id and value["_flag_is_proxy"] == is_proxy then - has_outbound = api.clone(value) + if value["_flag_tag"] == _node_id and value["_flag_proxy_tag"] == proxy_tag then + new_outbound = api.clone(value) break end end - if has_outbound then - has_outbound["tag"] = name - table.insert(outbounds, has_outbound) + if new_outbound then + new_outbound["tag"] = name + table.insert(outbounds, new_outbound) outboundTag = name else if _node.type ~= "V2ray" and _node.type ~= "Xray" then - if is_proxy == "1" then + if proxy_tag ~= "nil" then new_port = get_new_port() table.insert(inbounds, { tag = "proxy_" .. name, @@ -374,11 +381,11 @@ if node_section then table.insert(rules, 1, { type = "field", inboundTag = {"proxy_" .. name}, - outboundTag = "default" + outboundTag = proxy_tag }) end end - local _outbound = gen_outbound(_node, name, is_proxy, (is_proxy == "1" and "default" or nil)) + local _outbound = gen_outbound(_node, name, { proxy = (proxy_tag ~= "nil") and 1 or 0, tag = (proxy_tag ~= "nil") and proxy_tag or nil }) if _outbound then table.insert(outbounds, _outbound) outboundTag = name diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua index 8ca251b3b..85abebc05 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -139,7 +139,7 @@ if (has_v2ray or has_xray) and #nodes_table > 0 then end) local id = "default_node" - o = s:taboption("Main", ListValue, v.id .. "." .. id, "* " .. translate("Default")) + o = s:taboption("Main", ListValue, v.id .. "." .. id, string.format('* %s', translate("Default"))) o:depends("tcp_node", v.id) o:value("_direct", translate("Direct Connection")) o:value("_blackhole", translate("Blackhole")) @@ -154,7 +154,7 @@ if (has_v2ray or has_xray) and #nodes_table > 0 then end local id = "main_node" - o = s:taboption("Main", ListValue, v.id .. "." .. id, "* " .. translate("Default") .. " " .. translate("Preproxy"), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) + o = s:taboption("Main", ListValue, v.id .. "." .. id, string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) o:depends("tcp_node", v.id) o:value("nil", translate("Close")) for k1, v1 in pairs(normal_list) do diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/haproxy.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/haproxy.lua index 0dc15c440..32667ea25 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/haproxy.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/haproxy.lua @@ -56,6 +56,10 @@ s.sortable = true s.anonymous = true s.addremove = true +s.create = function(e, t) + TypedSection.create(e, api.gen_uuid()) +end + s.remove = function(self, section) for k, v in pairs(self.children) do v.rmempty = true diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua index 361577832..7f1a9279e 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua @@ -141,12 +141,15 @@ uci:foreach(appname, "shunt_rules", function(e) o:depends("protocol", "_shunt") if #nodes_table > 0 then - _proxy = s:option(Flag, e[".name"] .. "_proxy", translate(e.remarks) .. translate("Preproxy"), translate("Use the default node for the transit.")) - _proxy.default = 0 + _proxy_tag = s:option(ListValue, e[".name"] .. "_proxy_tag", string.format('* %s', translate(e.remarks) .. " " .. translate("Preproxy"))) + _proxy_tag:value("nil", translate("Close")) + _proxy_tag:value("default", translate("Default")) + _proxy_tag:value("main", translate("Default Preproxy")) + _proxy_tag.default = "nil" for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) - _proxy:depends(e[".name"], v.id) + _proxy_tag:depends(e[".name"], v.id) end end end) @@ -158,14 +161,14 @@ shunt_tips.cfgvalue = function(t, n) end shunt_tips:depends("protocol", "_shunt") -default_node = s:option(ListValue, "default_node", translate("Default") .. " " .. translate("Node")) +default_node = s:option(ListValue, "default_node", string.format('* %s', translate("Default"))) default_node:value("_direct", translate("Direct Connection")) default_node:value("_blackhole", translate("Blackhole")) for k, v in pairs(nodes_table) do default_node:value(v.id, v.remarks) end default_node:depends("protocol", "_shunt") if #nodes_table > 0 then - o = s:option(ListValue, "main_node", translate("Default") .. " " .. translate("Node") .. translate("Preproxy"), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) + o = s:option(ListValue, "main_node", string.format('* %s', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node.")) o:value("nil", translate("Close")) for k, v in pairs(nodes_table) do o:value(v.id, v.remarks) @@ -177,6 +180,7 @@ domainStrategy = s:option(ListValue, "domainStrategy", translate("Domain Strateg domainStrategy:value("AsIs") domainStrategy:value("IPIfNonMatch") domainStrategy:value("IPOnDemand") +domainStrategy.default = "IPOnDemand" domainStrategy.description = "