Base64 encode chapter IDs

This commit is contained in:
Alex Ling 2022-01-23 06:08:20 +00:00
parent 031df3a2bc
commit d862c386f1
3 changed files with 9 additions and 3 deletions

View File

@ -49,7 +49,7 @@ class Plugin
"Pushing to download queue" "Pushing to download queue"
jobs = matches.map { |ch| jobs = matches.map { |ch|
Queue::Job.new( Queue::Job.new(
"#{plugin.info.id}-#{ch["id"]}", "#{plugin.info.id}-#{Base64.encode ch["id"].as_s}",
"", # manga_id "", # manga_id
ch["title"].as_s, ch["title"].as_s,
sub.manga_title, sub.manga_title,

View File

@ -70,7 +70,13 @@ class Queue
ary = @id.split("-") ary = @id.split("-")
if ary.size == 2 if ary.size == 2
@plugin_id = ary[0] @plugin_id = ary[0]
@plugin_chapter_id = ary[1] # This begin-rescue block is for backward compatibility. In earlier
# versions we didn't encode the chapter ID
@plugin_chapter_id = begin
Base64.decode_string ary[1]
rescue
ary[1]
end
end end
end end

View File

@ -785,7 +785,7 @@ struct APIRouter
jobs = chapters.map { |ch| jobs = chapters.map { |ch|
Queue::Job.new( Queue::Job.new(
"#{plugin.info.id}-#{ch["id"]}", "#{plugin.info.id}-#{Base64.encode ch["id"].as_s}",
"", # manga_id "", # manga_id
ch["title"].as_s, ch["title"].as_s,
manga_title, manga_title,