update
This commit is contained in:
parent
b796a1a839
commit
6cb1c0f9eb
25
src/main/java/com/yutou/tools/nas/AdminManager.java
Normal file
25
src/main/java/com/yutou/tools/nas/AdminManager.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.yutou.tools.nas;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.yutou.tools.utils.RedisTools;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class AdminManager {
|
||||||
|
@Resource
|
||||||
|
RedisTools redisTools;
|
||||||
|
|
||||||
|
public String getAdminAddress(HttpServletRequest request){
|
||||||
|
JSONObject json=new JSONObject();
|
||||||
|
|
||||||
|
String address=redisTools.get("adminAddress");
|
||||||
|
if(address==null){
|
||||||
|
json.put("code",-1);
|
||||||
|
json.put("msg","暂未设置管理后台");
|
||||||
|
}
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,13 @@
|
|||||||
package com.yutou.tools.nas;
|
package com.yutou.tools.nas;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yutou.tools.mybatis.dao.UKeyDao;
|
import com.yutou.tools.mybatis.dao.UKeyDao;
|
||||||
import com.yutou.tools.mybatis.model.UKey;
|
import com.yutou.tools.mybatis.model.UKey;
|
||||||
|
import com.yutou.tools.utils.RedisTools;
|
||||||
|
import com.yutou.tools.utils.Tools;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -19,6 +23,8 @@ import java.util.regex.Pattern;
|
|||||||
@Controller
|
@Controller
|
||||||
public class UpdateIp {
|
public class UpdateIp {
|
||||||
private static List<String> keys = new ArrayList<>();
|
private static List<String> keys = new ArrayList<>();
|
||||||
|
@Resource
|
||||||
|
RedisTools redisTools;
|
||||||
|
|
||||||
/* static {
|
/* static {
|
||||||
keys.add("nas.yutou233.cn;");
|
keys.add("nas.yutou233.cn;");
|
||||||
@ -71,6 +77,50 @@ public class UpdateIp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/nas/getIp.do")
|
||||||
|
@ResponseBody
|
||||||
|
public String getIP(HttpServletRequest request) {
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("code", -1);
|
||||||
|
json.put("msg", "未登录");
|
||||||
|
if (Tools.checkWebLogin(request, redisTools) != 1) {
|
||||||
|
// return json.toJSONString();
|
||||||
|
}
|
||||||
|
updateList();
|
||||||
|
File file = new File("/etc/nginx/nginx.conf");
|
||||||
|
file = new File("D:\\nginx.conf");
|
||||||
|
if (file.exists()) {
|
||||||
|
String testIp = "0.0.0.0";
|
||||||
|
try {
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||||
|
String line;
|
||||||
|
boolean isIp = 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 (isIp) {
|
||||||
|
testIp = testIp(line);
|
||||||
|
if (testIp != null)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
json.put("code", 0);
|
||||||
|
json.put("msg", "ok");
|
||||||
|
json.put("data", testIp);
|
||||||
|
} else {
|
||||||
|
json.put("code", 0);
|
||||||
|
json.put("msg", "没有找到ip");
|
||||||
|
json.put("data", "0.0.0.0");
|
||||||
|
}
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
public String testIp(String ip) {
|
public String testIp(String ip) {
|
||||||
String pattern = "((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})(\\.((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})){3}";
|
String pattern = "((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})(\\.((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})){3}";
|
||||||
Pattern p = Pattern.compile(pattern);
|
Pattern p = Pattern.compile(pattern);
|
||||||
@ -87,12 +137,13 @@ public class UpdateIp {
|
|||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
boolean create = file.createNewFile();
|
boolean create = file.createNewFile();
|
||||||
if (create)
|
if (create)
|
||||||
System.out.println("创建文件完成:" +file.getAbsolutePath());
|
System.out.println("创建文件完成:" + file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
BufferedReader reader=new BufferedReader(new FileReader(file));
|
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||||
String tmp;
|
String tmp;
|
||||||
while ((tmp=reader.readLine())!=null){
|
while ((tmp = reader.readLine()) != null) {
|
||||||
keys.add(tmp.trim());
|
if (!keys.contains(tmp.trim()))
|
||||||
|
keys.add(tmp.trim());
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1,15 +1,167 @@
|
|||||||
package com.yutou.tools.utils;
|
package com.yutou.tools.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class Tools {
|
public class Tools {
|
||||||
public static Cookie getCookie(HttpServletRequest request,String key){
|
/**
|
||||||
for (Cookie cookie : request.getCookies()) {
|
* 设置Cookie
|
||||||
if(cookie.getName().equals(key)){
|
* @param response
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
|
* @param time
|
||||||
|
*/
|
||||||
|
public static void setCookie(HttpServletResponse response, String key,String value,int time) {
|
||||||
|
Cookie cookie = new Cookie(key, value);
|
||||||
|
if(time!=-1) {
|
||||||
|
cookie.setMaxAge(time);
|
||||||
|
}
|
||||||
|
response.addCookie(cookie);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设置Cookie
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @param key
|
||||||
|
* @param time 生命周期,为0时即为删除
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String setCookie(HttpServletRequest request, HttpServletResponse response, String key,int time) {
|
||||||
|
Cookie name = new Cookie("uname", key);
|
||||||
|
Cookie session = new Cookie("session", request.getSession().getId());
|
||||||
|
if(time!=-1) {
|
||||||
|
name.setMaxAge(time);
|
||||||
|
session.setMaxAge(time);
|
||||||
|
}
|
||||||
|
response.addCookie(name);
|
||||||
|
response.addCookie(session);
|
||||||
|
return request.getSession().getId();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取Cookie
|
||||||
|
* @param request
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Cookie getCookie(HttpServletRequest request,String key) {
|
||||||
|
Cookie[] cookies = request.getCookies();
|
||||||
|
for (Cookie cookie : cookies) {
|
||||||
|
if (key!=null&&cookie.getName().equals(key)) {
|
||||||
return cookie;
|
return cookie;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 删除Cookie
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String deleteCookie(HttpServletRequest request, HttpServletResponse response, String key) {
|
||||||
|
return setCookie(request, response, key, 0);
|
||||||
|
}
|
||||||
|
public static void sendServer(String title,String msg){
|
||||||
|
try{
|
||||||
|
System.out.println("title="+title+" msg="+msg);
|
||||||
|
/*HttpURLConnection connection= (HttpURLConnection) new URL("https://sc.ftqq.com/SCU64034T5adf5c5940dcecc016e0e9d0cf9b1e725da126ff47475.send?text="
|
||||||
|
+ URLEncoder.encode(title,"UTF-8")+"&desp="+URLEncoder.encode(msg,"UTF-8")).openConnection();
|
||||||
|
connection.connect();
|
||||||
|
InputStream inputStream=connection.getInputStream();
|
||||||
|
int i=inputStream.read();
|
||||||
|
inputStream.close();
|
||||||
|
connection.disconnect();*/
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目路径
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getPath(HttpServletRequest request) {
|
||||||
|
return request.getServletContext().getRealPath("/") + "/";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取客户端IP
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getRemoteAddress(HttpServletRequest request) {
|
||||||
|
String ip = request.getHeader("x-forwarded-for");
|
||||||
|
if (ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")) {
|
||||||
|
ip = request.getHeader("Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")) {
|
||||||
|
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
if (ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")) {
|
||||||
|
ip = request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* N以内的不重复随机数
|
||||||
|
*
|
||||||
|
* @param min
|
||||||
|
* 最小值
|
||||||
|
* @param max
|
||||||
|
* 最大值
|
||||||
|
* @param n
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int[] randomCommon(int min, int max, int n) {
|
||||||
|
int len = max - min + 1;
|
||||||
|
if (max < min || n > len) {
|
||||||
|
return new int[0];
|
||||||
|
}
|
||||||
|
// 初始化给定范围的待选数组
|
||||||
|
int[] source = new int[len];
|
||||||
|
for (int i = min; i < min + len; i++) {
|
||||||
|
source[i - min] = i;
|
||||||
|
}
|
||||||
|
int[] result = new int[n];
|
||||||
|
Random rd = new Random();
|
||||||
|
int index = 0;
|
||||||
|
for (int i = 0; i < result.length; i++) {
|
||||||
|
// 待选数组0到(len-2)随机一个下标
|
||||||
|
index = Math.abs(rd.nextInt() % len--);
|
||||||
|
// 将随机到的数放入结果集
|
||||||
|
result[i] = source[index];
|
||||||
|
// 将待选数组中被随机到的数,用待选数组(len-1)下标对应的数替换
|
||||||
|
source[index] = source[len];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public static int checkWebLogin(HttpServletRequest request,RedisTools redisTools){
|
||||||
|
JSONArray array=new JSONArray();
|
||||||
|
if(redisTools.get("bean")!=null){
|
||||||
|
array=JSONArray.parseArray(redisTools.get("bean"));
|
||||||
|
}
|
||||||
|
if(array.contains(Tools.getRemoteAddress(request))){
|
||||||
|
System.out.println("IP已被封禁");
|
||||||
|
return -100;
|
||||||
|
}
|
||||||
|
Cookie cookie = Tools.getCookie(request, "user");
|
||||||
|
if (cookie == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (redisTools.get(cookie.getValue()).equals("ok")) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,82 @@
|
|||||||
package com.yutou.tools.web;
|
package com.yutou.tools.web;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.yutou.tools.utils.RedisTools;
|
||||||
import com.yutou.tools.utils.Tools;
|
import com.yutou.tools.utils.Tools;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class userController {
|
public class userController {
|
||||||
|
@Resource
|
||||||
|
RedisTools redisTools;
|
||||||
|
|
||||||
public String getLoginState(HttpServletRequest request){
|
@RequestMapping("/login/check.do")
|
||||||
JSONObject json=new JSONObject();
|
@ResponseBody
|
||||||
Cookie cookie= Tools.getCookie(request,"user");
|
public String getLoginState(HttpServletRequest request) {
|
||||||
if(cookie==null){
|
JSONObject json = new JSONObject();
|
||||||
json.put("code",-1);
|
json.put("code", -1);
|
||||||
json.put("msg","未登录");
|
json.put("msg", "未登录");
|
||||||
|
JSONArray array=new JSONArray();
|
||||||
|
if(redisTools.get("bean")!=null){
|
||||||
|
array=JSONArray.parseArray(redisTools.get("bean"));
|
||||||
|
}
|
||||||
|
if(array.contains(Tools.getRemoteAddress(request))){
|
||||||
|
System.out.println("IP已被封禁");
|
||||||
return json.toJSONString();
|
return json.toJSONString();
|
||||||
}
|
}
|
||||||
return "";
|
Cookie cookie = Tools.getCookie(request, "user");
|
||||||
|
if (cookie == null) {
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
if (redisTools.get(cookie.getValue()).equals("ok")) {
|
||||||
|
json.put("code", 0);
|
||||||
|
json.put("msg", "登录成功");
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
json.put("code", -1);
|
||||||
|
json.put("msg", "未登录");
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/login/sendCaptcha.do")
|
||||||
|
@ResponseBody
|
||||||
|
public String captcha(HttpServletRequest request) {
|
||||||
|
int[] captcha = Tools.randomCommon(0, 9, 5);
|
||||||
|
String cc = "";
|
||||||
|
for (int value : captcha) {
|
||||||
|
cc += value;
|
||||||
|
}
|
||||||
|
redisTools.set("login",cc,5*60*1000);
|
||||||
|
Tools.sendServer("管理后台登录验证码", "本次登录验证码为:" + cc
|
||||||
|
+ ",登录IP:" + Tools.getRemoteAddress(request)
|
||||||
|
+ ",非正常登录,封禁IP:http://www.baidu.com");
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
|
@RequestMapping("/login/login.do")
|
||||||
|
@ResponseBody
|
||||||
|
public String login(HttpServletResponse response,String code){
|
||||||
|
JSONObject json=new JSONObject();
|
||||||
|
if(redisTools.get("login").equals(code.trim())){
|
||||||
|
String uuid=UUID.randomUUID().toString();
|
||||||
|
Tools.setCookie(response,"user",uuid.replace("-",""),30*24*60*60*1000);
|
||||||
|
redisTools.set(uuid.replace("-",""),"ok",30*24*60*60*1000);
|
||||||
|
json.put("code",0);
|
||||||
|
json.put("msg","登录成功");
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
json.put("code",-2);
|
||||||
|
json.put("msg","登录安全码错误");
|
||||||
|
return json.toJSONString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
||||||
<title>NAS</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: 0px;">
|
|
||||||
123
|
|
||||||
</div>
|
|
||||||
<div id="footer"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/layui/layui.js"></script>
|
|
||||||
<script src="/js/jquery-3.2.1.js"></script>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
layui.use(['layer', 'form', 'element'], function () {
|
|
||||||
var layer = layui.layer
|
|
||||||
, form = layui.form;
|
|
||||||
|
|
||||||
});
|
|
||||||
$.ajax({cache: false})
|
|
||||||
$('#header').load("/html/header.html");
|
|
||||||
$('#footer').load("/html/footer.html");
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
#icon {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.body {
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
45
web/html/body/nas/index.html
Normal file
45
web/html/body/nas/index.html
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<title>NAS</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: 0px;">
|
||||||
|
<div id="side"></div>
|
||||||
|
|
||||||
|
<div id="footer"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="/layui/layui.js"></script>
|
||||||
|
<script src="/js/jquery-3.2.1.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
layui.use(['layer', 'form', 'element'], function () {
|
||||||
|
var layer = layui.layer
|
||||||
|
, form = layui.form;
|
||||||
|
|
||||||
|
});
|
||||||
|
$.ajax({ cache: false })
|
||||||
|
$('#header').load("/html/header.html");
|
||||||
|
$('#footer').load("/html/footer.html");
|
||||||
|
$('#side').load("/html/body/nas/side.html");
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
#icon {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
53
web/html/body/nas/ip.html
Normal file
53
web/html/body/nas/ip.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<title>NAS</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>
|
||||||
|
<blockquote class="layui-elem-quote" ><span id="ip">当前IP:</span></blockquote>
|
||||||
|
<div id="footer"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="/layui/layui.js"></script>
|
||||||
|
<script src="/js/jquery-3.2.1.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
layui.use(['layer', 'form', 'element'], function () {
|
||||||
|
var layer = layui.layer
|
||||||
|
, form = layui.form;
|
||||||
|
|
||||||
|
});
|
||||||
|
$.ajax({ cache: false })
|
||||||
|
$('#header').load("/html/header.html");
|
||||||
|
$('#footer').load("/html/footer.html");
|
||||||
|
$('#side').load("/html/body/nas/side.html");
|
||||||
|
$.post("/nas/getIp.do",function(data){
|
||||||
|
var json=JSON.parse(data);
|
||||||
|
if(json.code!=0){
|
||||||
|
$('#ip').html(json.msg);
|
||||||
|
}else{
|
||||||
|
$('#ip').html("当前服务器IP:"+json.data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
#icon {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
28
web/html/body/nas/side.html
Normal file
28
web/html/body/nas/side.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<div class="layui-side layui-bg-black">
|
||||||
|
<div class="layui-side-scroll layui-bg-blue">
|
||||||
|
<!-- 左侧导航区域(可配合layui已有的垂直导航) -->
|
||||||
|
<ul class="layui-nav layui-nav-tree layui-bg-blue" lay-filter="test">
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a class="" href="javascript:;">本体管理</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a href="/html/body/nas/ip.html">查看IP</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a class="" href="javascript:;">管理后台</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a href="javascript:;">切换管理后台</a></dd>
|
||||||
|
<dd><a href="javascript:;">管理后台</a></dd>
|
||||||
|
<dd><a href="javascript:;">Jellyfin</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a href="javascript:;">功能管理</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a href="javascript:;">B站直播下载器</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
53
web/html/body/nas/switchAdmin.html
Normal file
53
web/html/body/nas/switchAdmin.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<title>NAS</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>
|
||||||
|
<blockquote class="layui-elem-quote" ><span id="ip">当前IP:</span></blockquote>
|
||||||
|
<div id="footer"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="/layui/layui.js"></script>
|
||||||
|
<script src="/js/jquery-3.2.1.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
layui.use(['layer', 'form', 'element'], function () {
|
||||||
|
var layer = layui.layer
|
||||||
|
, form = layui.form;
|
||||||
|
|
||||||
|
});
|
||||||
|
$.ajax({ cache: false })
|
||||||
|
$('#header').load("/html/header.html");
|
||||||
|
$('#footer').load("/html/footer.html");
|
||||||
|
$('#side').load("/html/body/nas/side.html");
|
||||||
|
$.post("/nas/getIp.do",function(data){
|
||||||
|
var json=JSON.parse(data);
|
||||||
|
if(json.code!=0){
|
||||||
|
$('#ip').html(json.msg);
|
||||||
|
}else{
|
||||||
|
$('#ip').html("当前服务器IP:"+json.data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
#icon {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -1,46 +1,55 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Title</title>
|
<title>Title</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="layui-header">
|
<div class="layui-header">
|
||||||
<ul class="layui-nav layui-bg-blue" lay-filter="">
|
<ul class="layui-nav layui-bg-blue" lay-filter="">
|
||||||
<li class="layui-nav-item"><a href="http://blog.yutou233.cn">博客</a></li>
|
<li class="layui-nav-item"><a href="http://blog.yutou233.cn">博客</a></li>
|
||||||
<div id="admin" style="display: inline-block; font-size: 0px;">
|
<div id="admin" style="display: inline-block; font-size: 0px;">
|
||||||
<li class="layui-nav-item"><a href="javascript:;">NAS管理</a>
|
<li class="layui-nav-item"><a href="/html/body/nas/index.html">NAS管理</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a href="javascript:;">工具集</a>
|
||||||
<dl class="layui-nav-child">
|
<dl class="layui-nav-child">
|
||||||
<dd><a href="/html/body/nas.html">查看NAS IP</a></dd>
|
<dd><a href="javascript:;" target="_blank">密码管理器</a></dd>
|
||||||
<dd><a href="#">切换NAS页面</a></dd>
|
|
||||||
<dd><a href="#">B站直播管理</a></dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
<li class="layui-nav-item">
|
||||||
<li class="layui-nav-item">
|
<a href="javascript:;">页面集</a>
|
||||||
<a href="javascript:;">工具集</a>
|
<dl class="layui-nav-child">
|
||||||
<dl class="layui-nav-child">
|
<dd><a href="http://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
|
||||||
<dd><a href="javascript:;" target="_blank">密码管理器</a></dd>
|
<dd><a href="http://bt.yutou233.cn" target="_blank">BT下载</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
<li class="layui-nav-item">
|
<li class="layui-nav-item" id='icon'>
|
||||||
<a href="javascript:;">页面集</a>
|
<a href="javascript:;" id="login"><img src="//t.cn/RCzsdCq" class="layui-nav-img">登录</a>
|
||||||
<dl class="layui-nav-child">
|
<dl class="layui-nav-child">
|
||||||
<dd><a href="http://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
|
<dd><a href="javascript:;">退了</a></dd>
|
||||||
<dd><a href="http://bt.yutou233.cn" target="_blank">BT下载</a></dd>
|
</dl>
|
||||||
</dl>
|
</li>
|
||||||
</li>
|
</ul>
|
||||||
<li class="layui-nav-item" id='icon'>
|
</div>
|
||||||
<a href=""><img src="//t.cn/RCzsdCq" class="layui-nav-img">登录</a>
|
|
||||||
<dl class="layui-nav-child">
|
|
||||||
<dd><a href="javascript:;">修改信息</a></dd>
|
|
||||||
<dd><a href="javascript:;">安全管理</a></dd>
|
|
||||||
<dd><a href="javascript:;">退了</a></dd>
|
|
||||||
</dl>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
$('#login').click(function () {
|
||||||
|
$.post('/login/sendCaptcha.do', function () {
|
||||||
|
layer.prompt({
|
||||||
|
title: '安全登录码'
|
||||||
|
}, function (value, index, elem) {
|
||||||
|
alert(value); //得到value
|
||||||
|
layer.close(index);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
$.ajax({cache: false})
|
$.ajax({cache: false})
|
||||||
$('#header').load("../html/header.html");
|
$('#header').load("/html/header.html");
|
||||||
$('#footer').load("../html/footer.html");
|
$('#footer').load("../html/footer.html");
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
Loading…
Reference in New Issue
Block a user