weblib: change STA
[fanfix.git] / src / be / nikiroo / fanfix / library / WebLibraryUrls.java
index be4cf256bd154297e51a65ce3bdb78a52b96ef55..c1d1cf21f3621ee4a89c99d2b96508fe3a3d1cea 100644 (file)
@@ -18,10 +18,28 @@ class WebLibraryUrls {
                        + "{luid}/cover";
        static private final String STORY_URL_JSON = STORY_URL_BASE + "{luid}/json";
 
+       // GET/SET ("value" param -> set STA to this value)
+       static private final String STORY_URL_SOURCE = STORY_URL_BASE
+                       + "{luid}/source";
+       static private final String STORY_URL_TITLE = STORY_URL_BASE
+                       + "{luid}/title";
+       static private final String STORY_URL_AUTHOR = STORY_URL_BASE
+                       + "{luid}/author";
+
        static private final String LIST_URL_BASE = "/list/";
 
        static public final String LIST_URL_METADATA = LIST_URL_BASE + "metadata";
 
+       // GET/SET ("luid" param -> set cover to the cover of this story -- not ok
+       // for /cover/story/)
+       static private final String COVER_URL_BASE = "/cover/";
+       static private final String COVER_URL_STORY = COVER_URL_BASE
+                       + "story/{luid}";
+       static private final String COVER_URL_AUTHOR = COVER_URL_BASE
+                       + "author/{author}";
+       static private final String COVER_URL_SOURCE = COVER_URL_BASE
+                       + "source/{source}";
+
        static public String getViewUrl(String luid, Integer chap, Integer para) {
                return VIEWER_URL //
                                .replace("{luid}", luid) //
@@ -47,10 +65,40 @@ class WebLibraryUrls {
                                .replace("{luid}", luid);
        }
 
+       static public String getStoryUrlSource(String luid) {
+               return STORY_URL_SOURCE //
+                               .replace("{luid}", luid);
+       }
+
+       static public String getStoryUrlTitle(String luid) {
+               return STORY_URL_TITLE//
+                               .replace("{luid}", luid);
+       }
+
+       static public String getStoryUrlAuthor(String luid) {
+               return STORY_URL_AUTHOR //
+                               .replace("{luid}", luid);
+       }
+
        static public boolean isSupportedUrl(String url) {
                return INDEX_URL.equals(url) || VERSION_URL.equals(url)
                                || LOGOUT_URL.equals(url) || isViewUrl(url) || isStoryUrl(url)
-                               || isListUrl(url);
+                               || isListUrl(url) || isCoverUrl(url);
+       }
+
+       static public String getCoverUrlStory(String luid) {
+               return COVER_URL_STORY //
+                               .replace("{luid}", luid);
+       }
+
+       static public String getCoverUrlSource(String source) {
+               return COVER_URL_SOURCE //
+                               .replace("{source}", source);
+       }
+
+       static public String getCoverUrlAuthor(String author) {
+               return COVER_URL_AUTHOR //
+                               .replace("{author}", author);
        }
 
        static public boolean isViewUrl(String url) {
@@ -64,4 +112,8 @@ class WebLibraryUrls {
        static public boolean isListUrl(String url) {
                return url != null && url.startsWith(LIST_URL_BASE);
        }
+
+       static public boolean isCoverUrl(String url) {
+               return url != null && url.startsWith(COVER_URL_BASE);
+       }
 }