mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 19:05:32 -04:00
Run 'crystal tool format'
This commit is contained in:
parent
9f6be70995
commit
3a60286c3a
@ -76,8 +76,8 @@ class SortedEntriesCacheEntry < CacheEntry(Array(String), Array(Entry))
|
|||||||
entries : Array(Entry), opt : SortOptions?)
|
entries : Array(Entry), opt : SortOptions?)
|
||||||
entries_sig = Digest::SHA1.hexdigest (entries.map &.id).to_s
|
entries_sig = Digest::SHA1.hexdigest (entries.map &.id).to_s
|
||||||
user_context = opt && opt.method == SortMethod::Progress ? username : ""
|
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"))
|
(opt ? opt.to_tuple.to_s : "nil"))
|
||||||
"#{sig}:sorted_entries"
|
"#{sig}:sorted_entries"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -101,8 +101,8 @@ class SortedTitlesCacheEntry < CacheEntry(Array(String), Array(Title))
|
|||||||
def self.gen_key(username : String, titles : Array(Title), opt : SortOptions?)
|
def self.gen_key(username : String, titles : Array(Title), opt : SortOptions?)
|
||||||
titles_sig = Digest::SHA1.hexdigest (titles.map &.id).to_s
|
titles_sig = Digest::SHA1.hexdigest (titles.map &.id).to_s
|
||||||
user_context = opt && opt.method == SortMethod::Progress ? username : ""
|
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"))
|
(opt ? opt.to_tuple.to_s : "nil"))
|
||||||
"#{sig}:sorted_titles"
|
"#{sig}:sorted_titles"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,8 @@ abstract class Entry
|
|||||||
def initialize(
|
def initialize(
|
||||||
@id, @title, @book,
|
@id, @title, @book,
|
||||||
@size, @pages, @mtime,
|
@size, @pages, @mtime,
|
||||||
@encoded_path, @encoded_title, @err_msg)
|
@encoded_path, @encoded_title, @err_msg
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
|
def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
|
||||||
|
@ -63,7 +63,7 @@ struct AdminRouter
|
|||||||
redirect_url = URI.new \
|
redirect_url = URI.new \
|
||||||
path: "/admin/user/edit",
|
path: "/admin/user/edit",
|
||||||
query: hash_to_query({"username" => original_username, \
|
query: hash_to_query({"username" => original_username, \
|
||||||
"admin" => admin, "error" => e.message})
|
"admin" => admin, "error" => e.message})
|
||||||
redirect env, redirect_url.to_s
|
redirect env, redirect_url.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1144,9 +1144,9 @@ struct APIRouter
|
|||||||
raise "Entry ID `#{eid}` of `#{title.title}` not found" if entry.nil?
|
raise "Entry ID `#{eid}` of `#{title.title}` not found" if entry.nil?
|
||||||
|
|
||||||
if entry.is_a? DirectoryEntry
|
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
|
else
|
||||||
file_hash = Digest::SHA1.hexdigest (entry.path + entry.mtime.to_s)
|
file_hash = Digest::SHA1.hexdigest(entry.path + entry.mtime.to_s)
|
||||||
end
|
end
|
||||||
e_tag = "W/#{file_hash}"
|
e_tag = "W/#{file_hash}"
|
||||||
if e_tag == prev_e_tag
|
if e_tag == prev_e_tag
|
||||||
|
@ -3,7 +3,7 @@ ENTRIES_IN_HOME_SECTIONS = 8
|
|||||||
UPLOAD_URL_PREFIX = "/uploads"
|
UPLOAD_URL_PREFIX = "/uploads"
|
||||||
STATIC_DIRS = %w(/css /js /img /webfonts /favicon.ico /robots.txt)
|
STATIC_DIRS = %w(/css /js /img /webfonts /favicon.ico /robots.txt)
|
||||||
SUPPORTED_FILE_EXTNAMES = [".zip", ".cbz", ".rar", ".cbr"]
|
SUPPORTED_FILE_EXTNAMES = [".zip", ".cbz", ".rar", ".cbr"]
|
||||||
SUPPORTED_IMG_TYPES = %w(
|
SUPPORTED_IMG_TYPES = %w(
|
||||||
image/jpeg
|
image/jpeg
|
||||||
image/png
|
image/png
|
||||||
image/webp
|
image/webp
|
||||||
@ -13,7 +13,6 @@ SUPPORTED_IMG_TYPES = %w(
|
|||||||
image/svg+xml
|
image/svg+xml
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def random_str
|
def random_str
|
||||||
UUID.random.to_s.gsub "-", ""
|
UUID.random.to_s.gsub "-", ""
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user