luci-app-passwall: sync upstream
This commit is contained in:
parent
17dde9704e
commit
d84a869f4f
@ -507,13 +507,15 @@ trojan_loglevel:value("4", "fatal")
|
|||||||
|
|
||||||
o = s:taboption("log", Flag, "advanced_log_feature", translate("Advanced log feature"), translate("For professionals only."))
|
o = s:taboption("log", Flag, "advanced_log_feature", translate("Advanced log feature"), translate("For professionals only."))
|
||||||
o.default = "0"
|
o.default = "0"
|
||||||
o.rmempty = false
|
o = s:taboption("log", Flag, "sys_log", translate("Logging to system log"), translate("Logging to the system log for more advanced functions. For example, send logs to a dedicated log server."))
|
||||||
local syslog = s:taboption("log", Flag, "sys_log", translate("Logging to system log"), translate("Logging to the system log for more advanced functions. For example, send logs to a dedicated log server."))
|
o:depends("advanced_log_feature", "1")
|
||||||
syslog:depends("advanced_log_feature", "1")
|
o.default = "0"
|
||||||
syslog.default = "0"
|
o = s:taboption("log", Value, "persist_log_path", translate("Persist log file directory"), translate("The path to the directory used to store persist log files, the \"/\" at the end can be omitted. Leave it blank to disable this feature."))
|
||||||
syslog.rmempty = false
|
o:depends({ ["advanced_log_feature"] = 1, ["sys_log"] = 0 })
|
||||||
local logpath = s:taboption("log", Value, "persist_log_path", translate("Persist log file directory"), translate("The path to the directory used to store persist log files, the \"/\" at the end can be omitted. Leave it blank to disable this feature."))
|
o = s:taboption("log", Value, "log_event_filter", translate("Log Event Filter"), translate("Support regular expression."))
|
||||||
logpath:depends({ ["advanced_log_feature"] = 1, ["sys_log"] = 0 })
|
o:depends("advanced_log_feature", "1")
|
||||||
|
o = s:taboption("log", Value, "log_event_cmd", translate("Shell Command"), translate("Shell command to execute, replace log content with %s."))
|
||||||
|
o:depends("advanced_log_feature", "1")
|
||||||
|
|
||||||
s:tab("faq", "FAQ")
|
s:tab("faq", "FAQ")
|
||||||
|
|
||||||
|
@ -1393,6 +1393,18 @@ msgstr "记录到系统日志"
|
|||||||
msgid "Logging to the system log for more advanced functions. For example, send logs to a dedicated log server."
|
msgid "Logging to the system log for more advanced functions. For example, send logs to a dedicated log server."
|
||||||
msgstr "将日志记录到系统日志,以实现更加高级的功能。例如,把日志发送到专门的日志服务器。"
|
msgstr "将日志记录到系统日志,以实现更加高级的功能。例如,把日志发送到专门的日志服务器。"
|
||||||
|
|
||||||
|
msgid "Log Event Filter"
|
||||||
|
msgstr "日志事件过滤器"
|
||||||
|
|
||||||
|
msgid "Support regular expression."
|
||||||
|
msgstr "支持正则表达式。"
|
||||||
|
|
||||||
|
msgid "Shell Command"
|
||||||
|
msgstr "Shell 命令"
|
||||||
|
|
||||||
|
msgid "Shell command to execute, replace log content with %s."
|
||||||
|
msgstr "要执行的 Shell 命令,用 %s 代替日志内容。"
|
||||||
|
|
||||||
msgid "Not enabled log"
|
msgid "Not enabled log"
|
||||||
msgstr "未启用日志"
|
msgstr "未启用日志"
|
||||||
|
|
||||||
|
@ -3,13 +3,17 @@
|
|||||||
CONFIG=passwall
|
CONFIG=passwall
|
||||||
LOG_FILE=/tmp/log/$CONFIG.log
|
LOG_FILE=/tmp/log/$CONFIG.log
|
||||||
LOCK_FILE_DIR=/tmp/lock
|
LOCK_FILE_DIR=/tmp/lock
|
||||||
|
LOG_EVENT_FILTER=
|
||||||
|
LOG_EVENT_CMD=
|
||||||
flag=0
|
flag=0
|
||||||
|
|
||||||
echolog() {
|
echolog() {
|
||||||
local d="$(date "+%Y-%m-%d %H:%M:%S")"
|
local d="$(date "+%Y-%m-%d %H:%M:%S")"
|
||||||
#echo -e "$d: $1"
|
local c="$1"
|
||||||
echo -e "$d: $1" >> $LOG_FILE
|
echo -e "$d: $c" >> $LOG_FILE
|
||||||
|
[ -n "$LOG_EVENT_CMD" ] && [ -n "$(echo -n $c |grep -E "$LOG_EVENT_FILTER")" ] && {
|
||||||
|
$(echo -n $LOG_EVENT_CMD |sed "s/%s/$c/g")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config_n_get() {
|
config_n_get() {
|
||||||
@ -154,6 +158,8 @@ test_auto_switch() {
|
|||||||
start() {
|
start() {
|
||||||
id=$1
|
id=$1
|
||||||
LOCK_FILE=${LOCK_FILE_DIR}/${CONFIG}_socks_auto_switch_${id}.lock
|
LOCK_FILE=${LOCK_FILE_DIR}/${CONFIG}_socks_auto_switch_${id}.lock
|
||||||
|
LOG_EVENT_FILTER=$(uci -q get "${CONFIG}.global[0].log_event_filter" 2>/dev/null)
|
||||||
|
LOG_EVENT_CMD=$(uci -q get "${CONFIG}.global[0].log_event_cmd" 2>/dev/null)
|
||||||
main_node=$(config_n_get $id node nil)
|
main_node=$(config_n_get $id node nil)
|
||||||
socks_port=$(config_n_get $id port 0)
|
socks_port=$(config_n_get $id port 0)
|
||||||
delay=$(config_n_get $id autoswitch_testing_time 30)
|
delay=$(config_n_get $id autoswitch_testing_time 30)
|
||||||
|
Loading…
Reference in New Issue
Block a user