luci-app-passwall: sync with upstream source

This commit is contained in:
xiaorouji 2021-01-07 12:12:47 +08:00 committed by CN_SZTL
parent e385554af8
commit 66cc0cd6c3
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
6 changed files with 9 additions and 32 deletions

View File

@ -340,15 +340,14 @@ function server_user_status()
end
function server_user_log()
local e = {}
local id = luci.http.formvalue("id")
if nixio.fs.access("/var/etc/passwall_server/" .. id .. ".log") then
e.code = 200
local content = luci.sys.exec("cat /var/etc/passwall_server/" .. id .. ".log")
content = content:gsub("\n", "<br />")
luci.http.write(content)
else
e.code = 400
luci.http.write(string.format("<script>alert('%s');window.close();</script>", i18n.translate("Not enabled log")))
end
e.data = luci.sys.exec("cat /var/etc/passwall_server/" .. id .. ".log")
http_write_json(e)
end
function server_get_log()

View File

@ -12,8 +12,6 @@ s.anonymous = true
s:tab("direct_list", translate("Direct List"))
s:tab("proxy_list", translate("Proxy List"))
s:tab("proxy_list2", translate("Proxy List") .. " 2")
s:tab("proxy_list3", translate("Proxy List") .. " 3")
---- Direct Hosts
local direct_host = string.format("/usr/share/%s/rules/direct_host", appname)

View File

@ -1,26 +1,5 @@
<script type="text/javascript">
//<![CDATA[
function get_log(cbi_id) {
if (cbi_id) {
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[server_user_log]])%>', {
id: cbi_id
},
function(x, result) {
if (x && x.status == 200) {
if (result.code == 200) {
var content = result.data;
content = content.replace(/\n/g, "<br />");
var new_window = window.open();
new_window.document.write(content);
} else {
alert('<%:Not enabled log%>');
}
}
}
);
}
}
var _users_status = document.getElementsByClassName('_users_status');
for(var i = 0; i < _users_status.length; i++) {
var id = _users_status[i].parentElement.parentElement.parentElement.id;
@ -45,7 +24,7 @@
var td = edit_btn[i].parentNode;
var new_div = "";
//添加"日志"按钮
new_div += '<input class="cbi-button cbi-button-add" type="button" value="<%:Log%>" onclick="get_log(\'' + id + '\')"/>&nbsp;&nbsp;';
new_div += '<input class="cbi-button cbi-button-add" type="button" value="<%:Log%>" onclick="window.open(\'' + '<%=url([[admin]], [[services]], [[passwall]], [[server_user_log]])%>' + '?id=' + id + '\', \'_blank\')"/>&nbsp;&nbsp;';
td.innerHTML = new_div + td.innerHTML;
}
catch(err) {

View File

@ -1234,7 +1234,7 @@ start() {
start_redir UDP udp
start_dns
add_dnsmasq
source $APP_PATH/iptables.sh start &
source $APP_PATH/iptables.sh start
/etc/init.d/dnsmasq restart >/dev/null 2>&1
echolog "重启 dnsmasq 服务[$?]"
}

View File

@ -575,7 +575,7 @@ add_firewall_rule() {
}
del_firewall_rule() {
ib_nat_exist=`$ipt_n -L PREROUTING | grep -c PSW`
ib_nat_exist=$($ipt_n -nL PREROUTING | grep -c PSW)
if [ ! -z "$ib_nat_exist" ];then
until [ "$ib_nat_exist" = 0 ]
do
@ -592,7 +592,7 @@ del_firewall_rule() {
$ip6t_m -D PREROUTING -j PSW 2>/dev/null
$ip6t_m -D OUTPUT -p tcp -j PSW_OUTPUT 2>/dev/null
ib_nat_exist=`expr $ib_nat_exist - 1`
ib_nat_exist=$(expr $ib_nat_exist - 1)
done
fi
$ipt_n -F PSW 2>/dev/null && $ipt_n -X PSW 2>/dev/null

View File

@ -62,6 +62,7 @@ gnews.org
go.com
google.com
google.com.hk
google.com.sg
google.com.tw
googleapis.com
googletagmanager.com