Skip to content

Commit

Permalink
chore: Format code
Browse files Browse the repository at this point in the history
Signed-off-by: Xingwang Liao <[email protected]>
  • Loading branch information
kuoruan committed Apr 9, 2019
1 parent 2f058a5 commit 1572926
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 205 deletions.
48 changes: 24 additions & 24 deletions luasrc/model/cbi/frpc/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ local server_table = { }
uci:foreach("frpc", "server", function(s)
if s.alias then
server_table[s[".name"]] = s.alias
elseif s.server_addr and s.server_port then
local ip = s.server_addr
if s.server_addr:find(":") then
ip = "[%s]" % s.server_addr
end
elseif s.server_addr and s.server_port then
local ip = s.server_addr
if s.server_addr:find(":") then
ip = "[%s]" % s.server_addr
end
server_table[s[".name"]] = "%s:%s" % { ip, s.server_port }
end
end)

local function frpc_version()
local file = uci:get("frpc", "main", "client_file")
local file = uci:get("frpc", "main", "client_file")

if not file or file == "" or not fs.stat(file) then
return "<em style=\"color: red;\">%s</em>" % translate("Invalid client file")
end
if not file or file == "" or not fs.stat(file) then
return "<em style=\"color: red;\">%s</em>" % translate("Invalid client file")
end

if not fs.access(file, "rwx", "rx", "rx") then
fs.chmod(file, 755)
end
if not fs.access(file, "rwx", "rx", "rx") then
fs.chmod(file, 755)
end

local version = util.trim(sys.exec("%s -v 2>/dev/null" % file))
if version == "" then
return "<em style=\"color: red;\">%s</em>" % translate("Can't get client version")
end
return translatef("Version: %s", version)
local version = util.trim(sys.exec("%s -v 2>/dev/null" % file))
if version == "" then
return "<em style=\"color: red;\">%s</em>" % translate("Can't get client version")
end
return translatef("Version: %s", version)
end

m = Map("frpc", "%s - %s" % { translate("Frpc"), translate("Common Settings") },
Expand Down Expand Up @@ -68,11 +68,11 @@ for k, v in pairs(server_table) do
end

o = s:taboption("general", ListValue, "run_user", translate("Run daemon as user"),
translate("Leave blank to use default user"))
translate("Leave blank to use default user"))
o:value("")
local user
for user in util.execi("cat /etc/passwd | cut -d':' -f1") do
o:value(user)
o:value(user)
end

o = s:taboption("general", Flag, "enable_logging", translate("Enable logging"))
Expand All @@ -96,13 +96,13 @@ o.datatype = "uinteger"
o.placeholder = '3'

o = s:taboption("advanced", Value, "pool_count", translate("Pool count"),
translate("Connections will be established in advance, default value is zero"))
translate("Connections will be established in advance, default value is zero"))
o.datatype = "uinteger"
o.defalut = '0'
o.placeholder = '0'

o = s:taboption("advanced", Value, "user", translate("Proxy user"),
translate("Your proxy name will be changed to {user}.{proxy}"))
translate("Your proxy name will be changed to {user}.{proxy}"))

o = s:taboption("advanced", Flag, "login_fail_exit", translate("Login fail exit"))
o.enabled = "true"
Expand All @@ -111,17 +111,17 @@ o.defalut = o.enabled
o.rmempty = false

o = s:taboption("advanced", ListValue, "protocol", translate("Protocol"),
translate("Communication protocol used to connect to server, default is tcp"))
translate("Communication protocol used to connect to server, default is tcp"))
o:value("tcp", "TCP")
o:value("kcp", "KCP")
o:value("websocket", "Websocket")
o.default = "tcp"

o = s:taboption("advanced", Value, "http_proxy", translate("HTTP proxy"),
translate("Connect frps by http proxy or socks5 proxy, format: [protocol]://[user]:[passwd]@[ip]:[port]"))
translate("Connect frps by http proxy or socks5 proxy, format: [protocol]://[user]:[passwd]@[ip]:[port]"))

o = s:taboption("advanced", Flag, "tls_enable", translate("TLS enable"),
translate("If true, Frpc will connect Frps by TLS"))
translate("If true, Frpc will connect Frps by TLS"))
o.enabled = "true"
o.disabled = "false"

Expand Down
2 changes: 1 addition & 1 deletion luasrc/model/cbi/frpc/rules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end

o = s:option(DummyValue, "type", translate("Type"))
o.cfgvalue = function (...)
local v = Value.cfgvalue(...)
local v = Value.cfgvalue(...)
return v and v:upper() or "?"
end

Expand Down
2 changes: 1 addition & 1 deletion luasrc/model/cbi/frpc/servers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ end

o = s:option(DummyValue, "tcp_mux", translate("TCP Mux"))
o.cfgvalue = function (...)
local v = Value.cfgvalue(...)
local v = Value.cfgvalue(...)
return v == "true" and translate("True") or translate("False")
end

Expand Down
28 changes: 14 additions & 14 deletions luasrc/view/frpc/status_header.htm
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
-%>

<fieldset class="cbi-section">
<p id="frpc_status">
<em><%:Collecting data...%></em>
</p>
<p id="frpc_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

<script type="text/javascript">//<![CDATA[
XHR.poll(5, '<%=dsp.build_url("admin/services/frpc/status")%>', null,
function (x, data) {
if (x.status !== 200 || !data) {
return;
}
XHR.poll(5, '<%=dsp.build_url("admin/services/frpc/status")%>', null,
function (x, data) {
if (x.status !== 200 || !data) {
return;
}

var frpcStatusElm = document.getElementById('frpc_status');
frpcStatusElm.innerHTML = data.running
? '<%:Running%>'
: '<%:Not Running%>';
}
)
var frpcStatusElm = document.getElementById('frpc_status');
frpcStatusElm.innerHTML = data.running
? '<%:Running%>'
: '<%:Not Running%>';
}
);
//]]></script>
Loading

0 comments on commit 1572926

Please sign in to comment.