luci-app-passwall: bump to 4-19

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
xiaorouji 2021-03-26 19:31:30 +08:00 committed by Tianling Shen
parent d70ee37f48
commit c04d124589
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
12 changed files with 91 additions and 83 deletions

View File

@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=4
PKG_RELEASE:=18
PKG_DATE:=20210325
PKG_RELEASE:=19
PKG_DATE:=20210327
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -34,7 +34,7 @@ local trojan = {
ssl = {
verify = (node.tls_allowInsecure ~= "1") and true or false,
verify_hostname = true,
cert = node.trojan_cert_path,
cert = nil,
cipher = cipher,
cipher_tls13 = cipher13,
sni = node.tls_serverName or node.address,
@ -58,12 +58,12 @@ local trojan = {
}
}
if node.type == "Trojan-Go" then
trojan.ssl.cipher = node.fingerprint == nil and cipher or (node.fingerprint == "disable" and cipher13 .. ":" .. cipher or "")
trojan.ssl.cipher_tls13 = node.fingerprint == nil and cipher13 or nil
trojan.ssl.fingerprint = (node.fingerprint ~= nil and node.fingerprint ~= "disable" ) and node.fingerprint or ""
trojan.ssl.alpn = node.trojan_transport == 'ws' and {} or {"h2", "http/1.1"}
if node.stream_security ~= "tls" and node.trojan_transport == "original" then trojan.ssl = nil end
trojan.transport_plugin = node.stream_security == "none" and node.trojan_transport == "original" and {
trojan.ssl.cipher = (node.fingerprint == nil) and cipher or (node.fingerprint == "disable" and cipher13 .. ":" .. cipher or "")
trojan.ssl.cipher_tls13 = (node.fingerprint == nil) and cipher13 or nil
trojan.ssl.fingerprint = (node.fingerprint ~= nil and node.fingerprint ~= "disable") and node.fingerprint or ""
trojan.ssl.alpn = (node.trojan_transport == 'ws') and {} or {"h2", "http/1.1"}
if node.tls ~= "1" and node.trojan_transport == "original" then trojan.ssl = nil end
trojan.transport_plugin = ((not node.tls or node.tls ~= "1") and node.trojan_transport == "original") and {
enabled = node.plugin_type ~= nil,
type = node.plugin_type or "plaintext",
command = node.plugin_type ~= "plaintext" and node.plugin_cmd or nil,
@ -71,7 +71,7 @@ if node.type == "Trojan-Go" then
arg = node.plugin_type ~= "plaintext" and { node.plugin_arg } or nil,
env = {}
} or nil
trojan.websocket = node.trojan_transport and node.trojan_transport:find('ws') and {
trojan.websocket = (node.trojan_transport and node.trojan_transport:find('ws')) and {
enabled = true,
path = node.ws_path or "/",
host = node.ws_host or (node.tls_serverName or node.address)

View File

@ -113,7 +113,8 @@ function gen_outbound(node, tag, is_proxy, proxy_tag)
} or nil,
tlsSettings = (node.stream_security == "tls") and {
serverName = node.tls_serverName,
allowInsecure = (node.tls_allowInsecure == "1") and true or false
allowInsecure = (node.tls_allowInsecure == "1") and true or false,
fingerprint = (node.fingerprint and node.fingerprint ~= "disable") and node.fingerprint or nil
} or nil,
tcpSettings = (node.transport == "tcp" and node.protocol ~= "socks") and {
header = {
@ -151,6 +152,9 @@ function gen_outbound(node, tag, is_proxy, proxy_tag)
security = node.quic_security,
key = node.quic_key,
header = {type = node.quic_guise}
} or nil,
grpcSettings = (node.transport == "grpc") and {
serviceName = node.grpc_serviceName
} or nil
} or nil,
settings = {

View File

@ -30,19 +30,19 @@ o.default = false
---- Console Username
o = s:option(Value, "console_user", translate("Console Username"))
o.default = ""
o:depends("balancing_enable", 1)
o:depends("balancing_enable", true)
---- Console Password
o = s:option(Value, "console_password", translate("Console Password"))
o.password = true
o.default = ""
o:depends("balancing_enable", 1)
o:depends("balancing_enable", true)
---- Console Port
o = s:option(Value, "console_port", translate("Console Port"), translate(
"In the browser input routing IP plus port access, such as:192.168.1.1:1188"))
o.default = "1188"
o:depends("balancing_enable", 1)
o:depends("balancing_enable", true)
-- [[ Balancing Settings ]]--
s = m:section(TypedSection, "haproxy_config", "",

View File

@ -424,8 +424,8 @@ tls:depends("type", "Trojan-Go")
xtls = s:option(Flag, "xtls", translate("XTLS"))
xtls.default = 0
xtls:depends({ type = "Xray", protocol = "vless", tls = "1" })
xtls:depends({ type = "Xray", protocol = "trojan", tls = "1" })
xtls:depends({ type = "Xray", protocol = "vless", tls = true })
xtls:depends({ type = "Xray", protocol = "trojan", tls = true })
flow = s:option(Value, "flow", translate("flow"))
flow.default = "xtls-rprx-direct"
@ -435,34 +435,41 @@ flow:value("xtls-rprx-direct")
flow:value("xtls-rprx-direct-udp443")
flow:value("xtls-rprx-splice")
flow:value("xtls-rprx-splice-udp443")
flow:depends("xtls", "1")
flow:depends("xtls", true)
-- [[ TLS部分 ]] --
tls_sessionTicket = s:option(Flag, "tls_sessionTicket", translate("Session Ticket"))
tls_sessionTicket.default = "0"
tls_sessionTicket:depends({ type = "Trojan", tls = "1" })
tls_sessionTicket:depends({ type = "Trojan-Plus", tls = "1" })
tls_sessionTicket:depends({ type = "Trojan-Go", tls = "1" })
tls_sessionTicket:depends({ type = "Trojan", tls = true })
tls_sessionTicket:depends({ type = "Trojan-Plus", tls = true })
tls_sessionTicket:depends({ type = "Trojan-Go", tls = true })
-- [[ Trojan TLS ]]--
trojan_force_fp = s:option(ListValue, "fingerprint", translate("Finger Print"))
for a, t in ipairs(force_fp) do trojan_force_fp:value(t) end
trojan_force_fp.default = "firefox"
trojan_force_fp:depends({ type = "Trojan-Go", tls = "1" })
trojan_go_fingerprint = s:option(ListValue, "trojan_go_fingerprint", translate("Finger Print"))
for a, t in ipairs(force_fp) do trojan_go_fingerprint:value(t) end
trojan_go_fingerprint.default = "firefox"
trojan_go_fingerprint:depends({ type = "Trojan-Go", tls = true })
function trojan_go_fingerprint.cfgvalue(self, section)
return m:get(section, "fingerprint")
end
function trojan_go_fingerprint.write(self, section, value)
m:set(section, "fingerprint", value)
end
tls_serverName = s:option(Value, "tls_serverName", translate("Domain"))
tls_serverName:depends("tls", "1")
tls_serverName:depends("xtls", "1")
tls_serverName:depends("tls", true)
tls_allowInsecure = s:option(Flag, "tls_allowInsecure", translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."))
tls_allowInsecure.default = "0"
tls_allowInsecure:depends("tls", "1")
tls_allowInsecure:depends("xtls", "1")
tls_allowInsecure:depends("tls", true)
-- [[ Trojan Cert ]]--
trojan_cert_path = s:option(Value, "trojan_cert_path", translate("Trojan Cert Path"))
trojan_cert_path.default = ""
trojan_cert_path:depends({ tls = "1", tls_allowInsecure = false })
xray_fingerprint = s:option(ListValue, "fingerprint", translate("Finger Print"))
xray_fingerprint:value("disable")
xray_fingerprint:value("chrome")
xray_fingerprint:value("firefox")
xray_fingerprint:value("safari")
xray_fingerprint:value("randomized")
xray_fingerprint.default = "disable"
xray_fingerprint:depends({ type = "Xray", tls = true, xtls = false })
trojan_transport = s:option(ListValue, "trojan_transport", translate("Transport"))
trojan_transport:value("original", "Original")
@ -477,7 +484,7 @@ trojan_plugin:value("plaintext", "Plain Text")
trojan_plugin:value("shadowsocks", "ShadowSocks")
trojan_plugin:value("other", "Other")
trojan_plugin.default = "plaintext"
trojan_plugin:depends({ tls = "0", trojan_transport = "original" })
trojan_plugin:depends({ tls = false, trojan_transport = "original" })
trojan_plugin_cmd = s:option(Value, "plugin_cmd", translate("Plugin Binary"))
trojan_plugin_cmd.placeholder = "eg: /usr/bin/v2ray-plugin"
@ -501,6 +508,7 @@ transport:value("ws", "WebSocket")
transport:value("h2", "HTTP/2")
transport:value("ds", "DomainSocket")
transport:value("quic", "QUIC")
transport:value("grpc", "gRPC")
transport:depends({ type = "Xray", protocol = "vmess" })
transport:depends({ type = "Xray", protocol = "vless" })
transport:depends({ type = "Xray", protocol = "socks" })
@ -611,6 +619,10 @@ quic_guise = s:option(ListValue, "quic_guise", translate("Camouflage Type"))
for a, t in ipairs(header_type_list) do quic_guise:value(t) end
quic_guise:depends("transport", "quic")
-- [[ gRPC部分 ]]--
grpc_serviceName = s:option(Value, "grpc_serviceName", "ServiceName")
grpc_serviceName:depends("transport", "grpc")
-- [[ Trojan-Go Shadowsocks2 ]] --
ss_aead = s:option(Flag, "ss_aead", translate("Shadowsocks2"))
ss_aead:depends("type", "Trojan-Go")

View File

@ -24,13 +24,13 @@ o:value(7, translate("Every day"))
for e = 1, 6 do o:value(e, translate("Week") .. e) end
o:value(0, translate("Week") .. translate("day"))
o.default = 0
o:depends("auto_update_subscribe", 1)
o:depends("auto_update_subscribe", true)
---- Day update rules
o = s:option(ListValue, "time_update_subscribe", translate("Day update rules"))
for e = 0, 23 do o:value(e, e .. translate("oclock")) end
o.default = 0
o:depends("auto_update_subscribe", 1)
o:depends("auto_update_subscribe", true)
o = s:option(ListValue, "filter_keyword_mode", translate("Filter keyword Mode"))
o:value("0", translate("Close"))

View File

@ -28,21 +28,21 @@ o.rmempty = false
---- Automatically turn off time
o = s:option(ListValue, "time_off", translate("Automatically turn off time"))
o.default = nil
o:depends("auto_on", "1")
o:depends("auto_on", true)
o:value(nil, translate("Disable"))
for e = 0, 23 do o:value(e, e .. translate("oclock")) end
---- Automatically turn on time
o = s:option(ListValue, "time_on", translate("Automatically turn on time"))
o.default = nil
o:depends("auto_on", "1")
o:depends("auto_on", true)
o:value(nil, translate("Disable"))
for e = 0, 23 do o:value(e, e .. translate("oclock")) end
---- Automatically restart time
o = s:option(ListValue, "time_restart", translate("Automatically restart time"))
o.default = nil
o:depends("auto_on", "1")
o:depends("auto_on", true)
o:value(nil, translate("Disable"))
for e = 0, 23 do o:value(e, e .. translate("oclock")) end
--]]

View File

@ -44,13 +44,13 @@ o:value(7, translate("Every day"))
for e = 1, 6 do o:value(e, translate("Week") .. e) end
o:value(0, translate("Week") .. translate("day"))
o.default = 0
o:depends("auto_update", 1)
o:depends("auto_update", true)
---- Time Update
o = s:option(ListValue, "time_update", translate("Day update rules"))
for e = 0, 23 do o:value(e, e .. translate("oclock")) end
o.default = 0
o:depends("auto_update", 1)
o:depends("auto_update", true)
o = s:option(Value, "xray_location_asset", translate("Location of Xray asset"), translate("This variable specifies a directory where geoip.dat and geosite.dat files are."))
o.default = "/usr/share/xray/"

View File

@ -16,7 +16,7 @@ function gen_config(user)
key_password = "",
cipher = user.fingerprint == nil and cipher or (user.fingerprint == "disable" and cipher13 .. ":" .. cipher or ""),
cipher_tls13 = user.fingerprint == nil and cipher13 or nil,
sni = user.tls_serverName,
sni = nil,
verify = (user.tls_allowInsecure ~= "1") and true or false,
verify_hostname = false,
reuse_session = true,
@ -29,7 +29,7 @@ function gen_config(user)
},
udp_timeout = 60,
disable_http_check = true,
transport_plugin = (user.tls == nil or user.tls ~= "1") and user.trojan_transport == "original" and {
transport_plugin = ((user.tls == nil or user.tls ~= "1") and user.trojan_transport == "original") and {
enabled = user.plugin_type ~= nil,
type = user.plugin_type or "plaintext",
command = user.plugin_type ~= "plaintext" and user.plugin_cmd or nil,
@ -37,10 +37,10 @@ function gen_config(user)
arg = user.plugin_type ~= "plaintext" and { user.plugin_arg } or nil,
env = {}
} or nil,
websocket = user.trojan_transport and user.trojan_transport:find('ws') and {
websocket = (user.trojan_transport and user.trojan_transport:find('ws')) and {
enabled = true,
path = user.ws_path or "/",
host = user.ws_host or (user.tls_serverName or user.address)
host = user.ws_host or ""
} or nil,
shadowsocks = (user.ss_aead == "1") and {
enabled = true,

View File

@ -209,6 +209,9 @@ function gen_config(user)
security = user.quic_security,
key = user.quic_key,
header = {type = user.quic_guise}
} or nil,
grpcSettings = (user.transport == "grpc") and {
serviceName = user.grpc_serviceName
} or nil
}
}

View File

@ -135,11 +135,11 @@ auth:depends({ type = "Xray", protocol = "socks" })
auth:depends({ type = "Xray", protocol = "http" })
username = s:option(Value, "username", translate("Username"))
username:depends("auth", "1")
username:depends("auth", true)
password = s:option(Value, "password", translate("Password"))
password.password = true
password:depends("auth", "1")
password:depends("auth", true)
password:depends("type", "SS")
password:depends("type", "SSR")
password:depends("type", "Brook")
@ -270,8 +270,8 @@ tls:depends("type", "Trojan-Go")
xtls = s:option(Flag, "xtls", translate("XTLS"))
xtls.default = 0
xtls:depends({ type = "Xray", protocol = "vless", tls = "1" })
xtls:depends({ type = "Xray", protocol = "trojan", tls = "1" })
xtls:depends({ type = "Xray", protocol = "vless", tls = true })
xtls:depends({ type = "Xray", protocol = "trojan", tls = true })
flow = s:option(Value, "flow", translate("flow"))
flow.default = "xtls-rprx-direct"
@ -279,18 +279,15 @@ flow:value("xtls-rprx-origin")
flow:value("xtls-rprx-origin-udp443")
flow:value("xtls-rprx-direct")
flow:value("xtls-rprx-direct-udp443")
flow:depends("xtls", "1")
flow:depends("xtls", true)
-- [[ TLS部分 ]] --
tls_allowInsecure = s:option(Flag, "tls_allowInsecure", translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."))
tls_allowInsecure.default = "0"
tls_allowInsecure:depends({ type = "Trojan", tls = "1" })
tls_allowInsecure:depends({ type = "Trojan-Plus", tls = "1" })
tls_allowInsecure:depends({ type = "Trojan-Go", tls = "1" })
tls_serverName = s:option(Value, "tls_serverName", translate("Domain"))
tls_serverName:depends("tls", "1")
tls_allowInsecure:depends({ type = "Trojan", tls = true })
tls_allowInsecure:depends({ type = "Trojan-Plus", tls = true })
tls_allowInsecure:depends({ type = "Trojan-Go", tls = true })
tls_certificateFile = s:option(FileUpload, "tls_certificateFile", translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem")
tls_certificateFile.validate = function(self, value, t)
@ -304,7 +301,7 @@ tls_certificateFile.validate = function(self, value, t)
return nil
end
tls_certificateFile.default = "/etc/config/ssl/" .. arg[1] .. ".pem"
tls_certificateFile:depends("tls", "1")
tls_certificateFile:depends("tls", true)
tls_keyFile = s:option(FileUpload, "tls_keyFile", translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key")
tls_keyFile.validate = function(self, value, t)
@ -318,13 +315,13 @@ tls_keyFile.validate = function(self, value, t)
return nil
end
tls_keyFile.default = "/etc/config/ssl/" .. arg[1] .. ".key"
tls_keyFile:depends("tls", "1")
tls_keyFile:depends("tls", true)
tls_sessionTicket = s:option(Flag, "tls_sessionTicket", translate("Session Ticket"))
tls_sessionTicket.default = "0"
tls_sessionTicket:depends({ type = "Trojan", tls = "1" })
tls_sessionTicket:depends({ type = "Trojan-Plus", tls = "1" })
tls_sessionTicket:depends({ type = "Trojan-Go", tls = "1" })
tls_sessionTicket:depends({ type = "Trojan", tls = true })
tls_sessionTicket:depends({ type = "Trojan-Plus", tls = true })
tls_sessionTicket:depends({ type = "Trojan-Go", tls = true })
transport = s:option(ListValue, "transport", translate("Transport"))
transport:value("tcp", "TCP")
@ -333,6 +330,7 @@ transport:value("ws", "WebSocket")
transport:value("h2", "HTTP/2")
transport:value("ds", "DomainSocket")
transport:value("quic", "QUIC")
transport:value("grpc", "gRPC")
transport:depends({ type = "Xray", protocol = "vmess" })
transport:depends({ type = "Xray", protocol = "vless" })
transport:depends({ type = "Xray", protocol = "socks" })
@ -352,7 +350,7 @@ trojan_plugin:value("plaintext", "Plain Text")
trojan_plugin:value("shadowsocks", "ShadowSocks")
trojan_plugin:value("other", "Other")
trojan_plugin.default = "plaintext"
trojan_plugin:depends({ tls = "0", trojan_transport = "original" })
trojan_plugin:depends({ tls = false, trojan_transport = "original" })
trojan_plugin_cmd = s:option(Value, "plugin_cmd", translate("Plugin Binary"))
trojan_plugin_cmd.placeholder = "eg: /usr/bin/v2ray-plugin"
@ -468,6 +466,10 @@ quic_guise = s:option(ListValue, "quic_guise", translate("Camouflage Type"))
for a, t in ipairs(header_type_list) do quic_guise:value(t) end
quic_guise:depends("transport", "quic")
-- [[ gRPC部分 ]]--
grpc_serviceName = s:option(Value, "grpc_serviceName", "ServiceName")
grpc_serviceName:depends("transport", "grpc")
acceptProxyProtocol = s:option(Flag, "acceptProxyProtocol", translate("acceptProxyProtocol"), translate("Whether to receive PROXY protocol, when this node want to be fallback or forwarded by proxy, it must be enable, otherwise it cannot be used."))
acceptProxyProtocol:depends({ type = "Xray", transport = "tcp" })
acceptProxyProtocol:depends({ type = "Xray", transport = "ws" })
@ -479,21 +481,21 @@ fallback:depends({ type = "Xray", protocol = "trojan", transport = "tcp" })
--[[
fallback_alpn = s:option(Value, "fallback_alpn", "Fallback alpn")
fallback_alpn:depends("fallback", "1")
fallback_alpn:depends("fallback", true)
fallback_path = s:option(Value, "fallback_path", "Fallback path")
fallback_path:depends("fallback", "1")
fallback_path:depends("fallback", true)
fallback_dest = s:option(Value, "fallback_dest", "Fallback dest")
fallback_dest:depends("fallback", "1")
fallback_dest:depends("fallback", true)
fallback_xver = s:option(Value, "fallback_xver", "Fallback xver")
fallback_xver.default = 0
fallback_xver:depends("fallback", "1")
fallback_xver:depends("fallback", true)
]]--
fallback_list = s:option(DynamicList, "fallback_list", "Fallback", translate("dest,path"))
fallback_list:depends("fallback", "1")
fallback_list:depends("fallback", true)
ss_aead = s:option(Flag, "ss_aead", translate("Shadowsocks2"))
ss_aead:depends("type", "Trojan-Go")
@ -502,11 +504,11 @@ ss_aead.default = "0"
ss_aead_method = s:option(ListValue, "ss_aead_method", translate("Encrypt Method"))
for _, v in ipairs(encrypt_methods_ss_aead) do ss_aead_method:value(v, v) end
ss_aead_method.default = "aead_aes_128_gcm"
ss_aead_method:depends("ss_aead", "1")
ss_aead_method:depends("ss_aead", true)
ss_aead_pwd = s:option(Value, "ss_aead_pwd", translate("Password"))
ss_aead_pwd.password = true
ss_aead_pwd:depends("ss_aead", "1")
ss_aead_pwd:depends("ss_aead", true)
tcp_fast_open = s:option(Flag, "tcp_fast_open", translate("TCP Fast Open"))
tcp_fast_open.default = "0"

View File

@ -80,7 +80,6 @@ local api = require "luci.model.cbi.passwall.api.api"
var opt = {
base: "cbid.passwall",
client : true,
fallback: "dummy",
get: function(opt) {
var id = this.base + "." + opt;
var obj = document.getElementsByName(id)[0] || document.getElementsByClassName(id)[0] || document.getElementById(id)
@ -88,13 +87,6 @@ local api = require "luci.model.cbi.passwall.api.api"
return obj;
} else {
return null;
/*
obj = document.getElementById(this.fallback);
if (opt === "address") obj.value = "0.0.0.0";
else if (opt === "mux") obj.value = "0";
if (this.client || (opt !== "address" && opt !== "mux")) alert("<%:Faltal on get option, please help in debug: %>" + opt);
return obj;
*/
}
},
getlist: function(opt) {
@ -131,7 +123,6 @@ local api = require "luci.model.cbi.passwall.api.api"
}
opt.base = "cbid." + urlname + "." + sid;
opt.client = urlname.indexOf("server") === -1;
opt.fallback = urlname + "-dummy";
var v_type = opt.get("type").value;
var v_alias = opt.get("remarks");
var url = null;
@ -352,7 +343,6 @@ local api = require "luci.model.cbi.passwall.api.api"
var opt = {
base: 'cbid.passwall',
client : true,
fallback: 'dummy',
get: function(opt) {
var obj;
var id = this.base + '.' + opt;
@ -360,8 +350,7 @@ local api = require "luci.model.cbi.passwall.api.api"
if (obj) {
return obj;
} else {
if (this.client || (opt !== "address" && opt !== "mux")) alert('<%:Faltal on get option, please help in debug: %>' + opt);
return document.getElementById(this.fallback);
return null;
}
},
set: function(opt, val) {
@ -402,7 +391,6 @@ local api = require "luci.model.cbi.passwall.api.api"
}
opt.base = "cbid." + urlname + "." + sid;
opt.client = urlname.indexOf("server") === -1;
opt.fallback = urlname + '-dummy';
var ssrurl = prompt('<%:Paste Share URL Here%>', '');
if (ssrurl === null || ssrurl === "") {
return false;
@ -793,7 +781,6 @@ local api = require "luci.model.cbi.passwall.api.api"
}
//]]></script>
<input type="text" class="hidden" id='<%=self.option%>-dummy' value="" />
<input type="button" class="cbi-button cbi-button-apply" value='<%:From Share URL%>' onclick="return fromUrl(this, '<%=self.option%>', '<%=self.value%>')" />
<input type="button" class="cbi-button cbi-button-apply" value='<%:Build Share URL%>' onclick="return buildUrl(this, '<%=self.option%>', '<%=self.value%>')" />
<span id="<%=self.option%>-status"></span>