7 Commits
Author SHA1 Message Date
hello-hao fb9f2a896e 📝 2024-01-03 14:00:17 +08:00
hello-hao 9ca8695cfd 📝 2024-01-03 13:59:15 +08:00
hellohao 33d4990ded 更新文档 2024-01-02 23:39:13 +08:00
hello-hao 679ada60bc feat:添加强制删除,优化七牛云对接 2024-01-02 17:33:01 +08:00
hello-hao e2e723eb52 feat:添加强制删除,优化七牛云对接 2023-12-29 17:28:08 +08:00
hello-hao 60db6036a5 📝 2023-10-13 10:02:55 +08:00
hello-hao 790fded8ca :bug:修复了一些功能 2023-09-25 14:03:53 +08:00
10 changed files with 77 additions and 81 deletions
-6
View File
@@ -1,6 +0,0 @@
*.js linguist-language=java
*.css linguist-language=java
*.html linguist-language=java
+16 -10
View File
@@ -4,7 +4,7 @@
![Visual Studio Marketplace Rating (Stars)](https://img.shields.io/visual-studio-marketplace/stars/ritwickdey.LiveServer?style=flat-square)
![https://img.shields.io/badge/license-AGPL-blue.svg?style=flat-square](https://img.shields.io/badge/license-AGPL-blue.svg?longCache=true&style=flat-square)
![https://img.shields.io/badge/license-AGPL-blue.svg?style=flat-square](https://img.shields.io/badge/license-AGPL-blue.svg?longCache=true&style=flat-square)
![https://img.shields.io/badge/language-java-orange.svg?style=flat-square](https://img.shields.io/badge/language-java-yellow.svg?longCache=true&style=popout-square)
>:exclamation: 托管的所有开源代码可能存在作者修改/测试/调整等行为,均为实验性代码,故并不保证程序或功能的可用性,如果你想要部署程序,请下载我们提供的编译整合包进行安装部署。
@@ -12,7 +12,7 @@
### 引导
[官网](https://tbed.hellohao.cn) | [论坛](http://bbs.hellohao.cn) | [文档](https://doc.hellohao.cn) | [演示站](https://pic.hellohao.cn) | [桌面客户端](https://tbed.hellohao.cn/app) | [前端源码](https://github.com/Hello-hao/tbed-web)
[官网](https://tbed.hellohao.cn) | [文档](https://doc.hellohao.cn) | [演示站](https://pic.hellohao.cn) | [桌面客户端](https://tbed.hellohao.cn/app) | [微信小程序](https://tbed.hellohao.cn/wechat) | [前端源码](https://github.com/Hello-hao/tbed-web)
### 前言
@@ -28,15 +28,17 @@
[Core版](https://hellohao.cn):开源版的基础上增加`Backblaze(B2)` 并且可`同个对象存储商家`可开多个存储源(可添加至90+存储源)
### 更新日志 `20230918`
### 更新日志 `20240102`
- 修复首页批量复制窗点击复制报错
- 调整菜单个人相册名字为相册空间
- 调整首页UI宽度
- 优化代码未激活账号登录时提示重新激活
- docker-compose方式部署添加数据库用户名配置项
- 修改拦截器写入响应数据时逻辑
- 优化图像链接转存功能
- 重构:相册页面UI显示效果
- 新增:相册页支持拖拽移动目录并支持了目录相互移动
- 新增:删除功能新增了强制删除选项
- 优化:大图片上传逻辑判断及展示效果
- 调整:用户个人信息失效时间,提高用户体验
- 调整:去除前端浏览器控制台输出Slogan
- 优化:七牛云存储源兼容了新地区的对接
- 优化:用户体验操作或提示
- 优化:系统处理图片的逻辑
[^_^]: 程序宣传视频:[自制宣传视频](https://www.bilibili.com/video/BV11r4y1y7mH/)
@@ -109,6 +111,8 @@
- /HellohaoData/:/HellohaoData/
environment:
MYSQL_URL: jdbc:mysql://hellohaodb/tbed?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# 数据库用户名(一般使用本镜像数据库无需修改,如果使用外部三方数据库自行修改自己的用户名)
MYSQL_USERNAME: root
# 自定设置一个MySQL的密码,请保证与下方 POSTGRES_PASSWORD 的变量值一致
MYSQL_PASS: tIaNGg@SHa&hIo56
# 前端域名(反代10089端口的域名)
@@ -214,6 +218,8 @@
- Shiro
### 声明
Hellohao图像托管已申请[**中国国家版权局计算机软件著作权**](https://register.ccopyright.com.cn/query.html)登记,受法律法规保护。
> 登记号:2023SR1210640
本项目遵循[GNU Affero General Public License v3.0](https://choosealicense.com/licenses/agpl-3.0/#)开源协议,使用前请悉知。
如果你想商用或程序定制,请先与我们联系,分享你的利益。
+1 -1
View File
@@ -196,7 +196,7 @@
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId>
<version>7.2.22</version>
<version>7.14.0</version>
</dependency>
<dependency>
<groupId>com.qcloud</groupId>
@@ -8,7 +8,6 @@ import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.TokenExpiredException;
import com.auth0.jwt.interfaces.DecodedJWT;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -24,7 +23,7 @@ public class JWTUtil {
public static String createToken(User user){
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.SECOND,604800 );//单位秒604800 为7天
calendar.add(Calendar.SECOND,2592000 );//单位秒
Algorithm algorithm = Algorithm.HMAC256(SECRET);
String token = JWT.create()
.withClaim("email", user.getEmail())
@@ -467,6 +467,7 @@ public class AdminController {
JSONObject jsonObj = JSONObject.parseObject(data);
String images = jsonObj.getString("images");
String uuid = jsonObj.getString("uuid");
Boolean forceDel = jsonObj.getBoolean("forceDel")==null?false:jsonObj.getBoolean("forceDel");
if (images == null) {
msg.setCode("404");
msg.setInfo("为获取到图像信息");
@@ -499,7 +500,7 @@ public class AdminController {
if (imgIds.size() == 0) {
msg.setCode("110404");
} else {
deleimages.dele(uuid, imgIds.stream().toArray(Long[]::new));
deleimages.dele(forceDel,uuid, imgIds.stream().toArray(Long[]::new));
msg.setCode("200");
}
return msg;
@@ -44,10 +44,11 @@ public class IndexController {
@Autowired private IRedisService iRedisService;
@Autowired private AppClientService appClientService;
public static String version = "20240102";
@RequestMapping(value = "/")
public String Welcome(Model model, HttpServletRequest httpServletRequest) {
model.addAttribute("name", "服务端程序(开源版)");
model.addAttribute("version", "20230918");
model.addAttribute("version", version);
model.addAttribute("ip", GetIPS.getIpAddr(httpServletRequest));
model.addAttribute("links", "https://github.com/Hello-hao/tbed");
return "welcome";
@@ -64,6 +65,8 @@ public class IndexController {
JSONObject jsonObject = new JSONObject();
AppClient appClient = appClientService.getAppClientData("app");
jsonObject.put("webname", cd.getString("webname"));
jsonObject.put("systype","free");
jsonObject.put("version",version);
jsonObject.put("websubtitle", cd.getString("websubtitle"));
jsonObject.put("keywords", cd.getString("keywords"));
jsonObject.put("webms", cd.getString("webms"));
@@ -79,10 +82,11 @@ public class IndexController {
jsonObject.put("clientname", appClient.getAppname());
jsonObject.put("clientlogo", appClient.getApplogo());
jsonObject.put("appupdate", appClient.getAppupdate());
jsonObject.put("serverVersion",version);
msg.setData(jsonObject);
return msg;
}
@PostMapping("/uploadChunkFile")
@PostMapping(value = {"/uploadChunkFile","/client/uploadChunkFile"})
@ResponseBody
@CrossOrigin
public Msg uploadChunk(HttpServletRequest request,Chunk chunk) {
@@ -105,7 +109,7 @@ public class IndexController {
}
}
@PostMapping("/processFile")
@PostMapping(value = {"/processFile","/client/processFile"})
@ResponseBody
@CrossOrigin
public Msg processFile(HttpServletRequest request,@RequestParam(value = "data", defaultValue = "") String data){
@@ -380,7 +384,7 @@ public class IndexController {
return msg;
}
}
msg = deleimages.dele(null, image.getId());
msg = deleimages.dele(false,null, image.getId());
List<Long> Delids = (List<Long>) msg.getData();
if (!Delids.contains(image.getId())) {
msg.setCode("500");
@@ -5,10 +5,10 @@ import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import com.google.gson.Gson;
import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.BucketManager;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.Region;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.storage.model.FileInfo;
@@ -28,18 +28,7 @@ public class KODOImageupload {
public ReturnImage ImageuploadKODO(
Map<Map<String, String>, File> fileMap, String username, Integer keyID) {
ReturnImage returnImage = new ReturnImage();
Configuration cfg;
if (key.getEndpoint().equals("1")) {
cfg = new Configuration(Zone.zone0());
} else if (key.getEndpoint().equals("2")) {
cfg = new Configuration(Zone.zone1());
} else if (key.getEndpoint().equals("3")) {
cfg = new Configuration(Zone.zone2());
} else if (key.getEndpoint().equals("4")) {
cfg = new Configuration(Zone.zoneNa0());
} else {
cfg = new Configuration(Zone.zoneAs0());
}
Configuration cfg = new Configuration(Region.autoRegion());
UploadManager uploadManager = new UploadManager(cfg);
Auth auth = Auth.create(key.getAccessKey(), key.getAccessSecret());
String upToken = auth.uploadToken(key.getBucketname(), null, 7200, null);
@@ -76,41 +65,25 @@ public class KODOImageupload {
public static Integer Initialize(Keys k) {
int ret = -1;
if (org.apache.commons.lang3.StringUtils.isBlank(k.getAccessKey())
|| org.apache.commons.lang3.StringUtils.isBlank(k.getAccessSecret())
|| org.apache.commons.lang3.StringUtils.isBlank(k.getEndpoint())
|| org.apache.commons.lang3.StringUtils.isBlank(k.getBucketname())
if (StringUtils.isBlank(k.getAccessKey())
|| StringUtils.isBlank(k.getAccessSecret())
|| StringUtils.isBlank(k.getEndpoint())
|| StringUtils.isBlank(k.getBucketname())
|| StringUtils.isBlank(k.getRequestAddress())) {
return -1;
}
Configuration cfg;
if (k.getEndpoint().equals("1")) {
cfg = new Configuration(Zone.zone0());
} else if (k.getEndpoint().equals("2")) {
cfg = new Configuration(Zone.zone1());
} else if (k.getEndpoint().equals("3")) {
cfg = new Configuration(Zone.zone2());
} else if (k.getEndpoint().equals("4")) {
cfg = new Configuration(Zone.zoneNa0());
} else {
cfg = new Configuration(Zone.zoneAs0());
}
Configuration cfg = new Configuration(Region.autoRegion());
UploadManager uploadManager = new UploadManager(cfg);
Auth auth = Auth.create(k.getAccessKey(), k.getAccessSecret());
String upToken =
auth.uploadToken(
k.getBucketname(),
null,
7200,
null); // auth.uploadToken(k.getBucketname());
BucketManager bmObj = new BucketManager(auth, cfg);
String upToken = auth.uploadToken(k.getBucketname(), null, 7200, null);
BucketManager BM = new BucketManager(auth, cfg);
BucketManager.FileListIterator fileListIterator = null;
try {
fileListIterator = bmObj.createFileListIterator(k.getBucketname(), "", 1, "/");
fileListIterator = BM.createFileListIterator(k.getBucketname(), "", 1, "/");
FileInfo[] items = fileListIterator.next();
if (items != null) {
ret = 1;
bucketManager = bmObj;
bucketManager = BM;
key = k;
}
} catch (Exception e) {
@@ -32,7 +32,7 @@ public class deleImages {
@Autowired private KeysServiceImpl keysService;
@Autowired private IRedisService iRedisService;
public Msg dele(String uuid, Long... imgIds) {
public Msg dele(boolean forceDel,String uuid, Long... imgIds) {
Msg msg = new Msg();
MyProgress myProgress = new MyProgress();
myProgress.InitializeDelImg();
@@ -44,6 +44,20 @@ public class deleImages {
boolean isDele = false;
try {
Images image = imgService.selectByPrimaryKey(imgIds[i]);
if (forceDel) {
try {
imgAndAlbumService.deleteImgAndAlbum(image.getImgurl());
imgTempService.delImgAndExp(image.getImguid());
imgService.deleimg(image.getId());
ids.add(image.getId());
successCount++;
System.out.println("删除成功加一个" + image.getId());
} catch (Exception e) {
e.printStackTrace();
System.err.println(image.getImgname() + ":图片数据库记录时发生错误");
errorIds.add(image.getImgurl());
}
}
Keys key = keysService.selectKeys(image.getSource());
if (key.getStorageType() == 1) {
isDele = nosImageupload.delNOS(key.getId(), image);
@@ -64,20 +78,21 @@ public class deleImages {
} else {
System.err.println("未获取到对象存储参数,删除失败。");
}
// if (isDele) {
try {
imgAndAlbumService.deleteImgAndAlbum(image.getImgurl());
imgTempService.delImgAndExp(image.getImguid());
imgService.deleimg(image.getId());
ids.add(image.getId());
successCount++;
System.out.println("删除成功加一个" + image.getId());
} catch (Exception e) {
e.printStackTrace();
System.err.println(image.getImgname() + ":图片数据库记录时发生错误");
errorIds.add(image.getImgurl());
if (!forceDel) {
try {
imgAndAlbumService.deleteImgAndAlbum(image.getImgurl());
imgTempService.delImgAndExp(image.getImguid());
imgService.deleimg(image.getId());
ids.add(image.getId());
successCount++;
System.out.println("删除成功加一个" + image.getId());
} catch (Exception e) {
e.printStackTrace();
System.err.println(image.getImgname() + ":图片数据库记录时发生错误");
errorIds.add(image.getImgurl());
}
}
// }
if(uuid!=null){
myProgress.setDelSuccessCount(successCount);
myProgress.setDelSuccessImgList(ids);
+7 -5
View File
@@ -9,11 +9,12 @@
FROM
`album`
<where>
1=1
<if test="albumkey != null">
`albumkey` = #{albumkey}
and `albumkey` = #{albumkey}
</if>
<if test="userid != null">
`userid` = #{userid}
and `userid` = #{userid}
</if>
</where>
</select>
@@ -38,14 +39,15 @@
u.username
FROM `album` a LEFT JOIN user u on a.userid = u.id
<where>
1=1
<if test="albumkey != null">
`albumkey` like '%${albumkey}%'
and `albumkey` like '%${albumkey}%'
</if>
<if test="username != null">
`username` like '%${username}%'
and `username` like '%${username}%'
</if>
<if test="userid != null">
a.userid = #{userid}
and a.userid = #{userid}
</if>
</where>
order by a.createdate
@@ -9,6 +9,7 @@
FROM
`imgandalbum`
<where>
1=1
<if test="albumkey != null">
`albumkey` = #{albumkey}
</if>
@@ -21,6 +22,7 @@
FROM
`imgandalbum`
<where>
1=1
<if test="imgname != null">
`imgname` = #{imgname}
</if>