118 lines
4.1 KiB
HTML
118 lines
4.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
<title>管理Clash订阅</title>
|
|
<link rel="stylesheet" href="/layui/css/layui.css">
|
|
</head>
|
|
|
|
<body>
|
|
<div class="layui-layout layui-layout-admin">
|
|
<div id="header"></div>
|
|
<div class="layui-body" style="left: 200px;">
|
|
<div id="side"></div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">ssr订阅地址</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" id="ssr" required lay-verify="required" placeholder="请输入订阅地址,回车提交" autocomplete="off" class="layui-input">
|
|
</div>
|
|
</div>
|
|
<table id="oss" lay-filter="myOssFilter"></table>
|
|
<div id="footer"></div>
|
|
</div>
|
|
</div>
|
|
<script type="text/html" id="topTools">
|
|
<div>
|
|
<a class="layui-btn layui-btn-xs" lay-event="addAddress">新增URL</a>
|
|
<a class="layui-btn layui-btn-xs" lay-event="showUrl">获取订阅地址</a>
|
|
|
|
</div>
|
|
</script>
|
|
<script type="text/html" id="listTools">
|
|
<div class="layui-btn-container">
|
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
|
|
|
</div>
|
|
</script>
|
|
<script src="/js/jquery-3.2.1.js"></script>
|
|
<script src="/layui/layui.js"></script>
|
|
<script>
|
|
|
|
layui.use(['table'], function () {
|
|
let table = layui.table;
|
|
let ta = table.render({
|
|
elem: "#oss",
|
|
url: "/tools/clash/list.do",
|
|
page: false,
|
|
toolbar: '#topTools',
|
|
parseData: function (json) {
|
|
return json
|
|
},
|
|
cols: [[
|
|
{field: 'url', title: '地址', width: 400, sort: true},
|
|
{field: "right", width: 200, toolbar: '#listTools'}
|
|
]],
|
|
done: function () {
|
|
table.on('tool(myOssFilter)', function (obj) {
|
|
if (obj.event === 'del') {
|
|
layer.msg(obj.data.item)
|
|
$.post('/tools/clash/del.do', {'url': obj.data.url}, function (json) {
|
|
layer.msg(json.msg)
|
|
});
|
|
}
|
|
})
|
|
table.on('toolbar(myOssFilter)', function (obj) {
|
|
console.log('add')
|
|
if (obj.event === 'addAddress') {
|
|
layer.prompt({
|
|
formType: 2,
|
|
value: '- DOMAIN-SUFFIX,{url},🔰 节点选择',
|
|
title: '请输入地址',
|
|
}, function (path, index, elem) {
|
|
$.post('/tools/clash/add.do', {'url': path}, function (json) {
|
|
layer.msg(json.msg)
|
|
});
|
|
layer.close(index);
|
|
});
|
|
} else if(obj.event === 'showUrl'){
|
|
layer.prompt({
|
|
formType: 2,
|
|
value: 'https://'+window.location.host+'/tools/clash/get.do?token=X9C2h61pDI7KFa0kaHNITjlCY7bbIFN0',
|
|
title: '请输入地址',
|
|
}, function (path, index, elem) {
|
|
$.post('/tools/clash/add.do', {'url': path}, function (json) {
|
|
layer.msg(json.msg)
|
|
});
|
|
layer.close(index);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
})
|
|
|
|
$('#ssr').keyup(function (event) {
|
|
if(event.keyCode===13){
|
|
$.post("/tools/clash/ssr.do?url="+$('#ssr')[0].value,function (json) {
|
|
layer.msg(json.msg)
|
|
})
|
|
}
|
|
})
|
|
$.get("/tools/clash/getssr.do",function(json){
|
|
if(json.code===0){
|
|
$('#ssr')[0].value=json.data
|
|
}
|
|
})
|
|
});
|
|
|
|
$('#header').load("/html/header.html");
|
|
$('#footer').load("/html/footer.html");
|
|
|
|
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html> |