mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Merge branch 'dev' into fix/rescan-when-files-added
This commit is contained in:
commit
19a8f3100b
@ -29,14 +29,16 @@ const readerComponent = () => {
|
|||||||
return {
|
return {
|
||||||
id: i + 1,
|
id: i + 1,
|
||||||
url: `${base_url}api/page/${tid}/${eid}/${i+1}`,
|
url: `${base_url}api/page/${tid}/${eid}/${i+1}`,
|
||||||
width: d.width,
|
width: d.width == 0 ? "100%" : d.width,
|
||||||
height: d.height,
|
height: d.height == 0 ? "100%" : d.height,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const avgRatio = this.items.reduce((acc, cur) => {
|
// Note: for image types not supported by image_size.cr, the width and height will be 0, and so `avgRatio` will be `Infinity`.
|
||||||
|
// TODO: support more image types in image_size.cr
|
||||||
|
const avgRatio = dimensions.reduce((acc, cur) => {
|
||||||
return acc + cur.height / cur.width
|
return acc + cur.height / cur.width
|
||||||
}, 0) / this.items.length;
|
}, 0) / dimensions.length;
|
||||||
|
|
||||||
console.log(avgRatio);
|
console.log(avgRatio);
|
||||||
this.longPages = avgRatio > 2;
|
this.longPages = avgRatio > 2;
|
||||||
|
@ -632,6 +632,16 @@ class Title
|
|||||||
|
|
||||||
if last_read_entry && last_read_entry.finished? username
|
if last_read_entry && last_read_entry.finished? username
|
||||||
last_read_entry = last_read_entry.next_entry username
|
last_read_entry = last_read_entry.next_entry username
|
||||||
|
if last_read_entry.nil?
|
||||||
|
# The last entry is finished. Return the first unfinished entry
|
||||||
|
# (if any)
|
||||||
|
sorted_entries(username).each do |e|
|
||||||
|
unless e.finished? username
|
||||||
|
last_read_entry = e
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
last_read_entry
|
last_read_entry
|
||||||
|
@ -11,6 +11,7 @@ SUPPORTED_IMG_TYPES = %w(
|
|||||||
image/avif
|
image/avif
|
||||||
image/gif
|
image/gif
|
||||||
image/svg+xml
|
image/svg+xml
|
||||||
|
image/jxl
|
||||||
)
|
)
|
||||||
|
|
||||||
def random_str
|
def random_str
|
||||||
@ -49,6 +50,7 @@ def register_mime_types
|
|||||||
# defiend by Crystal in `MIME.DEFAULT_TYPES`
|
# defiend by Crystal in `MIME.DEFAULT_TYPES`
|
||||||
".apng" => "image/apng",
|
".apng" => "image/apng",
|
||||||
".avif" => "image/avif",
|
".avif" => "image/avif",
|
||||||
|
".jxl" => "image/jxl",
|
||||||
}.each do |k, v|
|
}.each do |k, v|
|
||||||
MIME.register k, v
|
MIME.register k, v
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user