This commit is contained in:
lean 2020-03-18 13:45:04 +08:00
commit 47e76662a4
7 changed files with 40 additions and 9 deletions

View File

@ -1,18 +1,18 @@
#
# Copyright 2020 Weizheng Li <lwz322@qq.com>
# Copyright 2020 lwz322 <lwz322@qq.com>
# Licensed to the public under the MIT License.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-frps
PKG_VERSION:=0.0.1
PKG_VERSION:=0.0.2
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Weizheng Li <lwz322@qq.com>
PKG_MAINTAINER:=lwz322 <lwz322@qq.com>
LUCI_TITLE:=LuCI support for Frps
LUCI_DEPENDS:=+wget +frps

View File

@ -1,4 +1,4 @@
-- Copyright 2020 Weizheng Li <lwz322@qq.com>
-- Copyright 2020 lwz322 <lwz322@qq.com>
-- Licensed to the public under the MIT License.
local http = require "luci.http"

View File

@ -1,4 +1,4 @@
-- Copyright 2020 Weizheng Li <lwz322@qq.com>
-- Copyright 2020 lwz322 <lwz322@qq.com>
-- Licensed to the public under the MIT License.
local uci = require "luci.model.uci".cursor()

View File

@ -1,4 +1,4 @@
-- Copyright 2020 Weizheng Li <lwz322@qq.com>
-- Copyright 2020 lwz322 <lwz322@qq.com>
-- Licensed to the public under the MIT License.
local dsp = require "luci.dispatcher"
@ -24,6 +24,13 @@ o.disabled = "false"
o.defalut = o.enabled
o.rmempty = false
o = s:option(Flag, "tls_only", translate("Enforce frps only accept TLS connection")
translatef("Requirements: frpc v0.25.0+, frps v0.32.0+"))
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o.rmempty = false
o = s:option(Value, "bind_udp_port", translate("UDP bind port"),
translatef("Optional: udp port to help make udp hole to penetrate nat"))
o.datatype = "port"
@ -40,4 +47,8 @@ o = s:option(Value, "vhost_https_port", translate("vhost https port"),
translatef("Optional: Note: http port and https port can be same with bind_port"))
o.datatype = "port"
o = s:option(DynamicList, "extra_setting", translate("Extra Settings"),
translatef("List of extra settings will be added to config file. Format: option=value, eg. <code>detailed_errors_to_client=false</code>.(NO SPACE!)"))
o.placeholder = "option=value"
return m

View File

@ -1,5 +1,5 @@
<%#
Copyright 2020 Weizheng Li <lwz322@qq.com>
Copyright 2020 lwz322 <lwz322@qq.com>
Licensed to the public under the MIT License.
-%>

View File

@ -172,6 +172,12 @@ msgstr "子域名"
msgid "TCP mux"
msgstr "TCP 复用"
#: luasrc/model/cbi/frps/server.lua:27
msgid "Enforce frps only accept TLS connection"
msgstr "强制frps只接受TLS连接"
msgid "Requirements: frpc v0.25.0+, frps v0.32.0+"
msgstr "要求frpc版本0.25.0+, frps版本0.32.0+"
#: luasrc/model/cbi/frps/server.lua:18
msgid "Token"
msgstr "令牌"
@ -231,3 +237,9 @@ msgstr "虚拟主机http绑定端口"
#: luasrc/model/cbi/frps/server.lua:39
msgid "vhost https port"
msgstr "虚拟主机https绑定端口"
#: luasrc/model/cbi/frps/server.lua:50
msgid "Extra Settings"
msgstr "额外设置"
msgid "List of extra settings will be added to config file. Format: option=value, eg. <code>detailed_errors_to_client=false</code>.(NO SPACE!)"
msgstr "额外设置列表将会被添加到config文件中。 格式option=value<code>detailed_errors_to_client=false</code>.(不含空格!)"

View File

@ -1,6 +1,6 @@
#!/bin/sh /etc/rc.common
#
# Copyright 2020 Weizheng Li <lwz322@qq.com>
# Copyright 2020 lwz322 <lwz322@qq.com>
# Licensed to the public under the MIT License.
#
@ -71,6 +71,7 @@ frps_scetion_validate() {
'bind_port:port' \
'token:string' \
'tcp_mux:or("true", "false"):true' \
'tls_only:or("true", "false"):false' \
'bind_udp_port:port' \
'kcp_bind_port:port' \
'vhost_http_port:port' \
@ -98,7 +99,7 @@ create_config_file() {
echo "[common]" > "$tmp_file"
append_options "$tmp_file" \
"bind_port" "token" "tcp_mux" "bind_udp_port" "kcp_bind_port" "vhost_http_port" "vhost_https_port"
"bind_port" "token" "tcp_mux" "tls_only" "bind_udp_port" "kcp_bind_port" "vhost_http_port" "vhost_https_port"
if [ "x$enable_logging" = "x1" ] ; then
@ -130,6 +131,13 @@ create_config_file() {
append_options "$tmp_file" \
"max_pool_count" "max_ports_per_client" "subdomain_host" "dashboard_addr" "dashboard_port" "dashboard_user" "dashboard_pwd"
extra_setting=$(uci get frps.main.extra_setting 2>/dev/null)
if [ -n "$extra_setting" ] ; then
for o in $extra_setting ;do
echo "$o" >> "$tmp_file"
done
fi
sed '/^$/d' "$tmp_file" >"$config_file"
if [ "$?" = "0" ] ; then