static public final String LOGOUT_URL = "/logout";
+ static public final String EXIT_URL = "/exit";
+
static private final String VIEWER_URL_BASE = "/view/story/";
static private final String VIEWER_URL = VIEWER_URL_BASE
+ "{luid}/{chap}/{para}";
static private final String IMPRT_URL_PROGRESS = IMPRT_URL_BASE + "{luid}";
static public final String IMPRT_URL_IMPORT = IMPRT_URL_BASE + "import";
+ static private final String DELETE_URL_BASE = "/delete/";
+ static private final String DELETE_URL_STORY = DELETE_URL_BASE + "{luid}";
+
// 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/";
.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) || isCoverUrl(url) || isImprtUrl(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) {
.replace("{author}", author);
}
+ static public String getDeleteUrlStory(String luid) {
+ return DELETE_URL_STORY //
+ .replace("{luid}", luid);
+ }
+
static public boolean isViewUrl(String url) {
return url != null && url.startsWith(VIEWER_URL_BASE);
}
static public boolean isImprtUrl(String url) {
return url != null && url.startsWith(IMPRT_URL_BASE);
}
+
+ static public boolean isDeleteUrl(String url) {
+ return url != null && url.startsWith(DELETE_URL_BASE);
+ }
}