diff --git a/assets/lang/en.json b/assets/lang/en.json index da59091..66fba05 100644 --- a/assets/lang/en.json +++ b/assets/lang/en.json @@ -9,7 +9,7 @@ "Username or password incorrect": "Username or password incorrect", "Empty data": "Empty data", "Client Info": "Client Info", - "Proxies Status": "Proxies Status", + "Overview": "Overview", "Proxies": "Proxies", "Server Address": "Server Address", "Server Port": "Server Port", @@ -36,7 +36,7 @@ "Basic": "Basic Params", "Extra": "Extra Params", "Proxy Name": "Proxy Name", - "Customize Domains": "Customize Domains", + "Custom Domains": "Custom Domains", "Subdomain": "Subdomain", "Remote Port": "Remote Port", "Use Encryption": "Use Encryption", diff --git a/assets/lang/zh.json b/assets/lang/zh.json index 3ed545c..a984944 100644 --- a/assets/lang/zh.json +++ b/assets/lang/zh.json @@ -9,8 +9,8 @@ "Username or password incorrect": "用户名或密码错误", "Empty data": "无数据", "Client Info": "客户端信息", - "Proxies Status": "代理状态", - "Proxies": "代理", + "Overview": "概览列表", + "Proxies": "代理列表", "Server Address": "服务器地址", "Server Port": "服务器端口", "Protocol": "连接协议", @@ -36,7 +36,7 @@ "Basic": "基础参数", "Extra": "附加参数", "Proxy Name": "代理名称", - "Customize Domains": "自定义域名", + "Custom Domains": "自定义域名", "Subdomain": "子域名", "Remote Port": "服务端端口", "Use Encryption": "加密传输", diff --git a/assets/static/css/index.css b/assets/static/css/index.css index 35c09c2..a963809 100644 --- a/assets/static/css/index.css +++ b/assets/static/css/index.css @@ -81,11 +81,11 @@ section { } .layui-form-label { - width: 140px; + width: 100px; } .layui-input-block { - margin-left: 170px; + margin-left: 130px; } .layui-btn-sm { diff --git a/assets/static/js/index-proxy-list.js b/assets/static/js/index-proxy-list.js index 15c306c..37cad5a 100644 --- a/assets/static/js/index-proxy-list.js +++ b/assets/static/js/index-proxy-list.js @@ -1,7 +1,7 @@ var loadProxyInfo = (function ($) { var i18n = {}, currentProxyType, currentTitle; //param names in Basic tab - var basicParamNames = ['name', 'type', 'local_ip', 'local_port', 'custom_domains', 'sub_domain', 'remote_port', 'use_encryption', 'use_compression']; + var basicParamNames = ['name', 'type', 'local_ip', 'local_port', 'custom_domains', 'subdomain', 'remote_port', 'use_encryption', 'use_compression']; /** * get proxy info @@ -15,7 +15,7 @@ var loadProxyInfo = (function ($) { if (title != null) currentTitle = title; if (proxyType != null) - currentProxyType = proxyType; + currentProxyType = proxyType.toLowerCase(); $("#title").text(currentTitle); $('#content').empty(); var loading = layui.layer.load(); @@ -45,6 +45,11 @@ var loadProxyInfo = (function ($) { temp.name = key; temp.local_ip = temp.local_ip || '-'; temp.local_port = temp.local_port || '-'; + temp.use_encryption = temp.use_encryption || false; + if (currentProxyType === 'http' || currentProxyType === 'https') { + temp.custom_domains = temp.custom_domains || '-'; + temp.subdomain = temp.subdomain || '-'; + } dataList.push(temp); } @@ -52,12 +57,30 @@ var loadProxyInfo = (function ($) { var cols = [ {type: 'checkbox'}, {field: 'name', title: i18n['Name'], sort: true}, - {field: 'type', title: i18n['Type'], sort: true}, - {field: 'local_ip', title: i18n['LocalIp'], sort: true}, - {field: 'local_port', title: i18n['LocalPort'], sort: true}, - {title: i18n['Operation'], width: 150, toolbar: '#proxyListOperationTemplate'} + {field: 'type', title: i18n['Type'], width: 110, sort: true}, + {field: 'local_ip', title: i18n['LocalIp'], width: 150, sort: true}, + {field: 'local_port', title: i18n['LocalPort'], width: 120, sort: true}, ]; + if (currentProxyType === 'tcp' || currentProxyType === 'udp') { + cols.push({field: 'remote_port', title: i18n['RemotePort'], width: 130, sort: true}); + } else if (currentProxyType === 'http' || currentProxyType === 'https') { + cols.push({field: 'custom_domains', title: i18n['CustomDomains'], sort: true}); + cols.push({field: 'subdomain', title: i18n['Subdomain'], width: 150, sort: true}); + } + + cols.push({ + field: 'use_encryption', title: i18n['UseEncryption'], width: 170, templet: function (d) { + return i18n[d.use_encryption] + }, sort: true + }); + cols.push({ + field: 'use_compression', title: i18n['UseCompression'], width: 170, templet: function (d) { + return i18n[d.use_compression] + }, sort: true + }); + cols.push({title: i18n['Operation'], width: 150, toolbar: '#proxyListOperationTemplate'}); + var proxyListTable = layui.table.render({ elem: '#proxyListTable', height: $section.height(), @@ -157,7 +180,7 @@ var loadProxyInfo = (function ($) { type: 1, title: false, skin: 'proxy-popup', - area: ['500px', '400px'], + area: ['400px', '400px'], content: content, btn: [i18n['Confirm'], i18n['Cancel']], btn1: function (index) { diff --git a/assets/static/js/index-proxy-status.js b/assets/static/js/index-proxy-overview.js similarity index 84% rename from assets/static/js/index-proxy-status.js rename to assets/static/js/index-proxy-overview.js index 59a092f..7440eac 100644 --- a/assets/static/js/index-proxy-status.js +++ b/assets/static/js/index-proxy-overview.js @@ -1,4 +1,4 @@ -var loadProxiesStatus = (function ($) { +var loadOverview = (function ($) { var i18n = {}; /** @@ -6,7 +6,7 @@ var loadProxiesStatus = (function ($) { * @param lang {{}} language json * @param title page title */ - function loadProxiesStatus(lang, title) { + function loadOverview(lang, title) { i18n = lang; $("#title").text(title); $('#content').empty(); @@ -14,8 +14,8 @@ var loadProxiesStatus = (function ($) { $.getJSON('/proxy/api/status').done(function (result) { if (result.success) { - $('#content').html($('#proxiesTableTemplate').html()); - renderProxiesTable(JSON.parse(result.data)); + $('#content').html($('#overviewTableTemplate').html()); + renderOverviewTable(JSON.parse(result.data)); } else { layui.layer.msg(result.message); } @@ -29,7 +29,7 @@ var loadProxiesStatus = (function ($) { * @param data {Map>} proxy data * @param proxyType proxy type */ - function renderProxiesTable(data, proxyType) { + function renderOverviewTable(data, proxyType) { var dataList = []; for (var type in data) { var temp = data[type]; @@ -57,8 +57,8 @@ var loadProxiesStatus = (function ($) { {field: 'err', title: i18n['Info'], templet: '{{= d.err || "-" }}', width: 200} ]; - var proxiesTable = layui.table.render({ - elem: '#proxiesTable', + var overviewTable = layui.table.render({ + elem: '#overviewTable', height: $section.height(), text: {none: i18n['EmptyData']}, cols: [cols], @@ -73,9 +73,9 @@ var loadProxiesStatus = (function ($) { }); window.onresize = function () { - proxiesTable.resize(); + overviewTable.resize(); } } - return loadProxiesStatus; + return loadOverview; })(layui.$); \ No newline at end of file diff --git a/assets/static/js/index.js b/assets/static/js/index.js index 10fe4a6..2c3fd96 100644 --- a/assets/static/js/index.js +++ b/assets/static/js/index.js @@ -18,8 +18,8 @@ var title = elem.text(); if (id === 'clientInfo') { loadClientInfo(lang, title.trim()); - } else if (id === 'proxiesStatus') { - loadProxiesStatus(lang, title.trim()); + } else if (id === 'overview') { + loadOverview(lang, title.trim()); } else if (elem.closest('.layui-nav-item').attr('id') === 'proxies') { if (id != null && id.trim() !== '') { var suffix = elem.closest('.layui-nav-item').children('a').text().trim(); diff --git a/assets/templates/index.html b/assets/templates/index.html index 786210b..c4e96d7 100644 --- a/assets/templates/index.html +++ b/assets/templates/index.html @@ -7,8 +7,8 @@ - + @@ -30,7 +30,7 @@ ${ .ClientInfo }
  • - ${ .ProxiesStatus } + ${ .Overview }
  • ${ .Proxies } @@ -65,9 +65,9 @@ - @@ -176,18 +176,18 @@ class="layui-input"/> - {{# if (d.type === 'http' || d.type === 'https') { }} + {{# if (d.type.toLowerCase() === 'http' || d.type.toLowerCase() === 'https') { }}
    - +
    -
    -
    diff --git a/pkg/server/controller/controller.go b/pkg/server/controller/controller.go index 787c09b..f433bd5 100644 --- a/pkg/server/controller/controller.go +++ b/pkg/server/controller/controller.go @@ -61,7 +61,7 @@ func (c *HandleController) MakeIndexFunc() func(context *gin.Context) { "showExit": trimString(c.CommonInfo.AdminUser) != "" && trimString(c.CommonInfo.AdminPwd) != "", "FrpcPanel": ginI18n.MustGetMessage(context, "Frpc Panel"), "ClientInfo": ginI18n.MustGetMessage(context, "Client Info"), - "ProxiesStatus": ginI18n.MustGetMessage(context, "Proxies Status"), + "Overview": ginI18n.MustGetMessage(context, "Overview"), "Proxies": ginI18n.MustGetMessage(context, "Proxies"), "ServerAddress": ginI18n.MustGetMessage(context, "Server Address"), "ServerPort": ginI18n.MustGetMessage(context, "Server Port"), @@ -89,7 +89,7 @@ func (c *HandleController) MakeIndexFunc() func(context *gin.Context) { "LocalIp": ginI18n.MustGetMessage(context, "Local Ip"), "LocalPort": ginI18n.MustGetMessage(context, "Local Port"), "RemotePort": ginI18n.MustGetMessage(context, "Remote Port"), - "CustomizeDomains": ginI18n.MustGetMessage(context, "Customize Domains"), + "CustomDomains": ginI18n.MustGetMessage(context, "Custom Domains"), "Subdomain": ginI18n.MustGetMessage(context, "Subdomain"), "UseEncryption": ginI18n.MustGetMessage(context, "Use Encryption"), "true": ginI18n.MustGetMessage(context, "true"), @@ -116,6 +116,11 @@ func (c *HandleController) MakeLangFunc() func(context *gin.Context) { "running": ginI18n.MustGetMessage(context, "running"), "LocalIp": ginI18n.MustGetMessage(context, "Local Ip"), "LocalPort": ginI18n.MustGetMessage(context, "Local Port"), + "RemotePort": ginI18n.MustGetMessage(context, "Remote Port"), + "UseEncryption": ginI18n.MustGetMessage(context, "Use Encryption"), + "UseCompression": ginI18n.MustGetMessage(context, "Use Compression"), + "CustomDomains": ginI18n.MustGetMessage(context, "Custom Domains"), + "Subdomain": ginI18n.MustGetMessage(context, "Subdomain"), "Operation": ginI18n.MustGetMessage(context, "Operation"), "Confirm": ginI18n.MustGetMessage(context, "Confirm"), "Cancel": ginI18n.MustGetMessage(context, "Cancel"),