1 package be
.nikiroo
.fanfix
.library
;
4 static public final String INDEX_URL
= "/";
6 static public final String VERSION_URL
= "/version";
8 static public final String LOGOUT_URL
= "/logout";
10 static private final String VIEWER_URL_BASE
= "/view/story/";
11 static private final String VIEWER_URL
= VIEWER_URL_BASE
12 + "{luid}/{chap}/{para}";
14 static private final String STORY_URL_BASE
= "/story/";
15 static private final String STORY_URL
= STORY_URL_BASE
16 + "{luid}/{chap}/{para}";
17 static private final String STORY_URL_COVER
= STORY_URL_BASE
19 static private final String STORY_URL_JSON
= STORY_URL_BASE
+ "{luid}/json";
20 static private final String STORY_URL_METADATA
= STORY_URL_BASE
23 // GET/SET ("value" param -> set STA to this value)
24 static private final String STORY_URL_SOURCE
= STORY_URL_BASE
26 static private final String STORY_URL_TITLE
= STORY_URL_BASE
28 static private final String STORY_URL_AUTHOR
= STORY_URL_BASE
31 static private final String LIST_URL_BASE
= "/list/";
33 static public final String LIST_URL_METADATA
= LIST_URL_BASE
+ "metadata";
35 // "import" requires param "url" and return an luid, "/{luid}" return
36 // progress status as a JSON Progress or 404 if none (done or failed)
37 static private final String IMPRT_URL_BASE
= "/import/";
38 static private final String IMPRT_URL_PROGRESS
= IMPRT_URL_BASE
+ "{luid}";
39 static public final String IMPRT_URL_IMPORT
= IMPRT_URL_BASE
+ "import";
41 // GET/SET ("luid" param -> set cover to the cover of this story -- not ok
43 static private final String COVER_URL_BASE
= "/cover/";
44 static private final String COVER_URL_STORY
= COVER_URL_BASE
46 static private final String COVER_URL_AUTHOR
= COVER_URL_BASE
48 static private final String COVER_URL_SOURCE
= COVER_URL_BASE
51 static public String
getViewUrl(String luid
, Integer chap
, Integer para
) {
53 .replace("{luid}", luid
) //
54 .replace("/{chap}", chap
== null ?
"" : "/" + chap
) //
56 (chap
== null || para
== null) ?
"" : "/" + para
);
59 static public String
getStoryUrl(String luid
, int chap
, Integer para
) {
61 .replace("{luid}", luid
) //
62 .replace("{chap}", Integer
.toString(chap
)) //
63 .replace("{para}", para
== null ?
"" : Integer
.toString(para
));
66 static public String
getStoryUrlCover(String luid
) {
67 return STORY_URL_COVER
//
68 .replace("{luid}", luid
);
71 static public String
getStoryUrlJson(String luid
) {
72 return STORY_URL_JSON
//
73 .replace("{luid}", luid
);
76 static public String
getStoryUrlSource(String luid
) {
77 return STORY_URL_SOURCE
//
78 .replace("{luid}", luid
);
81 static public String
getStoryUrlTitle(String luid
) {
82 return STORY_URL_TITLE
//
83 .replace("{luid}", luid
);
86 static public String
getStoryUrlAuthor(String luid
) {
87 return STORY_URL_AUTHOR
//
88 .replace("{luid}", luid
);
91 static public String
getStoryUrlMetadata(String luid
) {
92 return STORY_URL_METADATA
//
93 .replace("{luid}", luid
);
96 static public String
getImprtProgressUrl(String luid
) {
97 return IMPRT_URL_PROGRESS
//
98 .replace("{luid}", luid
);
101 static public boolean isSupportedUrl(String url
) {
102 return INDEX_URL
.equals(url
) || VERSION_URL
.equals(url
)
103 || LOGOUT_URL
.equals(url
) || isViewUrl(url
) || isStoryUrl(url
)
104 || isListUrl(url
) || isCoverUrl(url
) || isImprtUrl(url
);
107 static public String
getCoverUrlStory(String luid
) {
108 return COVER_URL_STORY
//
109 .replace("{luid}", luid
);
112 static public String
getCoverUrlSource(String source
) {
113 return COVER_URL_SOURCE
//
114 .replace("{source}", source
);
117 static public String
getCoverUrlAuthor(String author
) {
118 return COVER_URL_AUTHOR
//
119 .replace("{author}", author
);
122 static public boolean isViewUrl(String url
) {
123 return url
!= null && url
.startsWith(VIEWER_URL_BASE
);
126 static public boolean isStoryUrl(String url
) {
127 return url
!= null && url
.startsWith(STORY_URL_BASE
);
130 static public boolean isListUrl(String url
) {
131 return url
!= null && url
.startsWith(LIST_URL_BASE
);
134 static public boolean isCoverUrl(String url
) {
135 return url
!= null && url
.startsWith(COVER_URL_BASE
);
138 static public boolean isImprtUrl(String url
) {
139 return url
!= null && url
.startsWith(IMPRT_URL_BASE
);