mirror of
https://github.com/Hello-hao/Tbed.git
synced 2026-09-20 03:18:28 +00:00
Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a9b463f76 | ||
|
|
297c5e226d | ||
|
|
624330a7c4 | ||
|
|
16d992daee | ||
|
|
72273d7508 | ||
|
|
69603ab2a8 | ||
|
|
77eb82e390 | ||
|
|
fe21100db0 | ||
|
|
1dbd7653ac | ||
|
|
6f5cbfc0b4 | ||
|
|
02d8ba470e | ||
|
|
f1febe089b | ||
|
|
04c09fd12c | ||
|
|
cbcc5d3425 | ||
|
|
140ab39a4e | ||
|
|
c273ae4d25 | ||
|
|
b1144862a2 | ||
|
|
f421aa0776 |
@@ -35,7 +35,7 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
|
||||
String serviceName = httpServletRequest.getServletPath();//获取接口
|
||||
String Users_Origin = httpServletRequest.getHeader("usersOrigin");
|
||||
String token = httpServletRequest.getHeader("Authorization");
|
||||
if(httpServletRequest.getMethod().equals("POST") && !serviceName.contains("/api") && !serviceName.contains("/verifyCode")
|
||||
if("POST".equals(httpServletRequest.getMethod()) && !serviceName.contains("/api") && !serviceName.contains("/verifyCode")
|
||||
&& !serviceName.contains("/getClientVersion") && !serviceName.contains("/client")){
|
||||
try{
|
||||
if(Users_Origin.compareTo(SecureUtil.md5(WEBHOST))!=0){
|
||||
@@ -153,4 +153,4 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package cn.hellohao.config;
|
||||
* @date 2020/5/15 9:20
|
||||
*/
|
||||
public class SysName {
|
||||
public static final String SYSNAME = "root,hellohaocheck,selectdomain,image,hellohaocheck,HellohaoData,TOIMG," +
|
||||
public static final String SYSNAME = "root,hellohaocheck,selectdomain,image,HellohaoData,TOIMG," +
|
||||
"user,users,admin,retrievepass,deleteimg,hellohaotempimg,360,hellohaotempwatermarimg,components,log";
|
||||
|
||||
public static Boolean CheckSysName(String name){
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ExceptionHandling {
|
||||
@ExceptionHandler
|
||||
public String test4(SocketException e){
|
||||
ModelAndView modelAndView = new ModelAndView("/index");
|
||||
Print.Normal("存储源配置不正确,初始化失败"+ e.getMessage());
|
||||
Print.Normal("存储源配置不正确,初始化失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
modelAndView.addObject("error",e.getMessage());
|
||||
return e.getMessage();
|
||||
|
||||
@@ -6,7 +6,6 @@ import cn.hellohao.pojo.Images;
|
||||
import cn.hellohao.pojo.Imgreview;
|
||||
import cn.hellohao.pojo.Keys;
|
||||
import cn.hellohao.pojo.Msg;
|
||||
import cn.hellohao.utils.FirstRun;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baidu.aip.contentcensor.AipContentCensor;
|
||||
@@ -22,7 +21,7 @@ import java.util.List;
|
||||
@Service
|
||||
public class ImgViolationJudgeServiceImpl {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(FirstRun.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(ImgViolationJudgeServiceImpl.class);
|
||||
@Autowired
|
||||
ImgreviewServiceImpl imgreviewService;
|
||||
@Autowired ImgMapper imgMapper;
|
||||
|
||||
@@ -43,22 +43,23 @@ public class InitializationStorage implements CommandLineRunner {
|
||||
public void intiStorage(){
|
||||
List<Keys> keylist = keysMapper.getKeys();
|
||||
for (Keys key : keylist) {
|
||||
if(key.getStorageType()!=0 && key.getStorageType()!=null){
|
||||
if(key.getStorageType()==1){
|
||||
Integer storageType = key.getStorageType();
|
||||
if(storageType != null && storageType != 0){
|
||||
if(storageType == 1){
|
||||
NOSImageupload.Initialize(key);
|
||||
}else if (key.getStorageType()==2){
|
||||
}else if (storageType == 2){
|
||||
OSSImageupload.Initialize(key);
|
||||
}else if(key.getStorageType()==3){
|
||||
}else if(storageType == 3){
|
||||
USSImageupload.Initialize(key);
|
||||
}else if(key.getStorageType()==4){
|
||||
}else if(storageType == 4){
|
||||
KODOImageupload.Initialize(key);
|
||||
}else if(key.getStorageType()==6){
|
||||
}else if(storageType == 6){
|
||||
COSImageupload.Initialize(key);
|
||||
}else if(key.getStorageType()==7){
|
||||
}else if(storageType == 7){
|
||||
FtpServiceImpl.Initialize(key);
|
||||
}else if(key.getStorageType()==8){
|
||||
}else if(storageType == 8){
|
||||
S3Imageupload.Initialize(key);
|
||||
}else if(key.getStorageType()==9){
|
||||
}else if(storageType == 9){
|
||||
WebDAVImageupload.Initialize(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class S3Imageupload {
|
||||
Map<Map<String, String>, File> fileMap, String username, Integer keyID) {
|
||||
ReturnImage returnImage = new ReturnImage();
|
||||
try {
|
||||
if (null == AS3 || null == AS3) {
|
||||
if (null == AS3 || null == KEY) {
|
||||
logger.error("S3 = 存储源对象为空");
|
||||
returnImage.setCode("500");
|
||||
return returnImage;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package cn.hellohao.utils;
|
||||
|
||||
import cn.hellohao.TbedApplication;
|
||||
import cn.hellohao.pojo.Msg;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -180,7 +179,6 @@ public class ImgUrlUtil {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
if(file.exists() && file.isFile()){
|
||||
String fileName = file.getName();
|
||||
fis = new FileInputStream(file);
|
||||
imgsize=fis.available()/1024;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class MyStringUtils {
|
||||
* @return URL
|
||||
*/
|
||||
public static String concatDomainAndPath(String domain, String path) {
|
||||
if (path != null && path.length() > 1 && path.charAt(0) != '/') {
|
||||
if (path != null && path.length() > 1 && !path.startsWith("/")) {
|
||||
path = '/' + path;
|
||||
}
|
||||
if (domain.charAt(domain.length() - 1) == '/') {
|
||||
|
||||
@@ -28,8 +28,7 @@ public class NetWorkTools {
|
||||
} catch (MalformedObjectNameException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String port = objectNames.iterator().next().getKeyProperty("port");
|
||||
return port;
|
||||
return objectNames.iterator().next().getKeyProperty("port");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,8 +38,8 @@ public class SpringContextHolder implements ApplicationContextAware {
|
||||
|
||||
private static void assertApplicationContext() {
|
||||
if (SpringContextHolder.applicationContext == null) {
|
||||
throw new RuntimeException("applicaitonContext属性为null,请检查是否注入了SpringContextHolder!");
|
||||
throw new RuntimeException("applicationContext属性为null,请检查是否注入了SpringContextHolder!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ private static final char[] CODE_SEQ = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
|
||||
private static final char[] NUMBER_ARRAY = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
|
||||
private static Random random = new Random();
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
public static String randomString(int length) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
sb.append(String.valueOf(CODE_SEQ[random.nextInt(CODE_SEQ.length)]));
|
||||
sb.append(CODE_SEQ[RANDOM.nextInt(CODE_SEQ.length)]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -24,7 +24,7 @@ return sb.toString();
|
||||
public static String randomNumberString(int length) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
sb.append(String.valueOf(NUMBER_ARRAY[random.nextInt(NUMBER_ARRAY.length)]));
|
||||
sb.append(NUMBER_ARRAY[RANDOM.nextInt(NUMBER_ARRAY.length)]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -43,6 +43,6 @@ return new Color(f + random.nextInt(b - f), f + random.nextInt(b - f), f + rando
|
||||
}
|
||||
|
||||
public static int nextInt(int bound) {
|
||||
return random.nextInt(bound);
|
||||
return RANDOM.nextInt(bound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ server.port=10088
|
||||
CROS_ALLOWED_ORIGINS=${HELLOHAO_WEB_HOST:http://127.0.0.1:8080}
|
||||
#数据库账号
|
||||
spring.datasource.username=${MYSQL_USERNAME:root}
|
||||
#数据库密码test
|
||||
#数据库密码
|
||||
spring.datasource.password=${MYSQL_PASS:root}
|
||||
#数据库链接地址
|
||||
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost:3306/tbed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8}
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
<!-- 滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 RollingFileAppender -->
|
||||
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/log_error.log</file>
|
||||
<!-- 过滤器,只记录WARN级别的日志 -->
|
||||
<!-- 果日志级别等于配置级别,过滤器会根据onMath 和 onMismatch接收或拒绝日志。 -->
|
||||
<!-- 过滤器,只记录ERROR级别的日志 -->
|
||||
<!-- 如果日志级别等于配置级别,过滤器会根据onMatch 和 onMismatch接收或拒绝日志。 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 设置过滤级别 -->
|
||||
<level>ERROR</level>
|
||||
@@ -124,7 +124,7 @@
|
||||
<!-- </encoder>-->
|
||||
<!-- </appender>-->
|
||||
|
||||
<!--name包下的类的日志输出-->
|
||||
<!-- cn.hellohao 包下类的日志输出 -->
|
||||
<logger name="cn.hellohao" additivity="false" level="DEBUG" >
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="INFO" />
|
||||
@@ -141,4 +141,4 @@
|
||||
<!-- root级别 DEBUG -->
|
||||
<!-- <root level="DEBUG">-->
|
||||
<!-- </root>-->
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
package cn.hellohao.Tbed;
|
||||
|
||||
import cn.hellohao.utils.SpringContextHolder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class TbedApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
assertNotNull(applicationContext);
|
||||
assertSame(applicationContext, SpringContextHolder.getApplicationContext());
|
||||
assertTrue(applicationContext.containsBean("tbedApplication"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user