Merge pull request !61 from stylefeng/cherry-pick-1710499324
pull/60/MERGE
stylefeng 2024-03-15 10:42:36 +00:00 committed by Gitee
commit e63108cc96
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 13 additions and 7 deletions

View File

@ -52,4 +52,9 @@ public class AliyunOssProperties {
*/
private String accessKeySecret;
/**
* https
*/
private Boolean isHttps = false;
}

View File

@ -32,10 +32,8 @@ import cn.stylefeng.roses.kernel.file.api.exception.FileException;
import cn.stylefeng.roses.kernel.file.api.exception.enums.FileExceptionEnum;
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
import cn.stylefeng.roses.kernel.file.api.pojo.props.AliyunOssProperties;
import com.aliyun.oss.ClientException;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.*;
import com.aliyun.oss.common.comm.Protocol;
import com.aliyun.oss.model.CannedAccessControlList;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.PutObjectRequest;
@ -73,9 +71,11 @@ public class AliyunFileOperator implements FileOperatorApi {
String endpoint = aliyunOssProperties.getEndPoint();
String accessKeyId = aliyunOssProperties.getAccessKeyId();
String accessKeySecret = aliyunOssProperties.getAccessKeySecret();
Boolean isHttps = aliyunOssProperties.getIsHttps();
ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
clientBuilderConfiguration.setProtocol(isHttps ? Protocol.HTTPS : Protocol.HTTP);
// 创建OSSClient实例。
ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret, clientBuilderConfiguration);
}
@Override

View File

@ -10,6 +10,7 @@ import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.file.api.FileInfoApi;
import cn.stylefeng.roses.kernel.file.api.expander.FileConfigExpander;
import cn.stylefeng.roses.kernel.file.api.pojo.AntdvFileInfo;
import cn.stylefeng.roses.kernel.file.api.pojo.request.SysFileInfoRequest;
import cn.stylefeng.roses.kernel.rule.callback.ConfigUpdateCallback;
@ -247,7 +248,7 @@ public class SysThemeServiceImpl extends ServiceImpl<SysThemeMapper, SysTheme> i
this.parseFileUrls(result);
// 缓存系统中激活的主题
themeCacheApi.put(ThemeConstants.THEME_GUNS_PLATFORM, result);
themeCacheApi.put(ThemeConstants.THEME_GUNS_PLATFORM, result, FileConfigExpander.getDefaultFileTimeoutSeconds());
return result;
}