From d0922b9398eecddff7aa751dcbe3b229cfbc033f Mon Sep 17 00:00:00 2001 From: lean Date: Sat, 4 Apr 2020 00:18:26 +0800 Subject: [PATCH] luci-app-ssr-plus: display log when enable socks5 server only --- package/lean/luci-app-ssr-plus/Makefile | 2 +- .../luasrc/model/cbi/shadowsocksr/log.lua | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile index 90f41900c..aaef6b01a 100644 --- a/package/lean/luci-app-ssr-plus/Makefile +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus PKG_VERSION:=175 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/log.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/log.lua index 7492bd187..6c5938ed7 100644 --- a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/log.lua +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/log.lua @@ -1,17 +1,20 @@ +local fs = require "nixio.fs" + f = SimpleForm("logview") -f.reset = false -f.submit = false + t = f:field(TextValue, "conf") t.rmempty = true t.rows = 20 function t.cfgvalue() -local logs = luci.util.execi("cat /tmp/ssrplus.log") -local s = "" -for line in logs do -s = line .. "\n" .. s -end -return s + if fs.access("/tmp/ssrplus.log") then + local logs = luci.util.execi("cat /tmp/ssrplus.log") + local s = "" + for line in logs do + s = line .. "\n" .. s + end + return s + end end t.readonly="readonly" -return f +return f \ No newline at end of file