mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
sync site domain defined in SyncOptions
This commit is contained in:
parent
d701485b08
commit
7fee481e47
3 changed files with 7 additions and 7 deletions
|
@ -151,7 +151,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
|||
public void run() {
|
||||
try {
|
||||
myNetworkContext.perform(
|
||||
new JsonRequest("https://demo.fbreader.org/login/test") {
|
||||
new JsonRequest(SyncOptions.URL + "login/test") {
|
||||
@Override
|
||||
public void processResponse(Object response) {
|
||||
// TODO: update message
|
||||
|
|
|
@ -220,12 +220,9 @@ public class SynchroniserService extends Service implements IBookCollection.List
|
|||
}
|
||||
}
|
||||
|
||||
private final static String DOMAIN = "demo.fbreader.org";
|
||||
private final static String BASE_URL = "https://" + DOMAIN + "/app/";
|
||||
|
||||
private static abstract class PostRequest extends ZLNetworkRequest.PostWithMap {
|
||||
PostRequest(String app, Map<String,String> data) {
|
||||
super(BASE_URL + app, false);
|
||||
super(SyncOptions.URL + "app/" + app, false);
|
||||
if (data != null) {
|
||||
for (Map.Entry<String, String> entry : data.entrySet()) {
|
||||
addPostParameter(entry.getKey(), entry.getValue());
|
||||
|
@ -245,7 +242,7 @@ public class SynchroniserService extends Service implements IBookCollection.List
|
|||
boolean Success = false;
|
||||
|
||||
UploadRequest(File file) {
|
||||
super(BASE_URL + "book.upload", file, false);
|
||||
super(SyncOptions.URL + "app/book.upload", file, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -318,7 +315,7 @@ public class SynchroniserService extends Service implements IBookCollection.List
|
|||
e.printStackTrace();
|
||||
return SyncStatus.ServerError;
|
||||
}
|
||||
final String csrfToken = myNetworkContext.getCookieValue(DOMAIN, "csrftoken");
|
||||
final String csrfToken = myNetworkContext.getCookieValue(SyncOptions.DOMAIN, "csrftoken");
|
||||
try {
|
||||
final String status = (String)result.get("status");
|
||||
if ((force && !"found".equals(status)) || "not found".equals(status)) {
|
||||
|
|
|
@ -22,6 +22,9 @@ package org.geometerplus.fbreader.fbreader.options;
|
|||
import org.geometerplus.zlibrary.core.options.*;
|
||||
|
||||
public class SyncOptions {
|
||||
public static final String DOMAIN = "demo.fbreader.org";
|
||||
public static final String URL = "https://" + DOMAIN + "/";
|
||||
|
||||
public final ZLBooleanOption Enabled =
|
||||
new ZLBooleanOption("Sync", "Enabled", false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue