weblib: allow /version without login
authorNiki Roo <niki@nikiroo.be>
Fri, 15 May 2020 09:31:10 +0000 (11:31 +0200)
committerNiki Roo <niki@nikiroo.be>
Fri, 15 May 2020 09:31:10 +0000 (11:31 +0200)
src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java
src/be/nikiroo/fanfix/library/WebLibraryUrls.java

index 7351d0dd3665bceffb58b02574345dfcb498d940..8895fb83a07b0eb6ff7116b3998a7a89a2acfb15 100644 (file)
@@ -173,13 +173,14 @@ abstract class WebLibraryServerHtml implements Runnable {
                                }
 
                                Response rep = null;
-                               if (!login.isSuccess() && WebLibraryUrls.isSupportedUrl(uri)) {
+                               if (!login.isSuccess()
+                                               && WebLibraryUrls.isSupportedUrl(uri, true)) {
                                        rep = loginPage(login, uri);
                                }
 
                                if (rep == null) {
                                        try {
-                                               if (WebLibraryUrls.isSupportedUrl(uri)) {
+                                               if (WebLibraryUrls.isSupportedUrl(uri, false)) {
                                                        if (WebLibraryUrls.INDEX_URL.equals(uri)) {
                                                                rep = root(session, cookies, login);
                                                        } else if (WebLibraryUrls.VERSION_URL.equals(uri)) {
index c02fc382341481ed9c8a95a74a16faf13544648b..2b757798c5aec05c044e29b4971a7043a1f59baa 100644 (file)
@@ -103,11 +103,16 @@ class WebLibraryUrls {
                                .replace("{luid}", luid);
        }
 
-       static public boolean isSupportedUrl(String url) {
-               return INDEX_URL.equals(url) || VERSION_URL.equals(url)
-                               || LOGOUT_URL.equals(url) || EXIT_URL.equals(url)
-                               || isViewUrl(url) || isStoryUrl(url) || isListUrl(url)
-                               || isCoverUrl(url) || isImprtUrl(url) || isDeleteUrl(url);
+       static public boolean isSupportedUrl(String url,
+                       boolean requiresLoginOnly) {
+               if (requiresLoginOnly) {
+                       return INDEX_URL.equals(url) || LOGOUT_URL.equals(url)
+                                       || EXIT_URL.equals(url) || isViewUrl(url) || isStoryUrl(url)
+                                       || isListUrl(url) || isCoverUrl(url) || isImprtUrl(url)
+                                       || isDeleteUrl(url);
+               }
+
+               return isSupportedUrl(url, true) || VERSION_URL.equals(url);
        }
 
        static public String getCoverUrlStory(String luid) {