update
This commit is contained in:
parent
4503f2207f
commit
e4ecde0db3
@ -13,7 +13,10 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class AppController {
|
public class AppController {
|
||||||
@ -87,4 +90,24 @@ public class AppController {
|
|||||||
QQBotManager.getInstance().sendMessage(_file,583819556L,"time = "+AppTools.getToDayNowTimeToString());
|
QQBotManager.getInstance().sendMessage(_file,583819556L,"time = "+AppTools.getToDayNowTimeToString());
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
@RequestMapping("/test.do")
|
||||||
|
@ResponseBody
|
||||||
|
public String test(HttpServletResponse response){
|
||||||
|
System.out.println("NAS自动关机");
|
||||||
|
/* try {
|
||||||
|
response.sendRedirect("http://192.168.31.88:9999/live/index.m3u8");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}*/
|
||||||
|
// return HttpTools.http_get("http://192.168.31.88:9999/live/index.m3u8",null);
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
@RequestMapping("*.ts")
|
||||||
|
public void test2(HttpServletResponse response, HttpServletRequest request){
|
||||||
|
try {
|
||||||
|
response.sendRedirect("http://192.168.31.88:9999/live"+request.getRequestURI());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
22
src/main/java/com/yutou/qqbot/utlis/CorsConfig.java
Normal file
22
src/main/java/com/yutou/qqbot/utlis/CorsConfig.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package com.yutou.qqbot.utlis;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class CorsConfig implements WebMvcConfigurer {
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
//设置允许跨域的路径
|
||||||
|
registry.addMapping("/**")
|
||||||
|
//设置允许跨域请求的域名
|
||||||
|
.allowedOriginPatterns("*")
|
||||||
|
//是否允许证书 不再默认开启
|
||||||
|
.allowCredentials(true)
|
||||||
|
//设置允许的方法
|
||||||
|
.allowedMethods("*")
|
||||||
|
//跨域允许时间
|
||||||
|
.maxAge(3600);
|
||||||
|
}
|
||||||
|
}
|
@ -63,6 +63,7 @@ public class HttpTools {
|
|||||||
String tmp;
|
String tmp;
|
||||||
while ((tmp = reader.readLine()) != null) {
|
while ((tmp = reader.readLine()) != null) {
|
||||||
str.append(tmp);
|
str.append(tmp);
|
||||||
|
str.append("\n");
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
@ -62,7 +62,10 @@ public class WebClient {
|
|||||||
ChromeOptions options = new ChromeOptions();
|
ChromeOptions options = new ChromeOptions();
|
||||||
// options.addArguments("--disable-gpu");
|
// options.addArguments("--disable-gpu");
|
||||||
// options.addArguments("blink-settings=imagesEnabled=false");
|
// options.addArguments("blink-settings=imagesEnabled=false");
|
||||||
options.addArguments("--headless");
|
String headless = RedisTools.get("headless");
|
||||||
|
if("true".equals(headless)) {
|
||||||
|
options.addArguments("--headless");
|
||||||
|
}
|
||||||
options.addArguments("--no-sandbox");
|
options.addArguments("--no-sandbox");
|
||||||
// options.addArguments("--incognito");
|
// options.addArguments("--incognito");
|
||||||
options.addArguments("--disable-plugins");
|
options.addArguments("--disable-plugins");
|
||||||
|
Loading…
Reference in New Issue
Block a user