mirror of
https://github.com/Hello-hao/Tbed.git
synced 2024-04-21 12:32:10 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc53e4c8ac |
@@ -28,16 +28,15 @@
|
||||
[Core版](https://hellohao.cn):开源版的基础上增加`Backblaze(B2)` 并且可`同个对象存储商家`可开多个存储源(可添加至90+存储源)
|
||||
|
||||
|
||||
### 更新日志 `20230622`
|
||||
### 更新日志 `20230918`
|
||||
|
||||
- 修复首页批量复制窗点击复制报错
|
||||
- 优化画廊分享复制分享信息时网址和提示字符的分割,以防被encode
|
||||
- 修复选择筛选框表单内容后,不检索也会筛选的异常情况
|
||||
- 筛选条件添加时间倒序/顺序、文件大小倒序/顺序
|
||||
- 优化用户登录账号支持邮箱/用户名方式登录
|
||||
- 修复了移动端web页面首页退出按钮无反应问题
|
||||
- 优化默认的站点logo展示逻辑,解决进入页面瞬间显示默认logo的问题
|
||||
- 强化图像链接转存功能,支持防盗链地址转存
|
||||
- 调整菜单个人相册名字为相册空间
|
||||
- 调整首页UI宽度
|
||||
- 优化代码未激活账号登录时提示重新激活
|
||||
- docker-compose方式部署添加数据库用户名配置项
|
||||
- 修改拦截器写入响应数据时逻辑
|
||||
- 优化图像链接转存功能
|
||||
|
||||
|
||||
[^_^]: 程序宣传视频:[自制宣传视频](https://www.bilibili.com/video/BV11r4y1y7mH/)
|
||||
@@ -174,6 +173,7 @@
|
||||
[^_^]: 
|
||||
|
||||
### 桌面客户端(win/mac)
|
||||
> 获取地址:[官网获取](https://www.hellohao.cn/app)
|
||||
|
||||
> `开源版`/`Core版` 都可以使用
|
||||
> 
|
||||
|
||||
@@ -10,10 +10,12 @@ import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* @author Hellohao
|
||||
@@ -139,11 +141,16 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter {
|
||||
info = "用户未找到";
|
||||
}
|
||||
System.err.println("拦截器False-"+info);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
final JSONObject jsonObject = new JSONObject();
|
||||
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
|
||||
httpServletResponse.setStatus(HttpServletResponse.SC_OK);
|
||||
httpServletResponse.setCharacterEncoding("UTF-8");
|
||||
httpServletResponse.setContentType("application/json");
|
||||
PrintWriter writer = httpServletResponse.getWriter();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("code",this.CODE);
|
||||
jsonObject.put("info",info);
|
||||
response.getWriter().write(jsonObject.toJSONString());
|
||||
writer.write(jsonObject.toJSONString());
|
||||
writer.flush();
|
||||
} catch (Exception e) {
|
||||
System.out.println("返回token验证失败403请求,报异常了");
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public class ShiroConfig {
|
||||
filterMap.put("/verifyCode","anon");
|
||||
filterMap.put("/verifyCodeForRegister","anon");
|
||||
filterMap.put("/verifyCodeForRetrieve","anon");
|
||||
filterMap.put("/verifyCodeFortowSendEmail","anon");
|
||||
filterMap.put("/api/**","anon");
|
||||
filterMap.put("/user/**","anon");
|
||||
filterMap.put("/ota/**","anon");
|
||||
|
||||
@@ -47,7 +47,7 @@ public class IndexController {
|
||||
@RequestMapping(value = "/")
|
||||
public String Welcome(Model model, HttpServletRequest httpServletRequest) {
|
||||
model.addAttribute("name", "服务端程序(开源版)");
|
||||
model.addAttribute("version", "20230622");
|
||||
model.addAttribute("version", "20230918");
|
||||
model.addAttribute("ip", GetIPS.getIpAddr(httpServletRequest));
|
||||
model.addAttribute("links", "https://github.com/Hello-hao/tbed");
|
||||
return "welcome";
|
||||
@@ -320,6 +320,29 @@ public class IndexController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = {"/verifyCodeFortowSendEmail","/wechat/verifyCodeFortowSendEmail"})
|
||||
@ResponseBody
|
||||
public Msg verifyCodeFortowSendEmail() {
|
||||
Msg msg = new Msg();
|
||||
try {
|
||||
ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(90, 35, 2, 2);
|
||||
// 自定义验证码内容为四则运算方式
|
||||
captcha.setGenerator(new MathGenerator(1));
|
||||
String code = getVerifyCodeOperator(captcha.getCode());
|
||||
String uid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
|
||||
iRedisService.setValue("verifyCodeFortowSendEmail_"+uid,code);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("codeKey",uid);
|
||||
jsonObject.put("codeImg",captcha.getImageBase64());
|
||||
msg.setData(jsonObject);
|
||||
return msg;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
msg.setCode("500");
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getVerifyCodeOperator(String str) {
|
||||
int a = Integer.valueOf(str.substring(0, 1));
|
||||
String yxf = str.substring(1, 2);
|
||||
|
||||
@@ -16,6 +16,8 @@ import org.apache.shiro.authc.IncorrectCredentialsException;
|
||||
import org.apache.shiro.authc.UnknownAccountException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
@@ -44,6 +46,7 @@ public class UserController {
|
||||
private SysConfigService sysConfigService;
|
||||
@Autowired
|
||||
IRedisService iRedisService;
|
||||
private Logger logger = LoggerFactory.getLogger(UserController.class);
|
||||
|
||||
@PostMapping("/register")
|
||||
@ResponseBody
|
||||
@@ -143,6 +146,57 @@ public class UserController {
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping(value = {"/validateEmail","/wechat/validateEmail"})
|
||||
@ResponseBody
|
||||
public Msg validateEmail(HttpServletRequest httpServletRequest,@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
Msg msg = new Msg();
|
||||
try {
|
||||
JSONObject jsonObj = JSONObject.parseObject(data);
|
||||
String email = jsonObj.getString("email");
|
||||
String towSendEmailCode = jsonObj.getString("towSendEmailCode");
|
||||
Object verifyCodeFortowSendEmail =iRedisService.getValue("verifyCodeFortowSendEmail_"+httpServletRequest.getHeader("verifyCodeFortowSendEmail"));
|
||||
User u = new User();
|
||||
u.setEmail(email);
|
||||
User user = userService.getUsers(u);
|
||||
if(user.getIsok()!=0){
|
||||
msg.setInfo("不知细叶谁裁出,二月春风似剪刀");
|
||||
return msg;
|
||||
}
|
||||
if(null==verifyCodeFortowSendEmail){
|
||||
msg.setCode("4035");
|
||||
msg.setInfo("验证码已失效,请重新弄获取。");
|
||||
return msg;
|
||||
}else if(null==towSendEmailCode){
|
||||
msg.setCode("4036");
|
||||
msg.setInfo("验证码不能为空。");
|
||||
return msg;
|
||||
}
|
||||
if((verifyCodeFortowSendEmail.toString().toLowerCase()).compareTo((towSendEmailCode.toLowerCase()))==0){
|
||||
//注册完发激活链接
|
||||
final Confdata dataJson = confdataService.selectConfdata("config");
|
||||
JSONObject confdata = JSONObject.parseObject(dataJson.getJsondata());
|
||||
EmailConfig emailConfig = emailConfigService.getemail();
|
||||
Thread thread = new Thread() {
|
||||
public void run() {
|
||||
Integer a = NewSendEmail.sendEmail(emailConfig,user.getUsername(), user.getUid(), user.getEmail(),confdata);
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
msg.setInfo("邮件已发送,请注意查收邮箱尽快激活账户(如果没收到,请检查垃圾邮件)");
|
||||
}else{
|
||||
msg.setCode("110408");
|
||||
msg.setInfo("验证码不正确");
|
||||
return msg;
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
logger.error("报错位置:/validateEmail",e);
|
||||
msg.setCode("500");
|
||||
msg.setInfo("邮件发送失败");
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@PostMapping("/login")//new
|
||||
@ResponseBody
|
||||
public Msg login(HttpServletRequest httpServletRequest,@RequestParam(value = "data", defaultValue = "") String data) {
|
||||
@@ -184,7 +238,8 @@ public class UserController {
|
||||
User user = (User) SecurityUtils.getSubject().getPrincipal();
|
||||
if(user.getIsok()==0){
|
||||
msg.setInfo("你的账号暂未激活");
|
||||
msg.setCode("110403");
|
||||
msg.setData(user.getEmail());
|
||||
msg.setCode("110402");
|
||||
return msg;
|
||||
}
|
||||
if(user.getIsok()<0){
|
||||
|
||||
@@ -4,8 +4,6 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Images {
|
||||
// 默认的时间字符串格式
|
||||
|
||||
//id, imgname, imgurl, userid
|
||||
private Long id;
|
||||
private String imgname;
|
||||
@@ -42,326 +40,6 @@ public class Images {
|
||||
private Integer isRepeat;//如果没有开启查重的时候他是0,开启为1
|
||||
private String searchname;
|
||||
private String order;
|
||||
//
|
||||
// public Images() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// public Images(String imgurl, String sizes, String abnormal, String updatetime, String username, String md5key, String imguid) {
|
||||
// this.imgurl = imgurl;
|
||||
// this.sizes = sizes;
|
||||
// this.abnormal = abnormal;
|
||||
// this.updatetime = updatetime;
|
||||
// this.username = username;
|
||||
// this.md5key = md5key;
|
||||
// this.imguid = imguid;
|
||||
// }
|
||||
//
|
||||
// public Images(Long id, String imgname, String imgurl, Integer userid, String sizes, String abnormal, Integer source,
|
||||
// Integer imgtype, String updatetime, String username, Integer storageType, String starttime, String stoptime,
|
||||
// String explains, String md5key, String notes, String useridlist, String imguid, String albumtitle,
|
||||
// String password, Integer selecttype,Long countNum,Integer monthNum,String yyyy,
|
||||
// String format,String about,Integer great,String[] classifuidlist,String classificationuid,String violation,
|
||||
// String idname,Integer isRepeat,String searchname) {
|
||||
// this.id = id;
|
||||
// this.imgname = imgname;
|
||||
// this.imgurl = imgurl;
|
||||
// this.userid = userid;
|
||||
// this.sizes = sizes;
|
||||
// this.abnormal = abnormal;
|
||||
// this.source = source;
|
||||
// this.imgtype = imgtype;
|
||||
// this.updatetime = updatetime;
|
||||
// this.username = username;
|
||||
// this.storageType = storageType;
|
||||
// this.starttime = starttime;
|
||||
// this.stoptime = stoptime;
|
||||
// this.explains = explains;
|
||||
// this.md5key = md5key;
|
||||
// this.notes = notes;
|
||||
// this.useridlist = useridlist;
|
||||
// this.imguid = imguid;
|
||||
// this.albumtitle = albumtitle;
|
||||
// this.password = password;
|
||||
// this.selecttype = selecttype;
|
||||
// this.countNum = countNum;
|
||||
// this.monthNum = monthNum;
|
||||
// this.yyyy = yyyy;
|
||||
// this.format = format;
|
||||
// this.about = about;
|
||||
// this.great = great;
|
||||
// this.classifuidlist = classifuidlist;
|
||||
// this.classificationuid = classificationuid;
|
||||
// this.violation = violation;
|
||||
// this.idname = idname;
|
||||
// this.isRepeat = isRepeat;
|
||||
// this.searchname = searchname;
|
||||
// }
|
||||
//
|
||||
// public Long getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(Long id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public String getImgname() {
|
||||
// return imgname;
|
||||
// }
|
||||
//
|
||||
// public void setImgname(String imgname) {
|
||||
// this.imgname = imgname;
|
||||
// }
|
||||
//
|
||||
// public String getImgurl() {
|
||||
// return imgurl;
|
||||
// }
|
||||
//
|
||||
// public void setImgurl(String imgurl) {
|
||||
// this.imgurl = imgurl;
|
||||
// }
|
||||
//
|
||||
// public Integer getUserid() {
|
||||
// return userid;
|
||||
// }
|
||||
//
|
||||
// public void setUserid(Integer userid) {
|
||||
// this.userid = userid;
|
||||
// }
|
||||
//
|
||||
// public String getSizes() {
|
||||
// return sizes;
|
||||
// }
|
||||
//
|
||||
// public void setSizes(String sizes) {
|
||||
// this.sizes = sizes;
|
||||
// }
|
||||
//
|
||||
// public String getAbnormal() {
|
||||
// return abnormal;
|
||||
// }
|
||||
//
|
||||
// public void setAbnormal(String abnormal) {
|
||||
// this.abnormal = abnormal;
|
||||
// }
|
||||
//
|
||||
// public Integer getSource() {
|
||||
// return source;
|
||||
// }
|
||||
//
|
||||
// public void setSource(Integer source) {
|
||||
// this.source = source;
|
||||
// }
|
||||
//
|
||||
// public Integer getImgtype() {
|
||||
// return imgtype;
|
||||
// }
|
||||
//
|
||||
// public void setImgtype(Integer imgtype) {
|
||||
// this.imgtype = imgtype;
|
||||
// }
|
||||
//
|
||||
// public String getUpdatetime() {
|
||||
// return updatetime;
|
||||
// }
|
||||
//
|
||||
// public void setUpdatetime(String updatetime) {
|
||||
// this.updatetime = updatetime;
|
||||
// }
|
||||
//
|
||||
// public String getUsername() {
|
||||
// return username;
|
||||
// }
|
||||
//
|
||||
// public void setUsername(String username) {
|
||||
// this.username = username;
|
||||
// }
|
||||
//
|
||||
// public Integer getStorageType() {
|
||||
// return storageType;
|
||||
// }
|
||||
//
|
||||
// public void setStorageType(Integer storageType) {
|
||||
// this.storageType = storageType;
|
||||
// }
|
||||
//
|
||||
// public String getStarttime() {
|
||||
// return starttime;
|
||||
// }
|
||||
//
|
||||
// public void setStarttime(String starttime) {
|
||||
// this.starttime = starttime;
|
||||
// }
|
||||
//
|
||||
// public String getStoptime() {
|
||||
// return stoptime;
|
||||
// }
|
||||
//
|
||||
// public void setStoptime(String stoptime) {
|
||||
// this.stoptime = stoptime;
|
||||
// }
|
||||
//
|
||||
// public String getExplains() {
|
||||
// return explains;
|
||||
// }
|
||||
//
|
||||
// public void setExplains(String explains) {
|
||||
// this.explains = explains;
|
||||
// }
|
||||
//
|
||||
// public String getMd5key() {
|
||||
// return md5key;
|
||||
// }
|
||||
//
|
||||
// public void setMd5key(String md5key) {
|
||||
// this.md5key = md5key;
|
||||
// }
|
||||
//
|
||||
// public String getNotes() {
|
||||
// return notes;
|
||||
// }
|
||||
//
|
||||
// public void setNotes(String notes) {
|
||||
// this.notes = notes;
|
||||
// }
|
||||
//
|
||||
// public String getUseridlist() {
|
||||
// return useridlist;
|
||||
// }
|
||||
//
|
||||
// public void setUseridlist(String useridlist) {
|
||||
// this.useridlist = useridlist;
|
||||
// }
|
||||
//
|
||||
// public String getImguid() {
|
||||
// return imguid;
|
||||
// }
|
||||
//
|
||||
// public void setImguid(String imguid) {
|
||||
// this.imguid = imguid;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public String getAlbumtitle() {
|
||||
// return albumtitle;
|
||||
// }
|
||||
//
|
||||
// public void setAlbumtitle(String albumtitle) {
|
||||
// this.albumtitle = albumtitle;
|
||||
// }
|
||||
//
|
||||
// public String getPassword() {
|
||||
// return password;
|
||||
// }
|
||||
//
|
||||
// public void setPassword(String password) {
|
||||
// this.password = password;
|
||||
// }
|
||||
//
|
||||
// public Integer getSelecttype() {
|
||||
// return selecttype;
|
||||
// }
|
||||
//
|
||||
// public void setSelecttype(Integer selecttype) {
|
||||
// this.selecttype = selecttype;
|
||||
// }
|
||||
//
|
||||
// public Long getCountNum() {
|
||||
// return countNum;
|
||||
// }
|
||||
//
|
||||
// public void setCountNum(Long countNum) {
|
||||
// this.countNum = countNum;
|
||||
// }
|
||||
//
|
||||
// public Integer getMonthNum() {
|
||||
// return monthNum;
|
||||
// }
|
||||
//
|
||||
// public void setMonthNum(Integer monthNum) {
|
||||
// this.monthNum = monthNum;
|
||||
// }
|
||||
//
|
||||
// public String getYyyy() {
|
||||
// return yyyy;
|
||||
// }
|
||||
//
|
||||
// public void setYyyy(String yyyy) {
|
||||
// this.yyyy = yyyy;
|
||||
// }
|
||||
//
|
||||
// public String getFormat() {
|
||||
// return format;
|
||||
// }
|
||||
//
|
||||
// public void setFormat(String format) {
|
||||
// this.format = format;
|
||||
// }
|
||||
//
|
||||
// public String getAbout() {
|
||||
// return about;
|
||||
// }
|
||||
//
|
||||
// public void setAbout(String about) {
|
||||
// this.about = about;
|
||||
// }
|
||||
//
|
||||
// public Integer getGreat() {
|
||||
// return great;
|
||||
// }
|
||||
//
|
||||
// public void setGreat(Integer great) {
|
||||
// this.great = great;
|
||||
// }
|
||||
//
|
||||
// public String[] getClassifuidlist() {
|
||||
// return classifuidlist;
|
||||
// }
|
||||
//
|
||||
// public void setClassifuidlist(String[] classifuidlist ) {
|
||||
// this.classifuidlist = classifuidlist;
|
||||
// }
|
||||
//
|
||||
// public String getClassificationuid() {
|
||||
// return classificationuid;
|
||||
// }
|
||||
//
|
||||
// public void setClassificationuid(String classificationuid) {
|
||||
// this.classificationuid = classificationuid;
|
||||
// }
|
||||
//
|
||||
// public String getViolation() {
|
||||
// return violation;
|
||||
// }
|
||||
//
|
||||
// public void setViolation(String violation) {
|
||||
// this.violation = violation;
|
||||
// }
|
||||
//
|
||||
// public String getIdname() {
|
||||
// return idname;
|
||||
// }
|
||||
//
|
||||
// public void setIdname(String idname) {
|
||||
// this.idname = idname;
|
||||
// }
|
||||
//
|
||||
// public Integer getIsRepeat() {
|
||||
// return isRepeat;
|
||||
// }
|
||||
//
|
||||
// public void setIsRepeat(Integer isRepeat) {
|
||||
// this.isRepeat = isRepeat;
|
||||
// }
|
||||
//
|
||||
// public String getSearchname() {
|
||||
// return searchname;
|
||||
// }
|
||||
//
|
||||
// public void setSearchname(String searchname) {
|
||||
// this.searchname = searchname;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ server.port=10088
|
||||
#前端域名需要带协议头http(s)://
|
||||
CROS_ALLOWED_ORIGINS=${HELLOHAO_WEB_HOST:http://127.0.0.1:8080}
|
||||
#数据库账号
|
||||
spring.datasource.username=root
|
||||
spring.datasource.username=${MYSQL_NAME:root}
|
||||
#数据库密码test
|
||||
spring.datasource.password=${MYSQL_PASS:root}
|
||||
#数据库链接地址
|
||||
spring.datasource.url=${MYSQL_URL:jdbc:mysql://127.0.0.1:3306/tbed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8}
|
||||
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost:3306/tbed?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8}
|
||||
#MySQL Driver 无需修改
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
|
||||
@@ -51,7 +51,7 @@ spring.datasource.druid.web-stat-filter.exclusions=false
|
||||
#log4j.logger.cn.hellohao.dao=DEBUG
|
||||
log4j2.formatMsgNoLookups=True
|
||||
logging.level.cn.hellohao=DEBUG
|
||||
logging.file.name=/HellohaoData/tbedlog/tbed_core.log
|
||||
logging.file.name=/HellohaoData/tbedlog/tbed.log
|
||||
logging.pattern.console=%blue(%d{yyyy-MM-dd HH:mm:ss,SSS}) [%cyan(%t)] [%yellow(%c)]-[%highlight(%p)] %msg%n
|
||||
logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
|
||||
logging.logback.rollingpolicy.clean-history-on-start=true
|
||||
|
||||
Reference in New Issue
Block a user