mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2025-04-05 08:37:18 +08:00
feat: 新增预览文件 host 黑名单机制
This commit is contained in:
parent
787e9fe615
commit
d1d8ffef7a
@ -81,6 +81,9 @@ base.url = ${KK_BASE_URL:default}
|
|||||||
#信任站点,多个用','隔开,设置了之后,会限制只能预览来自信任站点列表的文件,默认不限制
|
#信任站点,多个用','隔开,设置了之后,会限制只能预览来自信任站点列表的文件,默认不限制
|
||||||
#trust.host = kkview.cn
|
#trust.host = kkview.cn
|
||||||
trust.host = ${KK_TRUST_HOST:default}
|
trust.host = ${KK_TRUST_HOST:default}
|
||||||
|
#不信任站点,多个用','隔开,设置了之后,会限制来自不信任站点列表的文件,默认不限制
|
||||||
|
#not.trust.host = kkview.cn
|
||||||
|
not.trust.host= ${KK_NOT_TRUST_HOST:default}
|
||||||
#文本类型,默认如下,可自定义添加
|
#文本类型,默认如下,可自定义添加
|
||||||
simText = ${KK_SIMTEXT:txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd}
|
simText = ${KK_SIMTEXT:txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
@Component(value = ConfigConstants.BEAN_NAME)
|
@Component(value = ConfigConstants.BEAN_NAME)
|
||||||
public class ConfigConstants {
|
public class ConfigConstants {
|
||||||
public static final String BEAN_NAME = "configConstants";
|
public static final String BEAN_NAME = "configConstants";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
//pdfbox兼容低版本jdk
|
//pdfbox兼容低版本jdk
|
||||||
System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");
|
System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");
|
||||||
@ -35,6 +36,7 @@ public class ConfigConstants {
|
|||||||
private static String fileDir = ConfigUtils.getHomePath() + File.separator + "file" + File.separator;
|
private static String fileDir = ConfigUtils.getHomePath() + File.separator + "file" + File.separator;
|
||||||
private static String localPreviewDir;
|
private static String localPreviewDir;
|
||||||
private static CopyOnWriteArraySet<String> trustHostSet;
|
private static CopyOnWriteArraySet<String> trustHostSet;
|
||||||
|
private static CopyOnWriteArraySet<String> notTrustHostSet;
|
||||||
private static String pdfPresentationModeDisable;
|
private static String pdfPresentationModeDisable;
|
||||||
private static String pdfDisableEditing;
|
private static String pdfDisableEditing;
|
||||||
private static String pdfOpenFileDisable;
|
private static String pdfOpenFileDisable;
|
||||||
@ -61,7 +63,7 @@ public class ConfigConstants {
|
|||||||
private static Boolean officeDocumentOpenPasswords;
|
private static Boolean officeDocumentOpenPasswords;
|
||||||
private static String cadTimeout;
|
private static String cadTimeout;
|
||||||
private static int cadThread;
|
private static int cadThread;
|
||||||
private static String homePpageNumber;
|
private static String homePageNumber;
|
||||||
private static String homePagination;
|
private static String homePagination;
|
||||||
private static String homePageSize;
|
private static String homePageSize;
|
||||||
private static String homeSearch;
|
private static String homeSearch;
|
||||||
@ -74,10 +76,7 @@ public class ConfigConstants {
|
|||||||
public static final String DEFAULT_FTP_USERNAME = null;
|
public static final String DEFAULT_FTP_USERNAME = null;
|
||||||
public static final String DEFAULT_FTP_PASSWORD = null;
|
public static final String DEFAULT_FTP_PASSWORD = null;
|
||||||
public static final String DEFAULT_FTP_CONTROL_ENCODING = "UTF-8";
|
public static final String DEFAULT_FTP_CONTROL_ENCODING = "UTF-8";
|
||||||
public static final String DEFAULT_BASE_URL = "default";
|
public static final String DEFAULT_VALUE = "default";
|
||||||
public static final String DEFAULT_FILE_DIR_VALUE = "default";
|
|
||||||
public static final String DEFAULT_LOCAL_PREVIEW_DIR_VALUE = "default";
|
|
||||||
public static final String DEFAULT_TRUST_HOST = "default";
|
|
||||||
public static final String DEFAULT_PDF_PRESENTATION_MODE_DISABLE = "true";
|
public static final String DEFAULT_PDF_PRESENTATION_MODE_DISABLE = "true";
|
||||||
public static final String DEFAULT_PDF_OPEN_FILE_DISABLE = "true";
|
public static final String DEFAULT_PDF_OPEN_FILE_DISABLE = "true";
|
||||||
public static final String DEFAULT_PDF_PRINT_DISABLE = "true";
|
public static final String DEFAULT_PDF_PRINT_DISABLE = "true";
|
||||||
@ -108,6 +107,7 @@ public class ConfigConstants {
|
|||||||
public static final String DEFAULT_HOME_PAGINATION = "true";
|
public static final String DEFAULT_HOME_PAGINATION = "true";
|
||||||
public static final String DEFAULT_HOME_PAGSIZE = "15";
|
public static final String DEFAULT_HOME_PAGSIZE = "15";
|
||||||
public static final String DEFAULT_HOME_SEARCH = "true";
|
public static final String DEFAULT_HOME_SEARCH = "true";
|
||||||
|
|
||||||
public static Boolean isCacheEnabled() {
|
public static Boolean isCacheEnabled() {
|
||||||
return cacheEnabled;
|
return cacheEnabled;
|
||||||
}
|
}
|
||||||
@ -172,6 +172,7 @@ public class ConfigConstants {
|
|||||||
public void setMediaConvertDisable(String mediaConvertDisable) {
|
public void setMediaConvertDisable(String mediaConvertDisable) {
|
||||||
setMediaConvertDisableValue(mediaConvertDisable);
|
setMediaConvertDisableValue(mediaConvertDisable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setMediaConvertDisableValue(String mediaConvertDisable) {
|
public static void setMediaConvertDisableValue(String mediaConvertDisable) {
|
||||||
ConfigConstants.mediaConvertDisable = mediaConvertDisable;
|
ConfigConstants.mediaConvertDisable = mediaConvertDisable;
|
||||||
}
|
}
|
||||||
@ -251,7 +252,7 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setFileDirValue(String fileDir) {
|
public static void setFileDirValue(String fileDir) {
|
||||||
if (!DEFAULT_FILE_DIR_VALUE.equalsIgnoreCase(fileDir)) {
|
if (!DEFAULT_VALUE.equalsIgnoreCase(fileDir)) {
|
||||||
if (!fileDir.endsWith(File.separator)) {
|
if (!fileDir.endsWith(File.separator)) {
|
||||||
fileDir = fileDir + File.separator;
|
fileDir = fileDir + File.separator;
|
||||||
}
|
}
|
||||||
@ -269,7 +270,7 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setLocalPreviewDirValue(String localPreviewDir) {
|
public static void setLocalPreviewDirValue(String localPreviewDir) {
|
||||||
if (!DEFAULT_LOCAL_PREVIEW_DIR_VALUE.equals(localPreviewDir)) {
|
if (!DEFAULT_VALUE.equals(localPreviewDir)) {
|
||||||
if (!localPreviewDir.endsWith(File.separator)) {
|
if (!localPreviewDir.endsWith(File.separator)) {
|
||||||
localPreviewDir = localPreviewDir + File.separator;
|
localPreviewDir = localPreviewDir + File.separator;
|
||||||
}
|
}
|
||||||
@ -279,19 +280,29 @@ public class ConfigConstants {
|
|||||||
|
|
||||||
@Value("${trust.host:default}")
|
@Value("${trust.host:default}")
|
||||||
public void setTrustHost(String trustHost) {
|
public void setTrustHost(String trustHost) {
|
||||||
setTrustHostValue(trustHost);
|
setTrustHostSet(getHostValue(trustHost));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTrustHostValue(String trustHost) {
|
public static void setTrustHostValue(String trustHost){
|
||||||
CopyOnWriteArraySet<String> trustHostSet;
|
setTrustHostSet(getHostValue(trustHost));
|
||||||
if (DEFAULT_TRUST_HOST.equalsIgnoreCase(trustHost)) {
|
}
|
||||||
trustHostSet = new CopyOnWriteArraySet<>();
|
|
||||||
|
@Value("${not.trust.host:default}")
|
||||||
|
public void setNotTrustHost(String notTrustHost) {
|
||||||
|
setNotTrustHostSet(getHostValue(notTrustHost));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setNotTrustHostValue(String notTrustHost){
|
||||||
|
setNotTrustHostSet(getHostValue(notTrustHost));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CopyOnWriteArraySet<String> getHostValue(String trustHost) {
|
||||||
|
if (DEFAULT_VALUE.equalsIgnoreCase(trustHost)) {
|
||||||
|
return new CopyOnWriteArraySet<>();
|
||||||
} else {
|
} else {
|
||||||
String[] trustHostArray = trustHost.toLowerCase().split(",");
|
String[] trustHostArray = trustHost.toLowerCase().split(",");
|
||||||
trustHostSet = new CopyOnWriteArraySet<>(Arrays.asList(trustHostArray));
|
return new CopyOnWriteArraySet<>(Arrays.asList(trustHostArray));
|
||||||
setTrustHostSet(trustHostSet);
|
|
||||||
}
|
}
|
||||||
setTrustHostSet(trustHostSet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<String> getTrustHostSet() {
|
public static Set<String> getTrustHostSet() {
|
||||||
@ -302,6 +313,15 @@ public class ConfigConstants {
|
|||||||
ConfigConstants.trustHostSet = trustHostSet;
|
ConfigConstants.trustHostSet = trustHostSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Set<String> getNotTrustHostSet() {
|
||||||
|
return notTrustHostSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setNotTrustHostSet(CopyOnWriteArraySet<String> notTrustHostSet) {
|
||||||
|
ConfigConstants.notTrustHostSet = notTrustHostSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getPdfPresentationModeDisable() {
|
public static String getPdfPresentationModeDisable() {
|
||||||
return pdfPresentationModeDisable;
|
return pdfPresentationModeDisable;
|
||||||
}
|
}
|
||||||
@ -323,6 +343,7 @@ public class ConfigConstants {
|
|||||||
public void setPdfOpenFileDisable(String pdfOpenFileDisable) {
|
public void setPdfOpenFileDisable(String pdfOpenFileDisable) {
|
||||||
setPdfOpenFileDisableValue(pdfOpenFileDisable);
|
setPdfOpenFileDisableValue(pdfOpenFileDisable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPdfOpenFileDisableValue(String pdfOpenFileDisable) {
|
public static void setPdfOpenFileDisableValue(String pdfOpenFileDisable) {
|
||||||
ConfigConstants.pdfOpenFileDisable = pdfOpenFileDisable;
|
ConfigConstants.pdfOpenFileDisable = pdfOpenFileDisable;
|
||||||
}
|
}
|
||||||
@ -330,10 +351,12 @@ public class ConfigConstants {
|
|||||||
public static String getPdfPrintDisable() {
|
public static String getPdfPrintDisable() {
|
||||||
return pdfPrintDisable;
|
return pdfPrintDisable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${pdf.print.disable:true}")
|
@Value("${pdf.print.disable:true}")
|
||||||
public void setPdfPrintDisable(String pdfPrintDisable) {
|
public void setPdfPrintDisable(String pdfPrintDisable) {
|
||||||
setPdfPrintDisableValue(pdfPrintDisable);
|
setPdfPrintDisableValue(pdfPrintDisable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPdfPrintDisableValue(String pdfPrintDisable) {
|
public static void setPdfPrintDisableValue(String pdfPrintDisable) {
|
||||||
ConfigConstants.pdfPrintDisable = pdfPrintDisable;
|
ConfigConstants.pdfPrintDisable = pdfPrintDisable;
|
||||||
}
|
}
|
||||||
@ -346,6 +369,7 @@ public class ConfigConstants {
|
|||||||
public void setPdfDownloadDisable(String pdfDownloadDisable) {
|
public void setPdfDownloadDisable(String pdfDownloadDisable) {
|
||||||
setPdfDownloadDisableValue(pdfDownloadDisable);
|
setPdfDownloadDisableValue(pdfDownloadDisable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPdfDownloadDisableValue(String pdfDownloadDisable) {
|
public static void setPdfDownloadDisableValue(String pdfDownloadDisable) {
|
||||||
ConfigConstants.pdfDownloadDisable = pdfDownloadDisable;
|
ConfigConstants.pdfDownloadDisable = pdfDownloadDisable;
|
||||||
}
|
}
|
||||||
@ -353,10 +377,12 @@ public class ConfigConstants {
|
|||||||
public static String getPdfBookmarkDisable() {
|
public static String getPdfBookmarkDisable() {
|
||||||
return pdfBookmarkDisable;
|
return pdfBookmarkDisable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${pdf.bookmark.disable:true}")
|
@Value("${pdf.bookmark.disable:true}")
|
||||||
public void setPdfBookmarkDisable(String pdfBookmarkDisable) {
|
public void setPdfBookmarkDisable(String pdfBookmarkDisable) {
|
||||||
setPdfBookmarkDisableValue(pdfBookmarkDisable);
|
setPdfBookmarkDisableValue(pdfBookmarkDisable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPdfBookmarkDisableValue(String pdfBookmarkDisable) {
|
public static void setPdfBookmarkDisableValue(String pdfBookmarkDisable) {
|
||||||
ConfigConstants.pdfBookmarkDisable = pdfBookmarkDisable;
|
ConfigConstants.pdfBookmarkDisable = pdfBookmarkDisable;
|
||||||
}
|
}
|
||||||
@ -365,10 +391,12 @@ public class ConfigConstants {
|
|||||||
public static String getPdfDisableEditing() {
|
public static String getPdfDisableEditing() {
|
||||||
return pdfDisableEditing;
|
return pdfDisableEditing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${pdf.disable.editing:true}")
|
@Value("${pdf.disable.editing:true}")
|
||||||
public void setpdfDisableEditing(String pdfDisableEditing) {
|
public void setpdfDisableEditing(String pdfDisableEditing) {
|
||||||
setPdfDisableEditingValue(pdfDisableEditing);
|
setPdfDisableEditingValue(pdfDisableEditing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPdfDisableEditingValue(String pdfDisableEditing) {
|
public static void setPdfDisableEditingValue(String pdfDisableEditing) {
|
||||||
ConfigConstants.pdfDisableEditing = pdfDisableEditing;
|
ConfigConstants.pdfDisableEditing = pdfDisableEditing;
|
||||||
}
|
}
|
||||||
@ -376,10 +404,12 @@ public class ConfigConstants {
|
|||||||
public static String getOfficePreviewSwitchDisabled() {
|
public static String getOfficePreviewSwitchDisabled() {
|
||||||
return officePreviewSwitchDisabled;
|
return officePreviewSwitchDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.preview.switch.disabled:true}")
|
@Value("${office.preview.switch.disabled:true}")
|
||||||
public void setOfficePreviewSwitchDisabled(String officePreviewSwitchDisabled) {
|
public void setOfficePreviewSwitchDisabled(String officePreviewSwitchDisabled) {
|
||||||
ConfigConstants.officePreviewSwitchDisabled = officePreviewSwitchDisabled;
|
ConfigConstants.officePreviewSwitchDisabled = officePreviewSwitchDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficePreviewSwitchDisabledValue(String officePreviewSwitchDisabled) {
|
public static void setOfficePreviewSwitchDisabledValue(String officePreviewSwitchDisabled) {
|
||||||
ConfigConstants.officePreviewSwitchDisabled = officePreviewSwitchDisabled;
|
ConfigConstants.officePreviewSwitchDisabled = officePreviewSwitchDisabled;
|
||||||
}
|
}
|
||||||
@ -414,6 +444,7 @@ public class ConfigConstants {
|
|||||||
public static String[] getProhibit() {
|
public static String[] getProhibit() {
|
||||||
return prohibit;
|
return prohibit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${prohibit:exe,dll}")
|
@Value("${prohibit:exe,dll}")
|
||||||
public void setProhibit(String prohibit) {
|
public void setProhibit(String prohibit) {
|
||||||
String[] prohibitArr = prohibit.split(",");
|
String[] prohibitArr = prohibit.split(",");
|
||||||
@ -423,13 +454,16 @@ public class ConfigConstants {
|
|||||||
public static void setProhibitValue(String[] prohibit) {
|
public static void setProhibitValue(String[] prohibit) {
|
||||||
ConfigConstants.prohibit = prohibit;
|
ConfigConstants.prohibit = prohibit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String maxSize() {
|
public static String maxSize() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${spring.servlet.multipart.max-file-size:500MB}")
|
@Value("${spring.servlet.multipart.max-file-size:500MB}")
|
||||||
public void setSize(String size) {
|
public void setSize(String size) {
|
||||||
setSizeValue(size);
|
setSizeValue(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSizeValue(String size) {
|
public static void setSizeValue(String size) {
|
||||||
ConfigConstants.size = size;
|
ConfigConstants.size = size;
|
||||||
}
|
}
|
||||||
@ -437,10 +471,12 @@ public class ConfigConstants {
|
|||||||
public static String getPassword() {
|
public static String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${delete.password:123456}")
|
@Value("${delete.password:123456}")
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
setPasswordValue(password);
|
setPasswordValue(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPasswordValue(String password) {
|
public static void setPasswordValue(String password) {
|
||||||
ConfigConstants.password = password;
|
ConfigConstants.password = password;
|
||||||
}
|
}
|
||||||
@ -449,10 +485,12 @@ public class ConfigConstants {
|
|||||||
public static int getPdf2JpgDpi() {
|
public static int getPdf2JpgDpi() {
|
||||||
return pdf2JpgDpi;
|
return pdf2JpgDpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${pdf2jpg.dpi:105}")
|
@Value("${pdf2jpg.dpi:105}")
|
||||||
public void pdf2JpgDpi(int pdf2JpgDpi) {
|
public void pdf2JpgDpi(int pdf2JpgDpi) {
|
||||||
setPdf2JpgDpiValue(pdf2JpgDpi);
|
setPdf2JpgDpiValue(pdf2JpgDpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPdf2JpgDpiValue(int pdf2JpgDpi) {
|
public static void setPdf2JpgDpiValue(int pdf2JpgDpi) {
|
||||||
ConfigConstants.pdf2JpgDpi = pdf2JpgDpi;
|
ConfigConstants.pdf2JpgDpi = pdf2JpgDpi;
|
||||||
}
|
}
|
||||||
@ -460,10 +498,12 @@ public class ConfigConstants {
|
|||||||
public static String getOfficeTypeWeb() {
|
public static String getOfficeTypeWeb() {
|
||||||
return officeTypeWeb;
|
return officeTypeWeb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.type.web:web}")
|
@Value("${office.type.web:web}")
|
||||||
public void setOfficeTypeWeb(String officeTypeWeb) {
|
public void setOfficeTypeWeb(String officeTypeWeb) {
|
||||||
setOfficeTypeWebValue(officeTypeWeb);
|
setOfficeTypeWebValue(officeTypeWeb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficeTypeWebValue(String officeTypeWeb) {
|
public static void setOfficeTypeWebValue(String officeTypeWeb) {
|
||||||
ConfigConstants.officeTypeWeb = officeTypeWeb;
|
ConfigConstants.officeTypeWeb = officeTypeWeb;
|
||||||
}
|
}
|
||||||
@ -547,10 +587,12 @@ public class ConfigConstants {
|
|||||||
public static String getOfficePageRange() {
|
public static String getOfficePageRange() {
|
||||||
return officePageRange;
|
return officePageRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.pagerange:false}")
|
@Value("${office.pagerange:false}")
|
||||||
public void setOfficePageRange(String officePageRange) {
|
public void setOfficePageRange(String officePageRange) {
|
||||||
setOfficePageRangeValue(officePageRange);
|
setOfficePageRangeValue(officePageRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficePageRangeValue(String officePageRange) {
|
public static void setOfficePageRangeValue(String officePageRange) {
|
||||||
ConfigConstants.officePageRange = officePageRange;
|
ConfigConstants.officePageRange = officePageRange;
|
||||||
}
|
}
|
||||||
@ -558,10 +600,12 @@ public class ConfigConstants {
|
|||||||
public static String getOfficeWatermark() {
|
public static String getOfficeWatermark() {
|
||||||
return officeWatermark;
|
return officeWatermark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.watermark:false}")
|
@Value("${office.watermark:false}")
|
||||||
public void setOfficeWatermark(String officeWatermark) {
|
public void setOfficeWatermark(String officeWatermark) {
|
||||||
setOfficeWatermarkValue(officeWatermark);
|
setOfficeWatermarkValue(officeWatermark);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficeWatermarkValue(String officeWatermark) {
|
public static void setOfficeWatermarkValue(String officeWatermark) {
|
||||||
ConfigConstants.officeWatermark = officeWatermark;
|
ConfigConstants.officeWatermark = officeWatermark;
|
||||||
}
|
}
|
||||||
@ -569,10 +613,12 @@ public class ConfigConstants {
|
|||||||
public static String getOfficeQuality() {
|
public static String getOfficeQuality() {
|
||||||
return officeQuality;
|
return officeQuality;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.quality:80}")
|
@Value("${office.quality:80}")
|
||||||
public void setOfficeQuality(String officeQuality) {
|
public void setOfficeQuality(String officeQuality) {
|
||||||
setOfficeQualityValue(officeQuality);
|
setOfficeQualityValue(officeQuality);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficeQualityValue(String officeQuality) {
|
public static void setOfficeQualityValue(String officeQuality) {
|
||||||
ConfigConstants.officeQuality = officeQuality;
|
ConfigConstants.officeQuality = officeQuality;
|
||||||
}
|
}
|
||||||
@ -580,10 +626,12 @@ public class ConfigConstants {
|
|||||||
public static String getOfficeMaxImageResolution() {
|
public static String getOfficeMaxImageResolution() {
|
||||||
return officeMaxImageResolution;
|
return officeMaxImageResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.maximageresolution:150}")
|
@Value("${office.maximageresolution:150}")
|
||||||
public void setOfficeMaxImageResolution(String officeMaxImageResolution) {
|
public void setOfficeMaxImageResolution(String officeMaxImageResolution) {
|
||||||
setOfficeMaxImageResolutionValue(officeMaxImageResolution);
|
setOfficeMaxImageResolutionValue(officeMaxImageResolution);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficeMaxImageResolutionValue(String officeMaxImageResolution) {
|
public static void setOfficeMaxImageResolutionValue(String officeMaxImageResolution) {
|
||||||
ConfigConstants.officeMaxImageResolution = officeMaxImageResolution;
|
ConfigConstants.officeMaxImageResolution = officeMaxImageResolution;
|
||||||
}
|
}
|
||||||
@ -591,10 +639,12 @@ public class ConfigConstants {
|
|||||||
public static Boolean getOfficeExportBookmarks() {
|
public static Boolean getOfficeExportBookmarks() {
|
||||||
return officeExportBookmarks;
|
return officeExportBookmarks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.exportbookmarks:true}")
|
@Value("${office.exportbookmarks:true}")
|
||||||
public void setOfficeExportBookmarks(Boolean officeExportBookmarks) {
|
public void setOfficeExportBookmarks(Boolean officeExportBookmarks) {
|
||||||
setOfficeExportBookmarksValue(officeExportBookmarks);
|
setOfficeExportBookmarksValue(officeExportBookmarks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficeExportBookmarksValue(Boolean officeExportBookmarks) {
|
public static void setOfficeExportBookmarksValue(Boolean officeExportBookmarks) {
|
||||||
ConfigConstants.officeExportBookmarks = officeExportBookmarks;
|
ConfigConstants.officeExportBookmarks = officeExportBookmarks;
|
||||||
}
|
}
|
||||||
@ -602,10 +652,12 @@ public class ConfigConstants {
|
|||||||
public static Boolean getOfficeExportNotes() {
|
public static Boolean getOfficeExportNotes() {
|
||||||
return officeExportNotes;
|
return officeExportNotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.exportnotes:true}")
|
@Value("${office.exportnotes:true}")
|
||||||
public void setExportNotes(Boolean officeExportNotes) {
|
public void setExportNotes(Boolean officeExportNotes) {
|
||||||
setOfficeExportNotesValue(officeExportNotes);
|
setOfficeExportNotesValue(officeExportNotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficeExportNotesValue(Boolean officeExportNotes) {
|
public static void setOfficeExportNotesValue(Boolean officeExportNotes) {
|
||||||
ConfigConstants.officeExportNotes = officeExportNotes;
|
ConfigConstants.officeExportNotes = officeExportNotes;
|
||||||
}
|
}
|
||||||
@ -613,10 +665,12 @@ public class ConfigConstants {
|
|||||||
public static Boolean getOfficeDocumentOpenPasswords() {
|
public static Boolean getOfficeDocumentOpenPasswords() {
|
||||||
return officeDocumentOpenPasswords;
|
return officeDocumentOpenPasswords;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.documentopenpasswords:true}")
|
@Value("${office.documentopenpasswords:true}")
|
||||||
public void setDocumentOpenPasswords(Boolean officeDocumentOpenPasswords) {
|
public void setDocumentOpenPasswords(Boolean officeDocumentOpenPasswords) {
|
||||||
setOfficeDocumentOpenPasswordsValue(officeDocumentOpenPasswords);
|
setOfficeDocumentOpenPasswordsValue(officeDocumentOpenPasswords);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficeDocumentOpenPasswordsValue(Boolean officeDocumentOpenPasswords) {
|
public static void setOfficeDocumentOpenPasswordsValue(Boolean officeDocumentOpenPasswords) {
|
||||||
ConfigConstants.officeDocumentOpenPasswords = officeDocumentOpenPasswords;
|
ConfigConstants.officeDocumentOpenPasswords = officeDocumentOpenPasswords;
|
||||||
}
|
}
|
||||||
@ -628,56 +682,66 @@ public class ConfigConstants {
|
|||||||
public static String getBeian() {
|
public static String getBeian() {
|
||||||
return beian;
|
return beian;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${beian:default}")
|
@Value("${beian:default}")
|
||||||
public void setBeian(String beian) {
|
public void setBeian(String beian) {
|
||||||
setBeianValue(beian);
|
setBeianValue(beian);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBeianValue(String beian) {
|
public static void setBeianValue(String beian) {
|
||||||
ConfigConstants.beian = beian;
|
ConfigConstants.beian = beian;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String gethomePpageNumber() {
|
public static String getHomePageNumber() {
|
||||||
return homePpageNumber;
|
return homePageNumber;
|
||||||
}
|
|
||||||
@Value("${home.pagenumber:1}")
|
|
||||||
public void sethomePpageNumber(String homePpageNumber) {
|
|
||||||
sethomePpageNumberValue(homePpageNumber);
|
|
||||||
}
|
|
||||||
public static void sethomePpageNumberValue(String homePpageNumber) {
|
|
||||||
ConfigConstants.homePpageNumber = homePpageNumber;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String gethomePagination() {
|
@Value("${home.pagenumber:1}")
|
||||||
|
public void setHomePageNumber(String homePageNumber) {
|
||||||
|
setHomePageNumberValue(homePageNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setHomePageNumberValue(String homePageNumber) {
|
||||||
|
ConfigConstants.homePageNumber = homePageNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getHomePagination() {
|
||||||
return homePagination;
|
return homePagination;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${home.pagination:true}")
|
@Value("${home.pagination:true}")
|
||||||
public void sethomePagination(String homePagination) {
|
public void setHomePagination(String homePagination) {
|
||||||
sethomePaginationValue(homePagination);
|
setHomePaginationValue(homePagination);
|
||||||
}
|
}
|
||||||
public static void sethomePaginationValue(String homePagination) {
|
|
||||||
|
public static void setHomePaginationValue(String homePagination) {
|
||||||
ConfigConstants.homePagination = homePagination;
|
ConfigConstants.homePagination = homePagination;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String gethomePageSize() {
|
public static String getHomePageSize() {
|
||||||
return homePageSize;
|
return homePageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${home.pagesize:15}")
|
@Value("${home.pagesize:15}")
|
||||||
public void sethomePagesize(String homePageSize) {
|
public void setHomePageSize(String homePageSize) {
|
||||||
sethomePageSizeValue(homePageSize);
|
setHomePageSizeValue(homePageSize);
|
||||||
}
|
}
|
||||||
public static void sethomePageSizeValue(String homePageSize) {
|
|
||||||
|
public static void setHomePageSizeValue(String homePageSize) {
|
||||||
ConfigConstants.homePageSize = homePageSize;
|
ConfigConstants.homePageSize = homePageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String gethomeSearch() {
|
public static String getHomeSearch() {
|
||||||
return homeSearch;
|
return homeSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${home.search:1}")
|
@Value("${home.search:1}")
|
||||||
public void sethomeSearch(String homeSearch) {
|
public void setHomeSearch(String homeSearch) {
|
||||||
sethomeSearchValue(homeSearch);
|
setHomeSearchValue(homeSearch);
|
||||||
}
|
}
|
||||||
public static void sethomeSearchValue(String homeSearch) {
|
|
||||||
|
public static void setHomeSearchValue(String homeSearch) {
|
||||||
ConfigConstants.homeSearch = homeSearch;
|
ConfigConstants.homeSearch = homeSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ public class ConfigRefreshComponent {
|
|||||||
String configFilePath = ConfigUtils.getCustomizedConfigPath();
|
String configFilePath = ConfigUtils.getCustomizedConfigPath();
|
||||||
String baseUrl;
|
String baseUrl;
|
||||||
String trustHost;
|
String trustHost;
|
||||||
|
String notTrustHost;
|
||||||
String pdfPresentationModeDisable;
|
String pdfPresentationModeDisable;
|
||||||
String pdfOpenFileDisable;
|
String pdfOpenFileDisable;
|
||||||
String pdfPrintDisable;
|
String pdfPrintDisable;
|
||||||
@ -73,7 +74,7 @@ public class ConfigRefreshComponent {
|
|||||||
boolean officeDocumentOpenPasswords;
|
boolean officeDocumentOpenPasswords;
|
||||||
String cadTimeout;
|
String cadTimeout;
|
||||||
int cadThread;
|
int cadThread;
|
||||||
String homePpageNumber;
|
String homePageNumber;
|
||||||
String homePagination;
|
String homePagination;
|
||||||
String homePageSize;
|
String homePageSize;
|
||||||
String homeSearch;
|
String homeSearch;
|
||||||
@ -92,8 +93,9 @@ public class ConfigRefreshComponent {
|
|||||||
ftpControlEncoding = properties.getProperty("ftp.control.encoding", ConfigConstants.DEFAULT_FTP_CONTROL_ENCODING);
|
ftpControlEncoding = properties.getProperty("ftp.control.encoding", ConfigConstants.DEFAULT_FTP_CONTROL_ENCODING);
|
||||||
textArray = text.split(",");
|
textArray = text.split(",");
|
||||||
mediaArray = media.split(",");
|
mediaArray = media.split(",");
|
||||||
baseUrl = properties.getProperty("base.url", ConfigConstants.DEFAULT_BASE_URL);
|
baseUrl = properties.getProperty("base.url", ConfigConstants.DEFAULT_VALUE);
|
||||||
trustHost = properties.getProperty("trust.host", ConfigConstants.DEFAULT_TRUST_HOST);
|
trustHost = properties.getProperty("trust.host", ConfigConstants.DEFAULT_VALUE);
|
||||||
|
notTrustHost = properties.getProperty("not.trust.host", ConfigConstants.DEFAULT_VALUE);
|
||||||
pdfPresentationModeDisable = properties.getProperty("pdf.presentationMode.disable", ConfigConstants.DEFAULT_PDF_PRESENTATION_MODE_DISABLE);
|
pdfPresentationModeDisable = properties.getProperty("pdf.presentationMode.disable", ConfigConstants.DEFAULT_PDF_PRESENTATION_MODE_DISABLE);
|
||||||
pdfOpenFileDisable = properties.getProperty("pdf.openFile.disable", ConfigConstants.DEFAULT_PDF_OPEN_FILE_DISABLE);
|
pdfOpenFileDisable = properties.getProperty("pdf.openFile.disable", ConfigConstants.DEFAULT_PDF_OPEN_FILE_DISABLE);
|
||||||
pdfPrintDisable = properties.getProperty("pdf.print.disable", ConfigConstants.DEFAULT_PDF_PRINT_DISABLE);
|
pdfPrintDisable = properties.getProperty("pdf.print.disable", ConfigConstants.DEFAULT_PDF_PRINT_DISABLE);
|
||||||
@ -119,7 +121,7 @@ public class ConfigRefreshComponent {
|
|||||||
officeExportNotes = Boolean.parseBoolean(properties.getProperty("office.exportnotes", ConfigConstants.DEFAULT_OFFICE_EXPORTNOTES));
|
officeExportNotes = Boolean.parseBoolean(properties.getProperty("office.exportnotes", ConfigConstants.DEFAULT_OFFICE_EXPORTNOTES));
|
||||||
officeDocumentOpenPasswords = Boolean.parseBoolean(properties.getProperty("office.documentopenpasswords", ConfigConstants.DEFAULT_OFFICE_EOCUMENTOPENPASSWORDS));
|
officeDocumentOpenPasswords = Boolean.parseBoolean(properties.getProperty("office.documentopenpasswords", ConfigConstants.DEFAULT_OFFICE_EOCUMENTOPENPASSWORDS));
|
||||||
cadTimeout = properties.getProperty("cad.timeout", ConfigConstants.DEFAULT_CAD_TIMEOUT);
|
cadTimeout = properties.getProperty("cad.timeout", ConfigConstants.DEFAULT_CAD_TIMEOUT);
|
||||||
homePpageNumber = properties.getProperty("home.pagenumber", ConfigConstants.DEFAULT_HOME_PAGENUMBER);
|
homePageNumber = properties.getProperty("home.pagenumber", ConfigConstants.DEFAULT_HOME_PAGENUMBER);
|
||||||
homePagination = properties.getProperty("home.pagination", ConfigConstants.DEFAULT_HOME_PAGINATION);
|
homePagination = properties.getProperty("home.pagination", ConfigConstants.DEFAULT_HOME_PAGINATION);
|
||||||
homePageSize = properties.getProperty("home.pagesize", ConfigConstants.DEFAULT_HOME_PAGSIZE);
|
homePageSize = properties.getProperty("home.pagesize", ConfigConstants.DEFAULT_HOME_PAGSIZE);
|
||||||
homeSearch = properties.getProperty("home.search", ConfigConstants.DEFAULT_HOME_SEARCH);
|
homeSearch = properties.getProperty("home.search", ConfigConstants.DEFAULT_HOME_SEARCH);
|
||||||
@ -135,6 +137,7 @@ public class ConfigRefreshComponent {
|
|||||||
ConfigConstants.setFtpControlEncodingValue(ftpControlEncoding);
|
ConfigConstants.setFtpControlEncodingValue(ftpControlEncoding);
|
||||||
ConfigConstants.setBaseUrlValue(baseUrl);
|
ConfigConstants.setBaseUrlValue(baseUrl);
|
||||||
ConfigConstants.setTrustHostValue(trustHost);
|
ConfigConstants.setTrustHostValue(trustHost);
|
||||||
|
ConfigConstants.setNotTrustHostValue(notTrustHost);
|
||||||
ConfigConstants.setOfficePreviewSwitchDisabledValue(officePreviewSwitchDisabled);
|
ConfigConstants.setOfficePreviewSwitchDisabledValue(officePreviewSwitchDisabled);
|
||||||
ConfigConstants.setPdfPresentationModeDisableValue(pdfPresentationModeDisable);
|
ConfigConstants.setPdfPresentationModeDisableValue(pdfPresentationModeDisable);
|
||||||
ConfigConstants.setPdfOpenFileDisableValue(pdfOpenFileDisable);
|
ConfigConstants.setPdfOpenFileDisableValue(pdfOpenFileDisable);
|
||||||
@ -162,10 +165,10 @@ public class ConfigRefreshComponent {
|
|||||||
ConfigConstants.setDeleteCaptchaValue(deleteCaptcha);
|
ConfigConstants.setDeleteCaptchaValue(deleteCaptcha);
|
||||||
ConfigConstants.setCadTimeoutValue(cadTimeout);
|
ConfigConstants.setCadTimeoutValue(cadTimeout);
|
||||||
ConfigConstants.setCadThreadValue(cadThread);
|
ConfigConstants.setCadThreadValue(cadThread);
|
||||||
ConfigConstants.sethomePpageNumberValue(homePpageNumber);
|
ConfigConstants.setHomePageNumberValue(homePageNumber);
|
||||||
ConfigConstants.sethomePaginationValue(homePagination);
|
ConfigConstants.setHomePaginationValue(homePagination);
|
||||||
ConfigConstants.sethomePageSizeValue(homePageSize);
|
ConfigConstants.setHomePageSizeValue(homePageSize);
|
||||||
ConfigConstants.sethomeSearchValue(homeSearch);
|
ConfigConstants.setHomeSearchValue(homeSearch);
|
||||||
setWatermarkConfig(properties);
|
setWatermarkConfig(properties);
|
||||||
bufferedReader.close();
|
bufferedReader.close();
|
||||||
fileReader.close();
|
fileReader.close();
|
||||||
|
@ -43,10 +43,10 @@ public class AttributeSetFilter implements Filter {
|
|||||||
request.setAttribute("beian", ConfigConstants.getBeian());
|
request.setAttribute("beian", ConfigConstants.getBeian());
|
||||||
request.setAttribute("size", ConfigConstants.maxSize());
|
request.setAttribute("size", ConfigConstants.maxSize());
|
||||||
request.setAttribute("deleteCaptcha", ConfigConstants.getDeleteCaptcha());
|
request.setAttribute("deleteCaptcha", ConfigConstants.getDeleteCaptcha());
|
||||||
request.setAttribute("homePpageNumber", ConfigConstants.gethomePpageNumber());
|
request.setAttribute("homePageNumber", ConfigConstants.getHomePageNumber());
|
||||||
request.setAttribute("homePagination", ConfigConstants.gethomePagination());
|
request.setAttribute("homePagination", ConfigConstants.getHomePagination());
|
||||||
request.setAttribute("homePageSize", ConfigConstants.gethomePageSize());
|
request.setAttribute("homePageSize", ConfigConstants.getHomePageSize());
|
||||||
request.setAttribute("homeSearch", ConfigConstants.gethomeSearch());
|
request.setAttribute("homeSearch", ConfigConstants.getHomeSearch());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,7 @@ public class BaseUrlFilter implements Filter {
|
|||||||
final String urlInHeader = servletRequest.getHeader("X-Base-Url");
|
final String urlInHeader = servletRequest.getHeader("X-Base-Url");
|
||||||
if (StringUtils.isNotEmpty(urlInHeader)) {
|
if (StringUtils.isNotEmpty(urlInHeader)) {
|
||||||
baseUrl = urlInHeader;
|
baseUrl = urlInHeader;
|
||||||
} else if (configBaseUrl != null && !ConfigConstants.DEFAULT_BASE_URL.equalsIgnoreCase(configBaseUrl)) {
|
} else if (configBaseUrl != null && !ConfigConstants.DEFAULT_VALUE.equalsIgnoreCase(configBaseUrl)) {
|
||||||
//2、如果配置文件中配置了 baseUrl 且不为 default 则以配置文件为准
|
//2、如果配置文件中配置了 baseUrl 且不为 default 则以配置文件为准
|
||||||
baseUrl = configBaseUrl;
|
baseUrl = configBaseUrl;
|
||||||
} else {
|
} else {
|
||||||
|
@ -19,7 +19,7 @@ import org.springframework.util.FileCopyUtils;
|
|||||||
*/
|
*/
|
||||||
public class TrustHostFilter implements Filter {
|
public class TrustHostFilter implements Filter {
|
||||||
|
|
||||||
private String notTrustHost;
|
private String notTrustHostHtmlView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(FilterConfig filterConfig) {
|
public void init(FilterConfig filterConfig) {
|
||||||
@ -27,7 +27,7 @@ public class TrustHostFilter implements Filter {
|
|||||||
try {
|
try {
|
||||||
classPathResource.getInputStream();
|
classPathResource.getInputStream();
|
||||||
byte[] bytes = FileCopyUtils.copyToByteArray(classPathResource.getInputStream());
|
byte[] bytes = FileCopyUtils.copyToByteArray(classPathResource.getInputStream());
|
||||||
this.notTrustHost = new String(bytes, StandardCharsets.UTF_8);
|
this.notTrustHostHtmlView = new String(bytes, StandardCharsets.UTF_8);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -37,16 +37,24 @@ public class TrustHostFilter implements Filter {
|
|||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||||
String url = WebUtils.getSourceUrl(request);
|
String url = WebUtils.getSourceUrl(request);
|
||||||
String host = WebUtils.getHost(url);
|
String host = WebUtils.getHost(url);
|
||||||
if (host != null &&!ConfigConstants.getTrustHostSet().isEmpty() && !ConfigConstants.getTrustHostSet().contains(host)) {
|
assert host != null;
|
||||||
String html = this.notTrustHost.replace("${current_host}", host);
|
if (!isTrustHost(host) || isNotTrustHost(host)) {
|
||||||
|
String html = this.notTrustHostHtmlView.replace("${current_host}", host);
|
||||||
response.getWriter().write(html);
|
response.getWriter().write(html);
|
||||||
response.getWriter().close();
|
response.getWriter().close();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTrustHost(String host) {
|
||||||
|
return !ConfigConstants.getTrustHostSet().isEmpty() && ConfigConstants.getTrustHostSet().contains(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNotTrustHost(String host) {
|
||||||
|
return !ConfigConstants.getNotTrustHostSet().isEmpty() && ConfigConstants.getNotTrustHostSet().contains(host);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
$('#table').bootstrapTable({
|
$('#table').bootstrapTable({
|
||||||
url: 'listFiles',
|
url: 'listFiles',
|
||||||
pageNumber: ${homePpageNumber},//初始化加载第一页
|
pageNumber: ${homePageNumber},//初始化加载第一页
|
||||||
pageSize:${homePageSize}, //初始化单页记录数
|
pageSize:${homePageSize}, //初始化单页记录数
|
||||||
pagination: ${homePagination}, //是否分页
|
pagination: ${homePagination}, //是否分页
|
||||||
pageList: [5, 10, 20, 30, 50, 100, 200, 500],
|
pageList: [5, 10, 20, 30, 50, 100, 200, 500],
|
||||||
|
Loading…
Reference in New Issue
Block a user