diff --git a/src/pyj/book_list/home.pyj b/src/pyj/book_list/home.pyj index b129f5a36c..b0cf8d0592 100644 --- a/src/pyj/book_list/home.pyj +++ b/src/pyj/book_list/home.pyj @@ -113,7 +113,7 @@ def show_recent_stage2(books): to_sync = v'[]' username = get_interface_data().username 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 to_sync.push(v'[book.key, lr]') authors = book.metadata.authors.join(' & ') if book.metadata.authors else _('Unknown') @@ -128,8 +128,7 @@ def show_recent_stage2(books): )) if book.cover_name: 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', create_button( _('Browse all downloaded books…'), diff --git a/src/pyj/read_book/db.pyj b/src/pyj/read_book/db.pyj index e82093bfc6..5374086224 100644 --- a/src/pyj/read_book/db.pyj +++ b/src/pyj/read_book/db.pyj @@ -206,18 +206,18 @@ class DB: book.book_hash = manifest.book_hash.hash book.stored_files = {} book.is_complete = False - if get_interface_data().username: - newest_epoch = newest_pos = None - for pos in manifest.last_read_positions: - if newest_epoch is None or pos.epoch > newest_epoch: - newest_epoch = pos.epoch - newest_pos = pos.cfi - unkey = username_key(get_interface_data().username) - if newest_pos: - book.last_read[unkey] = new Date(newest_epoch * 1000) - book.last_read_position[unkey] = newest_pos - if manifest.annotations_map: - book.annotations_map[unkey] = manifest.annotations_map + newest_epoch = newest_pos = None + for pos in manifest.last_read_positions: + if newest_epoch is None or pos.epoch > newest_epoch: + newest_epoch = pos.epoch + newest_pos = pos.cfi + username = get_interface_data().username + unkey = username_key(username) + if newest_pos and username: + book.last_read[unkey] = new Date(newest_epoch * 1000) + book.last_read_position[unkey] = newest_pos + if manifest.annotations_map: + book.annotations_map[unkey] = manifest.annotations_map v'delete manifest.metadata' v'delete manifest.last_read_positions'