Browse Source

new config item support environment config

陈精华 1 year ago
parent
commit
a936113709

+ 1 - 1
server/pom.xml

@@ -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>

+ 7 - 7
server/src/main/config/application.properties

@@ -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}
 #删除 转换后OFFICE、CAD、TIFF、压缩包源文件 默认开启 节约磁盘空间
-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}

+ 8 - 8
server/src/main/java/cn/keking/config/ConfigConstants.java

@@ -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;
@@ -368,15 +368,15 @@ public class ConfigConstants {
         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;

+ 3 - 3
server/src/main/java/cn/keking/config/ConfigRefreshComponent.java

@@ -55,7 +55,7 @@ public class ConfigRefreshComponent {
                 String tifPreviewType;
                 String prohibit;
                 String[] prohibitArray;
-                String beiAn;
+                String beian;
                 String size;
                 String password;
                 int pdf2JpgDpi;
@@ -86,7 +86,7 @@ public class ConfigRefreshComponent {
                     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));
@@ -111,7 +111,7 @@ public class ConfigRefreshComponent {
                     ConfigConstants.setPdfBookmarkDisableValue(pdfBookmarkDisable);
                     ConfigConstants.setFileUploadDisableValue(fileUploadDisable);
                     ConfigConstants.setTifPreviewTypeValue(tifPreviewType);
-                    ConfigConstants.setBeiAnValue(beiAn);
+                    ConfigConstants.setBeianValue(beian);
                     ConfigConstants.setSizeValue(size);
                     ConfigConstants.setProhibitValue(prohibitArray);
                     ConfigConstants.setPasswordValue(password);

+ 1 - 1
server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java

@@ -40,7 +40,7 @@ public class AttributeSetFilter implements Filter {
         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());
     }
 

+ 7 - 9
server/src/main/resources/web/main/index.ftl

@@ -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('你确定要删除文件吗?')){
@@ -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 () {