This commit is contained in:
杨黄林
2023-09-25 23:51:03 +08:00
parent 14c09bdb69
commit d8f2c949ba
8 changed files with 64 additions and 36 deletions

View File

@@ -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",

View File

@@ -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": "加密传输",

View File

@@ -81,11 +81,11 @@ section {
}
.layui-form-label {
width: 140px;
width: 100px;
}
.layui-input-block {
margin-left: 170px;
margin-left: 130px;
}
.layui-btn-sm {

View File

@@ -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) {

View File

@@ -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<string,Map<string,string>>} 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: '<span>{{= d.err || "-" }}</span>', 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.$);

View File

@@ -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();

View File

@@ -7,8 +7,8 @@
<link rel="stylesheet" href="./static/css/index.css?v=${ .version }">
<link rel="stylesheet" href="./static/css/color.css?v=${ .version }">
<script src="./static/lib/layui/layui.js?v=${ .version }"></script>
<script src="./static/js/index-proxy-status.js?v=${ .version }"></script>
<script src="./static/js/index-client-info.js?v=${ .version }"></script>
<script src="./static/js/index-proxy-overview.js?v=${ .version }"></script>
<script src="./static/js/index-proxy-list.js?v=${ .version }"></script>
<script src="./static/js/index.js?v=${ .version }"></script>
</head>
@@ -30,7 +30,7 @@
<a href="javascript:void(0)" id="clientInfo">${ .ClientInfo }</a>
</li>
<li class="layui-nav-item">
<a href="javascript:void(0)" id="proxiesStatus">${ .ProxiesStatus }</a>
<a href="javascript:void(0)" id="overview">${ .Overview }</a>
</li>
<li class="layui-nav-item layui-nav-itemed" id="proxies">
<a class="" href="javascript:void(0)">${ .Proxies }</a>
@@ -65,9 +65,9 @@
</div>
<!--代理列表-代理表格模板-->
<script type="text/html" id="proxiesTableTemplate">
<section class="proxies">
<table id="proxiesTable" lay-filter="proxiesTable"></table>
<script type="text/html" id="overviewTableTemplate">
<section class="overview">
<table id="overviewTable" lay-filter="overviewTable"></table>
</section>
</script>
@@ -176,18 +176,18 @@
class="layui-input"/>
</div>
</div>
{{# if (d.type === 'http' || d.type === 'https') { }}
{{# if (d.type.toLowerCase() === 'http' || d.type.toLowerCase() === 'https') { }}
<div class="layui-form-item http https">
<label class="layui-form-label">${ .CustomizeDomains }</label>
<label class="layui-form-label">${ .CustomDomains }</label>
<div class="layui-input-block">
<textarea name="custom_domains" placeholder="${ .CustomizeDomains }" autocomplete="off"
<textarea name="custom_domains" placeholder="${ .CustomDomains }" autocomplete="off"
class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item layui-form-text http https">
<label class="layui-form-label">${ .Subdomain }</label>
<div class="layui-input-block">
<textarea name="sub_domain" placeholder="${ .Subdomain }" autocomplete="off"
<textarea name="subdomain" placeholder="${ .Subdomain }" autocomplete="off"
class="layui-textarea"></textarea>
</div>
</div>