11 Commits
Author SHA1 Message Date
hello-hao b0562203c2 📝 2022-02-11 14:14:11 +08:00
hello-hao 995582f7c6 📝 2022-02-08 13:41:13 +08:00
hello-hao e347ec2367 📝 2022-02-08 13:39:32 +08:00
hello-hao ffcd4dbf40 :bug:修复添加分发群组数据保存不全 2022-01-27 11:28:22 +08:00
hello-hao 6ee1673d83 :sparkles:分发群组/图像鉴别 2022-01-27 11:27:23 +08:00
hello-hao 7b0db6fe16 📝 2022-01-27 11:24:20 +08:00
hello-hao 1baed6a29a 📝 2021-12-29 14:05:39 +08:00
hello-hao a4855adbe6 :art:优化响应头和返回值判断逻辑 2021-12-29 11:12:24 +08:00
hello-hao b0cd5ca51f 📝 2021-12-15 10:28:03 +08:00
hello-hao 00b2f58916 📝 2021-11-29 11:34:33 +08:00
hello-hao 78b3206f65 🚑 2021-11-29 11:27:26 +08:00
20 changed files with 105 additions and 121 deletions
+38 -19
View File
@@ -1,6 +1,7 @@
# Hellohao图像托管程序 - 也许这会是最优秀的图床程序
![banner.png](http://img.wwery.com/Hellohao/HqXVDR2b.png)
![宣传图Banner](https://upload.cc/i1/2022/02/11/HSg5tX.png)
![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)
@@ -23,11 +24,12 @@
Core版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,`U-File`,`FTP`,`Backblaze(B2)`,`百度云BOS`,`青云Qingstor`,`Ucloud US3`,`Minio`,`AWS S3`
### 更新日志
> `20211129`
- 修复FTP存储源上传失败的问题
- 修复MAC系统下路径问题
- 优化系统部分代码
### 更新日志 `20220127`
- **修复** 添加分发群组时候数据不完善的问题
- **修复** 首页咨询弹窗”三天不提示“勾选不生效的问题
- 去除页面上关于图像压缩的无用展示(开源版无此功能)
- 优化了部分代码显示
### 引导
@@ -39,17 +41,26 @@ Core版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,
开源版编译包下载: [下载开源版程序包](https://github.com/Hello-hao/Tbed/releases/)
官网(含Core版)[http://Tbed.wwery.com](http://Tbed.wwery.com)
官网(含Core版)[https://tbed.hellohao.cn](https://tbed.hellohao.cn)
前端源码:[https://github.com/Hello-hao/tbed-web](https://github.com/Hello-hao/tbed-web)
文档地址:[http://doc.hellohao.cn](http://doc.hellohao.cn)
文档地址:[https://doc.hellohao.cn](https://doc.hellohao.cn)
文档地址(备用)[http://doc.wwery.com](http://doc.hellohao.cn)
程序展示[https://tc.hellohao.cn](https://tc.hellohao.cn)
程序展示[http://tc.hellohao.cn](http://tc.hellohao.cn)
作者博客[https://www.hellohao.cn](https://www.hellohao.cn)
--- **备用地址** ---
官网(含Core版)(备用)[http://tbed.wwery.com](http://tbed.wwery.com)
文档地址(备用)[http://doc.wwery.com](http://doc.wwery.com)
程序展示(备用)[http://tc.wwery.com](http://tc.wwery.com)
作者博客(备用)[http://www.wwery.com](http://www.wwery.com)
作者博客:[http://www.hellohao.cn](http://www.hellohao.cn)
@@ -91,15 +102,21 @@ Core版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,
### 系统预览
![首页](http://img.wwery.com/Hellohao/xI9TSKcI.png)
![首页](https://upload.cc/i1/2022/02/11/t2wCEF.png)
![控制台详情](http://img.wwery.com/Hellohao/klytOMWr.png)
![控制台详情](https://upload.cc/i1/2022/02/11/Al8UrH.png)
![相册](http://img.wwery.com/Hellohao/2UQkXTHw.png)
![相册](https://upload.cc/i1/2022/02/11/2LhEHJ.png)
![多存储源](http://img.wwery.com/Hellohao/xXSMlsTg.png)
![多存储源](https://upload.cc/i1/2022/02/11/gOPxZW.png)
![站点设置](http://img.wwery.com/Hellohao/n5zXistG.png)
![站点设置](https://upload.cc/i1/2022/02/11/Hj7pWM.png)
[^_^]: ![首页](http://img.wwery.com/Hellohao/xI9TSKcI.png)
[^_^]: ![控制台详情](http://img.wwery.com/Hellohao/klytOMWr.png)
[^_^]: ![相册](http://img.wwery.com/Hellohao/2UQkXTHw.png)
[^_^]: ![多存储源](http://img.wwery.com/Hellohao/xXSMlsTg.png)
[^_^]: ![站点设置](http://img.wwery.com/Hellohao/n5zXistG.png)
### 运行环境
@@ -142,9 +159,11 @@ Core版:`本地`,`阿里OSS`,`又拍USS`,`七牛KODO`,`腾讯COS`,`网易NOS`,
初始邮箱:`admin`
初始密码`admin`
### PC客户端
### 微信小程序
> 目前开发中,开发进度的快慢要根据作者的工作压力、心情状况等自身情况进行评估。
> 暂时无法给出具体发布小程序的时间。大家期待吧。
作者精力不够,工作繁忙,暂停更新
![小程序UI](https://upload.cc/i1/2022/02/11/6kPmr8.png)
### 声明
@@ -163,5 +182,5 @@ Hellohao博客: [http://www.hellohao.cn/](http://www.hellohao.cn/)
**如果你也支持Hellohao图床,可以请我喝杯咖啡。我会持续更新Hellohao图床**
**捐赠地址:** [**http://tbed.hellohao.cn/pay**](http://tbed.hellohao.cn/pay)
**捐赠地址:** [**https://tbed.hellohao.cn/pay**](https://tbed.hellohao.cn/pay)
@@ -0,0 +1,13 @@
package cn.hellohao.config;
import java.io.File;
/**
* @author Hellohao
* @version 1.0
* @date 29/11/2021 上午 10:35
*/
public class GlobalConstant {
public static String SYSTYPE = "LINUX";
public static String LOCPATH = File.separator + "HellohaoData";
}
@@ -12,7 +12,7 @@ public class WebImgConfigurer implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
String filePath = File.separator + "HellohaoData" + File.separator;
String filePath = GlobalConstant.LOCPATH + File.separator;
registry.addResourceHandler("/ota/**").addResourceLocations("file:"+filePath);
}
@@ -1,12 +0,0 @@
package cn.hellohao.pojo;
import java.io.File;
/**
* @author Hellohao
* @version 1.0
* @date 2020-04-04 2:12
*/
public class FixedResources {
public static final String LOCPATH = File.separator + "HellohaoData";
}
@@ -47,14 +47,16 @@ public class COSImageupload {
returnImage.setImgSize(entry.getValue().length());
returnImage.setCode("200");
} catch (CosServiceException serverException) {
returnImage.setCode("400");
serverException.printStackTrace();
} catch (CosClientException clientException) {
returnImage.setCode("400");
clientException.printStackTrace();
}
}
}catch(Exception e){
e.printStackTrace();
returnImage.setCode("200");
returnImage.setCode("500");
}
return returnImage;
}
@@ -126,7 +126,7 @@ public class ClientService {
e.printStackTrace();
System.out.println("未获取到图片的MD5,成成UUID");
}
Msg fileMiME = TypeDict.FileMiME(file, uploadConfig.getSuffix());
Msg fileMiME = TypeDict.FileMiME(file);
if (!fileMiME.getCode().equals("200")) {
//非图像文本
msg.setCode("4009");
@@ -22,7 +22,6 @@ public class FTPImageupload {
public ReturnImage ImageuploadFTP(Map<String, File> fileMap, String username,Integer keyID) {
ReturnImage returnImage = new ReturnImage();
Keys key = null;
String[] host = key.getEndpoint().split("\\:");
String h = host[0];
Integer p = Integer.parseInt(host[1]);
@@ -53,7 +53,6 @@ public class KODOImageupload {
try {
for (Map.Entry<String, File> entry : fileMap.entrySet()) {
String ShortUID = SetText.getShortUuid();
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
file = entry.getValue();
try {
Response response = uploadManager.put(file,username + "/" + ShortUID + "." + entry.getKey(),upToken);
@@ -63,6 +62,7 @@ public class KODOImageupload {
returnImage.setImgSize(entry.getValue().length());
returnImage.setCode("200");
} catch (QiniuException ex) {
returnImage.setCode("400");
Response r = ex.response;
System.err.println(r.toString());
try {
@@ -1,6 +1,7 @@
package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.Msg;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.utils.*;
import com.aliyun.oss.OSS;
@@ -27,6 +28,8 @@ public class OSSImageupload {
String ShortUID = SetText.getShortUuid();
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
file = entry.getValue();
Msg fileMiME = TypeDict.FileMiME(file);
meta.setHeader("content-type", fileMiME.getData().toString());
System.out.println("待上传的图片:"+username + "/" + ShortUID + "." + entry.getKey());
ossClient.putObject(key.getBucketname(), username + "/" + ShortUID + "." + entry.getKey(),file);
returnImage.setImgname(username + "/" + ShortUID + "." + entry.getKey());//entry.getValue().getOriginalFilename()
@@ -1,6 +1,7 @@
package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.Msg;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
import cn.hellohao.utils.*;
@@ -26,6 +27,8 @@ public class UFileImageupload {
for (Map.Entry<String, File> entry : fileMap.entrySet()) {
String ShortUID = SetText.getShortUuid();
file = entry.getValue();
Msg fileMiME = TypeDict.FileMiME(file);
meta.setHeader("content-type", fileMiME.getData().toString());
uFile.setContentMD5(UpYun.md5(file));
boolean result = uFile.writeFile(username + "/" + ShortUID + "." + entry.getKey(), file, true);
if(result){
@@ -34,6 +37,7 @@ public class UFileImageupload {
returnImage.setImgSize(entry.getValue().length());
returnImage.setCode("200");
}else{
returnImage.setCode("400");
System.err.println("上传失败");
}
}
@@ -1,6 +1,7 @@
package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.Msg;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
import cn.hellohao.utils.*;
@@ -29,6 +30,8 @@ public class USSImageupload {
for (Map.Entry<String, File> entry : fileMap.entrySet()) {
String ShortUID = SetText.getShortUuid();
file = entry.getValue();
Msg fileMiME = TypeDict.FileMiME(file);
meta.setHeader("content-type", fileMiME.getData().toString());
upyun.setContentMD5(UpYun.md5(file));
boolean result = upyun.writeFile(username + "/" + ShortUID + "." + entry.getKey(), file, true);
if(result){
@@ -37,6 +40,7 @@ public class USSImageupload {
returnImage.setImgSize(entry.getValue().length());
returnImage.setCode("200");
}else{
returnImage.setCode("400");
System.err.println("上传失败");
}
}
@@ -110,7 +110,7 @@ public class UploadServicel {
e.printStackTrace();
System.out.println("未获取到图片的MD5,成成UUID");
}
Msg fileMiME = TypeDict.FileMiME(file, uploadConfig.getSuffix());
Msg fileMiME = TypeDict.FileMiME(file);
if(!fileMiME.getCode().equals("200")) {
//非图像文本
msg.setCode("4000");
@@ -1,59 +0,0 @@
package cn.hellohao.utils;
import java.io.*;
public class DeleImg {
public static void charu(String imgUrlText) {
String filePath =File.separator + "HellohaoData" ;
File file = new File(filePath);
File file1 = new File(filePath+File.separator+"img.ini");
if(!file.exists()){
file.mkdirs();
}
if(!file1.exists()){
try {
file1.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
FileWriter fw = null;
try {
//如果文件存在,则追加内容;如果文件不存在,则创建文件
fw = new FileWriter(file1, true);
} catch (IOException e) {
e.printStackTrace();
}
PrintWriter pw = new PrintWriter(fw);
pw.println(imgUrlText);
pw.flush();
try {
fw.flush();
pw.close();
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
// 读取文件内容
public static String readFile(String path) {//路径
File file = new File(path);
StringBuilder result = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "GBK"));//构造一个BufferedReader类来读取文件
String s = null;
while ((s = br.readLine()) != null) {//使用readLine方法,一次读一行
result.append(System.lineSeparator() + s);
Print.Normal( s);
}
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return result.toString();
}
}
+25 -10
View File
@@ -1,5 +1,6 @@
package cn.hellohao.utils;
import cn.hellohao.config.GlobalConstant;
import org.omg.CORBA.Environment;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
@@ -8,6 +9,7 @@ import org.springframework.context.annotation.Configuration;
import java.io.File;
import java.sql.SQLException;
import java.util.Properties;
import java.util.UUID;
/**
@@ -28,7 +30,8 @@ public class FirstRun implements InitializingBean {
private String jdbcurl;
@Override
public void afterPropertiesSet() throws Exception {
public void afterPropertiesSet() {
isWindows();
RunSqlScript.USERNAME = jdbcusername;
RunSqlScript.PASSWORD = jdbcpass;
RunSqlScript.DBURL = jdbcurl;
@@ -83,11 +86,11 @@ public class FirstRun implements InitializingBean {
Print.Normal("Stage 7");
}
Integer ret6 = RunSqlScript.RunSelectCount(judgeTable+"'imgandalbum' and column_name = 'notes' and TABLE_SCHEMA='picturebed'");
if(ret6==0){
RunSqlScript.RunInsert(sql11);
Print.Normal("Stage 8");
}
// Integer ret6 = RunSqlScript.RunSelectCount(judgeTable+"'imgandalbum' and column_name = 'notes' and TABLE_SCHEMA='picturebed'");
// if(ret6==0){
// RunSqlScript.RunInsert(sql11);
// Print.Normal("Stage 8");
// }
RunSqlScript.RunInsert(sql10);
@@ -95,6 +98,8 @@ public class FirstRun implements InitializingBean {
RunSqlScript.RunInsert(inddx_md5key);
RunSqlScript.RunInsert("UPDATE `keys` SET `Endpoint` = '0' WHERE `id` = 8");
Print.Normal("Stage success");
clears();
}
//检查表是否存在,后边加'imgdata' and column_name = 'explains' 检查字段是否存在
@@ -115,7 +120,7 @@ public class FirstRun implements InitializingBean {
private String sql10 = "alter table config modify column `explain` varchar(1000),modify column links varchar(1000),modify column notice varchar(1000),modify column baidu varchar(1000)";
//添加imgandalbum字段notes(添加画廊图片说明)
private String sql11 = "alter table imgandalbum add notes varchar(1000) DEFAULT ' '";
// private String sql11 = "alter table imgandalbum add notes varchar(1000) DEFAULT ' '";
private String inddx_md5key = "ALTER TABLE imgdata ADD INDEX index_md5key_url ( md5key,imgurl)";
// create index yarn_app_result_i4 on yarn_app_result (flow_exec_id(100), another_column(50));
@@ -124,11 +129,11 @@ public class FirstRun implements InitializingBean {
private String compressed = "alter table imgdata row_format=compressed";
private void clears(){
File file1 = new File(File.separator+"HellohaoData"+File.separator+"hellohaotempimg");
File file2 = new File(File.separator+"HellohaoData"+File.separator+"hellohaotempwatermarimg");
File file1 = new File(GlobalConstant.LOCPATH+File.separator+"hellohaotempimg");
File file2 = new File(GlobalConstant.LOCPATH+File.separator+"hellohaotempwatermarimg");
//判断目录有没有创建
File file = new File(File.separator+"HellohaoData");
File file = new File(GlobalConstant.LOCPATH);
if(!file.exists()){
file.mkdirs();
file1.mkdirs();
@@ -143,4 +148,14 @@ public class FirstRun implements InitializingBean {
}
public boolean isWindows() {
System.out.println("当前系统类型:"+System.getProperties().getProperty("os.name").toUpperCase());
if(System.getProperties().getProperty("os.name").toUpperCase().contains("MAC")){
GlobalConstant.SYSTYPE = "MAC";
Properties props=System.getProperties();
GlobalConstant.LOCPATH = props.getProperty("user.home")+File.separator+".HellohaoData";
}
return System.getProperties().getProperty("os.name").toUpperCase().indexOf("WINDOWS") != -1;
}
}
@@ -1,8 +1,6 @@
package cn.hellohao.utils;
import cn.hellohao.service.impl.ImgServiceImpl;
import cn.hellohao.service.impl.ImgreviewServiceImpl;
import javax.servlet.http.HttpServletRequest;
/**
@@ -27,9 +25,6 @@ public class GetIPS implements Runnable {
thread.start();
}
/*** * 用于测试跨域 * @author huangweii * 2015年5月29日 */
public static String getIpAddr(HttpServletRequest request){
String ip = request.getHeader("X-Forwarded-For");
if(org.apache.commons.lang3.StringUtils.isNotEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)){
@@ -128,7 +128,7 @@ public class ImgUrlUtil {
//下载并且保存成功后 判断格式 如果不是图像格式 就删除
//
if(new File(saveDir+File.separator+fileName).exists()){
Msg msg = TypeDict.FileMiME(file,null);
Msg msg = TypeDict.FileMiME(file);
if(msg.getCode().equals("200")){
File f = new File(saveDir+File.separator+fileName);
String imgPath = saveDir+File.separator+fileName+"."+(msg.getData().toString().replace("image/",""));
@@ -1,5 +1,6 @@
package cn.hellohao.utils;
import cn.hellohao.config.GlobalConstant;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
@@ -16,7 +17,7 @@ public class LocUpdateImg {
public static boolean deleteLOCImg(String imagename){
boolean isDele = false;
try {
String filePath =File.separator + "HellohaoData" + File.separator+imagename;
String filePath = GlobalConstant.LOCPATH + File.separator+imagename;
File file = new File(filePath);
isDele = file.delete();
}catch (Exception e){
@@ -30,7 +31,7 @@ public class LocUpdateImg {
KeysServiceImpl keysService = SpringContextHolder.getBean(KeysServiceImpl.class);
final Keys key = keysService.selectKeys(keyID);
ReturnImage returnImage = new ReturnImage();
String filePath =File.separator + "HellohaoData" + File.separator;
String filePath =GlobalConstant.LOCPATH + File.separator;
File file = null;
for (Map.Entry<String, File> entry : fileMap.entrySet()) {
String ShortUID = SetText.getShortUuid();
@@ -69,7 +69,7 @@ MIDI (mid),文件头:4D546864
}
//apache大法
public static Msg FileMiME(File file, String suffix){
public static Msg FileMiME(File file ){
final Msg msg = new Msg();
try {
Tika tika = new Tika();
+4 -3
View File
@@ -7,12 +7,12 @@ spring.datasource.url=jdbc:mysql://localhost:3306/tbed?useUnicode=true&character
#端口
server.port=8089
#前端域名需要带协议头http(s)://
CROS_ALLOWED_ORIGINS=http://localhost:8080
CROS_ALLOWED_ORIGINS=http://127.0.0.1:8080
#下边的配置项不需要修改。
logging.config=classpath:logback-spring.xml
logging.file.path=/HellohaoData/tbedlog
#logging.config=classpath:logback-spring.xml
#logging.file.path=/HellohaoData/tbedlog
spring.thymeleaf.suffix=.html
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.mapper-locations=classpath:mapper/*.xml
@@ -44,3 +44,4 @@ spring.datasource.druid.stat-view-servlet.login-username=hellohao@dealer
spring.datasource.druid.stat-view-servlet.login-password=52BNmXPJL0rQQ3CU
spring.datasource.druid.stat-view-servlet.allow=127.0.0.1
spring.datasource.druid.web-stat-filter.exclusions=false
log4j2.formatMsgNoLookups=True
+2 -3
View File
@@ -10,7 +10,6 @@
<!-- `group`-->
<!-- </select>-->
<select id="grouplist" resultType="cn.hellohao.pojo.Group" parameterType="integer">
SELECT
g.id,g.groupname,g.keyid,g.usertype,g.compress,k.storageType,k.keyname
@@ -33,7 +32,7 @@
</select>
<insert id="addgroup" parameterType="cn.hellohao.pojo.Group">
insert into `group` (id,groupname,keyid) values (null,#{groupname},#{keyid})
insert into `group` (id,groupname,keyid,usertype,compress) values (null,#{groupname},#{keyid},#{usertype},#{compress})
</insert>
<select id="GetCountFroUserType" parameterType="integer" resultType="integer">
@@ -49,7 +48,7 @@
</delete>
<update id="setgroup" parameterType="cn.hellohao.pojo.Group">
UPDATE `group` SET groupname=#{groupname},keyid=#{keyid} where id = #{id};
UPDATE `group` SET groupname=#{groupname},keyid=#{keyid},usertype=#{usertype},compress=#{compress} where id = #{id};
</update>
<select id="getGroupFroUserType" parameterType="integer" resultType="cn.hellohao.pojo.Group">