Skip to content

Commit

Permalink
new config item support environment config
Browse files Browse the repository at this point in the history
  • Loading branch information
gitchenjh committed Jul 3, 2023
1 parent bfe4f73 commit a936113
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 29 deletions.
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<!-- <descriptor>src/main/assembly/dist-win32.xml</descriptor>-->
<descriptor>src/main/assembly/dist-win32.xml</descriptor>
<descriptor>src/main/assembly/dist-linux.xml</descriptor>
</descriptors>
</configuration>
Expand Down
14 changes: 7 additions & 7 deletions server/src/main/config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ watermark.angle = ${WATERMARK_ANGLE:10}

#Tif类型图片浏览模式:tif(利用前端js插件浏览);jpg(转换为jpg后前端显示);pdf(转换为pdf后显示,便于打印)
tif.preview.type = ${KK_TIF_PREVIEW_TYPE:tif}
# 备案信息
beiAn =
# 备案信息,默认为空
beian = ${KK_BEIAN:default}
#禁止上传类型
prohibit = exe,dll,dat
prohibit = ${KK_PROHIBIT:exe,dll,dat}
#删除密码
delete.password = 123456
delete.password = ${KK_DELETE_PASSWORD:123456}
#删除 转换后OFFICECADTIFF、压缩包源文件 默认开启 节约磁盘空间
delete.source.file = true
delete.source.file = ${KK_DELETE_SOURCE_FILE:true}
#配置PDF文件生成图片的像素大小,dpi 越高,图片质量越清晰,同时也会消耗更多的计算资源。
pdf2jpg.dpi = 144
pdf2jpg.dpi = ${KK_PDF2JPG_DPI:144}
#xlsx格式前端解析
office.type.web = web
office.type.web = ${KK_OFFICE_TYPE_WEB:web}
16 changes: 8 additions & 8 deletions server/src/main/java/cn/keking/config/ConfigConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ConfigConstants {
private static String pdfBookmarkDisable;
private static Boolean fileUploadDisable;
private static String tifPreviewType;
private static String beiAn;
private static String beian;
private static String[] prohibit = {};
private static String size;
private static String password;
Expand Down Expand Up @@ -368,15 +368,15 @@ public static void setTifPreviewTypeValue(String tifPreviewType) {
ConfigConstants.tifPreviewType = tifPreviewType;
}

public static String getBeiAn() {
return beiAn;
public static String getBeian() {
return beian;
}
@Value("${beiAn:无}")
public void setBeiAn(String beiAn) {
setBeiAnValue(beiAn);
@Value("${beian:default}")
public void setBeian(String beian) {
setBeianValue(beian);
}
public static void setBeiAnValue(String beiAn) {
ConfigConstants.beiAn = beiAn;
public static void setBeianValue(String beian) {
ConfigConstants.beian = beian;
}
public static String[] getProhibit() {
return prohibit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void run() {
String tifPreviewType;
String prohibit;
String[] prohibitArray;
String beiAn;
String beian;
String size;
String password;
int pdf2JpgDpi;
Expand Down Expand Up @@ -86,7 +86,7 @@ public void run() {
fileUploadDisable = Boolean.parseBoolean(properties.getProperty("file.upload.disable", ConfigConstants.DEFAULT_FILE_UPLOAD_DISABLE));
tifPreviewType = properties.getProperty("tif.preview.type", ConfigConstants.DEFAULT_TIF_PREVIEW_TYPE);
size = properties.getProperty("spring.servlet.multipart.max-file-size", ConfigConstants.DEFAULT_SIZE);
beiAn = properties.getProperty("beiAn", ConfigConstants.DEFAULT_BEIAN);
beian = properties.getProperty("beian", ConfigConstants.DEFAULT_BEIAN);
prohibit = properties.getProperty("prohibit", ConfigConstants.DEFAULT_PROHIBIT);
password = properties.getProperty("delete.password", ConfigConstants.DEFAULT_PASSWORD);
pdf2JpgDpi = Integer.parseInt(properties.getProperty("pdf2jpg.dpi", ConfigConstants.DEFAULT_PDF2_JPG_DPI));
Expand All @@ -111,7 +111,7 @@ public void run() {
ConfigConstants.setPdfBookmarkDisableValue(pdfBookmarkDisable);
ConfigConstants.setFileUploadDisableValue(fileUploadDisable);
ConfigConstants.setTifPreviewTypeValue(tifPreviewType);
ConfigConstants.setBeiAnValue(beiAn);
ConfigConstants.setBeianValue(beian);
ConfigConstants.setSizeValue(size);
ConfigConstants.setProhibitValue(prohibitArray);
ConfigConstants.setPasswordValue(password);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private void setFileAttribute(ServletRequest request){
request.setAttribute("fileKey", httpRequest.getParameter("fileKey"));
request.setAttribute("switchDisabled", ConfigConstants.getOfficePreviewSwitchDisabled());
request.setAttribute("fileUploadDisable", ConfigConstants.getFileUploadDisable());
request.setAttribute("beiAn", ConfigConstants.getBeiAn());
request.setAttribute("beian", ConfigConstants.getBeian());
request.setAttribute("size", ConfigConstants.maxSize());
}

Expand Down
16 changes: 7 additions & 9 deletions server/src/main/resources/web/main/index.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@
</div>
</div>
</div>
<div style="display: grid; place-items: center;">
<div>
<a target="_blank" href="https://beian.miit.gov.cn/">${beiAn}</a>
<#if beian?? && beian != "default">
<div style="display: grid; place-items: center;">
<div>
<a target="_blank" href="https://beian.miit.gov.cn/">${beian}</a>
</div>
</div>
</div>
</#if>
<script>
function deleteFile(fileName,password) {
if(window.confirm('你确定要删除文件吗?')){
Expand Down Expand Up @@ -209,11 +211,7 @@
+ '(/[\\w_!~*\'()\\.;?:@&=+$,%#-]+)+/?)$';//请求参数结尾- 英文或数字和[]内的各种字符
var re = new RegExp(strRegex, 'i');//i不区分大小写
//将url做uri转码后再匹配,解除请求参数中的中文和空字符影响
if (re.test(encodeURI(url))) {
return (true);
} else {
return (false);
}
return re.test(encodeURI(url));
}

$(function () {
Expand Down

0 comments on commit a936113

Please sign in to comment.