Browse Source

luci-app-ssr-plus: adapter luci-theme-openwrt-2020 theme

1、Status bar related services:Not running shows red, running shows green;
2、Kcptun version number of the status bar is bold。
zxlhhyccc 4 years ago
parent
commit
21f809797e
1 changed files with 10 additions and 9 deletions
  1. 10 9
      luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua

+ 10 - 9
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua

@@ -17,8 +17,9 @@ local nfip_count = 0
 local Process_list = luci.sys.exec("busybox ps -w")
 local uci = luci.model.uci.cursor()
 -- html constants
-font_blue = [[<font color="green">]]
-font_off = [[</font>]]
+font_blue = [[<b style=color:green>]]
+style_blue = [[<b style=color:red>]]
+font_off = [[</b>]]
 bold_on = [[<strong>]]
 bold_off = [[</strong>]]
 local kcptun_version = translate("Unknown")
@@ -29,7 +30,7 @@ else
 	if not nixio.fs.access(kcp_file, "rwx", "rx", "rx") then
 		nixio.fs.chmod(kcp_file, 755)
 	end
-	kcptun_version = luci.sys.exec(kcp_file .. " -v | awk '{printf $3}'")
+	kcptun_version = "<b>" ..luci.sys.exec(kcp_file .. " -v | awk '{printf $3}'") .. "</b>"
 	if not kcptun_version or kcptun_version == "" then
 		kcptun_version = translate("Unknown")
 	end
@@ -100,7 +101,7 @@ s.rawhtml = true
 if redir_run == 1 then
 	s.value = font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
 else
-	s.value = translate("Not Running")
+	s.value = style_blue .. bold_on .. translate("Not Running") .. bold_off .. font_off
 end
 
 s = m:field(DummyValue, "reudp_run", translate("Game Mode UDP Relay"))
@@ -108,7 +109,7 @@ s.rawhtml = true
 if reudp_run == 1 then
 	s.value = font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
 else
-	s.value = translate("Not Running")
+	s.value = style_blue .. bold_on .. translate("Not Running") .. bold_off .. font_off
 end
 
 if uci:get_first("shadowsocksr", 'global', 'pdnsd_enable', '0') ~= '0' then
@@ -117,7 +118,7 @@ if uci:get_first("shadowsocksr", 'global', 'pdnsd_enable', '0') ~= '0' then
 	if pdnsd_run == 1 then
 		s.value = font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
 	else
-		s.value = translate("Not Running")
+		s.value = style_blue .. bold_on .. translate("Not Running") .. bold_off .. font_off
 	end
 end
 
@@ -126,7 +127,7 @@ s.rawhtml = true
 if sock5_run == 1 then
 	s.value = font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
 else
-	s.value = translate("Not Running")
+	s.value = style_blue .. bold_on .. translate("Not Running") .. bold_off .. font_off
 end
 
 s = m:field(DummyValue, "server_run", translate("Local Servers"))
@@ -134,7 +135,7 @@ s.rawhtml = true
 if server_run == 1 then
 	s.value = font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
 else
-	s.value = translate("Not Running")
+	s.value = style_blue .. bold_on .. translate("Not Running") .. bold_off .. font_off
 end
 
 if nixio.fs.access("/usr/bin/kcptun-client") then
@@ -146,7 +147,7 @@ if nixio.fs.access("/usr/bin/kcptun-client") then
 	if kcptun_run == 1 then
 		s.value = font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
 	else
-		s.value = translate("Not Running")
+		s.value = style_blue .. bold_on .. translate("Not Running") .. bold_off .. font_off
 	end
 end