Run 'crystal tool format'

This commit is contained in:
Leeingnyo 2022-05-15 17:02:29 +09:00
parent 9f6be70995
commit 3a60286c3a
5 changed files with 10 additions and 10 deletions

View File

@ -76,7 +76,7 @@ class SortedEntriesCacheEntry < CacheEntry(Array(String), Array(Entry))
entries : Array(Entry), opt : SortOptions?)
entries_sig = Digest::SHA1.hexdigest (entries.map &.id).to_s
user_context = opt && opt.method == SortMethod::Progress ? username : ""
sig = Digest::SHA1.hexdigest (book_id + entries_sig + user_context +
sig = Digest::SHA1.hexdigest(book_id + entries_sig + user_context +
(opt ? opt.to_tuple.to_s : "nil"))
"#{sig}:sorted_entries"
end
@ -101,7 +101,7 @@ class SortedTitlesCacheEntry < CacheEntry(Array(String), Array(Title))
def self.gen_key(username : String, titles : Array(Title), opt : SortOptions?)
titles_sig = Digest::SHA1.hexdigest (titles.map &.id).to_s
user_context = opt && opt.method == SortMethod::Progress ? username : ""
sig = Digest::SHA1.hexdigest (titles_sig + user_context +
sig = Digest::SHA1.hexdigest(titles_sig + user_context +
(opt ? opt.to_tuple.to_s : "nil"))
"#{sig}:sorted_titles"
end

View File

@ -9,7 +9,8 @@ abstract class Entry
def initialize(
@id, @title, @book,
@size, @pages, @mtime,
@encoded_path, @encoded_title, @err_msg)
@encoded_path, @encoded_title, @err_msg
)
end
def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)

View File

@ -1144,9 +1144,9 @@ struct APIRouter
raise "Entry ID `#{eid}` of `#{title.title}` not found" if entry.nil?
if entry.is_a? DirectoryEntry
file_hash = Digest::SHA1.hexdigest (entry.path + entry.mtime.to_s + entry.size)
file_hash = Digest::SHA1.hexdigest(entry.path + entry.mtime.to_s + entry.size)
else
file_hash = Digest::SHA1.hexdigest (entry.path + entry.mtime.to_s)
file_hash = Digest::SHA1.hexdigest(entry.path + entry.mtime.to_s)
end
e_tag = "W/#{file_hash}"
if e_tag == prev_e_tag

View File

@ -13,7 +13,6 @@ SUPPORTED_IMG_TYPES = %w(
image/svg+xml
)
def random_str
UUID.random.to_s.gsub "-", ""
end