Merge branch 'feature/opds' into dev

This commit is contained in:
Alex Ling
2020-06-05 14:28:36 +00:00
6 changed files with 181 additions and 4 deletions

View File

@@ -39,6 +39,12 @@ def send_json(env, json)
env.response.print json
end
def send_attachment(env, path)
MIME.register ".cbz", "application/vnd.comicbook+zip"
MIME.register ".cbr", "application/vnd.comicbook-rar"
send_file env, path, filename: File.basename(path), disposition: "attachment"
end
def hash_to_query(hash)
hash.map { |k, v| "#{k}=#{v}" }.join("&")
end
@@ -125,3 +131,7 @@ def validate_password(password)
raise "password should contain ASCII characters only"
end
end
macro render_xml(path)
send_file env, ECR.render({{path}}).to_slice, "application/xml"
end