From: Niki Roo Date: Fri, 15 May 2020 09:31:10 +0000 (+0200) Subject: weblib: allow /version without login X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=44f134a51306506cc3458aabc774222cc0041a1c;p=nikiroo-utils.git weblib: allow /version without login --- diff --git a/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java b/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java index 7351d0d..8895fb8 100644 --- a/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java +++ b/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java @@ -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)) { diff --git a/src/be/nikiroo/fanfix/library/WebLibraryUrls.java b/src/be/nikiroo/fanfix/library/WebLibraryUrls.java index c02fc38..2b75779 100644 --- a/src/be/nikiroo/fanfix/library/WebLibraryUrls.java +++ b/src/be/nikiroo/fanfix/library/WebLibraryUrls.java @@ -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) {