From 44f134a51306506cc3458aabc774222cc0041a1c Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Fri, 15 May 2020 11:31:10 +0200 Subject: [PATCH] weblib: allow /version without login --- .../fanfix/library/WebLibraryServerHtml.java | 5 +++-- src/be/nikiroo/fanfix/library/WebLibraryUrls.java | 15 ++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java b/src/be/nikiroo/fanfix/library/WebLibraryServerHtml.java index 7351d0dd..8895fb83 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 c02fc382..2b757798 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) { -- 2.27.0