mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix syncing for anon users
This commit is contained in:
parent
18c779a1a8
commit
c003690502
@ -113,7 +113,7 @@ def show_recent_stage2(books):
|
|||||||
to_sync = v'[]'
|
to_sync = v'[]'
|
||||||
username = get_interface_data().username
|
username = get_interface_data().username
|
||||||
for book in books:
|
for book in books:
|
||||||
if username and to_sync.length < 10:
|
if to_sync.length < 10:
|
||||||
lr = book.last_read[username_key(username)] or new Date(0) # noqa: unused-local
|
lr = book.last_read[username_key(username)] or new Date(0) # noqa: unused-local
|
||||||
to_sync.push(v'[book.key, lr]')
|
to_sync.push(v'[book.key, lr]')
|
||||||
authors = book.metadata.authors.join(' & ') if book.metadata.authors else _('Unknown')
|
authors = book.metadata.authors.join(' & ') if book.metadata.authors else _('Unknown')
|
||||||
@ -128,7 +128,6 @@ def show_recent_stage2(books):
|
|||||||
))
|
))
|
||||||
if book.cover_name:
|
if book.cover_name:
|
||||||
db.get_file(book, book.cover_name, show_cover.bind(img_id))
|
db.get_file(book, book.cover_name, show_cover.bind(img_id))
|
||||||
if username:
|
|
||||||
start_sync(to_sync)
|
start_sync(to_sync)
|
||||||
container.appendChild(E.div(style='margin: 1rem 1rem',
|
container.appendChild(E.div(style='margin: 1rem 1rem',
|
||||||
create_button(
|
create_button(
|
||||||
|
@ -206,14 +206,14 @@ class DB:
|
|||||||
book.book_hash = manifest.book_hash.hash
|
book.book_hash = manifest.book_hash.hash
|
||||||
book.stored_files = {}
|
book.stored_files = {}
|
||||||
book.is_complete = False
|
book.is_complete = False
|
||||||
if get_interface_data().username:
|
|
||||||
newest_epoch = newest_pos = None
|
newest_epoch = newest_pos = None
|
||||||
for pos in manifest.last_read_positions:
|
for pos in manifest.last_read_positions:
|
||||||
if newest_epoch is None or pos.epoch > newest_epoch:
|
if newest_epoch is None or pos.epoch > newest_epoch:
|
||||||
newest_epoch = pos.epoch
|
newest_epoch = pos.epoch
|
||||||
newest_pos = pos.cfi
|
newest_pos = pos.cfi
|
||||||
unkey = username_key(get_interface_data().username)
|
username = get_interface_data().username
|
||||||
if newest_pos:
|
unkey = username_key(username)
|
||||||
|
if newest_pos and username:
|
||||||
book.last_read[unkey] = new Date(newest_epoch * 1000)
|
book.last_read[unkey] = new Date(newest_epoch * 1000)
|
||||||
book.last_read_position[unkey] = newest_pos
|
book.last_read_position[unkey] = newest_pos
|
||||||
if manifest.annotations_map:
|
if manifest.annotations_map:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user