🤞 Sync 2026-08-09 18:27:19

This commit is contained in:
github-actions[bot] committed 2026-08-09 18:27:19 +08:00
1 parent 59356ee7dd
commit df29e10344
54 files changed
+424 -239

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall2
PKG_VERSION:=26.8.7
PKG_RELEASE:=70
PKG_RELEASE:=71
PKG_PO_VERSION:=$(PKG_VERSION)
PKG_CONFIG_DEPENDS:= \
@@ -449,22 +449,22 @@ end
function add_node()
local redirect = http.formvalue("redirect")
local uuid = api.gen_short_uuid()
uci:section(appname, "nodes", uuid)
local uid = api.gen_random_char()
uci:section(appname, "nodes", uid)
local group = http.formvalue("group")
if group and group ~= "default" then
uci:set(appname, uuid, "group", group)
uci:set(appname, uid, "group", group)
end
uci:set(appname, uuid, "type", "Xray")
uci:set(appname, uid, "type", "Xray")
if redirect == "1" then
api.uci_save(uci, appname)
http.redirect(api.url("node_config", uuid))
http.redirect(api.url("node_config", uid))
else
api.uci_save(uci, appname, true, true)
http_write_json({result = uuid})
http_write_json({result = uid})
end
end
@@ -479,17 +479,17 @@ end
function copy_node()
local section = http.formvalue("section")
local uuid = api.gen_short_uuid()
uci:section(appname, "nodes", uuid)
local uid = api.gen_random_char()
uci:section(appname, "nodes", uid)
for k, v in pairs(uci:get_all(appname, section)) do
if not k:match("^%.") and k ~= "group" then
if k == "remarks" then v = (v or "") .. "(1)" end
uci:set(appname, uuid, k, v)
uci:set(appname, uid, k, v)
end
end
uci:set(appname, uuid, "add_mode", 1)
uci:set(appname, uid, "add_mode", 1)
api.uci_save(uci, appname)
http.redirect(api.url("node_config", uuid))
http.redirect(api.url("node_config", uid))
end
function clear_all_nodes()
@@ -1055,29 +1055,29 @@ function add_shunt_rule()
local add_name = http.formvalue("add_name")
local redirect = http.formvalue("redirect")
local uuid = add_name
local uid = add_name
if add_name then
local has = uci:get(appname, uuid)
local has = uci:get(appname, uid)
if has then
http_write_json_error({ message = "This ID already exists." })
return
end
else
uuid = api.gen_short_uuid()
uid = api.gen_random_char()
end
uci:section(appname, "shunt_rules", uuid)
uci:section(appname, "shunt_rules", uid)
local group = http.formvalue("group")
if group and group ~= "default" then
uci:set(appname, uuid, "group", group)
uci:set(appname, uid, "group", group)
end
if redirect == "1" then
api.uci_save(uci, appname)
http.redirect(api.url("shunt_rules", uuid))
http.redirect(api.url("shunt_rules", uid))
else
api.uci_save(uci, appname)
http_write_json_ok({uuid = uuid, redirect_url = api.url("shunt_rules", uuid)})
http_write_json_ok({uid = uid, redirect_url = api.url("shunt_rules", uid)})
end
end
@@ -23,10 +23,9 @@ s.anonymous = true
s.addremove = true
s.extedit = api.url("acl_config", "%s")
function s.create(e, t)
local uuid = api.gen_short_uuid(5)
uuid = "acl_" .. uuid
TypedSection.create(e, uuid)
luci.http.redirect(e.extedit:format(uuid))
local uid = "acl_" .. api.gen_random_char(5)
TypedSection.create(e, uid)
luci.http.redirect(e.extedit:format(uid))
end
---- Enable
@@ -326,10 +326,9 @@ s2.anonymous = true
s2.addremove = true
s2.extedit = api.url("socks_config", "%s")
function s2.create(e, t)
local uuid = api.gen_short_uuid(5)
uuid = "socks_" .. uuid
TypedSection.create(e, uuid)
luci.http.redirect(e.extedit:format(uuid))
local uid = "socks_" .. api.gen_random_char(5)
TypedSection.create(e, uid)
luci.http.redirect(e.extedit:format(uid))
end
o = s2:option(DummyValue, "status", translate("Status"))
@@ -113,9 +113,8 @@ s.anonymous = true
s.addremove = true
s.create = function(e, t)
local uuid = api.gen_short_uuid(5)
uuid = "haproxy_" .. uuid
TypedSection.create(e, uuid)
local uid = "haproxy_" .. api.gen_random_char(5)
TypedSection.create(e, uid)
end
s.remove = function(self, section)
@@ -134,12 +134,11 @@ s.sortable = true
s.template = "cbi/tblsection"
s.extedit = api.url("node_subscribe_config", "%s")
function s.create(e, t)
local uuid = api.gen_short_uuid(5)
uuid = "sub_" .. uuid
TypedSection.create(e, uuid)
m:set(uuid, "hysteria_up_mbps", "100")
m:set(uuid, "hysteria_down_mbps", "100")
luci.http.redirect(e.extedit:format(uuid))
local uid = "sub_" .. api.gen_random_char(5)
TypedSection.create(e, uid)
m:set(uid, "hysteria_up_mbps", "100")
m:set(uid, "hysteria_down_mbps", "100")
luci.http.redirect(e.extedit:format(uid))
end
o = s:option(Value, "remark", translate("Remarks"))
@@ -263,9 +263,8 @@ if has_xray then
s_xray_noise.addremove = true
s_xray_noise.create = function(e, t)
local uuid = api.gen_short_uuid(5)
uuid = "xray_noise_" .. uuid
TypedSection.create(e, uuid)
local uid = "xray_noise_" .. api.gen_random_char(5)
TypedSection.create(e, uid)
end
s_xray_noise.remove = function(self, section)
@@ -21,10 +21,9 @@ t.sortable = true
t.template = "cbi/tblsection"
t.extedit = api.url("server_user", "%s")
function t.create(e, t)
local uuid = api.gen_uuid()
t = uuid
TypedSection.create(e, t)
luci.http.redirect(e.extedit:format(t))
local uid = api.gen_random_char()
TypedSection.create(e, uid)
luci.http.redirect(e.extedit:format(uid))
end
function t.remove(e, t)
e.map.proceed = true
@@ -111,7 +111,7 @@ o:depends({ [_n("protocol")] = "socks" })
o = s:option(DynamicList, _n("uuid"), translate("ID") .. "/" .. translate("Password"))
for i = 1, 3 do
o:value(api.gen_uuid(1))
o:value(api.gen_uuid())
end
o:depends({ [_n("protocol")] = "vmess" })
o:depends({ [_n("protocol")] = "vless" })
@@ -235,7 +235,7 @@ o:depends({ [_n("protocol")] = "shadowsocks" })
o = s:option(DynamicList, _n("uuid"), translate("ID") .. "/" .. translate("Password"))
for i = 1, 3 do
o:value(api.gen_uuid(1))
o:value(api.gen_uuid())
end
o:depends({ [_n("protocol")] = "vmess" })
o:depends({ [_n("protocol")] = "vless" })
+2 -5
View File
@@ -669,15 +669,12 @@ function get_full_node_remarks(n)
return remarks
end
function gen_uuid(format)
function gen_uuid()
local uuid = sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)")
if format == nil then
uuid = string.gsub(uuid, "-", "")
end
return uuid
end
function gen_short_uuid(length)
function gen_random_char(length)
if not length then length = 8 end
return sys.exec("echo -n $(head /dev/urandom | tr -dc A-Za-z0-9 | head -c %s)" % length)
end
@@ -56,15 +56,15 @@ display:block !important;
<div class="inner">
<div class="pure-g">
<div class="pure-u-1-2">
<span class="flag"><img src="/luci-static/passwall/flags/loading.svg" class="pure-img"></span> <span
<span class="flag"><img src="/luci-static/passwall2/flags/loading.svg" class="pure-img"></span> <span
class="status-info">获取中...</span>
</div>
<div class="pure-u-1-2">
<div class="icon-con">
<img src="/luci-static/passwall/img/site_icon1_01.png" class="pure-img i1">
<img src="/luci-static/passwall/img/site_icon1_02.png" class="pure-img i2">
<img src="/luci-static/passwall/img/site_icon1_03.png" class="pure-img i3">
<img src="/luci-static/passwall/img/site_icon1_04.png" class="pure-img i4">
<img src="/luci-static/passwall2/img/site_icon1_01.png" class="pure-img i1">
<img src="/luci-static/passwall2/img/site_icon1_02.png" class="pure-img i2">
<img src="/luci-static/passwall2/img/site_icon1_03.png" class="pure-img i3">
<img src="/luci-static/passwall2/img/site_icon1_04.png" class="pure-img i4">
</div>
</div>
</div>
@@ -72,8 +72,8 @@ display:block !important;
</div>
<script>
const _ASSETS = '/luci-static/passwall/';
const CHECK_IP_URL = '<%=url([[admin]], [[services]], [[passwall]], [[ip]])%>';
const _ASSETS = '/luci-static/passwall2/';
const CHECK_IP_URL = '<%=url([[admin]], [[services]], [[passwall2]], [[ip]])%>';
let wW = window.innerWidth;
@@ -2274,7 +2274,7 @@ local function update_node(manual)
chain_node_type = (outbound_iface_group ~= "") and "iface" or chain_node_type
end
for _, vv in ipairs(list) do
local cfgid = uci:section(appname, "nodes", api.gen_short_uuid())
local cfgid = uci:section(appname, "nodes", api.gen_random_char())
for kkk, vvv in pairs(vv) do
if type(vvv) == "table" and next(vvv) ~= nil then
uci:set_list(appname, cfgid, kkk, vvv)