This commit is contained in:
2022-03-11 21:07:06 +08:00
parent 4503f2207f
commit e4ecde0db3
4 changed files with 50 additions and 1 deletions

View 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);
}
}

View File

@@ -63,6 +63,7 @@ public class HttpTools {
String tmp;
while ((tmp = reader.readLine()) != null) {
str.append(tmp);
str.append("\n");
}
reader.close();
return str.toString();

View File

@@ -62,7 +62,10 @@ public class WebClient {
ChromeOptions options = new ChromeOptions();
// options.addArguments("--disable-gpu");
// 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("--incognito");
options.addArguments("--disable-plugins");