移植原始版本

This commit is contained in:
yutou
2021-04-07 14:52:03 +08:00
parent 70798c5e94
commit 5d5a4eef97
59 changed files with 9390 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
package com.yutou.nas.Controllers;
import com.yutou.nas.utils.HttpTools;
import com.yutou.nas.utils.RedisTools;
import com.yutou.nas.utils.Tools;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@Controller
public class ToolsController {
@ResponseBody
@RequestMapping("/tools/openpc.do")
public String open_pc(HttpServletRequest request, String type) {
if (StringUtils.isEmpty(type)) {
if (Tools.checkWebLogin(request) == 1) {
HttpTools.get("http://" + UpdateIp.nas_ip + ":8000/tools/openpc.do?token=zIrsh9TUZP2lfRW753PannG49E7VJvor&type=nas");
}
} else {
if (type.equals("nas")) {
try {
Process process = Runtime.getRuntime().exec("wakeonlan 00:D8:61:6F:02:2F");
RedisTools.processOut(process.getInputStream());
RedisTools.processOut(process.getErrorStream());
process.destroy();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return "ok";
}
@ResponseBody
@RequestMapping("/tools/server.do")
public String sendServerManager(String title, String msg) {
Tools.sendServer(title, msg);
return "ok";
}
}