Remove the Context and Router classes

This commit is contained in:
Alex Ling
2020-12-30 15:58:51 +00:00
parent db2a51a26b
commit af2fd2a66a
10 changed files with 89 additions and 121 deletions
+4 -6
View File
@@ -1,18 +1,16 @@
require "./router"
class OPDSRouter < Router
struct OPDSRouter
def initialize
get "/opds" do |env|
titles = @context.library.titles
titles = Library.default.titles
render_xml "src/views/opds/index.xml.ecr"
end
get "/opds/book/:title_id" do |env|
begin
title = @context.library.get_title(env.params.url["title_id"]).not_nil!
title = Library.default.get_title(env.params.url["title_id"]).not_nil!
render_xml "src/views/opds/title.xml.ecr"
rescue e
@context.error e
Logger.error e
env.response.status_code = 404
end
end