mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2025-04-04 23:39:25 +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 = ${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}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||
@Component(value = ConfigConstants.BEAN_NAME)
|
||||
public class ConfigConstants {
|
||||
public static final String BEAN_NAME = "configConstants";
|
||||
|
||||
static {
|
||||
//pdfbox兼容低版本jdk
|
||||
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 localPreviewDir;
|
||||
private static CopyOnWriteArraySet<String> trustHostSet;
|
||||
private static CopyOnWriteArraySet<String> notTrustHostSet;
|
||||
private static String pdfPresentationModeDisable;
|
||||
private static String pdfDisableEditing;
|
||||
private static String pdfOpenFileDisable;
|
||||
@ -61,7 +63,7 @@ public class ConfigConstants {
|
||||
private static Boolean officeDocumentOpenPasswords;
|
||||
private static String cadTimeout;
|
||||
private static int cadThread;
|
||||
private static String homePpageNumber;
|
||||
private static String homePageNumber;
|
||||
private static String homePagination;
|
||||
private static String homePageSize;
|
||||
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_PASSWORD = null;
|
||||
public static final String DEFAULT_FTP_CONTROL_ENCODING = "UTF-8";
|
||||
public static final String DEFAULT_BASE_URL = "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_VALUE = "default";
|
||||
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_PRINT_DISABLE = "true";
|
||||
@ -108,6 +107,7 @@ public class ConfigConstants {
|
||||
public static final String DEFAULT_HOME_PAGINATION = "true";
|
||||
public static final String DEFAULT_HOME_PAGSIZE = "15";
|
||||
public static final String DEFAULT_HOME_SEARCH = "true";
|
||||
|
||||
public static Boolean isCacheEnabled() {
|
||||
return cacheEnabled;
|
||||
}
|
||||
@ -172,6 +172,7 @@ public class ConfigConstants {
|
||||
public void setMediaConvertDisable(String mediaConvertDisable) {
|
||||
setMediaConvertDisableValue(mediaConvertDisable);
|
||||
}
|
||||
|
||||
public static void setMediaConvertDisableValue(String mediaConvertDisable) {
|
||||
ConfigConstants.mediaConvertDisable = mediaConvertDisable;
|
||||
}
|
||||
@ -251,7 +252,7 @@ public class ConfigConstants {
|
||||
}
|
||||
|
||||
public static void setFileDirValue(String fileDir) {
|
||||
if (!DEFAULT_FILE_DIR_VALUE.equalsIgnoreCase(fileDir)) {
|
||||
if (!DEFAULT_VALUE.equalsIgnoreCase(fileDir)) {
|
||||
if (!fileDir.endsWith(File.separator)) {
|
||||
fileDir = fileDir + File.separator;
|
||||
}
|
||||
@ -269,7 +270,7 @@ public class ConfigConstants {
|
||||
}
|
||||
|
||||
public static void setLocalPreviewDirValue(String localPreviewDir) {
|
||||
if (!DEFAULT_LOCAL_PREVIEW_DIR_VALUE.equals(localPreviewDir)) {
|
||||
if (!DEFAULT_VALUE.equals(localPreviewDir)) {
|
||||
if (!localPreviewDir.endsWith(File.separator)) {
|
||||
localPreviewDir = localPreviewDir + File.separator;
|
||||
}
|
||||
@ -279,19 +280,29 @@ public class ConfigConstants {
|
||||
|
||||
@Value("${trust.host:default}")
|
||||
public void setTrustHost(String trustHost) {
|
||||
setTrustHostValue(trustHost);
|
||||
setTrustHostSet(getHostValue(trustHost));
|
||||
}
|
||||
|
||||
public static void setTrustHostValue(String trustHost) {
|
||||
CopyOnWriteArraySet<String> trustHostSet;
|
||||
if (DEFAULT_TRUST_HOST.equalsIgnoreCase(trustHost)) {
|
||||
trustHostSet = new CopyOnWriteArraySet<>();
|
||||
public static void setTrustHostValue(String trustHost){
|
||||
setTrustHostSet(getHostValue(trustHost));
|
||||
}
|
||||
|
||||
@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 {
|
||||
String[] trustHostArray = trustHost.toLowerCase().split(",");
|
||||
trustHostSet = new CopyOnWriteArraySet<>(Arrays.asList(trustHostArray));
|
||||
setTrustHostSet(trustHostSet);
|
||||
return new CopyOnWriteArraySet<>(Arrays.asList(trustHostArray));
|
||||
}
|
||||
setTrustHostSet(trustHostSet);
|
||||
}
|
||||
|
||||
public static Set<String> getTrustHostSet() {
|
||||
@ -302,6 +313,15 @@ public class ConfigConstants {
|
||||
ConfigConstants.trustHostSet = trustHostSet;
|
||||
}
|
||||
|
||||
public static Set<String> getNotTrustHostSet() {
|
||||
return notTrustHostSet;
|
||||
}
|
||||
|
||||
public static void setNotTrustHostSet(CopyOnWriteArraySet<String> notTrustHostSet) {
|
||||
ConfigConstants.notTrustHostSet = notTrustHostSet;
|
||||
}
|
||||
|
||||
|
||||
public static String getPdfPresentationModeDisable() {
|
||||
return pdfPresentationModeDisable;
|
||||
}
|
||||
@ -323,6 +343,7 @@ public class ConfigConstants {
|
||||
public void setPdfOpenFileDisable(String pdfOpenFileDisable) {
|
||||
setPdfOpenFileDisableValue(pdfOpenFileDisable);
|
||||
}
|
||||
|
||||
public static void setPdfOpenFileDisableValue(String pdfOpenFileDisable) {
|
||||
ConfigConstants.pdfOpenFileDisable = pdfOpenFileDisable;
|
||||
}
|
||||
@ -330,10 +351,12 @@ public class ConfigConstants {
|
||||
public static String getPdfPrintDisable() {
|
||||
return pdfPrintDisable;
|
||||
}
|
||||
|
||||
@Value("${pdf.print.disable:true}")
|
||||
public void setPdfPrintDisable(String pdfPrintDisable) {
|
||||
setPdfPrintDisableValue(pdfPrintDisable);
|
||||
}
|
||||
|
||||
public static void setPdfPrintDisableValue(String pdfPrintDisable) {
|
||||
ConfigConstants.pdfPrintDisable = pdfPrintDisable;
|
||||
}
|
||||
@ -346,6 +369,7 @@ public class ConfigConstants {
|
||||
public void setPdfDownloadDisable(String pdfDownloadDisable) {
|
||||
setPdfDownloadDisableValue(pdfDownloadDisable);
|
||||
}
|
||||
|
||||
public static void setPdfDownloadDisableValue(String pdfDownloadDisable) {
|
||||
ConfigConstants.pdfDownloadDisable = pdfDownloadDisable;
|
||||
}
|
||||
@ -353,10 +377,12 @@ public class ConfigConstants {
|
||||
public static String getPdfBookmarkDisable() {
|
||||
return pdfBookmarkDisable;
|
||||
}
|
||||
|
||||
@Value("${pdf.bookmark.disable:true}")
|
||||
public void setPdfBookmarkDisable(String pdfBookmarkDisable) {
|
||||
setPdfBookmarkDisableValue(pdfBookmarkDisable);
|
||||
}
|
||||
|
||||
public static void setPdfBookmarkDisableValue(String pdfBookmarkDisable) {
|
||||
ConfigConstants.pdfBookmarkDisable = pdfBookmarkDisable;
|
||||
}
|
||||
@ -365,10 +391,12 @@ public class ConfigConstants {
|
||||
public static String getPdfDisableEditing() {
|
||||
return pdfDisableEditing;
|
||||
}
|
||||
|
||||
@Value("${pdf.disable.editing:true}")
|
||||
public void setpdfDisableEditing(String pdfDisableEditing) {
|
||||
setPdfDisableEditingValue(pdfDisableEditing);
|
||||
}
|
||||
|
||||
public static void setPdfDisableEditingValue(String pdfDisableEditing) {
|
||||
ConfigConstants.pdfDisableEditing = pdfDisableEditing;
|
||||
}
|
||||
@ -376,10 +404,12 @@ public class ConfigConstants {
|
||||
public static String getOfficePreviewSwitchDisabled() {
|
||||
return officePreviewSwitchDisabled;
|
||||
}
|
||||
|
||||
@Value("${office.preview.switch.disabled:true}")
|
||||
public void setOfficePreviewSwitchDisabled(String officePreviewSwitchDisabled) {
|
||||
ConfigConstants.officePreviewSwitchDisabled = officePreviewSwitchDisabled;
|
||||
}
|
||||
|
||||
public static void setOfficePreviewSwitchDisabledValue(String officePreviewSwitchDisabled) {
|
||||
ConfigConstants.officePreviewSwitchDisabled = officePreviewSwitchDisabled;
|
||||
}
|
||||
@ -414,6 +444,7 @@ public class ConfigConstants {
|
||||
public static String[] getProhibit() {
|
||||
return prohibit;
|
||||
}
|
||||
|
||||
@Value("${prohibit:exe,dll}")
|
||||
public void setProhibit(String prohibit) {
|
||||
String[] prohibitArr = prohibit.split(",");
|
||||
@ -423,13 +454,16 @@ public class ConfigConstants {
|
||||
public static void setProhibitValue(String[] prohibit) {
|
||||
ConfigConstants.prohibit = prohibit;
|
||||
}
|
||||
|
||||
public static String maxSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Value("${spring.servlet.multipart.max-file-size:500MB}")
|
||||
public void setSize(String size) {
|
||||
setSizeValue(size);
|
||||
}
|
||||
|
||||
public static void setSizeValue(String size) {
|
||||
ConfigConstants.size = size;
|
||||
}
|
||||
@ -437,10 +471,12 @@ public class ConfigConstants {
|
||||
public static String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@Value("${delete.password:123456}")
|
||||
public void setPassword(String password) {
|
||||
setPasswordValue(password);
|
||||
}
|
||||
|
||||
public static void setPasswordValue(String password) {
|
||||
ConfigConstants.password = password;
|
||||
}
|
||||
@ -449,10 +485,12 @@ public class ConfigConstants {
|
||||
public static int getPdf2JpgDpi() {
|
||||
return pdf2JpgDpi;
|
||||
}
|
||||
|
||||
@Value("${pdf2jpg.dpi:105}")
|
||||
public void pdf2JpgDpi(int pdf2JpgDpi) {
|
||||
setPdf2JpgDpiValue(pdf2JpgDpi);
|
||||
}
|
||||
|
||||
public static void setPdf2JpgDpiValue(int pdf2JpgDpi) {
|
||||
ConfigConstants.pdf2JpgDpi = pdf2JpgDpi;
|
||||
}
|
||||
@ -460,10 +498,12 @@ public class ConfigConstants {
|
||||
public static String getOfficeTypeWeb() {
|
||||
return officeTypeWeb;
|
||||
}
|
||||
|
||||
@Value("${office.type.web:web}")
|
||||
public void setOfficeTypeWeb(String officeTypeWeb) {
|
||||
setOfficeTypeWebValue(officeTypeWeb);
|
||||
}
|
||||
|
||||
public static void setOfficeTypeWebValue(String officeTypeWeb) {
|
||||
ConfigConstants.officeTypeWeb = officeTypeWeb;
|
||||
}
|
||||
@ -547,10 +587,12 @@ public class ConfigConstants {
|
||||
public static String getOfficePageRange() {
|
||||
return officePageRange;
|
||||
}
|
||||
|
||||
@Value("${office.pagerange:false}")
|
||||
public void setOfficePageRange(String officePageRange) {
|
||||
setOfficePageRangeValue(officePageRange);
|
||||
}
|
||||
|
||||
public static void setOfficePageRangeValue(String officePageRange) {
|
||||
ConfigConstants.officePageRange = officePageRange;
|
||||
}
|
||||
@ -558,10 +600,12 @@ public class ConfigConstants {
|
||||
public static String getOfficeWatermark() {
|
||||
return officeWatermark;
|
||||
}
|
||||
|
||||
@Value("${office.watermark:false}")
|
||||
public void setOfficeWatermark(String officeWatermark) {
|
||||
setOfficeWatermarkValue(officeWatermark);
|
||||
}
|
||||
|
||||
public static void setOfficeWatermarkValue(String officeWatermark) {
|
||||
ConfigConstants.officeWatermark = officeWatermark;
|
||||
}
|
||||
@ -569,10 +613,12 @@ public class ConfigConstants {
|
||||
public static String getOfficeQuality() {
|
||||
return officeQuality;
|
||||
}
|
||||
|
||||
@Value("${office.quality:80}")
|
||||
public void setOfficeQuality(String officeQuality) {
|
||||
setOfficeQualityValue(officeQuality);
|
||||
}
|
||||
|
||||
public static void setOfficeQualityValue(String officeQuality) {
|
||||
ConfigConstants.officeQuality = officeQuality;
|
||||
}
|
||||
@ -580,10 +626,12 @@ public class ConfigConstants {
|
||||
public static String getOfficeMaxImageResolution() {
|
||||
return officeMaxImageResolution;
|
||||
}
|
||||
|
||||
@Value("${office.maximageresolution:150}")
|
||||
public void setOfficeMaxImageResolution(String officeMaxImageResolution) {
|
||||
setOfficeMaxImageResolutionValue(officeMaxImageResolution);
|
||||
}
|
||||
|
||||
public static void setOfficeMaxImageResolutionValue(String officeMaxImageResolution) {
|
||||
ConfigConstants.officeMaxImageResolution = officeMaxImageResolution;
|
||||
}
|
||||
@ -591,10 +639,12 @@ public class ConfigConstants {
|
||||
public static Boolean getOfficeExportBookmarks() {
|
||||
return officeExportBookmarks;
|
||||
}
|
||||
|
||||
@Value("${office.exportbookmarks:true}")
|
||||
public void setOfficeExportBookmarks(Boolean officeExportBookmarks) {
|
||||
setOfficeExportBookmarksValue(officeExportBookmarks);
|
||||
}
|
||||
|
||||
public static void setOfficeExportBookmarksValue(Boolean officeExportBookmarks) {
|
||||
ConfigConstants.officeExportBookmarks = officeExportBookmarks;
|
||||
}
|
||||
@ -602,10 +652,12 @@ public class ConfigConstants {
|
||||
public static Boolean getOfficeExportNotes() {
|
||||
return officeExportNotes;
|
||||
}
|
||||
|
||||
@Value("${office.exportnotes:true}")
|
||||
public void setExportNotes(Boolean officeExportNotes) {
|
||||
setOfficeExportNotesValue(officeExportNotes);
|
||||
}
|
||||
|
||||
public static void setOfficeExportNotesValue(Boolean officeExportNotes) {
|
||||
ConfigConstants.officeExportNotes = officeExportNotes;
|
||||
}
|
||||
@ -613,10 +665,12 @@ public class ConfigConstants {
|
||||
public static Boolean getOfficeDocumentOpenPasswords() {
|
||||
return officeDocumentOpenPasswords;
|
||||
}
|
||||
|
||||
@Value("${office.documentopenpasswords:true}")
|
||||
public void setDocumentOpenPasswords(Boolean officeDocumentOpenPasswords) {
|
||||
setOfficeDocumentOpenPasswordsValue(officeDocumentOpenPasswords);
|
||||
}
|
||||
|
||||
public static void setOfficeDocumentOpenPasswordsValue(Boolean officeDocumentOpenPasswords) {
|
||||
ConfigConstants.officeDocumentOpenPasswords = officeDocumentOpenPasswords;
|
||||
}
|
||||
@ -628,56 +682,66 @@ public class ConfigConstants {
|
||||
public static String getBeian() {
|
||||
return beian;
|
||||
}
|
||||
|
||||
@Value("${beian:default}")
|
||||
public void setBeian(String beian) {
|
||||
setBeianValue(beian);
|
||||
}
|
||||
|
||||
public static void setBeianValue(String beian) {
|
||||
ConfigConstants.beian = beian;
|
||||
}
|
||||
|
||||
|
||||
public static String gethomePpageNumber() {
|
||||
return homePpageNumber;
|
||||
}
|
||||
@Value("${home.pagenumber:1}")
|
||||
public void sethomePpageNumber(String homePpageNumber) {
|
||||
sethomePpageNumberValue(homePpageNumber);
|
||||
}
|
||||
public static void sethomePpageNumberValue(String homePpageNumber) {
|
||||
ConfigConstants.homePpageNumber = homePpageNumber;
|
||||
public static String getHomePageNumber() {
|
||||
return homePageNumber;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Value("${home.pagination:true}")
|
||||
public void sethomePagination(String homePagination) {
|
||||
sethomePaginationValue(homePagination);
|
||||
public void setHomePagination(String homePagination) {
|
||||
setHomePaginationValue(homePagination);
|
||||
}
|
||||
public static void sethomePaginationValue(String homePagination) {
|
||||
|
||||
public static void setHomePaginationValue(String homePagination) {
|
||||
ConfigConstants.homePagination = homePagination;
|
||||
}
|
||||
|
||||
public static String gethomePageSize() {
|
||||
public static String getHomePageSize() {
|
||||
return homePageSize;
|
||||
}
|
||||
|
||||
@Value("${home.pagesize:15}")
|
||||
public void sethomePagesize(String homePageSize) {
|
||||
sethomePageSizeValue(homePageSize);
|
||||
public void setHomePageSize(String homePageSize) {
|
||||
setHomePageSizeValue(homePageSize);
|
||||
}
|
||||
public static void sethomePageSizeValue(String homePageSize) {
|
||||
|
||||
public static void setHomePageSizeValue(String homePageSize) {
|
||||
ConfigConstants.homePageSize = homePageSize;
|
||||
}
|
||||
|
||||
public static String gethomeSearch() {
|
||||
public static String getHomeSearch() {
|
||||
return homeSearch;
|
||||
}
|
||||
|
||||
@Value("${home.search:1}")
|
||||
public void sethomeSearch(String homeSearch) {
|
||||
sethomeSearchValue(homeSearch);
|
||||
public void setHomeSearch(String homeSearch) {
|
||||
setHomeSearchValue(homeSearch);
|
||||
}
|
||||
public static void sethomeSearchValue(String homeSearch) {
|
||||
|
||||
public static void setHomeSearchValue(String homeSearch) {
|
||||
ConfigConstants.homeSearch = homeSearch;
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ public class ConfigRefreshComponent {
|
||||
String configFilePath = ConfigUtils.getCustomizedConfigPath();
|
||||
String baseUrl;
|
||||
String trustHost;
|
||||
String notTrustHost;
|
||||
String pdfPresentationModeDisable;
|
||||
String pdfOpenFileDisable;
|
||||
String pdfPrintDisable;
|
||||
@ -73,7 +74,7 @@ public class ConfigRefreshComponent {
|
||||
boolean officeDocumentOpenPasswords;
|
||||
String cadTimeout;
|
||||
int cadThread;
|
||||
String homePpageNumber;
|
||||
String homePageNumber;
|
||||
String homePagination;
|
||||
String homePageSize;
|
||||
String homeSearch;
|
||||
@ -92,8 +93,9 @@ public class ConfigRefreshComponent {
|
||||
ftpControlEncoding = properties.getProperty("ftp.control.encoding", ConfigConstants.DEFAULT_FTP_CONTROL_ENCODING);
|
||||
textArray = text.split(",");
|
||||
mediaArray = media.split(",");
|
||||
baseUrl = properties.getProperty("base.url", ConfigConstants.DEFAULT_BASE_URL);
|
||||
trustHost = properties.getProperty("trust.host", ConfigConstants.DEFAULT_TRUST_HOST);
|
||||
baseUrl = properties.getProperty("base.url", ConfigConstants.DEFAULT_VALUE);
|
||||
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);
|
||||
pdfOpenFileDisable = properties.getProperty("pdf.openFile.disable", ConfigConstants.DEFAULT_PDF_OPEN_FILE_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));
|
||||
officeDocumentOpenPasswords = Boolean.parseBoolean(properties.getProperty("office.documentopenpasswords", ConfigConstants.DEFAULT_OFFICE_EOCUMENTOPENPASSWORDS));
|
||||
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);
|
||||
homePageSize = properties.getProperty("home.pagesize", ConfigConstants.DEFAULT_HOME_PAGSIZE);
|
||||
homeSearch = properties.getProperty("home.search", ConfigConstants.DEFAULT_HOME_SEARCH);
|
||||
@ -135,6 +137,7 @@ public class ConfigRefreshComponent {
|
||||
ConfigConstants.setFtpControlEncodingValue(ftpControlEncoding);
|
||||
ConfigConstants.setBaseUrlValue(baseUrl);
|
||||
ConfigConstants.setTrustHostValue(trustHost);
|
||||
ConfigConstants.setNotTrustHostValue(notTrustHost);
|
||||
ConfigConstants.setOfficePreviewSwitchDisabledValue(officePreviewSwitchDisabled);
|
||||
ConfigConstants.setPdfPresentationModeDisableValue(pdfPresentationModeDisable);
|
||||
ConfigConstants.setPdfOpenFileDisableValue(pdfOpenFileDisable);
|
||||
@ -162,10 +165,10 @@ public class ConfigRefreshComponent {
|
||||
ConfigConstants.setDeleteCaptchaValue(deleteCaptcha);
|
||||
ConfigConstants.setCadTimeoutValue(cadTimeout);
|
||||
ConfigConstants.setCadThreadValue(cadThread);
|
||||
ConfigConstants.sethomePpageNumberValue(homePpageNumber);
|
||||
ConfigConstants.sethomePaginationValue(homePagination);
|
||||
ConfigConstants.sethomePageSizeValue(homePageSize);
|
||||
ConfigConstants.sethomeSearchValue(homeSearch);
|
||||
ConfigConstants.setHomePageNumberValue(homePageNumber);
|
||||
ConfigConstants.setHomePaginationValue(homePagination);
|
||||
ConfigConstants.setHomePageSizeValue(homePageSize);
|
||||
ConfigConstants.setHomeSearchValue(homeSearch);
|
||||
setWatermarkConfig(properties);
|
||||
bufferedReader.close();
|
||||
fileReader.close();
|
||||
|
@ -43,10 +43,10 @@ public class AttributeSetFilter implements Filter {
|
||||
request.setAttribute("beian", ConfigConstants.getBeian());
|
||||
request.setAttribute("size", ConfigConstants.maxSize());
|
||||
request.setAttribute("deleteCaptcha", ConfigConstants.getDeleteCaptcha());
|
||||
request.setAttribute("homePpageNumber", ConfigConstants.gethomePpageNumber());
|
||||
request.setAttribute("homePagination", ConfigConstants.gethomePagination());
|
||||
request.setAttribute("homePageSize", ConfigConstants.gethomePageSize());
|
||||
request.setAttribute("homeSearch", ConfigConstants.gethomeSearch());
|
||||
request.setAttribute("homePageNumber", ConfigConstants.getHomePageNumber());
|
||||
request.setAttribute("homePagination", ConfigConstants.getHomePagination());
|
||||
request.setAttribute("homePageSize", ConfigConstants.getHomePageSize());
|
||||
request.setAttribute("homeSearch", ConfigConstants.getHomeSearch());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ public class BaseUrlFilter implements Filter {
|
||||
final String urlInHeader = servletRequest.getHeader("X-Base-Url");
|
||||
if (StringUtils.isNotEmpty(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 则以配置文件为准
|
||||
baseUrl = configBaseUrl;
|
||||
} else {
|
||||
|
@ -19,7 +19,7 @@ import org.springframework.util.FileCopyUtils;
|
||||
*/
|
||||
public class TrustHostFilter implements Filter {
|
||||
|
||||
private String notTrustHost;
|
||||
private String notTrustHostHtmlView;
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) {
|
||||
@ -27,7 +27,7 @@ public class TrustHostFilter implements Filter {
|
||||
try {
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -37,16 +37,24 @@ public class TrustHostFilter implements Filter {
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
String url = WebUtils.getSourceUrl(request);
|
||||
String host = WebUtils.getHost(url);
|
||||
if (host != null &&!ConfigConstants.getTrustHostSet().isEmpty() && !ConfigConstants.getTrustHostSet().contains(host)) {
|
||||
String html = this.notTrustHost.replace("${current_host}", host);
|
||||
assert host != null;
|
||||
if (!isTrustHost(host) || isNotTrustHost(host)) {
|
||||
String html = this.notTrustHostHtmlView.replace("${current_host}", host);
|
||||
response.getWriter().write(html);
|
||||
response.getWriter().close();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
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
|
||||
public void destroy() {
|
||||
|
||||
|
@ -258,7 +258,7 @@
|
||||
$(function () {
|
||||
$('#table').bootstrapTable({
|
||||
url: 'listFiles',
|
||||
pageNumber: ${homePpageNumber},//初始化加载第一页
|
||||
pageNumber: ${homePageNumber},//初始化加载第一页
|
||||
pageSize:${homePageSize}, //初始化单页记录数
|
||||
pagination: ${homePagination}, //是否分页
|
||||
pageList: [5, 10, 20, 30, 50, 100, 200, 500],
|
||||
|
Loading…
Reference in New Issue
Block a user