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,8 +76,8 @@ 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 +
(opt ? opt.to_tuple.to_s : "nil"))
sig = Digest::SHA1.hexdigest(book_id + entries_sig + user_context +
(opt ? opt.to_tuple.to_s : "nil"))
"#{sig}:sorted_entries"
end
end
@ -101,8 +101,8 @@ 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 +
(opt ? opt.to_tuple.to_s : "nil"))
sig = Digest::SHA1.hexdigest(titles_sig + user_context +
(opt ? opt.to_tuple.to_s : "nil"))
"#{sig}:sorted_titles"
end
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

@ -63,7 +63,7 @@ struct AdminRouter
redirect_url = URI.new \
path: "/admin/user/edit",
query: hash_to_query({"username" => original_username, \
"admin" => admin, "error" => e.message})
"admin" => admin, "error" => e.message})
redirect env, redirect_url.to_s
end

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

@ -3,7 +3,7 @@ ENTRIES_IN_HOME_SECTIONS = 8
UPLOAD_URL_PREFIX = "/uploads"
STATIC_DIRS = %w(/css /js /img /webfonts /favicon.ico /robots.txt)
SUPPORTED_FILE_EXTNAMES = [".zip", ".cbz", ".rar", ".cbr"]
SUPPORTED_IMG_TYPES = %w(
SUPPORTED_IMG_TYPES = %w(
image/jpeg
image/png
image/webp
@ -13,7 +13,6 @@ SUPPORTED_IMG_TYPES = %w(
image/svg+xml
)
def random_str
UUID.random.to_s.gsub "-", ""
end