From b1c6b17bf7ea3622323252a3fb3e2ad0e241f468 Mon Sep 17 00:00:00 2001 From: bobo liu <7552030+fakeboboliu@users.noreply.github.com> Date: Tue, 9 Mar 2021 23:13:48 +0800 Subject: [PATCH] luci-app-frpc: add config field of user (#6496) --- package/lean/luci-app-frpc/Makefile | 2 +- package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua | 4 ++++ package/lean/luci-app-frpc/po/zh-cn/frp.po | 6 ++++++ package/lean/luci-app-frpc/root/etc/config/frp | 1 + package/lean/luci-app-frpc/root/etc/init.d/frp | 4 +++- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package/lean/luci-app-frpc/Makefile b/package/lean/luci-app-frpc/Makefile index ed9bb9c86..6804fdcf3 100644 --- a/package/lean/luci-app-frpc/Makefile +++ b/package/lean/luci-app-frpc/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=LuCI for FRPC LUCI_DEPENDS:=+wget +frpc LUCI_PKGARCH:=all -PKG_VERSION:=1.2 +PKG_VERSION:=1.3 PKG_RELEASE:=1 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua index 531dd84f6..34fc151fb 100644 --- a/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua +++ b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua @@ -26,6 +26,10 @@ e=t:taboption("base",Value, "token", translate("Token"), translate("Time duratio e.optional=false e.password=true e.rmempty=false +e=t:taboption("base",Value, "user", translate("User"), translate("Commonly used to distinguish you with other clients.")) +e.optional=true +e.default = "" +e.rmempty=false e=t:taboption("base",Value, "vhost_http_port", translate("Vhost HTTP Port")) e.datatype = "port" e.rmempty=false diff --git a/package/lean/luci-app-frpc/po/zh-cn/frp.po b/package/lean/luci-app-frpc/po/zh-cn/frp.po index 17f775a70..72698cb3f 100644 --- a/package/lean/luci-app-frpc/po/zh-cn/frp.po +++ b/package/lean/luci-app-frpc/po/zh-cn/frp.po @@ -41,6 +41,12 @@ msgstr "端口" msgid "Token" msgstr "令牌" +msgid "User" +msgstr "用户名" + +msgid "Commonly used to distinguish you with other clients." +msgstr "通常用于区分你与其他客户端" + msgid "Time duration between server of frpc and frps mustn't exceed 15 minutes." msgstr "frpc服务器与frps之间的时间间隔不得超过15分钟" diff --git a/package/lean/luci-app-frpc/root/etc/config/frp b/package/lean/luci-app-frpc/root/etc/config/frp index 736e571f9..8b1f67bbb 100644 --- a/package/lean/luci-app-frpc/root/etc/config/frp +++ b/package/lean/luci-app-frpc/root/etc/config/frp @@ -14,3 +14,4 @@ config frp 'common' option log_level 'info' option enable_http_proxy '0' option protocol 'tcp' + option user '' diff --git a/package/lean/luci-app-frpc/root/etc/init.d/frp b/package/lean/luci-app-frpc/root/etc/init.d/frp index 53fee3ba3..21a2e55d9 100755 --- a/package/lean/luci-app-frpc/root/etc/init.d/frp +++ b/package/lean/luci-app-frpc/root/etc/init.d/frp @@ -171,7 +171,7 @@ boot() { start() { config_load "frp" - local enabled server_addr server_port time privilege_token tcp_mux enable_cpool + local enabled server_addr server_port time privilege_token user tcp_mux enable_cpool local pool_count log_level log_max_days login_fail_exit http_proxy protocol config_get_bool enabled common enabled 1 @@ -181,6 +181,7 @@ start() { config_get server_addr common server_addr config_get server_port common server_port config_get token common token + config_get user common user config_get enable_cpool common enable_cpool config_get pool_count common pool_count config_get log_level common log_level @@ -201,6 +202,7 @@ start() { echo "server_addr=${server_addr}" >>$tmpconf echo "server_port=${server_port}" >>$tmpconf echo "token=${token}" >>$tmpconf + [ -n "$user" ] && echo "user=$user" >>$tmpconf echo "log_level=${log_level}" >>$tmpconf echo "log_max_days=${log_max_days}" >>$tmpconf echo "protocol=${protocol}" >>$tmpconf