mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 19:05:32 -04:00
Upgrade to Crystal 0.35.1
This commit is contained in:
parent
b2dc44a919
commit
455315a362
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: crystallang/crystal:0.34.0-alpine
|
image: crystallang/crystal:0.35.1-alpine
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM crystallang/crystal:0.34.0-alpine AS builder
|
FROM crystallang/crystal:0.35.1-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /Mango
|
WORKDIR /Mango
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ FROM arm32v7/ubuntu:18.04
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -y wget git make llvm-8 llvm-8-dev g++ libsqlite3-dev libyaml-dev libgc-dev libssl-dev libcrypto++-dev libevent-dev libgmp-dev zlib1g-dev libpcre++-dev pkg-config libarchive-dev libxml2-dev libacl1-dev nettle-dev liblzo2-dev liblzma-dev libbz2-dev libjpeg-turbo8-dev libpng-dev libtiff-dev
|
RUN apt-get update && apt-get install -y wget git make llvm-8 llvm-8-dev g++ libsqlite3-dev libyaml-dev libgc-dev libssl-dev libcrypto++-dev libevent-dev libgmp-dev zlib1g-dev libpcre++-dev pkg-config libarchive-dev libxml2-dev libacl1-dev nettle-dev liblzo2-dev liblzma-dev libbz2-dev libjpeg-turbo8-dev libpng-dev libtiff-dev
|
||||||
|
|
||||||
RUN git clone https://github.com/crystal-lang/crystal && cd crystal && git checkout 0.34.0 && make deps && cd ..
|
RUN git clone https://github.com/crystal-lang/crystal && cd crystal && git checkout 0.35.1 && make deps && cd ..
|
||||||
RUN git clone https://github.com/kostya/myhtml && cd myhtml/src/ext && git checkout v1.5.0 && make && cd ..
|
RUN git clone https://github.com/kostya/myhtml && cd myhtml/src/ext && git checkout v1.5.0 && make && cd ..
|
||||||
RUN git clone https://github.com/jessedoyle/duktape.cr && cd duktape.cr/ext && git checkout v0.20.0 && make && cd ..
|
RUN git clone https://github.com/jessedoyle/duktape.cr && cd duktape.cr/ext && git checkout v0.20.0 && make && cd ..
|
||||||
RUN git clone https://github.com/hkalexling/image_size.cr && cd image_size.cr && git checkout v0.2.0 && make && cd ..
|
RUN git clone https://github.com/hkalexling/image_size.cr && cd image_size.cr && git checkout v0.2.0 && make && cd ..
|
||||||
|
@ -2,7 +2,7 @@ FROM arm64v8/ubuntu:18.04
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -y wget git make llvm-8 llvm-8-dev g++ libsqlite3-dev libyaml-dev libgc-dev libssl-dev libcrypto++-dev libevent-dev libgmp-dev zlib1g-dev libpcre++-dev pkg-config libarchive-dev libxml2-dev libacl1-dev nettle-dev liblzo2-dev liblzma-dev libbz2-dev libjpeg-turbo8-dev libpng-dev libtiff-dev
|
RUN apt-get update && apt-get install -y wget git make llvm-8 llvm-8-dev g++ libsqlite3-dev libyaml-dev libgc-dev libssl-dev libcrypto++-dev libevent-dev libgmp-dev zlib1g-dev libpcre++-dev pkg-config libarchive-dev libxml2-dev libacl1-dev nettle-dev liblzo2-dev liblzma-dev libbz2-dev libjpeg-turbo8-dev libpng-dev libtiff-dev
|
||||||
|
|
||||||
RUN git clone https://github.com/crystal-lang/crystal && cd crystal && git checkout 0.34.0 && make deps && cd ..
|
RUN git clone https://github.com/crystal-lang/crystal && cd crystal && git checkout 0.35.1 && make deps && cd ..
|
||||||
RUN git clone https://github.com/kostya/myhtml && cd myhtml/src/ext && git checkout v1.5.0 && make && cd ..
|
RUN git clone https://github.com/kostya/myhtml && cd myhtml/src/ext && git checkout v1.5.0 && make && cd ..
|
||||||
RUN git clone https://github.com/jessedoyle/duktape.cr && cd duktape.cr/ext && git checkout v0.20.0 && make && cd ..
|
RUN git clone https://github.com/jessedoyle/duktape.cr && cd duktape.cr/ext && git checkout v0.20.0 && make && cd ..
|
||||||
RUN git clone https://github.com/hkalexling/image_size.cr && cd image_size.cr && git checkout v0.2.0 && make && cd ..
|
RUN git clone https://github.com/hkalexling/image_size.cr && cd image_size.cr && git checkout v0.2.0 && make && cd ..
|
||||||
|
36
shard.lock
36
shard.lock
@ -1,62 +1,62 @@
|
|||||||
version: 1.0
|
version: 2.0
|
||||||
shards:
|
shards:
|
||||||
ameba:
|
ameba:
|
||||||
github: crystal-ameba/ameba
|
git: https://github.com/crystal-ameba/ameba.git
|
||||||
version: 0.12.1
|
version: 0.12.1
|
||||||
|
|
||||||
archive:
|
archive:
|
||||||
github: hkalexling/archive.cr
|
git: https://github.com/hkalexling/archive.cr.git
|
||||||
version: 0.4.0
|
version: 0.4.0
|
||||||
|
|
||||||
baked_file_system:
|
baked_file_system:
|
||||||
github: schovi/baked_file_system
|
git: https://github.com/schovi/baked_file_system.git
|
||||||
version: 0.9.8
|
version: 0.9.8+git.commit.fb3091b546797fbec3c25dc0e1e2cff60bb9033b
|
||||||
|
|
||||||
clim:
|
clim:
|
||||||
github: at-grandpa/clim
|
git: https://github.com/at-grandpa/clim.git
|
||||||
version: 0.12.0
|
version: 0.12.0
|
||||||
|
|
||||||
db:
|
db:
|
||||||
github: crystal-lang/crystal-db
|
git: https://github.com/crystal-lang/crystal-db.git
|
||||||
version: 0.9.0
|
version: 0.9.0
|
||||||
|
|
||||||
duktape:
|
duktape:
|
||||||
github: jessedoyle/duktape.cr
|
git: https://github.com/jessedoyle/duktape.cr.git
|
||||||
version: 0.20.0
|
version: 0.20.0
|
||||||
|
|
||||||
exception_page:
|
exception_page:
|
||||||
github: crystal-loot/exception_page
|
git: https://github.com/crystal-loot/exception_page.git
|
||||||
version: 0.1.4
|
version: 0.1.4
|
||||||
|
|
||||||
http_proxy:
|
http_proxy:
|
||||||
github: mamantoha/http_proxy
|
git: https://github.com/mamantoha/http_proxy.git
|
||||||
version: 0.7.1
|
version: 0.7.1
|
||||||
|
|
||||||
image_size:
|
image_size:
|
||||||
github: hkalexling/image_size.cr
|
git: https://github.com/hkalexling/image_size.cr.git
|
||||||
version: 0.4.0
|
version: 0.4.0
|
||||||
|
|
||||||
kemal:
|
kemal:
|
||||||
github: kemalcr/kemal
|
git: https://github.com/kemalcr/kemal.git
|
||||||
version: 0.26.1
|
version: 0.27.0
|
||||||
|
|
||||||
kemal-session:
|
kemal-session:
|
||||||
github: kemalcr/kemal-session
|
git: https://github.com/kemalcr/kemal-session.git
|
||||||
version: 0.12.1
|
version: 0.12.1
|
||||||
|
|
||||||
kilt:
|
kilt:
|
||||||
github: jeromegn/kilt
|
git: https://github.com/jeromegn/kilt.git
|
||||||
version: 0.4.0
|
version: 0.4.0
|
||||||
|
|
||||||
myhtml:
|
myhtml:
|
||||||
github: kostya/myhtml
|
git: https://github.com/kostya/myhtml.git
|
||||||
version: 1.5.1
|
version: 1.5.1
|
||||||
|
|
||||||
radix:
|
radix:
|
||||||
github: luislavena/radix
|
git: https://github.com/luislavena/radix.git
|
||||||
version: 0.3.9
|
version: 0.3.9
|
||||||
|
|
||||||
sqlite3:
|
sqlite3:
|
||||||
github: crystal-lang/crystal-sqlite3
|
git: https://github.com/crystal-lang/crystal-sqlite3.git
|
||||||
version: 0.16.0
|
version: 0.16.0
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ targets:
|
|||||||
mango:
|
mango:
|
||||||
main: src/mango.cr
|
main: src/mango.cr
|
||||||
|
|
||||||
crystal: 0.34.0
|
crystal: 0.35.1
|
||||||
|
|
||||||
license: MIT
|
license: MIT
|
||||||
|
|
||||||
@ -21,6 +21,7 @@ dependencies:
|
|||||||
github: crystal-lang/crystal-sqlite3
|
github: crystal-lang/crystal-sqlite3
|
||||||
baked_file_system:
|
baked_file_system:
|
||||||
github: schovi/baked_file_system
|
github: schovi/baked_file_system
|
||||||
|
version: 0.9.8+git.commit.fb3091b546797fbec3c25dc0e1e2cff60bb9033b
|
||||||
archive:
|
archive:
|
||||||
github: hkalexling/archive.cr
|
github: hkalexling/archive.cr
|
||||||
ameba:
|
ameba:
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
require "zip"
|
require "compress/zip"
|
||||||
require "archive"
|
require "archive"
|
||||||
|
|
||||||
# A unified class to handle all supported archive formats. It uses the ::Zip
|
# A unified class to handle all supported archive formats. It uses the
|
||||||
# module in crystal standard library if the target file is a zip archive.
|
# Compress::Zip module in crystal standard library if the target file is
|
||||||
# Otherwise it uses `archive.cr`.
|
# a zip archive. Otherwise it uses `archive.cr`.
|
||||||
class ArchiveFile
|
class ArchiveFile
|
||||||
def initialize(@filename : String)
|
def initialize(@filename : String)
|
||||||
if [".cbz", ".zip"].includes? File.extname filename
|
if [".cbz", ".zip"].includes? File.extname filename
|
||||||
@archive_file = Zip::File.new filename
|
@archive_file = Compress::Zip::File.new filename
|
||||||
else
|
else
|
||||||
@archive_file = Archive::File.new filename
|
@archive_file = Archive::File.new filename
|
||||||
end
|
end
|
||||||
@ -20,16 +20,16 @@ class ArchiveFile
|
|||||||
end
|
end
|
||||||
|
|
||||||
def close
|
def close
|
||||||
if @archive_file.is_a? Zip::File
|
if @archive_file.is_a? Compress::Zip::File
|
||||||
@archive_file.as(Zip::File).close
|
@archive_file.as(Compress::Zip::File).close
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Lists all file entries
|
# Lists all file entries
|
||||||
def entries
|
def entries
|
||||||
ary = [] of Zip::File::Entry | Archive::Entry
|
ary = [] of Compress::Zip::File::Entry | Archive::Entry
|
||||||
@archive_file.entries.map do |e|
|
@archive_file.entries.map do |e|
|
||||||
if (e.is_a? Zip::File::Entry && e.file?) ||
|
if (e.is_a? Compress::Zip::File::Entry && e.file?) ||
|
||||||
(e.is_a? Archive::Entry && e.info.file?)
|
(e.is_a? Archive::Entry && e.info.file?)
|
||||||
ary.push e
|
ary.push e
|
||||||
end
|
end
|
||||||
@ -37,8 +37,8 @@ class ArchiveFile
|
|||||||
ary
|
ary
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_entry(e : Zip::File::Entry | Archive::Entry) : Bytes?
|
def read_entry(e : Compress::Zip::File::Entry | Archive::Entry) : Bytes?
|
||||||
if e.is_a? Zip::File::Entry
|
if e.is_a? Compress::Zip::File::Entry
|
||||||
data = nil
|
data = nil
|
||||||
e.open do |io|
|
e.open do |io|
|
||||||
slice = Bytes.new e.uncompressed_size
|
slice = Bytes.new e.uncompressed_size
|
||||||
|
@ -23,7 +23,7 @@ class StaticHandler < Kemal::Handler
|
|||||||
|
|
||||||
slice = Bytes.new file.size
|
slice = Bytes.new file.size
|
||||||
file.read slice
|
file.read slice
|
||||||
return send_file env, slice, file.mime_type
|
return send_file env, slice, MIME.from_filename file.path
|
||||||
end
|
end
|
||||||
call_next env
|
call_next env
|
||||||
end
|
end
|
||||||
|
@ -26,9 +26,9 @@ class Logger
|
|||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
@log = Log.for("")
|
@log = Log.for("")
|
||||||
|
|
||||||
@backend = Log::IOBackend.new
|
@backend = Log::IOBackend.new
|
||||||
@backend.formatter = ->(entry : Log::Entry, io : IO) do
|
|
||||||
|
format_proc = ->(entry : Log::Entry, io : IO) do
|
||||||
color = :default
|
color = :default
|
||||||
{% begin %}
|
{% begin %}
|
||||||
case entry.severity.label.to_s().downcase
|
case entry.severity.label.to_s().downcase
|
||||||
@ -45,12 +45,14 @@ class Logger
|
|||||||
io << entry.message
|
io << entry.message
|
||||||
end
|
end
|
||||||
|
|
||||||
Log.builder.bind "*", @@severity, @backend
|
@backend.formatter = Log::Formatter.new &format_proc
|
||||||
|
Log.setup @@severity, @backend
|
||||||
end
|
end
|
||||||
|
|
||||||
# Ignores @@severity and always log msg
|
# Ignores @@severity and always log msg
|
||||||
def log(msg)
|
def log(msg)
|
||||||
@backend.write Log::Entry.new "", Log::Severity::None, msg, nil
|
@backend.write Log::Entry.new "", Log::Severity::None, msg,
|
||||||
|
Log::Metadata.empty, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.log(msg)
|
def self.log(msg)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
require "./api"
|
require "./api"
|
||||||
require "zip"
|
require "compress/zip"
|
||||||
|
|
||||||
module MangaDex
|
module MangaDex
|
||||||
class PageJob
|
class PageJob
|
||||||
property success = false
|
property success = false
|
||||||
property url : String
|
property url : String
|
||||||
property filename : String
|
property filename : String
|
||||||
property writer : Zip::Writer
|
property writer : Compress::Zip::Writer
|
||||||
property tries_remaning : Int32
|
property tries_remaning : Int32
|
||||||
|
|
||||||
def initialize(@url, @filename, @writer, @tries_remaning)
|
def initialize(@url, @filename, @writer, @tries_remaning)
|
||||||
@ -69,7 +69,7 @@ module MangaDex
|
|||||||
# Find the number of digits needed to store the number of pages
|
# Find the number of digits needed to store the number of pages
|
||||||
len = Math.log10(chapter.pages.size).to_i + 1
|
len = Math.log10(chapter.pages.size).to_i + 1
|
||||||
|
|
||||||
writer = Zip::Writer.new zip_path
|
writer = Compress::Zip::Writer.new zip_path
|
||||||
# Create a buffered channel. It works as an FIFO queue
|
# Create a buffered channel. It works as an FIFO queue
|
||||||
channel = Channel(PageJob).new chapter.pages.size
|
channel = Channel(PageJob).new chapter.pages.size
|
||||||
spawn do
|
spawn do
|
||||||
|
@ -53,7 +53,7 @@ class Plugin
|
|||||||
end
|
end
|
||||||
|
|
||||||
zip_path = File.join manga_dir, "#{chapter_title}.cbz.part"
|
zip_path = File.join manga_dir, "#{chapter_title}.cbz.part"
|
||||||
writer = Zip::Writer.new zip_path
|
writer = Compress::Zip::Writer.new zip_path
|
||||||
rescue e
|
rescue e
|
||||||
@queue.set_status Queue::JobStatus::Error, job
|
@queue.set_status Queue::JobStatus::Error, job
|
||||||
unless e.message.nil?
|
unless e.message.nil?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user