diff --git a/src/main/java/cn/hellohao/auth/filter/SubjectFilter.java b/src/main/java/cn/hellohao/auth/filter/SubjectFilter.java index 48d1a1e..4636398 100644 --- a/src/main/java/cn/hellohao/auth/filter/SubjectFilter.java +++ b/src/main/java/cn/hellohao/auth/filter/SubjectFilter.java @@ -50,7 +50,6 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter { return false; } } - //验证Token String token = httpServletRequest.getHeader("Authorization"); JSONObject jsonObject = JWTUtil.checkToken(token); if(!jsonObject.getBoolean("check")){ @@ -63,20 +62,14 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter { }else{ Subject subject = SecurityUtils.getSubject(); User user = (User) subject.getPrincipal(); - //判断shiro里是否存有用户信息,如果没有,就再存进去。 if(user==null){ -// System.out.println("Token没过期,但是Shiro里的用户信息空了,重新执行登录"); - //封装用户的登录数据(shiro认证的时候使用) UsernamePasswordToken tokenOBJ = new UsernamePasswordToken(jsonObject.getString("email"),jsonObject.getString("password")); - //设置记住我 tokenOBJ.setRememberMe(true); try { - //执行登录方法,如果没有异常,说明登录成功 subject.login(tokenOBJ); SecurityUtils.getSubject().getSession().setTimeout(3600000);//一小时 } catch (Exception e) { - System.err.println("拦截器,登录失败,false"); - //e.printStackTrace(); +// System.err.println("拦截器,登录失败,false"); this.CODE = "403"; return false; } @@ -103,9 +96,7 @@ public class SubjectFilter extends BasicHttpAuthenticationFilter { protected boolean onAccessDenied(ServletRequest request, ServletResponse response, Object mappedValue) { String info = "未知错误"; try { - if(this.CODE.equals("405")){ - info = "当前请求域名认证失败"; - }else if(this.CODE.equals("406")){ + if(this.CODE.equals("406")){ info = "前端域名配置不正确"; }else if(this.CODE.equals("403")){ info = "当前用户无权访问该请求"; diff --git a/src/main/java/cn/hellohao/auth/shiro/ShiroConfig.java b/src/main/java/cn/hellohao/auth/shiro/ShiroConfig.java index 3631e21..eaa8de8 100644 --- a/src/main/java/cn/hellohao/auth/shiro/ShiroConfig.java +++ b/src/main/java/cn/hellohao/auth/shiro/ShiroConfig.java @@ -20,30 +20,14 @@ import java.util.Map; @Configuration public class ShiroConfig { - - //shiro过滤对象 - @Bean//(name = "shiroFilterFactoryBean") + @Bean public ShiroFilterFactoryBean shiroFilterFactoryBean(@Qualifier("defaultWebSecurityManager") DefaultWebSecurityManager defaultWebSecurityManager){ ShiroFilterFactoryBean bean = new ShiroFilterFactoryBean(); - //设置安全管理器 bean.setSecurityManager(defaultWebSecurityManager); Map filters = bean.getFilters(); -// Map filter = new HashMap<>(); filters.put("JWT",new SubjectFilter()); bean.setFilters(filters); - - //添加shiro内置过滤器 -/* - * anon: 无需认证就可以访问 - * authc: 必须认证了才可以访问 - * user: 必须拥有 记住我 功能才能访问 - * perms: 拥有对某个资源的权限才能访问 - * roles: 拥有某个角色的权限才能访问 - * */ - Map filterMap = new LinkedHashMap<>(); - - //放行页面 filterMap.put("/verifyCode","anon"); filterMap.put("/verifyCodeForRegister","anon"); filterMap.put("/verifyCodeForRetrieve","anon"); @@ -52,17 +36,13 @@ public class ShiroConfig { filterMap.put("/ota/**","anon"); filterMap.put("/admin/root/**","roles[admin]"); filterMap.put("/**","JWT"); - - //认证失败的返回页面 bean.setLoginUrl("/jurisError"); - //未授权页面 bean.setUnauthorizedUrl("/authError"); bean.setFilterChainDefinitionMap(filterMap); return bean; } - //安全对象 @Bean public DefaultWebSecurityManager defaultWebSecurityManager(@Qualifier("userRealm") UserRealm userRealm){ @@ -80,12 +60,5 @@ public class ShiroConfig { } - //配置禁用session -// @Bean -// public StatelessDefaultSubjectFactory statelessDefaultSubjectFactory(){ -// StatelessDefaultSubjectFactory statelessDefaultSubjectFactory = new StatelessDefaultSubjectFactory(); -// return statelessDefaultSubjectFactory; -// } - } diff --git a/src/main/java/cn/hellohao/auth/shiro/StatelessDefaultSubjectFactory.java b/src/main/java/cn/hellohao/auth/shiro/StatelessDefaultSubjectFactory.java deleted file mode 100644 index 9565c19..0000000 --- a/src/main/java/cn/hellohao/auth/shiro/StatelessDefaultSubjectFactory.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.hellohao.auth.shiro; - -/** - * @author Hellohao - * @version 1.0 - * @date 2021/6/15 17:30 - */ -//public class StatelessDefaultSubjectFactory extends DefaultWebSecurityManager { -// //不创建Session -// public Subject createSubject(SubjectContext context){ -// context.setSessionCreationEnabled(false); -// return super.createSubject(context); -// } -//} diff --git a/src/main/java/cn/hellohao/auth/shiro/UserRealm.java b/src/main/java/cn/hellohao/auth/shiro/UserRealm.java index 20a58d2..c7e1874 100644 --- a/src/main/java/cn/hellohao/auth/shiro/UserRealm.java +++ b/src/main/java/cn/hellohao/auth/shiro/UserRealm.java @@ -28,38 +28,28 @@ public class UserRealm extends AuthorizingRealm { //授权 @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { -// System.out.println("..///执行了授权方法"); SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); - //拿到当前登录的对象 Subject subject = SecurityUtils.getSubject(); User user = (User) subject.getPrincipal(); ArrayList roleList = new ArrayList(); if(user.getLevel()==2){ - //赋予管理员权限 -// info.addRole("admin"); roleList.add("admin"); roleList.add("user"); -// info.addStringPermission("user:one"); }else{ -// info.addRole("user"); roleList.add("user"); } info.addRoles(roleList); return info; } - //认证(登录) @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken tokenOBJ) throws AuthenticationException { -// System.out.println("执行了认证方法"); UsernamePasswordToken userToken = null; userToken = (UsernamePasswordToken)tokenOBJ; User user = new User(); user.setEmail(userToken.getUsername()); User u = userService.getUsers(user); - //用户名认证 if(u==null){ - //返回null 就是异常:UnknownAccountException return null; } //密码认证(防止泄露,不需要我们做) diff --git a/src/main/java/cn/hellohao/config/SysName.java b/src/main/java/cn/hellohao/config/SysName.java index 4cb05f0..faf9d72 100644 --- a/src/main/java/cn/hellohao/config/SysName.java +++ b/src/main/java/cn/hellohao/config/SysName.java @@ -1,7 +1,7 @@ package cn.hellohao.config; /** - * @author Tiansh + * @author Hellohao * @version 1.0 * @date 2020/5/15 9:20 */ diff --git a/src/main/java/cn/hellohao/config/WebImgConfigurer.java b/src/main/java/cn/hellohao/config/WebImgConfigurer.java index 1f43833..7c87a40 100644 --- a/src/main/java/cn/hellohao/config/WebImgConfigurer.java +++ b/src/main/java/cn/hellohao/config/WebImgConfigurer.java @@ -13,10 +13,6 @@ public class WebImgConfigurer implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { String filePath = File.separator + "HellohaoData" + File.separator; - //和页面有关的静态目录都放在项目的static目录下 - //registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); - //上传的图片在D盘下的OTA目录下,访问路径如:http://localhost:8081/OTA/d3cf0281-bb7f-40e0-ab77-406db95ccf2c.jpg - //其中OTA表示访问的前缀。"file:D:/OTA/"是文件真实的存储路径 registry.addResourceHandler("/ota/**").addResourceLocations("file:"+filePath); } diff --git a/src/main/java/cn/hellohao/controller/AdminController.java b/src/main/java/cn/hellohao/controller/AdminController.java index c770af5..5f5e2b6 100644 --- a/src/main/java/cn/hellohao/controller/AdminController.java +++ b/src/main/java/cn/hellohao/controller/AdminController.java @@ -4,8 +4,7 @@ import cn.hellohao.config.SysName; import cn.hellohao.pojo.*; import cn.hellohao.pojo.vo.PageResultBean; import cn.hellohao.service.*; -import cn.hellohao.service.impl.AlbumServiceImpl; -import cn.hellohao.service.impl.UserServiceImpl; +import cn.hellohao.service.impl.*; import cn.hellohao.utils.*; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -43,7 +42,7 @@ public class AdminController { @Autowired private ImgreviewService imgreviewService; @Autowired - private ConfigService configService; + private ImgTempService imgTempService; @Autowired private UploadConfigService uploadConfigService; @Autowired @@ -55,6 +54,22 @@ public class AdminController { @Autowired AlbumServiceImpl albumServiceI; + @Autowired + private NOSImageupload nosImageupload; + @Autowired + private OSSImageupload ossImageupload; + @Autowired + private COSImageupload cosImageupload; + @Autowired + private KODOImageupload kodoImageupload; + @Autowired + private USSImageupload ussImageupload; + @Autowired + private UFileImageupload uFileImageupload; + @Autowired + private FTPImageupload ftpImageupload; + + @PostMapping(value = "/overviewData") //new @ResponseBody public Msg overviewData(@RequestParam(value = "data", defaultValue = "") String data) { @@ -122,7 +137,7 @@ public class AdminController { } - @PostMapping(value = "/SpaceExpansion")//new kuorong + @PostMapping(value = "/SpaceExpansion")//new @ResponseBody public Msg SpaceExpansion(@RequestParam(value = "data", defaultValue = "") String data) { final Msg msg = new Msg(); @@ -159,67 +174,6 @@ public class AdminController { } - @RequestMapping(value = "/tosurvey") - public String admin2(HttpSession session, Model model) { - User u = (User) session.getAttribute("user"); - String sysetmname = System.getProperty("os.name"); - String isarch = System.getProperty("os.arch"); - String jdk = System.getProperty("java.version"); - model.addAttribute("username", u.getUsername()); - model.addAttribute("levels", u.getLevel()); - model.addAttribute("sysetmname",sysetmname); - model.addAttribute("isarch", isarch); - model.addAttribute("jdk", jdk); - //空间大小 - UploadConfig uploadConfig = uploadConfigService.getUpdateConfig(); - Long usermemory = imgService.getusermemory(u.getId()); - if(usermemory==null){usermemory=0L;} - User user = userService.getUsers(u); - if(u!=null){ - if (u.getLevel() == 1) { - model.addAttribute("level", "普通用户"); - } else if (u.getLevel() == 2) { - model.addAttribute("level", "管理员"); - } else { - model.addAttribute("level", "未 知"); - } - model.addAttribute("levels", u.getLevel()); - model.addAttribute("username", u.getUsername()); - model.addAttribute("api", uploadConfig.getApi()); - - model.addAttribute("memory",user.getMemory());//单位M - if(usermemory==null){ - model.addAttribute("usermemory", 0);//单位M - }else{ - float d = (float) (Math.round((usermemory/1024.0F) * 100.0) / 100.0); - model.addAttribute("usermemory", d);//单位M - } - } - return "admin/survey"; - } - - @RequestMapping(value = "/getwebconfig") - @ResponseBody - public String getwebconfig(HttpSession session) { - JSONObject jsonObject = new JSONObject(); - UploadConfig uploadConfig = uploadConfigService.getUpdateConfig(); - User u = (User) session.getAttribute("user"); - Imgreview imgreview = imgreviewService.selectByPrimaryKey(1); - jsonObject.put("usercount", imgService.countimg(u.getId())); - jsonObject.put("counts", imgService.counts(null) ); - jsonObject.put("getusertotal", userService.getUserTotal()); - jsonObject.put("imgreviewcount", imgreview.getCount()); - if(uploadConfig.getIsupdate()!=1){ - jsonObject.put("VisitorUpload", 0);//是否禁用了游客上传 - }else{ - Long temp = imgService.getusermemory(0); - jsonObject.put("VisitorUpload", uploadConfig.getIsupdate());//是否禁用了游客上传 - jsonObject.put("UsedSize", (temp == null ? 0 : temp/1024));//访客已用大小 - jsonObject.put("VisitorMemory", uploadConfig.getVisitormemory());//访客共大小 - } - return jsonObject.toString(); - } - @PostMapping("/getRecently")//new 获取榜单和最近上传 @ResponseBody public Msg getRecently(@RequestParam(value = "data", defaultValue = "") String data) { @@ -303,7 +257,7 @@ public class AdminController { return msg; } - @PostMapping("/getStorage")//new 获取当前一共有多少种存储源 这是种类 + @PostMapping("/getStorage")//new @ResponseBody public Msg getStorage() { Msg msg = new Msg(); @@ -312,7 +266,7 @@ public class AdminController { return msg; } - @PostMapping("/getStorageName")//new 获取当前一共有多少个存储源 这是总个数 + @PostMapping("/getStorageName")//new @ResponseBody public Msg getStorageName() { Msg msg = new Msg(); @@ -358,7 +312,6 @@ public class AdminController { } Images img = new Images(); PageHelper.startPage(pageNum, pageSize); -// img.setUseridlist(user.getId().toString()); if(violation){ img.setViolation("true"); } @@ -431,7 +384,6 @@ public class AdminController { msg.setInfo("用户名不得超过20位字符"); return msg; } - if(subject.hasRole("admin")){ final User userOld = new User(); userOld.setId(u.getId()); @@ -475,9 +427,87 @@ public class AdminController { } + @PostMapping("/deleImages") //new + @ResponseBody + public Msg deleImages(@RequestParam(value = "data", defaultValue = "") String data) { + Msg msg = new Msg(); + JSONObject jsonObj = JSONObject.parseObject(data); + JSONArray images = jsonObj.getJSONArray("images"); + Subject subject = SecurityUtils.getSubject(); + User user = (User) subject.getPrincipal(); + if(null == user){ + msg.setCode("500"); + msg.setInfo("当前用户信息不存在"); + return msg; + } + if(images.size()==0){ + msg.setCode("404"); + msg.setInfo("为获取到图像信息"); + return msg; + } + for (int i = 0; i < images.size(); i++) { + Integer imgid = images.getInteger(i); + Images image = imgService.selectByPrimaryKey(imgid); + Integer keyid = image.getSource(); + String imgname = image.getImgname(); + Keys key = keysService.selectKeys(keyid); + if(!subject.hasRole("admin")){ + if(image.getUserid()!=user.getId()){ + break; + } + } + //删除图片 + boolean isDele = false; + try{ + if (key.getStorageType() == 1) { + isDele = nosImageupload.delNOS(key.getId(), imgname); + } else if (key.getStorageType() == 2) { + isDele = ossImageupload.delOSS(key.getId(), imgname); + } else if (key.getStorageType() == 3) { + isDele = ussImageupload.delUSS(key.getId(), imgname); + } else if (key.getStorageType() == 4) { + isDele = kodoImageupload.delKODO(key.getId(), imgname); + } else if (key.getStorageType() == 5) { + isDele = LocUpdateImg.deleteLOCImg(imgname); + }else if (key.getStorageType() == 6) { + isDele = cosImageupload.delCOS(key.getId(), imgname); + }else if (key.getStorageType() == 7) { + isDele = ftpImageupload.delFTP(key.getId(), imgname); + }else if (key.getStorageType() == 8) { + isDele = uFileImageupload.delUFile(key.getId(), imgname); + }else { + System.err.println("未获取到对象存储参数,删除失败。"); + } + }catch (Exception e){ + e.printStackTrace(); + } + //删除库 + if(isDele){ + try { + //删除图像表之前先删除临时数据表,图像表也会删除 + imgTempService.delImgAndExp(image.getImguid()); + imgService.deleimg(imgid); + imgAndAlbumService.deleteImgAndAlbum(imgname); + } catch (Exception e) { + e.printStackTrace(); + msg.setInfo("图片记录删除失败,请重试"); + msg.setCode("500"); + return msg; + } + msg.setInfo("删除成功"); + }else{ + imgTempService.delImgAndExp(image.getImguid()); + imgService.deleimg(imgid); + imgAndAlbumService.deleteImgAndAlbum(imgname); + msg.setInfo("图片记录已删除,但是图片源删除失败"); + } + } + System.out.println("返回的值:"+msg.toString()); + return msg; + } //工具函数 diff --git a/src/main/java/cn/hellohao/controller/AdminRootController.java b/src/main/java/cn/hellohao/controller/AdminRootController.java index d7705aa..394298e 100644 --- a/src/main/java/cn/hellohao/controller/AdminRootController.java +++ b/src/main/java/cn/hellohao/controller/AdminRootController.java @@ -3,10 +3,7 @@ package cn.hellohao.controller; import cn.hellohao.pojo.*; import cn.hellohao.service.*; import cn.hellohao.service.impl.*; -import cn.hellohao.utils.GetCurrentSource; -import cn.hellohao.utils.Print; -import cn.hellohao.utils.SetFiles; -import cn.hellohao.utils.StringUtils; +import cn.hellohao.utils.*; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; @@ -53,10 +50,11 @@ public class AdminRootController { private GroupService groupService; @Autowired private ImgService imgService; + @Autowired + private ImgreviewService imgreviewService; - @PostMapping(value = "/getUserList")//new selectusertable - @ResponseBody + @PostMapping(value = "/getUserList")//new public Map getUserList(@RequestParam(value = "data", defaultValue = "") String data) { JSONObject jsonObj = JSONObject.parseObject(data); Integer pageNum = jsonObj.getInteger("pageNum"); @@ -181,8 +179,6 @@ public class AdminRootController { return msg; } - - //获取当前所有的存储策略信息 @PostMapping("/LoadInfo")//new @ResponseBody public Msg LoadInfo(@RequestParam(value = "data", defaultValue = "") String data) { @@ -190,7 +186,6 @@ public class AdminRootController { try { JSONObject jsonData = JSONObject.parseObject(data); Integer keyId = jsonData.getInteger("keyId"); - JSONObject jsonObject = new JSONObject(); jsonObject.put("id",keyId); Keys key = keysService.selectKeys(keyId); @@ -210,7 +205,6 @@ public class AdminRootController { }else if(key.getStorageType()==8){ ret = UFileImageupload.Initialize(key); } - Long l = imgService.getsourcememory(keyId); jsonObject.put("isok",ret); jsonObject.put("storagetype",key.getStorageType()); @@ -265,7 +259,7 @@ public class AdminRootController { } - @PostMapping("/getSettingConfig") //new upload配置表的相关设置 + @PostMapping("/getSettingConfig") //new @ResponseBody public Msg getSettingConfig(@RequestParam(value = "data", defaultValue = "") String data) { final Msg msg = new Msg(); @@ -276,9 +270,6 @@ public class AdminRootController { UploadConfig uploadConfig = uploadConfigService.getUpdateConfig(); Config config = configService.getSourceype(); SysConfig sysConfig = sysConfigService.getstate(); - //把字节换算一下,页面上显示M -// filesizetourists = (filesizetourists*1024*1024) ,filesizeuser=(filesizeuser*1024*1024) -// visitormemory=(visitormemory*1024*1024),usermemory=(usermemory*1024*1024) uploadConfig.setUsermemory(Long.toString(Long.valueOf(uploadConfig.getUsermemory())/1024/1024)); uploadConfig.setVisitormemory(Long.toString(Long.valueOf(uploadConfig.getVisitormemory())/1024/1024)); uploadConfig.setFilesizetourists(Long.toString(Long.valueOf(uploadConfig.getFilesizetourists())/1024/1024)); @@ -321,11 +312,9 @@ public class AdminRootController { uploadConfig.setFilesizetourists(Long.toString(Long.valueOf(uploadConfig.getFilesizetourists())*1024*1024)); uploadConfig.setUsermemory(Long.toString(Long.valueOf(uploadConfig.getUsermemory())*1024*1024)); uploadConfig.setFilesizeuser(Long.toString(Long.valueOf(uploadConfig.getFilesizeuser())*1024*1024)); - uploadConfigService.setUpdateConfig(uploadConfig); configService.setSourceype(config); sysConfigService.setstate(sysConfig); - msg.setInfo("配置保存成功"); }catch (Exception e){ e.printStackTrace(); @@ -336,5 +325,70 @@ public class AdminRootController { } + @PostMapping(value = "/getOrderConfig")//new + @ResponseBody + public Msg emailconfig() { + final Msg msg = new Msg(); + EmailConfig emailConfig = null; + Imgreview imgreview = null; + try { + final JSONObject jsonObject = new JSONObject(); + emailConfig = emailConfigService.getemail(); + imgreview = imgreviewService.selectByPrimaryKey(1); + jsonObject.put("emailConfig",emailConfig); + jsonObject.put("imgreview",imgreview); + msg.setData(jsonObject); + } catch (Exception e) { + e.printStackTrace(); + msg.setCode("110500"); + msg.setInfo("获取相关配置信息失败"); + } + return msg; + } + + + @PostMapping("/updateEmailConfig") //new + @ResponseBody + public Msg updateemail(@RequestParam(value = "data", defaultValue = "") String data ) { + final Msg msg = new Msg(); + try { + JSONObject jsonObj = JSONObject.parseObject(data); + EmailConfig emailConfig = JSON.toJavaObject(jsonObj,EmailConfig.class); + if(null==emailConfig.getId() || null==emailConfig.getEmailname() || null==emailConfig.getEmailurl() || null==emailConfig.getEmails() + || null==emailConfig.getEmailkey() || null==emailConfig.getPort() || null==emailConfig.getUsing() + || emailConfig.getEmailname().equals("") || emailConfig.getEmailurl().equals("") || emailConfig.getEmails().equals("") + || emailConfig.getEmailkey().equals("") || emailConfig.getPort().equals("")){ + msg.setCode("110400"); + msg.setInfo("各参数不能为空"); + return msg; + } + emailConfigService.updateemail(emailConfig); + msg.setInfo("保存成功"); + } catch (Exception e) { + e.printStackTrace(); + msg.setCode("110500"); + msg.setInfo("保存过程出现错误"); + } + return msg; + } + + @PostMapping("/mailTest") //new + @ResponseBody + public Msg mailTest(@RequestParam(value = "data", defaultValue = "") String data ) { + Msg msg = new Msg(); + JSONObject jsonObj = JSONObject.parseObject(data); + String tomail = jsonObj.getString("tomail"); + EmailConfig emailConfig = JSON.toJavaObject(jsonObj,EmailConfig.class); + if(null==emailConfig.getEmails() || null==emailConfig.getEmailkey() || null==emailConfig.getEmailurl() + || null==emailConfig.getPort() || null==emailConfig.getEmailname() || null==tomail){ +// if(jsonObj.size()==0){ + msg.setCode("110400"); + msg.setInfo("邮箱配置参数不能为空"); + }else{ + msg = NewSendEmail.sendTestEmail(emailConfig, tomail); + } + return msg; + } + } diff --git a/src/main/java/cn/hellohao/controller/AlbumController.java b/src/main/java/cn/hellohao/controller/AlbumController.java index bf1e4e9..1aee07c 100644 --- a/src/main/java/cn/hellohao/controller/AlbumController.java +++ b/src/main/java/cn/hellohao/controller/AlbumController.java @@ -1,6 +1,7 @@ package cn.hellohao.controller; import cn.hellohao.pojo.*; +import cn.hellohao.pojo.vo.PageResultBean; import cn.hellohao.service.*; import cn.hellohao.service.impl.AlbumServiceImpl; import com.alibaba.fastjson.JSONArray; @@ -39,7 +40,7 @@ public class AlbumController { @Autowired private UserService userService; - @PostMapping("/admin/getGalleryList") //new 获取画廊地址 + @PostMapping("/admin/getGalleryList") //new @ResponseBody public Map getGalleryList (@RequestParam(value = "data", defaultValue = "") String data){ Subject subject = SecurityUtils.getSubject(); @@ -177,8 +178,82 @@ public class AlbumController { } + @PostMapping("/checkPass")//new + @ResponseBody + public Msg checkPass(@RequestParam(value = "data", defaultValue = "") String data) { + Msg msg = new Msg(); + JSONObject json = new JSONObject(); + JSONObject jsonObject = null; + try { + jsonObject = JSONObject.parseObject(data); + String key = jsonObject.getString("key"); + Album album = new Album(); + album.setAlbumkey(key); + Album a = albumServiceImpl.selectAlbum(album); + if(a!=null){ + json.put("album",a); + json.put("exist",true); + if(a.getPassword()!=null && !a.getPassword().equals("")){ + json.put("passType",true); + }else{ + json.put("passType",false); + } + msg.setData(json); + }else{ + json.put("exist",false); + msg.setData(json); + } + } catch (Exception e) { + e.printStackTrace(); + msg.setCode("110500"); + msg.setInfo("操作失败"); + msg.setData(json); + } + return msg; + } - + @PostMapping("/getAlbumList") //new + @ResponseBody + public Msg getAlbumList(@RequestParam(value = "data", defaultValue = "") String data){ + Msg msg = new Msg(); + JSONObject json = new JSONObject(); + JSONObject jsonObject = JSONObject.parseObject(data); + Integer pageNum = jsonObject.getInteger("pageNum"); + Integer pageSize = jsonObject.getInteger("pageSize"); + String albumkey = jsonObject.getString("albumkey"); + String password = jsonObject.getString("password"); + if(null!=password){ + password = password.replace(" ", ""); + } + Album album = new Album(); + album.setAlbumkey(albumkey); + Album a = albumServiceImpl.selectAlbum(album); + if(a==null){ + msg.setCode("110404"); + msg.setInfo("画廊地址不存在"); + }else{ + PageHelper.startPage(pageNum, pageSize); + if(a.getPassword()==null || (a.getPassword().replace(" ", "")).equals("")){ + List imagesList = imgAndAlbumService.selectImgForAlbumkey(albumkey); + PageInfo rolePageInfo = new PageInfo<>(imagesList); + PageResultBean pageResultBean = new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList()); + json.put("imagesList",pageResultBean); + }else{ + if(a.getPassword().equals(password)){ + List imagesList = imgAndAlbumService.selectImgForAlbumkey(albumkey); + PageInfo rolePageInfo = new PageInfo<>(imagesList); + PageResultBean pageResultBean = new PageResultBean<>(rolePageInfo.getTotal(), rolePageInfo.getList()); + json.put("imagesList",pageResultBean); + }else{ + msg.setCode("110403"); + msg.setInfo("画廊密码错误"); + } + } + json.put("titlename",a.getAlbumtitle()); + msg.setData(json); + } + return msg; + } diff --git a/src/main/java/cn/hellohao/controller/ClientController.java b/src/main/java/cn/hellohao/controller/ClientController.java index 08d39c0..5a24ff2 100644 --- a/src/main/java/cn/hellohao/controller/ClientController.java +++ b/src/main/java/cn/hellohao/controller/ClientController.java @@ -29,35 +29,17 @@ import java.util.*; */ @RestController public class ClientController { - @Autowired - private NOSImageupload nOSImageupload; - @Autowired - private UserService userService; - @Autowired - private KeysService keysService; - @Autowired - private OSSImageupload ossImageupload; - @Autowired - private ConfigService configService; - @Autowired - private USSImageupload ussImageupload; - @Autowired - private KODOImageupload kodoImageupload; - @Autowired - private UploadConfigService uploadConfigService; - @Autowired - private NoticeService noticeService; - @Autowired - private COSImageupload cosImageupload; - @Autowired - private FTPImageupload ftpImageupload; - @Autowired - private UFileImageupload uFileImageupload; - @Autowired - private ImgService imgService; - @Value("${systemupdate}") - private String systemupdate; + @Autowired + private ClientService clientService; + + + @PostMapping(value = "/uploadbymail") + @ResponseBody + public Msg uploadbymail(HttpServletRequest request, @RequestParam("file") MultipartFile file, String mail, String pass) { + Msg resultBean = clientService.uploadImg(request, file, mail, pass); + return resultBean; + } } diff --git a/src/main/java/cn/hellohao/controller/CodeController.java b/src/main/java/cn/hellohao/controller/CodeController.java index d5fc527..9f28b0f 100644 --- a/src/main/java/cn/hellohao/controller/CodeController.java +++ b/src/main/java/cn/hellohao/controller/CodeController.java @@ -1,13 +1,8 @@ package cn.hellohao.controller; import cn.hellohao.pojo.Code; -import cn.hellohao.pojo.Config; import cn.hellohao.pojo.Msg; -import cn.hellohao.pojo.User; import cn.hellohao.service.CodeService; -import cn.hellohao.service.KeysService; -import cn.hellohao.service.UserService; -import cn.hellohao.service.impl.ImgServiceImpl; import cn.hutool.crypto.SecureUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -18,8 +13,6 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; - -import javax.servlet.http.HttpSession; import java.util.*; /** diff --git a/src/main/java/cn/hellohao/controller/ErrorController.java b/src/main/java/cn/hellohao/controller/ErrorController.java deleted file mode 100644 index 50eccdb..0000000 --- a/src/main/java/cn/hellohao/controller/ErrorController.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.hellohao.controller; - -import cn.hellohao.pojo.Msg; -import org.springframework.boot.web.servlet.error.ErrorController; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.servlet.http.HttpServletRequest; - -/** - * 错误页面拦截 - * */ - -@Controller -class MainsiteErrorController implements ErrorController { - - @RequestMapping("/error") - public String handleError(HttpServletRequest request){ - //获取statusCode:401,404,500 - Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code"); - if(statusCode == 401){ - return "401"; - }else if(statusCode == 404){ - return "404"; - }else if(statusCode == 403){ - return "403"; - }else{ - return "500"; - } - - } - //认证失败 - @RequestMapping("/jurisError") - @ResponseBody - public Msg jurisError(HttpServletRequest request){ - Msg msg = new Msg(); - msg.setCode("4031"); - msg.setInfo("Authentication request failed"); - return msg; - } - - -} \ No newline at end of file diff --git a/src/main/java/cn/hellohao/controller/ExceptionHandling.java b/src/main/java/cn/hellohao/controller/ExceptionHandling.java index 8e0188b..c0cd040 100644 --- a/src/main/java/cn/hellohao/controller/ExceptionHandling.java +++ b/src/main/java/cn/hellohao/controller/ExceptionHandling.java @@ -67,20 +67,5 @@ public class ExceptionHandling { -// @ExceptionHandler -// public String methodArgumentNotValid(BindException e) { -// List allErrors = e.getBindingResult().getAllErrors(); -// StringBuilder errorMessage = new StringBuilder(); -// for (int i = 0; i < allErrors.size(); i++) { -// ObjectError error = allErrors.get(i); -// errorMessage.append(error.getDefaultMessage()); -// if (i != allErrors.size() - 1) { -// errorMessage.append(", "); -// } -// } -// // do something -// System.out.println(errorMessage.toString());// 这里面是错误信息 -// return errorMessage.toString(); -// } } diff --git a/src/main/java/cn/hellohao/controller/GroupController.java b/src/main/java/cn/hellohao/controller/GroupController.java index 0721478..b1cd731 100644 --- a/src/main/java/cn/hellohao/controller/GroupController.java +++ b/src/main/java/cn/hellohao/controller/GroupController.java @@ -1,26 +1,19 @@ package cn.hellohao.controller; import cn.hellohao.pojo.Group; -import cn.hellohao.pojo.Keys; import cn.hellohao.pojo.Msg; -import cn.hellohao.pojo.User; import cn.hellohao.service.GroupService; import cn.hellohao.service.KeysService; import cn.hellohao.service.UserService; -import cn.hellohao.utils.StringUtils; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; - -import javax.servlet.http.HttpSession; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -52,8 +45,6 @@ public class GroupController { return msg; } - - //获取code列表 @PostMapping(value = "/getGroupList")//new @ResponseBody public Map getgrouplist(@RequestParam(value = "data", defaultValue = "") String data) { @@ -78,7 +69,6 @@ public class GroupController { return map; } - @PostMapping(value = "/addGroup")//new @ResponseBody public Msg addisgroup(@RequestParam(value = "data", defaultValue = "") String data) { @@ -95,7 +85,6 @@ public class GroupController { @PostMapping("/updateGroup")//new @ResponseBody public Msg updategroup(@RequestParam(value = "data", defaultValue = "") String data) { - JSONObject jsonObject = JSONObject.parseObject(data); Group group = new Group(); group.setId(jsonObject.getInteger("id")); diff --git a/src/main/java/cn/hellohao/controller/ImageReviewController.java b/src/main/java/cn/hellohao/controller/ImageReviewController.java index dc6b5e9..e5d4daa 100644 --- a/src/main/java/cn/hellohao/controller/ImageReviewController.java +++ b/src/main/java/cn/hellohao/controller/ImageReviewController.java @@ -1,43 +1,61 @@ package cn.hellohao.controller; import cn.hellohao.pojo.Imgreview; +import cn.hellohao.pojo.Msg; import cn.hellohao.service.ImgreviewService; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; @Controller -@RequestMapping("/admin") +@RequestMapping("/admin/root") public class ImageReviewController { @Autowired private ImgreviewService imgreviewService; - @RequestMapping(value = "/root/ImageReview") - public String ForwardImageReview(Model model) { - Imgreview imgreview = imgreviewService.selectByPrimaryKey(1); - model.addAttribute("appid", imgreview.getAppId()); - model.addAttribute("apikey", imgreview.getApiKey()); - model.addAttribute("secretkey", imgreview.getSecretKey()); - model.addAttribute("using", imgreview.getUsing()); - return "admin/imageIdentify"; - } - - @RequestMapping(value = "/root/ImgreviewSwitch") + @PostMapping("/updateimgReviewConfig") //new @ResponseBody - public String ImgreviewSwitch(String appId, String apiKey, String secretKey, Integer using) { - Imgreview imgreview = new Imgreview(); - imgreview.setId(1);//目前就一种鉴黄功能所以设死了 - imgreview.setUsing(using); - imgreview.setAppId(appId); - imgreview.setApiKey(apiKey); - imgreview.setSecretKey(secretKey); - Integer ret = imgreviewService.updateByPrimaryKeySelective(imgreview); - - return ret.toString(); + public Msg updateimgReviewConfig(@RequestParam(value = "data", defaultValue = "") String data ) { + final Msg msg = new Msg(); + try { + JSONObject jsonObj = JSONObject.parseObject(data); + Imgreview imgreview = JSON.toJavaObject(jsonObj,Imgreview.class); + if(imgreview.getId()==1){ + if(null==imgreview.getId() || null==imgreview.getApiKey() || null==imgreview.getUsing() || null==imgreview.getSecretKey() + || null==imgreview.getAppId() || imgreview.getApiKey().equals("") + || imgreview.getSecretKey().equals("") || imgreview.getAppId().equals("")){ + msg.setCode("110400"); + msg.setInfo("各参数不能为空"); + return msg; + } + }else{ + if(null==imgreview.getId() || null==imgreview.getApiKey() || null==imgreview.getUsing() + || imgreview.getApiKey().equals("") + ){ + msg.setCode("110400"); + msg.setInfo("各参数不能为空"); + return msg; + } + } + if(null == imgreviewService.selectByPrimaryKey(imgreview.getId())){ + imgreviewService.insert(imgreview); + }else{ + imgreviewService.updateByPrimaryKeySelective(imgreview); + } + msg.setInfo("保存成功"); + } catch (Exception e) { + e.printStackTrace(); + msg.setCode("110500"); + msg.setInfo("保存过程出现错误"); + } + return msg; } } diff --git a/src/main/java/cn/hellohao/controller/IndexController.java b/src/main/java/cn/hellohao/controller/IndexController.java index 1a67969..d17bb89 100644 --- a/src/main/java/cn/hellohao/controller/IndexController.java +++ b/src/main/java/cn/hellohao/controller/IndexController.java @@ -14,62 +14,55 @@ import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.FileSystemResource; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; - -import javax.imageio.ImageIO; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import java.awt.image.BufferedImage; import java.io.*; -import java.util.*; @Controller public class IndexController { + @Autowired + private ImgService imgService; @Autowired private SysConfigService sysConfigService; @Autowired IRedisService iRedisService; @Autowired - private NOSImageupload nOSImageupload; - @Autowired - private UserService userService; - @Autowired - private KeysService keysService; - @Autowired private ConfigService configService; @Autowired private UploadConfigService uploadConfigService; @Autowired - private USSImageupload ussImageupload; + private UploadServicel uploadServicel; @Autowired - private KODOImageupload kodoImageupload; + private NOSImageupload nosImageupload; + @Autowired + private OSSImageupload ossImageupload; @Autowired private COSImageupload cosImageupload; @Autowired + private KODOImageupload kodoImageupload; + @Autowired + private USSImageupload ussImageupload; + @Autowired + private UFileImageupload uFileImageupload; + @Autowired private FTPImageupload ftpImageupload; @Autowired - private ImgService imgService; + AlbumServiceImpl albumService; @Autowired - private UploadServicel uploadServicel; - - private String[] iparr; - - public static String vu; + private KeysService keysService; + @Autowired + private ImgTempService imgTempService; + @Autowired + private ImgAndAlbumService imgAndAlbumService; - - @RequestMapping(value = "/webInfo")//upimg new + @RequestMapping(value = "/webInfo") @ResponseBody - public Msg webInfo(HttpSession httpSession) { + public Msg webInfo() { final Msg msg = new Msg(); Config config = configService.getSourceype(); UploadConfig updateConfig = uploadConfigService.getUpdateConfig(); @@ -86,8 +79,6 @@ public class IndexController { jsonObject.put("aboutinfo",config.getAboutinfo()); jsonObject.put("logo",config.getLogo()); jsonObject.put("api",updateConfig.getApi()); -// jsonObject.put("watermark",updateConfig.getWatermark()); -// jsonObject.put("guidepage",sysConfig.getGuidepage()); jsonObject.put("register",sysConfig.getRegister()); msg.setData(jsonObject); return msg; @@ -109,11 +100,6 @@ public class IndexController { return uploadServicel.uploadForLoc(request,multipartFile,day,null,jsonArray); } - - - - - @RequestMapping(value = "/getUploadInfo")//new @ResponseBody public Msg getUploadInfo() { @@ -148,19 +134,13 @@ public class IndexController { String token = request.getHeader("Authorization"); if(token != null) { JSONObject tokenJson = JWTUtil.checkToken(token); -// boolean check = (boolean) result.get("check"); -// String password = (String) result.get("password"); if(tokenJson.getBoolean("check")){ - //获取当前用户 Subject subject = SecurityUtils.getSubject(); - //封装用户的登录数据(shiro认证的时候使用) UsernamePasswordToken tokenOBJ = new UsernamePasswordToken(tokenJson.getString("email"),tokenJson.getString("password")); - //设置记住我 tokenOBJ.setRememberMe(true); try { - //执行登录方法,如果没有异常,说明登录成功 subject.login(tokenOBJ); - SecurityUtils.getSubject().getSession().setTimeout(3600000);//一小时 + SecurityUtils.getSubject().getSession().setTimeout(3600000); User u = (User) subject.getPrincipal(); final JSONObject jsonObject = new JSONObject(); jsonObject.put("RoleLevel",u.getLevel()==2?"admin":"user"); @@ -168,7 +148,6 @@ public class IndexController { msg.setCode("200"); msg.setData(jsonObject); } catch (Exception e) { - //此异常说明用户名不存在 msg.setCode("40041"); msg.setInfo("登录失效,请重新登录"); System.err.println("登录失效,请重新登录"); @@ -246,8 +225,92 @@ public class IndexController { } } + //删除图像 + @PostMapping("/deleImagesByUid") //new + @ResponseBody + public Msg deleImagesByUid(@RequestParam(value = "data", defaultValue = "") String data) { + Msg msg = new Msg(); + JSONObject jsonObj = JSONObject.parseObject(data); + String imguid = jsonObj.getString("imguid"); + Images image = imgService.selectImgUrlByImgUID(imguid); + Subject subject = SecurityUtils.getSubject(); + User user = (User) subject.getPrincipal(); + if(null!=user){ + if(user.getId()!=image.getUserid()){ + msg.setInfo("删除失败,该图片不允许你执行操作"); + msg.setCode("100403"); + return msg; + } + } + Integer keyid = image.getSource(); + String imgname = image.getImgname(); + Keys key = keysService.selectKeys(keyid); + //删除图片 + boolean isDele = false; + if (key.getStorageType() == 1) { + isDele = nosImageupload.delNOS(key.getId(), imgname); + } else if (key.getStorageType() == 2) { + isDele = ossImageupload.delOSS(key.getId(), imgname); + } else if (key.getStorageType() == 3) { + isDele = ussImageupload.delUSS(key.getId(), imgname); + } else if (key.getStorageType() == 4) { + isDele = kodoImageupload.delKODO(key.getId(), imgname); + } else if (key.getStorageType() == 5) { + isDele = LocUpdateImg.deleteLOCImg(imgname); + }else if (key.getStorageType() == 6) { + isDele = cosImageupload.delCOS(key.getId(), imgname); + }else if (key.getStorageType() == 7) { + isDele = ftpImageupload.delFTP(key.getId(), imgname); + }else if (key.getStorageType() == 8) { + isDele = uFileImageupload.delUFile(key.getId(), imgname); + }else { + System.err.println("未获取到对象存储参数,删除失败。"); + } + //删除库 + if(isDele){ + try { + imgAndAlbumService.deleteImgAndAlbum(imgname); + imgTempService.delImgAndExp(image.getImguid()); + imgService.deleimg(image.getId()); + } catch (Exception e) { + e.printStackTrace(); + msg.setInfo("图片记录时发生错误"); + msg.setCode("500"); + return msg; + } + msg.setInfo("删除成功"); + }else{ + imgAndAlbumService.deleteImgAndAlbum(imgname); + imgTempService.delImgAndExp(image.getImguid()); + imgService.deleimg(image.getId()); + msg.setInfo("图片记录已删除,但是图片源删除失败"); + msg.setCode("500"); + } + System.out.println("返回的值:"+msg.toString()); + return msg; + } + //没有权限 + @RequestMapping("/authError") + @ResponseBody + public Msg authError(HttpServletRequest request){ + Msg msg = new Msg(); + msg.setCode("4031"); + msg.setInfo("You don't have authority"); + return msg; + } + + //认证失败 + @RequestMapping("/jurisError") + @ResponseBody + public Msg jurisError(HttpServletRequest request){ + Msg msg = new Msg(); + msg.setCode("4031"); + msg.setInfo("Authentication request failed"); + return msg; + } + } diff --git a/src/main/java/cn/hellohao/controller/UserController.java b/src/main/java/cn/hellohao/controller/UserController.java index 7706981..6600650 100644 --- a/src/main/java/cn/hellohao/controller/UserController.java +++ b/src/main/java/cn/hellohao/controller/UserController.java @@ -13,6 +13,7 @@ import cn.hellohao.config.SysName; import cn.hellohao.pojo.*; import cn.hellohao.service.*; import cn.hellohao.utils.*; +import cn.hutool.core.util.HexUtil; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.IncorrectCredentialsException; import org.apache.shiro.authc.UnknownAccountException; @@ -54,16 +55,13 @@ public class UserController { String userIP = GetIPS.getIpAddr(request); String verifyCodeForRegister = jsonObj.getString("verifyCode"); Object redis_verifyCodeForRegister = iRedisService.getValue(userIP+"_hellohao_verifyCodeForRegister"); - if(!SetText.checkEmail(email)){ - //邮箱格式不正确 msg.setCode("110403"); msg.setInfo("邮箱格式不正确"); return msg; } String regex = "^\\w+$"; if(username.length()>20 || !username.matches (regex)){ - //用户名格式不正确 msg.setCode("110403"); msg.setInfo("用户名不得超过20位字符"); return msg; @@ -135,7 +133,6 @@ public class UserController { return msg; } - //shiro登录认证 @PostMapping("/login")//new @ResponseBody public Msg login(HttpServletRequest request,@RequestParam(value = "data", defaultValue = "") String data) { @@ -156,15 +153,10 @@ public class UserController { return msg; } if((redis_VerifyCode.toString().toLowerCase()).compareTo((verifyCode.toLowerCase()))==0){ -// if(true){ - //获取当前用户 Subject subject = SecurityUtils.getSubject(); - //封装用户的登录数据(shiro认证的时候使用) UsernamePasswordToken tokenOBJ = new UsernamePasswordToken(email,password); - //设置记住我 tokenOBJ.setRememberMe(true); try { - //执行登录方法,如果没有异常,说明登录成功 subject.login(tokenOBJ); SecurityUtils.getSubject().getSession().setTimeout(3600000);//一小时 JSONObject jsonObject = new JSONObject(); @@ -179,7 +171,6 @@ public class UserController { msg.setCode("110403"); return msg; } -// String token = TokenUtil.sign(user); String token = JWTUtil.createToken(user); Subject su = SecurityUtils.getSubject(); System.out.println("当前用户角色:admin:"+su.hasRole("admin")); @@ -216,8 +207,33 @@ public class UserController { return msg; } + + + //邮箱激活 + @RequestMapping(value = "/activation", method = RequestMethod.GET) + public String activation(Model model, HttpServletRequest request, HttpSession session, String activation, String username) { + Config config = configService.getSourceype(); + Integer ret = 0; + User u2 = new User(); + u2.setUid(activation); + User user = userService.getUsers(u2); + model.addAttribute("webhost",SubjectFilter.WEBHOST); + if (user != null && user.getIsok() == 0) { + userService.uiduser(activation); + model.addAttribute("title","激活成功"); + model.addAttribute("name","Hi~"+username); + model.addAttribute("note","您的账号已成功激活看"); + return "msg"; + } else { + model.addAttribute("title","操作无效"); + model.addAttribute("name","该页面为无效页面"); + model.addAttribute("note","请返回首页"); + return "msg"; + } + } + //退出 - @PostMapping(value = "/logout") + @PostMapping(value = "/logout")//new @ResponseBody public Msg exit(Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) { Msg msg = new Msg(); @@ -228,7 +244,8 @@ public class UserController { return msg; } - @PostMapping("/retrievePass") + //retrievepass + @PostMapping("/retrievePass") //new @ResponseBody public Msg retrievePass(HttpServletRequest request, @RequestParam(value = "data", defaultValue = "") String data) { Msg msg = new Msg(); @@ -238,6 +255,7 @@ public class UserController { String retrieveCode = jsonObj.getString("retrieveCode"); String userIP = GetIPS.getIpAddr(request); Object redis_verifyCodeForEmailRetrieve = iRedisService.getValue(userIP+"_hellohao_verifyCodeForEmailRetrieve"); + EmailConfig emailConfig = emailConfigService.getemail(); if(null==redis_verifyCodeForEmailRetrieve){ msg.setCode("4035"); @@ -290,47 +308,43 @@ public class UserController { } //邮箱激活 - @RequestMapping(value = "/activation", method = RequestMethod.GET) - public String activation(Model model, HttpServletRequest request, HttpSession session, String activation, String username) { - Config config = configService.getSourceype(); + @RequestMapping(value = "/retrieve", method = RequestMethod.GET) //new + public String retrieve(Model model, String activation,String cip) { Integer ret = 0; - User u2 = new User(); - u2.setUid(activation); - User user = userService.getUsers(u2); + try { + User u2 = new User(); + u2.setUid(activation); + User user = userService.getUsers(u2); + user.setIsok(1); + String new_pass = HexUtil.decodeHexStr(cip);//解密密码 + user.setPassword(Base64Encryption.encryptBASE64(new_pass.getBytes())); + String uid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); + user.setUid(uid); + if (user != null) { + Integer r = userService.changeUser(user); + model.addAttribute("title","成功"); + model.addAttribute("name","新密码:"+new_pass);// + model.addAttribute("note","密码已被系统重置,请即使登录修改你的新密码"); + } else { + model.addAttribute("title","抱歉"); + model.addAttribute("name","为获取到用户信息"); + model.addAttribute("note","操作失败"); + } + }catch (Exception e){ + e.printStackTrace(); + model.addAttribute("title","抱歉"); + model.addAttribute("name","系统操作过程中发生错误"); + model.addAttribute("note","操作失败"); + } model.addAttribute("webhost", SubjectFilter.WEBHOST); - if (user != null && user.getIsok() == 0) { - userService.uiduser(activation); - model.addAttribute("title","激活成功"); - model.addAttribute("name","Hi~"+username); - model.addAttribute("note","您的账号已成功激活看"); - return "msg"; - } else { - model.addAttribute("title","操作无效"); - model.addAttribute("name","该页面为无效页面"); - model.addAttribute("note","请返回首页"); - return "msg"; - } + return "msg"; + } - } - @PostMapping(value = "/verification") - @ResponseBody - public Integer verification(HttpSession session,Integer tmp,Integer type) { - Random random = new Random(); - if(type==1){ - number1 = random.nextInt(100); - istmp1 = tmp; - Print.Normal(tmp-number1); - } - if(type==2){ - number2 = random.nextInt(100); - istmp2 = tmp; - Print.Normal(tmp-number2); - } - return 1; - } private Integer number1; private Integer istmp1; private Integer number2; private Integer istmp2; + + } diff --git a/src/main/java/cn/hellohao/dao/ImgMapper.java b/src/main/java/cn/hellohao/dao/ImgMapper.java index 3a77502..498dd22 100644 --- a/src/main/java/cn/hellohao/dao/ImgMapper.java +++ b/src/main/java/cn/hellohao/dao/ImgMapper.java @@ -32,7 +32,7 @@ public interface ImgMapper { Long getsourcememory(@Param("source") Integer source); - Integer md5Count(@Param("md5key") String md5key); + Integer md5Count(Images images); Images selectImgUrlByMD5(@Param("md5key") String md5key); @@ -46,5 +46,6 @@ public interface ImgMapper { List countByM(Images images); + Images selectImgUrlByImgUID(@Param("imguid") String imguid); } diff --git a/src/main/java/cn/hellohao/pojo/Images.java b/src/main/java/cn/hellohao/pojo/Images.java index 7086bdb..e3843ac 100644 --- a/src/main/java/cn/hellohao/pojo/Images.java +++ b/src/main/java/cn/hellohao/pojo/Images.java @@ -22,7 +22,6 @@ public class Images { private String notes; private String useridlist; private String imguid; - private String shortlink; private String format; private String about; private Integer great; @@ -41,7 +40,7 @@ public class Images { super(); } - public Images(String imgurl, String sizes, String abnormal, String updatetime, String username, String md5key, String imguid,String shortlink) { + 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; @@ -54,7 +53,7 @@ public class Images { public Images(Integer 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 shortlink, + String password, Integer selecttype,Long countNum,Integer monthNum,String yyyy, String format,String about,Integer great,String[] classifuidlist,String classificationuid,String violation) { this.id = id; this.imgname = imgname; @@ -74,7 +73,6 @@ public class Images { this.notes = notes; this.useridlist = useridlist; this.imguid = imguid; - this.shortlink = shortlink; this.albumtitle = albumtitle; this.password = password; this.selecttype = selecttype; @@ -234,13 +232,6 @@ public class Images { this.imguid = imguid; } - public String getShortlink() { - return shortlink; - } - - public void setShortlink(String shortlink) { - this.shortlink = shortlink; - } public String getAlbumtitle() { return albumtitle; diff --git a/src/main/java/cn/hellohao/pojo/SysConfig.java b/src/main/java/cn/hellohao/pojo/SysConfig.java index 454aaa2..f016f5a 100644 --- a/src/main/java/cn/hellohao/pojo/SysConfig.java +++ b/src/main/java/cn/hellohao/pojo/SysConfig.java @@ -8,13 +8,15 @@ package cn.hellohao.pojo; public class SysConfig { private Integer id; private Integer register; + private String checkduplicate; public SysConfig() { } - public SysConfig(Integer id, Integer register) { + public SysConfig(Integer id, Integer register, String checkduplicate) { this.id = id; this.register = register; + this.checkduplicate = checkduplicate; } public Integer getId() { @@ -32,4 +34,14 @@ public class SysConfig { public void setRegister(Integer register) { this.register = register; } + + public String getCheckduplicate() { + return checkduplicate; + } + + public void setCheckduplicate(String checkduplicate) { + this.checkduplicate = checkduplicate; + } + + } diff --git a/src/main/java/cn/hellohao/service/ImgService.java b/src/main/java/cn/hellohao/service/ImgService.java index e00f13d..3acc00d 100644 --- a/src/main/java/cn/hellohao/service/ImgService.java +++ b/src/main/java/cn/hellohao/service/ImgService.java @@ -33,7 +33,7 @@ public interface ImgService { Long getsourcememory(Integer source); - Integer md5Count(String md5key); + Integer md5Count(Images images); Images selectImgUrlByMD5(String md5key); @@ -47,4 +47,6 @@ public interface ImgService { List countByM(Images images); + Images selectImgUrlByImgUID( String imguid); + } diff --git a/src/main/java/cn/hellohao/service/impl/COSImageupload.java b/src/main/java/cn/hellohao/service/impl/COSImageupload.java index dacd019..3a0d6db 100644 --- a/src/main/java/cn/hellohao/service/impl/COSImageupload.java +++ b/src/main/java/cn/hellohao/service/impl/COSImageupload.java @@ -42,7 +42,6 @@ public class COSImageupload { String userkey =username + "/" + ShortUID + "." + entry.getKey(); PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, userkey, file); PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest); - returnImage.setUid(ShortUID); returnImage.setImgname(userkey); returnImage.setImgurl(key.getRequestAddress() + "/" + userkey); returnImage.setImgSize(entry.getValue().length()); diff --git a/src/main/java/cn/hellohao/service/impl/ClientService.java b/src/main/java/cn/hellohao/service/impl/ClientService.java new file mode 100644 index 0000000..8479a78 --- /dev/null +++ b/src/main/java/cn/hellohao/service/impl/ClientService.java @@ -0,0 +1,331 @@ +package cn.hellohao.service.impl; + +import cn.hellohao.dao.*; +import cn.hellohao.pojo.*; +import cn.hellohao.pojo.vo.PageResultBean; +import cn.hellohao.service.ImgAndAlbumService; +import cn.hellohao.service.SysConfigService; +import cn.hellohao.utils.*; +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baidu.aip.contentcensor.AipContentCensor; +import com.baidu.aip.contentcensor.EImgType; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import net.coobird.thumbnailator.filters.Watermark; +import org.apache.commons.codec.digest.DigestUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.io.FileInputStream; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @author Hellohao + * @version 1.0 + * @date 2021/10/28 16:38 + */ +@Service +public class ClientService { + + @Autowired + private ImgAndAlbumService imgAndAlbumService; + @Autowired + private NOSImageupload nOSImageupload; + @Autowired + private OSSImageupload ossImageupload; + @Autowired + private USSImageupload ussImageupload; + @Autowired + private KODOImageupload kodoImageupload; + @Autowired + private COSImageupload cosImageupload; + @Autowired + private SysConfigService sysConfigService; + @Autowired + private FTPImageupload ftpImageupload; + @Autowired + private UFileImageupload uFileImageupload; + @Autowired + private UserMapper userMapper; + @Autowired + private KeysMapper keysMapper; + @Autowired + private ConfigMapper configMapper; + @Autowired + private UploadConfigMapper uploadConfigMapper; + @Autowired + private NoticeMapper noticeMapper; + @Autowired + private ImgMapper imgMapper; + @Autowired + ImgreviewMapper imgreviewMapper; + + + public Msg uploadImg(HttpServletRequest request, MultipartFile multipartFile, String email, String pass ){ + Msg msg = new Msg(); + try { + Integer sourceKeyId = 0; + FileInputStream fis = null; + String md5key = null; + Integer setday = 0; + JSONObject jsonObject = new JSONObject(); + Config config = configMapper.getSourceype(); + String userip = GetIPS.getIpAddr(request); + UploadConfig uploadConfig = uploadConfigMapper.getUpdateConfig(); + if (uploadConfig.getApi() != 1) { + msg.setCode("4003"); + msg.setInfo("管理员关闭了API接口"); + return msg; + } + File file = SetFiles.changeFile_new(multipartFile); + User u2 = new User(); + if (!file.exists() || email == null || pass == null) { + msg.setCode("4005"); + msg.setInfo("必要参数不能为空"); + return msg; + } + u2.setEmail(email); + u2.setPassword(Base64Encryption.encryptBASE64(pass.getBytes())); + User u = userMapper.getUsers(u2); + //判断用户的账号密码是否存在(正确) + if (null == u || u.getIsok() != 1) { + msg.setCode("4006"); + msg.setInfo("用户信息不正确,账号异常"); + return msg; + } + String imguid = UUID.randomUUID().toString().replace("-", ""); + //判断上传前的一些用户限制信息 + Msg msg1 = updateImgCheck(u, uploadConfig); + if (!msg1.getCode().equals("300")) { + return msg1; + } + sourceKeyId = group.getKeyid(); + Keys key = keysMapper.selectKeys(sourceKeyId); + Long tmp = (memory == -1 ? -2 : UsedTotleMemory); + if (tmp >= memory) { + msg.setCode("4007"); + msg.setInfo(u == null ? "游客空间已用尽" : "您的可用空间不足"); + return msg; + } + if (file.length() > TotleMemory) { + System.err.println("文件大小:" + file.length()); + System.err.println("最大限制:" + TotleMemory); + msg.setCode("4008"); + msg.setInfo("图像超出系统限制大小"); + return msg; + } + try { + fis = new FileInputStream(file); + md5key = DigestUtils.md5Hex(fis); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("未获取到图片的MD5,成成UUID"); + } + Msg fileMiME = TypeDict.FileMiME(file, uploadConfig.getSuffix()); + if (!fileMiME.getCode().equals("200")) { + //非图像文本 + msg.setCode("4009"); + msg.setInfo(fileMiME.getInfo()); + return msg; + } + if (md5key == null || md5key.equals("")) { + md5key = UUID.randomUUID().toString().replace("-", ""); + } + String prefix = file.getName().substring(file.getName().lastIndexOf(".") + 1); + if (uploadConfig.getBlacklist() != null) { + String[] iparr = uploadConfig.getBlacklist().split(";"); + for (String s : iparr) { + if (s.equals(userip)) { + msg.setCode("4010"); + msg.setInfo("你暂时不能上传"); + return msg; + } + } + } + //判断图片是否存在 + if(Integer.valueOf(sysConfigService.getstate().getCheckduplicate())==1) { + Images imaOBJ = new Images(); + imaOBJ.setMd5key(md5key); + imaOBJ.setUserid(u.getId()); + if (imgMapper.md5Count(imaOBJ) > 0) { + Images images = imgMapper.selectImgUrlByMD5(md5key); + jsonObject.put("url", images.getImgurl()); + jsonObject.put("name", file.getName()); + jsonObject.put("size", images.getSizes()); + msg.setData(jsonObject); + return msg; + } + } + Map map = new HashMap<>(); + String fileName = file.getName(); + if (file.exists()) { + map.put(prefix, file); + } + long stime = System.currentTimeMillis(); + Map m = null; + ReturnImage returnImage = GetSource.storageSource(key.getStorageType(), map, updatePath, key.getId()); + Images img = new Images(); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + if (returnImage.getCode().equals("200")) { + String imgurl = returnImage.getImgurl(); + Long imgsize = returnImage.getImgSize(); + String imgname = returnImage.getImgname(); + img.setImgurl(imgurl); + img.setUpdatetime(df.format(new Date())); + img.setSource(key.getId()); + img.setUserid(u == null ? 0 : u.getId()); + img.setSizes(imgsize.toString()); + if (uploadConfig.getUrltype() == 2) { + img.setImgname(imgname); + } else { + img.setImgname(SetText.getSubString(imgname, key.getRequestAddress() + "/", "")); + } + img.setImgtype(setday > 0 ? 1 : 0); + img.setAbnormal(userip); + img.setMd5key(md5key); + img.setImguid(imguid); + img.setFormat(fileMiME.getData().toString()); + userMapper.insertimg(img); + long etime = System.currentTimeMillis(); + Print.Normal("上传图片所用总时长:" + String.valueOf(etime - stime) + "ms"); + jsonObject.put("url", img.getImgurl()); + jsonObject.put("name", imgname); + jsonObject.put("size", img.getSizes()); + //启动鉴黄线程 + new Thread(() -> { + LegalImageCheck(img); + }).start(); + } else { + msg.setCode("5001"); + msg.setInfo("上传服务内部错误"); + return msg; + } + file.delete(); + msg.setData(jsonObject); +// 新代码结束========= + return msg; + }catch (Exception e){ + e.printStackTrace(); + msg.setCode("5001"); + msg.setInfo("Error for server:500"); + return msg; + } + + } + + + public static Group group; //上传用户或游客的所属分组 + public static Long memory;//上传用户或者游客的分配容量 memory + public static Long TotleMemory;//用户或者游客下可使用的总容量 //maxsize + public static Long UsedTotleMemory;//用户或者游客已经用掉的总容量 //usermemory + public static String updatePath="tourist"; + + //判断用户 或 游客 当前上传图片的一系列校验 + private Msg updateImgCheck(User user, UploadConfig uploadConfig){ + final Msg msg = new Msg(); + java.text.DateFormat dateFormat = null; + try { + dateFormat = new SimpleDateFormat("yyyy/MM/dd"); + if (user == null) { + //用户没有登陆,值判断游客能不能上传即可 + if(uploadConfig.getIsupdate()!=1){ + msg.setCode("1000"); + msg.setInfo("系统已禁用游客上传"); + return msg; + } + group = GetCurrentSource.GetSource(null); + memory = Long.valueOf(uploadConfig.getVisitormemory());//单位 B 游客设置总量 + TotleMemory = Long.valueOf(uploadConfig.getFilesizetourists());//单位 B 游客单文件大小 + UsedTotleMemory = imgMapper.getusermemory(0)==null?0L : imgMapper.getusermemory(0);//单位 B + } else { + //判断用户能不能上传 + if(uploadConfig.getUserclose()!=1){ + msg.setCode("1001"); + msg.setInfo("系统已禁用上传功能"); + return msg; + } + updatePath = user.getUsername(); + group= GetCurrentSource.GetSource(user.getId()); + memory = Long.valueOf(user.getMemory())*1024*1024;//单位 B + TotleMemory = Long.valueOf(uploadConfig.getFilesizeuser());//单位 B + UsedTotleMemory = imgMapper.getusermemory(user.getId())==null?0L:imgMapper.getusermemory(user.getId());//单位 B + } + //判断上传的图片目录结构类型 + if (uploadConfig.getUrltype() == 2) { + updatePath = dateFormat.format(new Date()); + } + msg.setCode("300"); + } catch (Exception e) { + e.printStackTrace(); + msg.setCode("500"); + } + return msg; + } + + //图片鉴黄 + + private synchronized void LegalImageCheck(Images images){ + System.out.println("非法图像鉴别进程启动"); + Imgreview imgreview = null; + try { + imgreview = imgreviewMapper.selectByusing(1); + } catch (Exception e) { + Print.warning("获取鉴别程序的时候发生错误"); + e.printStackTrace(); + } + LegalImageCheckForBaiDu(imgreview,images); + } + + private void LegalImageCheckForBaiDu(Imgreview imgreview,Images images){ + if(imgreview.getUsing()==1){ + try { + AipContentCensor client = new AipContentCensor(imgreview.getAppId(), imgreview.getApiKey(), imgreview.getSecretKey()); + client.setConnectionTimeoutInMillis(5000); + client.setSocketTimeoutInMillis(30000); + org.json.JSONObject res = client.antiPorn(images.getImgurl()); + res = client.imageCensorUserDefined(images.getImgurl(), EImgType.URL, null); + com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray("[" + res.toString() + "]"); + for (Object o : jsonArray) { + JSONObject jsonObject = (JSONObject) o; + com.alibaba.fastjson.JSONArray data = jsonObject.getJSONArray("data"); + Integer conclusionType = jsonObject.getInteger("conclusionType"); + if(conclusionType!=null){ + if (conclusionType == 2) { + for (Object datum : data) { + JSONObject imgdata = (JSONObject) datum; + if (imgdata.getInteger("type") == 1) { + Images img = new Images(); + img.setImgname(images.getImgname()); + img.setViolation("1[1]");//数字是鉴别平台的主键ID,括号是非法的类型,参考上面的注释 + imgMapper.setImg(img); + Imgreview imgv = new Imgreview(); + imgv.setId(1); + Integer count = imgreview.getCount(); + System.out.println("违法图片总数:" + count); + imgv.setCount(count + 1); + imgreviewMapper.updateByPrimaryKeySelective(imgv); + System.err.println("存在非法图片,进行处理操作"); + } + } + } + } + } + + }catch (Exception e){ + System.out.println("图像鉴黄线程执行过程中出现异常"); + e.printStackTrace(); + + } + + } + } + + +} diff --git a/src/main/java/cn/hellohao/service/impl/FTPImageupload.java b/src/main/java/cn/hellohao/service/impl/FTPImageupload.java index 3ce56f3..840fd55 100644 --- a/src/main/java/cn/hellohao/service/impl/FTPImageupload.java +++ b/src/main/java/cn/hellohao/service/impl/FTPImageupload.java @@ -39,7 +39,6 @@ public class FTPImageupload { if (flag) { boolean isUpload = ftps.upload(file, "/" + userkey, ""); if(isUpload){ - returnImage.setUid(ShortUID); returnImage.setImgname(userkey); returnImage.setImgurl(key.getRequestAddress() + "/"+ userkey); returnImage.setImgSize(entry.getValue().length()); diff --git a/src/main/java/cn/hellohao/service/impl/ImgAndAlbumServiceImpl.java b/src/main/java/cn/hellohao/service/impl/ImgAndAlbumServiceImpl.java index 58da05b..d255028 100644 --- a/src/main/java/cn/hellohao/service/impl/ImgAndAlbumServiceImpl.java +++ b/src/main/java/cn/hellohao/service/impl/ImgAndAlbumServiceImpl.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Service; import java.util.List; /** - * @author Tiansh + * @author Hellohao * @version 1.0 * @date 2019/12/19 15:40 */ diff --git a/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java b/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java index b2f412d..f794714 100644 --- a/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java +++ b/src/main/java/cn/hellohao/service/impl/ImgServiceImpl.java @@ -211,8 +211,8 @@ public class ImgServiceImpl implements ImgService { } @Override - public Integer md5Count(String md5key) { - return imgMapper.md5Count(md5key); + public Integer md5Count(Images images) { + return imgMapper.md5Count(images); } @Override @@ -244,4 +244,9 @@ public class ImgServiceImpl implements ImgService { return imgMapper.countByM(images); } + @Override + public Images selectImgUrlByImgUID(String imguid) { + return imgMapper.selectImgUrlByImgUID(imguid); + } + } diff --git a/src/main/java/cn/hellohao/service/impl/KODOImageupload.java b/src/main/java/cn/hellohao/service/impl/KODOImageupload.java index ac71d37..8a4b84c 100644 --- a/src/main/java/cn/hellohao/service/impl/KODOImageupload.java +++ b/src/main/java/cn/hellohao/service/impl/KODOImageupload.java @@ -58,7 +58,6 @@ public class KODOImageupload { try { Response response = uploadManager.put(file,username + "/" + ShortUID + "." + entry.getKey(),upToken); DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class); - returnImage.setUid(ShortUID); returnImage.setImgname(username + "/" + ShortUID + "." + entry.getKey()); returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + ShortUID + "." + entry.getKey()); returnImage.setImgSize(entry.getValue().length()); diff --git a/src/main/java/cn/hellohao/service/impl/NOSImageupload.java b/src/main/java/cn/hellohao/service/impl/NOSImageupload.java index 2eaf07a..a88962d 100644 --- a/src/main/java/cn/hellohao/service/impl/NOSImageupload.java +++ b/src/main/java/cn/hellohao/service/impl/NOSImageupload.java @@ -35,7 +35,6 @@ public class NOSImageupload { String ShortUID = SetText.getShortUuid(); file = entry.getValue(); nosClient.putObject(key.getBucketname(), username + "/" + ShortUID+ "." + entry.getKey(), file); - returnImage.setUid(ShortUID); returnImage.setImgname(username + "/" + ShortUID+ "." + entry.getKey()); returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + ShortUID + "." + entry.getKey()); returnImage.setImgSize(entry.getValue().length()); diff --git a/src/main/java/cn/hellohao/service/impl/OSSImageupload.java b/src/main/java/cn/hellohao/service/impl/OSSImageupload.java index 82082f2..f47ea2b 100644 --- a/src/main/java/cn/hellohao/service/impl/OSSImageupload.java +++ b/src/main/java/cn/hellohao/service/impl/OSSImageupload.java @@ -30,7 +30,6 @@ public class OSSImageupload { file = entry.getValue(); System.out.println("待上传的图片:"+username + "/" + ShortUID + "." + entry.getKey()); ossClient.putObject(key.getBucketname(), username + "/" + ShortUID + "." + entry.getKey(),file); - returnImage.setUid(ShortUID); returnImage.setImgname(username + "/" + ShortUID + "." + entry.getKey());//entry.getValue().getOriginalFilename() returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + ShortUID + "." + entry.getKey()); returnImage.setImgSize(file.length()); diff --git a/src/main/java/cn/hellohao/service/impl/UFileImageupload.java b/src/main/java/cn/hellohao/service/impl/UFileImageupload.java index e6bebab..994f00b 100644 --- a/src/main/java/cn/hellohao/service/impl/UFileImageupload.java +++ b/src/main/java/cn/hellohao/service/impl/UFileImageupload.java @@ -29,7 +29,6 @@ public class UFileImageupload { uFile.setContentMD5(UpYun.md5(file)); boolean result = uFile.writeFile(username + "/" + ShortUID + "." + entry.getKey(), file, true); if(result){ - returnImage.setUid(ShortUID); returnImage.setImgname(username + "/" + ShortUID + "." + entry.getKey()); returnImage.setImgurl(key.getRequestAddress() + "/" +username + "/" + ShortUID + "." + entry.getKey()); returnImage.setImgSize(entry.getValue().length()); diff --git a/src/main/java/cn/hellohao/service/impl/USSImageupload.java b/src/main/java/cn/hellohao/service/impl/USSImageupload.java index bc2845a..e8927b6 100644 --- a/src/main/java/cn/hellohao/service/impl/USSImageupload.java +++ b/src/main/java/cn/hellohao/service/impl/USSImageupload.java @@ -32,7 +32,6 @@ public class USSImageupload { upyun.setContentMD5(UpYun.md5(file)); boolean result = upyun.writeFile(username + "/" + ShortUID + "." + entry.getKey(), file, true); if(result){ - returnImage.setUid(ShortUID); returnImage.setImgname(username + "/" + ShortUID + "." + entry.getKey()); returnImage.setImgurl(key.getRequestAddress() + "/" +username + "/" + ShortUID + "." + entry.getKey()); returnImage.setImgSize(entry.getValue().length()); diff --git a/src/main/java/cn/hellohao/service/impl/UploadServicel.java b/src/main/java/cn/hellohao/service/impl/UploadServicel.java index 433773b..b5e44da 100644 --- a/src/main/java/cn/hellohao/service/impl/UploadServicel.java +++ b/src/main/java/cn/hellohao/service/impl/UploadServicel.java @@ -120,6 +120,24 @@ public class UploadServicel { if(md5key==null || md5key.equals("")){ md5key = UUID.randomUUID().toString().replace("-", ""); } + + //判断图片是否存在 + if(Integer.valueOf(sysConfigService.getstate().getCheckduplicate())==1){ + Images imaOBJ = new Images(); + imaOBJ.setMd5key(md5key); + imaOBJ.setUserid(u==null?0:u.getId()); + if(imgMapper.md5Count(imaOBJ)>0){ + Images images = imgMapper.selectImgUrlByMD5(md5key); + jsonObject.put("url", images.getImgurl()); + jsonObject.put("name",file.getName()); + jsonObject.put("imguid",images.getImguid()); +// jsonObject.put("shortLink",images.getShortlink()); + msg.setData(jsonObject); + return msg; + } + } + + String prefix = file.getName().substring(file.getName().lastIndexOf(".")+1); //判断黑名单 if (uploadConfig.getBlacklist() != null) { @@ -170,17 +188,14 @@ public class UploadServicel { img.setMd5key(md5key); img.setImguid(imguid); img.setFormat(fileMiME.getData().toString()); - img.setShortlink(returnImage.getUid()); userMapper.insertimg(img); long etime = System.currentTimeMillis(); Print.Normal("上传图片所用总时长:" + String.valueOf(etime - stime) + "ms"); jsonObject.put("url", img.getImgurl()); jsonObject.put("name", imgname); jsonObject.put("imguid",img.getImguid()); - jsonObject.put("shortLink", img.getShortlink()); - //启动鉴黄线程 +// jsonObject.put("shortLink", img.getShortlink()); new Thread(()->{LegalImageCheck(img);}).start(); - }else{ msg.setCode("5001"); msg.setInfo("上传服务内部错误"); @@ -266,13 +281,18 @@ public class UploadServicel { TotleMemory = Long.valueOf(uploadConfig.getFilesizetourists());//单位 B 游客单文件大小 UsedTotleMemory = imgMapper.getusermemory(0)==null?0L : imgMapper.getusermemory(0);//单位 B } else { + //判断用户能不能上传 + if(uploadConfig.getUserclose()!=1){ + msg.setCode("1001"); + msg.setInfo("系统已禁用上传功能"); + return msg; + } updatePath = user.getUsername(); group= GetCurrentSource.GetSource(user.getId()); memory = Long.valueOf(user.getMemory())*1024*1024;//单位 B TotleMemory = Long.valueOf(uploadConfig.getFilesizeuser());//单位 B UsedTotleMemory = imgMapper.getusermemory(user.getId())==null?0L:imgMapper.getusermemory(user.getId());//单位 B } - //判断上传的图片目录结构类型 if (uploadConfig.getUrltype() == 2) { updatePath = dateFormat.format(new Date()); } @@ -293,7 +313,6 @@ public class UploadServicel { Print.warning("获取鉴别程序的时候发生错误"); e.printStackTrace(); } - //判断哪个鉴别平台 if(null != imgreview){ LegalImageCheckForBaiDu(imgreview,images); } @@ -302,7 +321,6 @@ public class UploadServicel { private void LegalImageCheckForBaiDu(Imgreview imgreview,Images images){ System.out.println("非法图像鉴别进程启动-BaiDu"); -// Imgreview imgreview = imgreviewService.selectByPrimaryKey(1); if(imgreview.getUsing()==1){ try { AipContentCensor client = new AipContentCensor(imgreview.getAppId(), imgreview.getApiKey(), imgreview.getSecretKey()); @@ -312,24 +330,19 @@ public class UploadServicel { res = client.imageCensorUserDefined(images.getImgurl(), EImgType.URL, null); System.err.println("返回的鉴黄json:"+res.toString()); com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray("[" + res.toString() + "]"); - for (Object o : jsonArray) { com.alibaba.fastjson.JSONObject jsonObject = (com.alibaba.fastjson.JSONObject) o; com.alibaba.fastjson.JSONArray data = jsonObject.getJSONArray("data"); Integer conclusionType = jsonObject.getInteger("conclusionType"); if(conclusionType!=null){ if (conclusionType == 2) { - //1:合规,2:不合规,3:疑似,4:审核失败 for (Object datum : data) { com.alibaba.fastjson.JSONObject imgdata = (com.alibaba.fastjson.JSONObject) datum; if (imgdata.getInteger("type") == 1) { - //type参数 0:百度官方违禁图库、1:色情识别、2:暴恐识别、3:恶心图识别、4:广告检测、5:政治敏感识别、6:图像质量检测、7:用户图像黑名单、8:用户图像白名单、10:用户头像审核、11:百度官方违禁词库、12:图文审核、13:自定义文本黑名单、14:自定义文本白名单、15:EasyDL自定义模型、16:敏感旗帜标志识别、21:不良场景识别、24:直播场景审核 - //存在非法图片,进行处理操作 Images img = new Images(); img.setImgname(images.getImgname()); - img.setViolation("1[1]");//数字是鉴别平台的主键ID,括号是非法的类型,参考上面的注释 + img.setViolation("1[1]"); imgMapper.setImg(img); - //计入总数 Imgreview imgv = new Imgreview(); imgv.setId(1); Integer count = imgreview.getCount(); diff --git a/src/main/java/cn/hellohao/utils/LocUpdateImg.java b/src/main/java/cn/hellohao/utils/LocUpdateImg.java index 59d9efd..54bb493 100644 --- a/src/main/java/cn/hellohao/utils/LocUpdateImg.java +++ b/src/main/java/cn/hellohao/utils/LocUpdateImg.java @@ -50,7 +50,6 @@ public class LocUpdateImg { } bos.flush(); bos.close(); - returnImage.setUid(ShortUID); returnImage.setImgname(username + "/" +ShortUID + "." + entry.getKey());//entry.getValue().getOriginalFilename() returnImage.setImgurl(key.getRequestAddress() +"/ota/"+username + "/" + ShortUID + "." + entry.getKey()); returnImage.setImgSize(entry.getValue().length()); diff --git a/src/main/java/cn/hellohao/utils/NewSendEmail.java b/src/main/java/cn/hellohao/utils/NewSendEmail.java index 3cd4a8d..a8721f3 100644 --- a/src/main/java/cn/hellohao/utils/NewSendEmail.java +++ b/src/main/java/cn/hellohao/utils/NewSendEmail.java @@ -9,7 +9,6 @@ import com.mitchellbosecke.pebble.PebbleEngine; import com.mitchellbosecke.pebble.template.PebbleTemplate; import io.github.biezhi.ome.OhMyEmail; import org.springframework.core.io.ClassPathResource; - import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; @@ -19,16 +18,6 @@ import java.util.UUID; public class NewSendEmail { - public static void initialEmail(EmailConfig emailConfig) { -// Properties p = new Properties(); -// p.setProperty("mail.smtp.auth", "true"); -// p.setProperty("mail.smtp.host", emailConfig.getEmailurl()); -// p.setProperty("mail.smtp.port", emailConfig.getPort()); -// p.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); - - - } - public static Integer sendEmail(EmailConfig emailConfig, String username, String uid, String toEmail, Config config) { Properties props = new Properties(); @@ -114,7 +103,6 @@ public class NewSendEmail { // 配置一次即可,可以配置为静态方法 // OhMyEmail.config(OhMyEmail.SMTP_QQ(false), "xxxx@qq.com", "your@password"); OhMyEmail.config(props, emailConfig.getEmails(), emailConfig.getEmailkey()); - String webname=config.getWebname(); String domain = config.getDomain(); String new_pass = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,10); @@ -144,28 +132,5 @@ public class NewSendEmail { } - public static void main(String[] args)throws Exception { - - Properties props = new Properties(); - props.put("mail.smtp.auth", "true"); - props.put("mail.smtp.ssl.enable", "true"); - props.put("mail.debug", "false"); - props.put("mail.transport.protocol", "smtp"); - props.put("mail.debug", "false"); - props.put("mail.smtp.timeout", "20000"); - props.put("mail.smtp.port", "25");//465 25 - props.put("mail.smtp.host", "smtpdm.aliyun.com"); - - // 配置一次即可,可以配置为静态方法 -// OhMyEmail.config(OhMyEmail.SMTP_QQ(false), "xxxx@qq.com", "your@password"); - OhMyEmail.config(props, "hellohao@wwery.com", "TianShiHao1995"); - OhMyEmail.subject("账号激活邮件测试") - .from("hahhaha") - .to("923453645@qq.com") - .html("hellohao") - .send(); - - } - } diff --git a/src/main/resources/mapper/ImgAndAlbumMapper.xml b/src/main/resources/mapper/ImgAndAlbumMapper.xml index 0565f0a..df0f8f8 100644 --- a/src/main/resources/mapper/ImgAndAlbumMapper.xml +++ b/src/main/resources/mapper/ImgAndAlbumMapper.xml @@ -40,10 +40,12 @@ \ No newline at end of file diff --git a/src/main/resources/mapper/ImgMapper.xml b/src/main/resources/mapper/ImgMapper.xml index 641b235..2c79835 100644 --- a/src/main/resources/mapper/ImgMapper.xml +++ b/src/main/resources/mapper/ImgMapper.xml @@ -17,7 +17,6 @@ a.explains, a.md5key, a.imguid, - a.shortlink, a.format, a.about, a.great, @@ -115,14 +114,7 @@ + + + \ No newline at end of file diff --git a/src/main/resources/mapper/ImgTempMapper.xml b/src/main/resources/mapper/ImgTempMapper.xml index 64dc334..be732e8 100644 --- a/src/main/resources/mapper/ImgTempMapper.xml +++ b/src/main/resources/mapper/ImgTempMapper.xml @@ -40,9 +40,6 @@ DELETE imgtemp,imgdata FROM imgtemp LEFT JOIN imgdata ON imgtemp.imguid = imgdata.imguid WHERE imgdata.imguid =#{imguid} - - - diff --git a/src/main/resources/mapper/SysConfigMapper.xml b/src/main/resources/mapper/SysConfigMapper.xml index c5abccd..aa9f682 100644 --- a/src/main/resources/mapper/SysConfigMapper.xml +++ b/src/main/resources/mapper/SysConfigMapper.xml @@ -10,8 +10,12 @@ UPDATE sysconfig - `register` = #{register} + `register` = #{register}, + + `checkduplicate` = #{checkduplicate}, + + where id=1 diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml index 11508a6..dd62283 100644 --- a/src/main/resources/mapper/UserMapper.xml +++ b/src/main/resources/mapper/UserMapper.xml @@ -105,8 +105,8 @@ - INSERT INTO imgdata (id, imgname, imgurl, userid, updatetime,sizes,abnormal,source,imgtype,md5key,imguid,shortlink,format,about,great,violation) - VALUES (NULL, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},#{abnormal},#{source},#{imgtype},#{md5key},#{imguid},#{shortlink},#{format},#{about},"0",null) + INSERT INTO imgdata (id, imgname, imgurl, userid, updatetime,sizes,abnormal,source,imgtype,md5key,imguid,format,about,great,violation) + VALUES (NULL, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},#{abnormal},#{source},#{imgtype},#{md5key},#{imguid},#{format},#{about},"0",null) @@ -183,8 +183,7 @@ isok, ceil((memory/1024/1024)) as memory, groupid, - (select groupname from `group` where id = groupid) as groupname, - token + (select groupname from `group` where id = groupid) as groupname FROM user where diff --git a/src/main/resources/templates/admin/about.html b/src/main/resources/templates/admin/about.html deleted file mode 100644 index edc5858..0000000 --- a/src/main/resources/templates/admin/about.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - 关于系统 - - - - - - -
-

- -

-
-

 开发者:Hellohao

-
-

 技术博客:http://www.hellohao.cn

-
-

 Guthub开源:https://github.com/Hello-hao/Tbed

-
-

开发者交流群:864800972

-
- -

 2020-09-24    检查更新

-
-

 捐赠开发者:展开

-
-

- -

- -
- - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/addgroup.html b/src/main/resources/templates/admin/addgroup.html deleted file mode 100644 index 28021c3..0000000 --- a/src/main/resources/templates/admin/addgroup.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - 增加分发群组 - - - - -
- -
-
- -
- -
-
-
- -
- -
-
-

-
- - - - - - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/albumlist.html b/src/main/resources/templates/admin/albumlist.html deleted file mode 100644 index 4a57ebb..0000000 --- a/src/main/resources/templates/admin/albumlist.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - 我的画廊 - - - -
-
- 查询画廊: -
- -
- -
-
-
-
- - - - - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/api.html b/src/main/resources/templates/admin/api.html deleted file mode 100644 index bc414f5..0000000 --- a/src/main/resources/templates/admin/api.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - API接口 - - - - - - -
-

请求地址:

- - - - - - - - - - - - - - - - - - - - - - -
功 能接 口
请求方式POST
请求地址
-
-

请求参数:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
参数名参数类型必 填参数说明
filefile 图像文件
emailString用户邮箱
passString用户密码
-

返回参数:

- - - - - - - - - - - - - - - - - - - - - - - - - -
参数名称参数类型参数说明
codeNumber状态码,成功返回200,失败返回负数
msgString提示信息
dataArray|Object图片上传后的信息
- -

参数实例:

-

-
-            //成功实例:
-{
-    "code": 200,
-    "msg": "success",
-    "data": [
-        {
-            "Imgname": "bloglogo.png",
-            "Imgurl": "https://cdn.wwery.com/user/5dbfa0807100052.png"
-        }
-    ]
-}
-
-        
-
-        //失败实例:
-{
-        "code": 200,
-        "msg": "success",
-        "data": [
-        {
-        "Imgname": "Tbed.zip",
-        "Imgurl": "文件超出系统设定大小,不得超过"
-        }
-    ]
-}
-        
-

- -

上传头需要是Content-Type: multipart/form-data;

-
-
-
- - -
- - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/code.html b/src/main/resources/templates/admin/code.html deleted file mode 100644 index 3123868..0000000 --- a/src/main/resources/templates/admin/code.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - 扩容码管理 - - - - -
-
- 查询用户: -
- -
- -
-
-
-
- - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/emailconfig.html b/src/main/resources/templates/admin/emailconfig.html deleted file mode 100644 index 8ba599d..0000000 --- a/src/main/resources/templates/admin/emailconfig.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - 邮箱配置 - - - - - -
-

邮箱配置(SMTP)

-
-
- -
- -
- - - 开启前保证下方信息填写正确,并已保存 -
-
-
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
- -
- -
-
- -
- 保存 -
-
-
- - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/group.html b/src/main/resources/templates/admin/group.html deleted file mode 100644 index f104097..0000000 --- a/src/main/resources/templates/admin/group.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - 分发群组 - - - - -
- - - - - - - -
-

注意:默认群组不可删除,游客或者未分配的注册用户都将会存入默认群组的存储源。

-

增加群组选择存储源时,必须保证你的存储源配置项已经填写完整,否则会出错。

-
-
-
- - - - - - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/imageIdentify.html b/src/main/resources/templates/admin/imageIdentify.html deleted file mode 100644 index f09ca72..0000000 --- a/src/main/resources/templates/admin/imageIdentify.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - 图片审核配置 - - - - - -
-

百度鉴黄Key配置

-
- 注意:若您修改了配置文件中的默认定时器配置,设置的周期表达式必须小于一天。否则会有遗漏
推荐设置为:每天某个时辰执行、或每几个小时、每几分钟执行一次。
-

 

-
-
- -
- - - 开启前保证下方信息填写正确,并已保存 -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- 保存 -
-
-
- - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/index.html b/src/main/resources/templates/admin/index.html deleted file mode 100644 index 0c121a0..0000000 --- a/src/main/resources/templates/admin/index.html +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - - - - - 图床后台管理 - - - - - - - - - -
-
- - - - - - -
- - - - -
-
-
-
-
    -
  • -
-
-
- -
-
-
-
-
- -
-
    -
  • 关闭此页
  • -
  • 关闭所有
  • -
  • 关闭其他
  • -
  • 关闭左侧
  • -
  • 关闭右侧
  • -
-
- - -
-
- - - - - - - - - - diff --git a/src/main/resources/templates/admin/modifyuser.html b/src/main/resources/templates/admin/modifyuser.html deleted file mode 100644 index 42436f4..0000000 --- a/src/main/resources/templates/admin/modifyuser.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - 修改用户信息 - - - -
-
-
- -
- - -
-
-
- -
- -
-
-

-
- - - - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/setgroup.html b/src/main/resources/templates/admin/setgroup.html deleted file mode 100644 index bdbe832..0000000 --- a/src/main/resources/templates/admin/setgroup.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - 修改分发群组 - - - -
-
-
- -
- -
-
-
- -
- -
-
-

-
- - - - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/setuser.html b/src/main/resources/templates/admin/setuser.html deleted file mode 100644 index b77ee27..0000000 --- a/src/main/resources/templates/admin/setuser.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - 密码修改 - - - - - -
-

密码修改

- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- 保存 -
-
-
- - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/storageconfig.html b/src/main/resources/templates/admin/storageconfig.html deleted file mode 100644 index 8ed3810..0000000 --- a/src/main/resources/templates/admin/storageconfig.html +++ /dev/null @@ -1,401 +0,0 @@ - - - - - 储存源配置 - - - - - -
-

存储源Key配置

- 此配置仅为保存存储源key信息,若要使用指定存储源,请在【用户管理】-【分发群组】进行指定配置 -
-
-
-
- -
- -
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- - 需带有http://或https:// -
-
- - -
- -
- -
-
-
- -
- - 需带有http://或https:// -
-
-
- -
- 保存 -
-
-
- - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/survey.html b/src/main/resources/templates/admin/survey.html deleted file mode 100644 index 6440553..0000000 --- a/src/main/resources/templates/admin/survey.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - - 本站概况 - - - - - - - - - - - - -
-
-

开发者公告

-
-
-
-

暂无重要公告通知。

-
-
- - - -
-

系统概况

-
- -
-

-
-
-
-
- -
-
- -
-
-
-
-
- -
-
- 非法图片拦截 -

0

-
-
-
-
-
-
-
-
- -
-
- 游客使用量(M) -

未知

-
-
-
-
-
-
-
-

我的信息

-
-
-
- -
-
-
-
-

0

-

- 我的图片总数 -

- -
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - -
- - -
- - -
- - -
- - JAVA开发 -
-
-
-
-
- -
-
- - - - - - - - - - - - - diff --git a/src/main/resources/templates/admin/table.html b/src/main/resources/templates/admin/table.html deleted file mode 100644 index 7deabed..0000000 --- a/src/main/resources/templates/admin/table.html +++ /dev/null @@ -1,571 +0,0 @@ - - - - - - 图片列表 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-
- - -
- -
- - -
-
- 列表显示: -
-
- -
-
- 存储源: -
-
- -
-
- 时间: -
-
- - - - -
- 筛选 -
-
- -
-
-
- -
-
-
-
-
×
-
-
- - - - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/user.html b/src/main/resources/templates/admin/user.html deleted file mode 100644 index 444cb3e..0000000 --- a/src/main/resources/templates/admin/user.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - 用户管理 - - - -
-
- 查询用户: -
- -
- -
-
-
-
- - - - - - \ No newline at end of file diff --git a/src/main/resources/templates/admin/webconfig.html b/src/main/resources/templates/admin/webconfig.html deleted file mode 100644 index fde583c..0000000 --- a/src/main/resources/templates/admin/webconfig.html +++ /dev/null @@ -1,565 +0,0 @@ - - - - - 系统配置 - - - - -
-
-
-
    -
  • 首页设置
  • -
  • 百度统计
  • -
  • 上传配置
  • -
  • 站点配置
  • -
-
-
- -
-
- -
- - 欲想显示多个公告请用 | 分开 -
-
-
-
- -
- -
-
-
-
- -
- 填写访问本站的域名或IP,需带有http://或https://,否则开启邮箱激活和本地存储不能正常使用。如:http://127.0.0.1:8088,IP需带端口,最后不需要加/ -
-
-
-
- -
- -
-
-
-
- -
- 如果你的服务器带宽较差,不建议使用视频背景 -
-
-
-
- -
- -
-
-
- - - - - - - - - - - - - - - - - -
- -
- - 不填写,则不显示(请合理管理长度,若输入超长代码块可能导致字符溢出,保存失败。) -
-
-
- -
- -
- - -
-
-
-
- -
- - -
-
-
-
- -
- - -
精简首页:页面加载完直接打开上传页面,没有展示页 -
-
- - - 保存 -
-
-
-
- -
- - 添加网站统计的JS代码,不需要要添加<script>标签</script> -
- 保存 -
-
-
- -
-

站点API配置

-
-
-
- -
- -
-
-
-
-

游客上传配置

-
-
-
- -
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
-

会员上传配置

-
-
- -
- -
-
-
- -
- -
-
-
-

存储容量分配(M)  输入“-1”则为无限制

-
-
- -
- -
-
-
- -
- -
-
-
-

支持文件配置

-
-
- -
- - 配个类型用“ , ”隔开(PS:只可以设置图片格式,其他文件格式无效) -
-
-

图片链接格式

-
-
-
- -
- - -
-
-
-
-
-
- -
- - 多个IP用;(英文分号)隔开 例如:127.0.0.1;127.0.0.2 否则无法生效 -
-
-
-
- - 保存 -
- -
-
-
- -
- -
-
-
-
-
- -
- - 多个关键词用(英文)“ , ”隔开 -
-
-
-
-
- -
- - 填写站点(favicon)图标的,大小控制在64×64以内,需是.ico格式的链接 -
-
-
-
-
- -
- - -
-
-
-
- 保存 -
-
-
-
- - - - - - \ No newline at end of file diff --git a/src/main/resources/templates/album/addalbum.html b/src/main/resources/templates/album/addalbum.html deleted file mode 100644 index ca8d0fd..0000000 --- a/src/main/resources/templates/album/addalbum.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - 创建画廊 - - - - - - -
-
-
-
- -
- -
-
-
- -
- -
-
-
-
-
    - -
-
-
-
- 创建 -
-
-
- - - - - - \ No newline at end of file diff --git a/src/main/resources/templates/album/album_new.html b/src/main/resources/templates/album/album_new.html deleted file mode 100644 index 6bfd336..0000000 --- a/src/main/resources/templates/album/album_new.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
-
-

-

© Photo album sharing from hellohao

- -
-
- - - - - - - - - - - - - - - - diff --git a/src/main/resources/templates/err.html b/src/main/resources/templates/err.html deleted file mode 100644 index 2e90c1b..0000000 --- a/src/main/resources/templates/err.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - 登录超时 - - - - -
-
-
-
-
-

登录已过期,请重新登录

- - - - \ No newline at end of file diff --git a/src/main/resources/templates/exception.html b/src/main/resources/templates/exception.html deleted file mode 100644 index 5ee3b73..0000000 --- a/src/main/resources/templates/exception.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - 登录超时 - - - -
-
-
-
-
-

- - - \ No newline at end of file diff --git a/src/main/resources/templates/index-Minimalism.html b/src/main/resources/templates/index-Minimalism.html deleted file mode 100644 index 78bc2b6..0000000 --- a/src/main/resources/templates/index-Minimalism.html +++ /dev/null @@ -1,913 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - -
- -
-
- -
-
-
-
- 您也可以尝试文件拖拽,使用截屏工具,然后激活窗口后使用Ctrl+V粘贴。 -
- 使用图片URL地址上传 -
- -
-
-
- -
-
-
-
-
-
- - -

-
-
-
-
- © 2019 Hellohao - All Rights Reserved - Collect from Hellohao博客 -
-
-
-
-
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html deleted file mode 100644 index b25b795..0000000 --- a/src/main/resources/templates/index.html +++ /dev/null @@ -1,736 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
- -
- LOADING
-
-
- -
-
-
-
- -
-
-
-
-
-
-
-
-
-
-

- 立即上传 - - -
-
-

纯粹免费的图片驿站

-
-

- Hellohao Figure bed:support several mainstream object storage, CDN acceleration is more stable. - Technology constantly updated, we will always move forward on the road ahead. -

-
-
-
-
-
-
days
-
0
-
-
-
-
-
hours
-
0
-
-
-
-
-
mins
-
0
-
-
-
-
-
secs
-
0
-
-
-
-
-
- -
-
- - Hellohao©技术支持 - -
-
-
-
-
-
- -
- -
-
-
-
- -
-
- -
-
-
-
- 您也可以尝试文件拖拽,使用截屏工具,然后激活窗口后粘贴。 -
- 使用图片URL地址上传 -
- -
-
-
- -
-
-
-
-
-
-
- - COPY - - -
-
-
-
-
-
-
-
-
- - - - - - -
-
-
-
-
-
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/templates/isok.html b/src/main/resources/templates/isok.html deleted file mode 100644 index 7c8d17e..0000000 --- a/src/main/resources/templates/isok.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - -
-
-
- -
-
-
-

Hellohao图床

-
-
-
- - 纯粹的图片寄存站。 -
-
-
-
-
-
-

-
-

您的账号已 成功激活 啦,注册用户可上传更大图片和所有的上传历史记录。快去试试吧!

-
-
-

- -
-
-
-
-
- -
-
-
嗨~朋友
-
- 如果使用过程中如果遇到问题,欢迎与我反馈
- - - -
-
-
-
-
-
-
-
- -
-
- - - - \ No newline at end of file diff --git a/src/main/resources/templates/check.html b/src/main/resources/templates/msg.html similarity index 76% rename from src/main/resources/templates/check.html rename to src/main/resources/templates/msg.html index e5b32c2..45bc828 100644 --- a/src/main/resources/templates/check.html +++ b/src/main/resources/templates/msg.html @@ -1,14 +1,16 @@ - + - Verification failed + 消息提示 -

Verification failed

-
-

你的域名验证未通过审核。

-

此版本为HellohaoPro,需要域名验证才可使用。

+

+
+

+

+ GO HOME \ No newline at end of file