From 2f2419bdf592fb3471316937be683422d8afdf25 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 28 Dec 2019 20:45:37 +0800 Subject: [PATCH] luci-app-passwall: sync with upstream source --- package/lienol/luci-app-passwall/Makefile | 18 +- .../luasrc/controller/passwall.lua | 5 +- .../luasrc/model/cbi/passwall/global.lua | 56 +- .../luasrc/model/cbi/passwall/node_config.lua | 11 + .../luasrc/model/cbi/passwall/node_list.lua | 46 +- .../view/passwall/rule/rule_version.htm | 14 + .../luci-app-passwall/po/zh-cn/passwall.po | 36 +- .../root/etc/config/passwall | 9 +- .../root/etc/config/passwall_rule/chnlist | 73511 ++++++++++++++++ .../root/usr/share/passwall/app.sh | 282 +- .../root/usr/share/passwall/iptables.sh | 1 + .../root/usr/share/passwall/rule_update.sh | 45 +- 12 files changed, 73874 insertions(+), 160 deletions(-) create mode 100644 package/lienol/luci-app-passwall/root/etc/config/passwall_rule/chnlist diff --git a/package/lienol/luci-app-passwall/Makefile b/package/lienol/luci-app-passwall/Makefile index d882a3760f..f5d6add830 100644 --- a/package/lienol/luci-app-passwall/Makefile +++ b/package/lienol/luci-app-passwall/Makefile @@ -1,13 +1,13 @@ # Copyright (C) 2018-2020 Lienol # -# This is free software, licensed under the Apache License, Version 2.0 . +# This is free software, licensed under the GNU General Public License v3. # include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=3.0 -PKG_RELEASE:=135-20191220 +PKG_RELEASE:=142-20191228 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PO2LMO:=./po2lmo @@ -57,17 +57,17 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_haproxy bool "Include haproxy" default n -config PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS - bool "Include ChinaDNS" - default y - -config PACKAGE_$(PKG_NAME)_INCLUDE_pdnsd - bool "Include pdnsd" +config PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG + bool "Include ChinaDNS-NG" default y config PACKAGE_$(PKG_NAME)_INCLUDE_dns2socks bool "Include dns2socks" default y + +config PACKAGE_$(PKG_NAME)_INCLUDE_pdnsd + bool "Include pdnsd" + default y endmenu endef @@ -89,7 +89,7 @@ define Package/$(PKG_NAME) +PACKAGE_$(PKG_NAME)_INCLUDE_Brook:brook \ +PACKAGE_$(PKG_NAME)_INCLUDE_kcptun:kcptun-client \ +PACKAGE_$(PKG_NAME)_INCLUDE_haproxy:haproxy \ - +PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS:openwrt_chinadns \ + +PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG:chinadns-ng \ +PACKAGE_$(PKG_NAME)_INCLUDE_pdnsd:pdnsd-alt \ +PACKAGE_$(PKG_NAME)_INCLUDE_dns2socks:dns2socks endef diff --git a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua index a1d4f72e45..75da7bef53 100644 --- a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua +++ b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua @@ -19,8 +19,9 @@ function index() end entry({"admin", "vpn", "passwall", "settings"}, cbi("passwall/global"), _("Basic Settings"), 1).dependent = true - entry({"admin", "vpn", "passwall", "node_list"}, cbi("passwall/node_list"), - _("Node List"), 2).dependent = true + entry({"admin", "vpn", "passwall", "node_list"}, + cbi("passwall/node_list", {autoapply = true}), _("Node List"), 2).dependent = + true -- entry({"admin", "vpn", "passwall", "auto_switch"}, -- cbi("passwall/auto_switch"), _("Auto Switch"), 3).leaf = true entry({"admin", "vpn", "passwall", "other"}, cbi("passwall/other"), diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua index 037abd2cc3..8b1e3e02fb 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua @@ -40,7 +40,8 @@ else end -- [[ Global Settings ]]-- -s = m:section(TypedSection, "global", translate("Global Settings")) +s = m:section(TypedSection, "global", translate("Global Settings"), + translate("If you can use it, very stable. If not, GG !!!")) s.anonymous = true s.addremove = false @@ -94,10 +95,8 @@ o = s:option(ListValue, "dns_mode", translate("DNS Forward Mode"), translate( "if you use no patterns are used, DNS of wan will be used by default as upstream of dnsmasq")) o.rmempty = false o:reset_values() -if is_installed("openwrt_chinadns") or is_finded("chinadns") then - o:value("chinadns", "ChinaDNS") -end -if is_installed("dns2socks") or is_finded("dns2socks") then +if is_finded("chinadns-ng") then o:value("chinadns-ng", "ChinaDNS-NG") end +if is_finded("dns2socks") then o:value("dns2socks", "dns2socks " .. translate("Need Socks5 server")) end if is_installed("pdnsd") or is_installed("pdnsd-alt") or is_finded("pdnsd") then @@ -106,29 +105,40 @@ end o:value("local_7913", translate("Use local port 7913 as DNS")) o:value("nonuse", translate("No patterns are used")) -o = s:option(Value, "dns2socks_forward", translate("DNS Forward Address")) +---- DNS Forward +o = s:option(Value, "dns_forward", translate("DNS Forward Address")) o.default = "8.8.4.4" -o:value("8.8.4.4", "8.8.4.4(Google DNS1)") -o:value("8.8.8.8", "8.8.8.8(Google DNS2)") -o:value("208.67.222.222", "208.67.222.222(OpenDNS DNS1)") -o:value("208.67.220.220", "208.67.220.220(OpenDNS DNS2)") +o:value("8.8.4.4", "8.8.4.4 (Google DNS)") +o:value("8.8.8.8", "8.8.8.8 (Google DNS)") +o:value("208.67.222.222", "208.67.222.222 (OpenDNS DNS)") +o:value("208.67.220.220", "208.67.220.220 (OpenDNS DNS)") o:depends("dns_mode", "dns2socks") +o:depends("dns_mode", "pdnsd") ----- upstreamm DNS Server for ChinaDNS -o = s:option(ListValue, "up_chinadns_mode", - translate("upstreamm DNS Server for ChinaDNS"), translate( - "Domestic DNS server 1 in advanced Settings is used as domestic DNS by default")) -o.default = "OpenDNS_1" -o:depends("dns_mode", "chinadns") -o:value("OpenDNS_1", "OpenDNS_1") -o:value("OpenDNS_2", "OpenDNS_2") +---- Use TCP Node Resolve DNS +o = s:option(Flag, "use_tcp_node_resolve_dns", + translate("Use TCP Node Resolve DNS"), + translate("If checked, DNS is resolved using the TCP node.")) +o.default = 1 +o:depends("dns_mode", "pdnsd") + +---- upstreamm DNS Server for ChinaDNS-NG +o = s:option(ListValue, "up_chinadns_ng_mode", + translate("upstreamm DNS Server for ChinaDNS-NG"), translate( + "Domestic DNS server in advanced Settings is used as domestic DNS by default")) +o.default = "208.67.222.222" +o:value("208.67.222.222", "208.67.222.222 (OpenDNS DNS)") +o:value("208.67.220.220", "208.67.220.220 (OpenDNS DNS)") +if is_finded("dns2socks") then + o:value("dns2socks", "dns2socks " .. translate("Need Socks5 server")) +end o:value("custom", translate("custom")) +o:depends("dns_mode", "chinadns-ng") ----- upstreamm DNS Server -o = s:option(Value, "up_chinadns_custom", translate("DNS Server"), translate( - "example: 114.114.114.114,208.67.222.222:443,8.8.8.8
Need at least one,Other DNS services can be used as upstream, such as smartdns.")) -o.default = "114.114.114.114,208.67.222.222:5353" -o:depends("up_chinadns_mode", "custom") +o = s:option(Value, "up_chinadns_ng_custom", translate("DNS Server"), translate( + "example: 127.0.0.1#5335
Need at least one,Other DNS services can be used as upstream, such as dns2socks.")) +o.default = "208.67.222.222#443" +o:depends("up_chinadns_ng_mode", "custom") ---- Default Proxy Mode o = s:option(ListValue, "proxy_mode", diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_config.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_config.lua index ceba70d6f8..10b17b72b8 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_config.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_config.lua @@ -139,6 +139,17 @@ tcp_fast_open:depends("type", "SS") tcp_fast_open:depends("type", "SSR") tcp_fast_open:depends("type", "Trojan") +ss_plugin = s:option(ListValue, "ss_plugin", translate("plugin")) +ss_plugin:value("none", translate("none")) +if is_finded("v2ray-plugin") then ss_plugin:value("v2ray-plugin") end +ss_plugin:depends("type", "SS") + +ss_plugin_v2ray_opts = s:option(ListValue, "ss_plugin_v2ray_opts", translate("opts")) +ss_plugin_v2ray_opts:value("http", translate("HTTP")) +ss_plugin_v2ray_opts:value("https", translate("HTTPS")) +ss_plugin_v2ray_opts:value("quic", translate("QUIC")) +ss_plugin_v2ray_opts:depends("ss_plugin", "v2ray-plugin") + use_kcp = s:option(Flag, "use_kcp", translate("Use Kcptun"), "" .. translate( "Please confirm whether the Kcptun is installed. If not, please go to Rule Update download installation.") .. diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_list.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_list.lua index cc15533b32..549a29efc7 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_list.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_list.lua @@ -23,6 +23,14 @@ o.default = 1 ---- Concise display nodes o = s:option(Flag, "compact_display_nodes", translate("Concise display nodes")) +o.default = 0 + +---- Show Add Mode +o = s:option(Flag, "show_add_mode", translate("Show Add Mode")) +o.default = 1 + +---- Show group +o = s:option(Flag, "show_group", translate("Show Group")) o.default = 1 -- [[ Add the node via the link ]]-- @@ -46,15 +54,17 @@ function s.remove(t, a) luci.http.redirect(d.build_url("admin", "vpn", "passwall", "node_list")) end --- 简洁模式 -if api.uci_get_type("global_other", "compact_display_nodes", "1") == "1" then - o = s:option(DummyValue, "group", translate("Group")) - o.width = "25%" - o.cfgvalue = function(t, n) +if api.uci_get_type("global_other", "show_group", "1") == "1" then + show_group = s:option(DummyValue, "group", translate("Group")) + show_group.cfgvalue = function(t, n) local group = api.uci_get_type_id(n, "group") or "无" return group ~= "" and group or "无" end +end +-- 简洁模式 +if api.uci_get_type("global_other", "compact_display_nodes", "0") == "1" then + if show_group then show_group.width = "25%" end o = s:option(DummyValue, "remarks", translate("Remarks")) o.cfgvalue = function(t, n) local str = "" @@ -64,9 +74,7 @@ if api.uci_get_type("global_other", "compact_display_nodes", "1") == "1" then local type = api.uci_get_type_id(n, "type") or "" local address = api.uci_get_type_id(n, "address") or "" local port = api.uci_get_type_id(n, "port") or "" - if is_sub == "" and group == "" then - str = str .. type .. ":" - end + if is_sub == "" and group == "" then str = str .. type .. ":" end str = str .. remarks if address ~= "" and port ~= "" then local s = " (" .. address .. ":" .. port .. ")" @@ -80,15 +88,17 @@ else o = s:option(DummyValue, "remarks", translate("Remarks")) ---- Add Mode - o = s:option(DummyValue, "add_mode", translate("Add Mode")) - o.cfgvalue = function(t, n) - local v = Value.cfgvalue(t, n) - if v and v ~= '' then - return v - else - return '手动' + if api.uci_get_type("global_other", "show_add_mode", "1") == "1" then + o = s:option(DummyValue, "add_mode", translate("Add Mode")) + o.cfgvalue = function(t, n) + local v = Value.cfgvalue(t, n) + if v and v ~= '' then + return v + else + return '手动' + end + return str end - return str end ---- Type @@ -132,8 +142,4 @@ o.template = "passwall/node_list/apply" m:append(Template("passwall/node_list/node_list")) -if luci.http.formvalue("cbi.apply") then - luci.http.redirect(d.build_url("admin", "vpn", "passwall", "node_list")) -end - return m diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm index 89088c604f..d2a69f51ee 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm @@ -4,9 +4,11 @@ local dsp = require "luci.dispatcher" local gfwlist_version = api.uci_get_type("global_rules", "gfwlist_version") local chnroute_version = api.uci_get_type("global_rules", "chnroute_version") +local chnlist_version = api.uci_get_type("global_rules", "chnlist_version") local gfwlist_update = api.uci_get_type("global_rules", "gfwlist_update", "1") == "1" and "checked='checked'" or "" local chnroute_update = api.uci_get_type("global_rules", "chnroute_update", "1") == "1" and "checked='checked'" or "" +local chnlist_update = api.uci_get_type("global_rules", "chnlist_update", "1") == "1" and "checked='checked'" or "" -%>