B站下载页面新增添加url功能

This commit is contained in:
Yutousama 2020-05-05 20:02:39 +08:00
parent 6627f00d3e
commit 0f0906a02f
2 changed files with 31 additions and 2 deletions

View File

@ -48,16 +48,31 @@ public class UpdateIp {
StringBuilder stringBuffer = new StringBuilder();
String line = null;
boolean isIp = false;
boolean isNas=false;
while ((line = reader.readLine()) != null) {
//System.out.println(line.trim().replace("server_name","").replace("upstream","").trim());
if (keys.contains(line.trim().replace("server_name", "").replace("upstream", "").replace("{", "").trim())) {
isIp = true;
}
if(line.trim().replace("server_name", "").trim().equals("nas.yutou233.cn;")){
isNas=true;
}
if (isIp) {
String testIp = testIp(line);
if (testIp != null) {
System.out.println("检测到目标:" + line + " 修改IP " + testIp + " > " + ip);
line = line.replace(testIp, ip);
if(isNas){
String adminAddress=redisTools.get("adminAddress");
if(adminAddress!=null) {
JSONObject json=JSONObject.parseObject(adminAddress);
line = "proxy_pass http://" +ip+":"+json.getInteger("port")+"/;";
}else{
line = line.replace(testIp, ip);
}
isNas=false;
}else {
line = line.replace(testIp, ip);
}
isIp = false;
}

View File

@ -14,7 +14,8 @@
<div class="layui-body" style="left: 200px;">
<div id="side"></div>
<blockquote class="layui-elem-quote"><span id="ip">B站直播下载器</span></blockquote>
<table id="address" lay-filter="listTools"></table>
<button type="button" id='add' class="layui-btn layui-btn-normal" style="margin-left: 10px;">新增</button>
<table id="address" lay-filter="listTools" ></table>
<div id="footer"></div>
</div>
@ -107,6 +108,19 @@
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html");
$('#add').click(function(){
layer.prompt({
title:"填写url或cid"
},function(value,index){
$.post("/bili/live/add/url.do",{url:value},function(data){
let json=JSON.parse(data);
layer.msg(json.msg);
layer.close(index)
});
})
});
</script>
<style>