git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update from fanfix-swing
[fanfix.git]
/
library
/
WebLibraryServer.java
diff --git
a/library/WebLibraryServer.java
b/library/WebLibraryServer.java
index e0096fcc590b94963137d1476d9f57caf7398124..3e2c90605de78b2956290b4b36b56bb8a6a42688 100644
(file)
--- a/
library/WebLibraryServer.java
+++ b/
library/WebLibraryServer.java
@@
-231,6
+231,10
@@
public class WebLibraryServer implements Runnable {
}
if (login.isSuccess()) {
}
if (login.isSuccess()) {
+ if (!login.isWl()) {
+ whitelist.clear();
+ }
+
// refresh token
session.getCookies().set(new Cookie("token",
login.getToken(), "30; path=/"));
// 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/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<String> whitelist) {
String[] cover = uri.split("/");
int off = 2;
private Response getStoryPart(String uri, List<String> 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)
// 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) {
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());
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) {
} else {
Story story = story(luid, whitelist);
if (story != null) {