X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FWebLibraryServer.java;h=3e2c90605de78b2956290b4b36b56bb8a6a42688;hb=c5103223c48d55a178f30e972313b009d8f79056;hp=e0096fcc590b94963137d1476d9f57caf7398124;hpb=f433d15308b70e23280a65cef8c54002a7a971ce;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/WebLibraryServer.java b/src/be/nikiroo/fanfix/library/WebLibraryServer.java index e0096fc..3e2c906 100644 --- a/src/be/nikiroo/fanfix/library/WebLibraryServer.java +++ b/src/be/nikiroo/fanfix/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) {