Shinsuke Sugaya 9 роки тому
батько
коміт
93228789a3

+ 4 - 0
src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java

@@ -87,12 +87,16 @@ public abstract class FessSearchAction extends FessBaseAction {
 
     protected boolean favoriteSupport;
 
+    protected boolean thumbnailSupport;
+
     @Override
     public ActionResponse hookBefore(final ActionRuntime runtime) { // application may override
         searchLogSupport = fessConfig.isSearchLog();
         favoriteSupport = fessConfig.isUserFavorite();
+        thumbnailSupport = fessConfig.isThumbnailEnabled();
         runtime.registerData("searchLogSupport", searchLogSupport);
         runtime.registerData("favoriteSupport", favoriteSupport);
+        runtime.registerData("thumbnailSupport", thumbnailSupport);
         if (fessConfig.isWebApiPopularWord()) {
             runtime.registerData("popularWords", popularWordHelper.getWordList(null, null, null, null, null));
         }

+ 1 - 1
src/main/java/org/codelibs/fess/app/web/screenshot/ScreenshotAction.java

@@ -63,7 +63,7 @@ public class ScreenshotAction extends FessSearchAction {
                             return true;
                         }).orElse(null);
         final String url = DocumentUtil.getValue(doc, fessConfig.getIndexFieldUrl(), String.class);
-        if (StringUtil.isBlank(form.queryId) || StringUtil.isBlank(url) || screenShotManager == null) {
+        if (StringUtil.isBlank(form.queryId) || StringUtil.isBlank(url) || !thumbnailSupport) {
             // 404
             throw404("Screenshot for " + form.docId + " is not found.");
             return null;

+ 2 - 2
src/main/java/org/codelibs/fess/app/web/search/SearchAction.java

@@ -127,11 +127,11 @@ public class SearchAction extends FessSearchAction {
             return asHtml(path_SearchJsp).renderWith(data -> {
                 renderData.register(data);
                 // favorite or screenshot
-                    if (favoriteSupport || screenShotManager != null) {
+                    if (favoriteSupport || thumbnailSupport) {
                         final String queryId = renderData.getQueryId();
                         final List<Map<String, Object>> documentItems = renderData.getDocumentItems();
                         userInfoHelper.storeQueryId(queryId, documentItems);
-                        if (screenShotManager != null) {
+                        if (thumbnailSupport) {
                             screenShotManager.storeRequest(queryId, documentItems);
                             RenderDataUtil.register(data, "screenShotSupport", true);
                         }