X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=library%2FWebLibraryServer.java;h=3e2c90605de78b2956290b4b36b56bb8a6a42688;hp=e0096fcc590b94963137d1476d9f57caf7398124;hb=4b3d19dce4816fee47886ae525664fef74e0380e;hpb=5f3671e17febc5b7f6abbfc62c66c4045d47ec8d diff --git a/library/WebLibraryServer.java b/library/WebLibraryServer.java index e0096fc..3e2c906 100644 --- a/library/WebLibraryServer.java +++ b/library/WebLibraryServer.java @@ -231,6 +231,10 @@ public class WebLibraryServer implements Runnable { } if (login.isSuccess()) { + if (!login.isWl()) { + whitelist.clear(); + } + // refresh token session.getCookies().set(new Cookie("token", login.getToken(), "30; path=/")); @@ -651,6 +655,7 @@ public class WebLibraryServer implements Runnable { // /story/luid/chapter/para <-- text/image // /story/luid/cover <-- image // /story/luid/metadata <-- json + // /story/luid/json <-- json, whole chapter (no images) private Response getStoryPart(String uri, List whitelist) { String[] cover = uri.split("/"); int off = 2; @@ -667,7 +672,7 @@ public class WebLibraryServer implements Runnable { // 1-based (0 = desc) int chapter = 0; if (chapterStr != null && !"cover".equals(chapterStr) - && !"metadata".equals(chapterStr)) { + && !"metadata".equals(chapterStr) && !"json".equals(chapterStr)) { try { chapter = Integer.parseInt(chapterStr); if (chapter < 0) { @@ -706,6 +711,11 @@ public class WebLibraryServer implements Runnable { JSONObject json = JsonIO.toJson(meta); mimeType = "application/json"; in = new ByteArrayInputStream(json.toString().getBytes()); + } else if ("json".equals(chapterStr)) { + Story story = story(luid, whitelist); + JSONObject json = JsonIO.toJson(story); + mimeType = "application/json"; + in = new ByteArrayInputStream(json.toString().getBytes()); } else { Story story = story(luid, whitelist); if (story != null) {