插件更名
This commit is contained in:
parent
d30c1bbed7
commit
023e570e3a
@ -10,7 +10,7 @@ LUCI_TITLE:=LuCI for Frp Client
|
||||
LUCI_DEPENDS:=+wget +frpc
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-frpclient
|
||||
PKG_NAME:=luci-app-frpc
|
||||
PKG_VERSION:=1.4
|
||||
PKG_RELEASE:=2
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
module("luci.controller.frp", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/frp") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "frp"}, cbi("frp/basic"), _("Frp Client"), 100).dependent = true
|
||||
entry({"admin", "services", "frp", "config"}, cbi("frp/config")).leaf = true
|
||||
entry({"admin", "services", "frp", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pidof frpc > /dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
18
luci-app-frpc/luasrc/controller/frpc.lua
Normal file
18
luci-app-frpc/luasrc/controller/frpc.lua
Normal file
@ -0,0 +1,18 @@
|
||||
module("luci.controller.frpc", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/frpc") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "frpc"}, cbi("frpc/basic"), _("Frp Client"), 100).dependent = true
|
||||
entry({"admin", "services", "frpc", "config"}, cbi("frpc/config")).leaf = true
|
||||
entry({"admin", "services", "frpc", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pidof frpc > /dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
@ -2,17 +2,17 @@ local o = require "luci.dispatcher"
|
||||
local e = require ("luci.model.ipkg")
|
||||
local s = require "nixio.fs"
|
||||
local e = luci.model.uci.cursor()
|
||||
local i = "frp"
|
||||
local i = "frpc"
|
||||
local a, t, e
|
||||
local n = {}
|
||||
|
||||
a = Map("frp")
|
||||
a = Map("frpc")
|
||||
a.title = translate("Frp Client")
|
||||
a.description = translate("Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.")
|
||||
|
||||
a:section(SimpleSection).template = "frp/frp_status"
|
||||
a:section(SimpleSection).template = "frpc/frp_status"
|
||||
|
||||
t = a:section(NamedSection, "common", "frp")
|
||||
t = a:section(NamedSection, "common", "frpc")
|
||||
t.anonymous = true
|
||||
t.addremove = false
|
||||
|
||||
@ -165,7 +165,7 @@ e.rows = 26
|
||||
e.wrap = "off"
|
||||
e.readonly = true
|
||||
e.cfgvalue = function(t,t)
|
||||
return s.readfile("/var/etc/frp/frpc.log")or""
|
||||
return s.readfile("/var/etc/frpc/frpc.log")or""
|
||||
end
|
||||
e.write = function(e,e,e)
|
||||
end
|
@ -1,13 +1,13 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[frp]], [[status]])%>', null,
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[frpc]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('frp_status');
|
||||
var tb = document.getElementById('frpc_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>Frp <%:RUNNING%></font></b></em>';
|
||||
var links = '<em><b><font color=green>Frpc <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>Frp <%:NOT RUNNING%></font></b></em>';
|
||||
tb.innerHTML = '<em><b><font color=red>Frpc <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[frp]], [[status]])%>', null,
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="frp_status">
|
||||
<p id="frpc_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
@ -6,7 +6,7 @@ START=99
|
||||
SERVICE_WRITE_PID=1
|
||||
SERVICE_DAEMONIZE=1
|
||||
|
||||
LOGFILE="/var/etc/frp/frpc.log"
|
||||
LOGFILE="/var/etc/frpc/frpc.log"
|
||||
|
||||
echo_date(){
|
||||
local log=$1
|
||||
@ -154,7 +154,7 @@ frp_add_cru(){
|
||||
time=$1
|
||||
if [ ! -f "/etc/crontabs/root" ] || [ -z "$(cat /etc/crontabs/root | grep frp)" ]; then
|
||||
sed -i '/frp/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
echo "*/$time * * * * /etc/init.d/frp restart" >> /etc/crontabs/root
|
||||
echo "*/$time * * * * /etc/init.d/frpc restart" >> /etc/crontabs/root
|
||||
fi
|
||||
|
||||
}
|
||||
@ -186,7 +186,7 @@ boot() {
|
||||
|
||||
start() {
|
||||
|
||||
config_load "frp"
|
||||
config_load "frpc"
|
||||
local enabled server_addr server_port time privilege_token user tcp_mux enable_cpool tls_enable
|
||||
local pool_count log_level log_max_days login_fail_exit http_proxy protocol admin_port admin_user admin_pwd
|
||||
local tls_cert_file tls_key_file tls_trusted_ca_file
|
||||
@ -214,13 +214,13 @@ start() {
|
||||
config_get tls_trusted_ca_file common tls_trusted_ca_file
|
||||
|
||||
|
||||
mkdir -p /var/etc/frp
|
||||
mkdir -p /var/etc/frpc
|
||||
[ ! -f "$LOGFILE" ] && touch $LOGFILE
|
||||
|
||||
[ ! -f "/usr/bin/frpc" ] && download_binary
|
||||
[ ! -f "/usr/bin/frpc" ] && logger -t Frp 'Download frpc failed, please retry.' && exit 0
|
||||
|
||||
local tmpconf="/var/etc/frp/frpc.conf"
|
||||
local tmpconf="/var/etc/frpc/frpc.conf"
|
||||
|
||||
echo "[common]" >$tmpconf
|
||||
echo "server_addr=${server_addr}" >>$tmpconf
|
||||
@ -240,7 +240,7 @@ start() {
|
||||
[ -n "$tls_trusted_ca_file" ] && echo "tls_trusted_ca_file=$tls_trusted_ca_file" >>$tmpconf
|
||||
|
||||
|
||||
config_load "frp"
|
||||
config_load "frpc"
|
||||
frp_write_bool tcp_mux common 1
|
||||
frp_write_bool tls_enable common 0
|
||||
frp_write_bool login_fail_exit common 1
|
@ -1,9 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@frp[-1]
|
||||
add ucitrack frp
|
||||
set ucitrack.@frp[-1].init=frp
|
||||
delete ucitrack.@frpc[-1]
|
||||
add ucitrack frpc
|
||||
set ucitrack.@frpc[-1].init=frpc
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
@ -2,10 +2,10 @@
|
||||
"luci-app-frpc": {
|
||||
"description": "Grant UCI access for luci-app-frpc",
|
||||
"read": {
|
||||
"uci": [ "frp" ]
|
||||
"uci": [ "frpc" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "frp" ]
|
||||
"uci": [ "frpc" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user