Read/unread a directory with API

This commit is contained in:
Alex Ling
2020-04-19 15:47:36 +00:00
parent b449d906ec
commit ec6a7bd3d9
3 changed files with 38 additions and 7 deletions

View File

@@ -258,6 +258,26 @@ class Title
end
end
# Set the reading progress of all entries and nested libraries to 100%
def read_all(username)
@entries.each do |e|
save_progress username, e.title, e.pages
end
titles.each do |t|
t.read_all username
end
end
# Set the reading progress of all entries and nested libraries to 0%
def unread_all(username)
@entries.each do |e|
save_progress username, e.title, 0
end
titles.each do |t|
t.unread_all username
end
end
# For backward backward compatibility with v0.1.0, we save entry titles
# instead of IDs in info.json
def save_progress(username, entry, page)