mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 02:09:35 +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() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
myNetworkContext.perform(
|
myNetworkContext.perform(
|
||||||
new JsonRequest("https://demo.fbreader.org/login/test") {
|
new JsonRequest(SyncOptions.URL + "login/test") {
|
||||||
@Override
|
@Override
|
||||||
public void processResponse(Object response) {
|
public void processResponse(Object response) {
|
||||||
// TODO: update message
|
// 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 {
|
private static abstract class PostRequest extends ZLNetworkRequest.PostWithMap {
|
||||||
PostRequest(String app, Map<String,String> data) {
|
PostRequest(String app, Map<String,String> data) {
|
||||||
super(BASE_URL + app, false);
|
super(SyncOptions.URL + "app/" + app, false);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
for (Map.Entry<String, String> entry : data.entrySet()) {
|
for (Map.Entry<String, String> entry : data.entrySet()) {
|
||||||
addPostParameter(entry.getKey(), entry.getValue());
|
addPostParameter(entry.getKey(), entry.getValue());
|
||||||
|
@ -245,7 +242,7 @@ public class SynchroniserService extends Service implements IBookCollection.List
|
||||||
boolean Success = false;
|
boolean Success = false;
|
||||||
|
|
||||||
UploadRequest(File file) {
|
UploadRequest(File file) {
|
||||||
super(BASE_URL + "book.upload", file, false);
|
super(SyncOptions.URL + "app/book.upload", file, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -318,7 +315,7 @@ public class SynchroniserService extends Service implements IBookCollection.List
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return SyncStatus.ServerError;
|
return SyncStatus.ServerError;
|
||||||
}
|
}
|
||||||
final String csrfToken = myNetworkContext.getCookieValue(DOMAIN, "csrftoken");
|
final String csrfToken = myNetworkContext.getCookieValue(SyncOptions.DOMAIN, "csrftoken");
|
||||||
try {
|
try {
|
||||||
final String status = (String)result.get("status");
|
final String status = (String)result.get("status");
|
||||||
if ((force && !"found".equals(status)) || "not found".equals(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.*;
|
import org.geometerplus.zlibrary.core.options.*;
|
||||||
|
|
||||||
public class SyncOptions {
|
public class SyncOptions {
|
||||||
|
public static final String DOMAIN = "demo.fbreader.org";
|
||||||
|
public static final String URL = "https://" + DOMAIN + "/";
|
||||||
|
|
||||||
public final ZLBooleanOption Enabled =
|
public final ZLBooleanOption Enabled =
|
||||||
new ZLBooleanOption("Sync", "Enabled", false);
|
new ZLBooleanOption("Sync", "Enabled", false);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue