mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
re-synchronize selected books
This commit is contained in:
parent
05fd7f181f
commit
76bc6da867
1 changed files with 4 additions and 4 deletions
|
@ -212,14 +212,14 @@ public class SynchroniserService extends Service implements IBookCollection.List
|
||||||
private SyncStatus uploadBookToServer(Book book) {
|
private SyncStatus uploadBookToServer(Book book) {
|
||||||
final ZLPhysicalFile file = book.File.getPhysicalFile();
|
final ZLPhysicalFile file = book.File.getPhysicalFile();
|
||||||
final String hash = myCollection.getHash(book);
|
final String hash = myCollection.getHash(book);
|
||||||
|
final boolean force = book.labels().contains(Book.SYNC_TOSYNC_LABEL);
|
||||||
if (hash == null) {
|
if (hash == null) {
|
||||||
return SyncStatus.HashNotComputed;
|
return SyncStatus.HashNotComputed;
|
||||||
} else if (myActualHashesFromServer.contains(hash)) {
|
} else if (myActualHashesFromServer.contains(hash)) {
|
||||||
return SyncStatus.AlreadyUploaded;
|
return SyncStatus.AlreadyUploaded;
|
||||||
} else if (myDeletedHashesFromServer.contains(hash) &&
|
} else if (!force && myDeletedHashesFromServer.contains(hash)) {
|
||||||
!book.labels().contains(Book.SYNC_TOSYNC_LABEL)) {
|
|
||||||
return SyncStatus.ToBeDeleted;
|
return SyncStatus.ToBeDeleted;
|
||||||
} else if (book.labels().contains(Book.SYNC_FAILURE_LABEL)) {
|
} else if (!force && book.labels().contains(Book.SYNC_FAILURE_LABEL)) {
|
||||||
return SyncStatus.FailedPreviuousTime;
|
return SyncStatus.FailedPreviuousTime;
|
||||||
}
|
}
|
||||||
final Map<String,Object> result = new HashMap<String,Object>();
|
final Map<String,Object> result = new HashMap<String,Object>();
|
||||||
|
@ -239,7 +239,7 @@ public class SynchroniserService extends Service implements IBookCollection.List
|
||||||
final String csrfToken = myNetworkContext.getCookieValue(DOMAIN, "csrftoken");
|
final String csrfToken = myNetworkContext.getCookieValue(DOMAIN, "csrftoken");
|
||||||
try {
|
try {
|
||||||
final String status = (String)result.get("status");
|
final String status = (String)result.get("status");
|
||||||
if ("not found".equals(status)) {
|
if ((force && !"found".equals(status)) || "not found".equals(status)) {
|
||||||
try {
|
try {
|
||||||
final UploadRequest uploadRequest = new UploadRequest(file.javaFile());
|
final UploadRequest uploadRequest = new UploadRequest(file.javaFile());
|
||||||
uploadRequest.addHeader("Referer", verificationRequest.getURL());
|
uploadRequest.addHeader("Referer", verificationRequest.getURL());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue