Standard rb

This commit is contained in:
2023-12-21 19:44:15 +11:00
parent 6a0adf1f81
commit 05aa2bf1fd
4 changed files with 12 additions and 12 deletions

View File

@@ -5,21 +5,21 @@ module Adamantium
module Timemachine module Timemachine
class Show < Adamantium::View class Show < Adamantium::View
include Deps[ include Deps[
"repos.post_repo", "repos.post_repo",
"repos.movie_repo", "repos.movie_repo",
"repos.podcast_scrobble_repo", "repos.podcast_scrobble_repo",
"repos.trip_repo" "repos.trip_repo"
] ]
expose :posts do |date| expose :posts do |date|
post_repo.posts_for_timemachine(date: date.value).map do |post| post_repo.posts_for_timemachine(date: date.value).map do |post|
Decorators::Posts::Decorator.new(post) Decorators::Posts::Decorator.new(post)
end end
end end
expose :bookmarks do |date| expose :bookmarks do |date|
post_repo.bookmarks_for_timemachine(date: date.value).map do |post| post_repo.bookmarks_for_timemachine(date: date.value).map do |post|
Decorators::Bookmarks::Decorator.new(post) Decorators::Bookmarks::Decorator.new(post)
end end
end end
@@ -36,13 +36,13 @@ module Adamantium
unless today_to_tomorrow[:hours] < 0 unless today_to_tomorrow[:hours] < 0
TimeMath.day.advance(date.value, +1) TimeMath.day.advance(date.value, +1)
.strftime("%Y/%m/%d") .strftime("%Y/%m/%d")
end end
end end
expose :today do expose :today do
Time.now Time.now
.strftime("%Y/%m/%d") .strftime("%Y/%m/%d")
end end
expose :current_date do |year:, month:, day:| expose :current_date do |year:, month:, day:|

View File

@@ -21,7 +21,7 @@ end
require "adamantium/middleware/header_fix" require "adamantium/middleware/header_fix"
use Adamantium::Middleware::HeaderFix do |headers, env| use Adamantium::Middleware::HeaderFix do |headers, env|
# if env["REQUEST_METHOD"] == "HEAD" # if env["REQUEST_METHOD"] == "HEAD"
headers['Content-Type'] = "text/html; charset=utf-8" headers["Content-Type"] = "text/html; charset=utf-8"
# end # end
end end

View File

@@ -4,7 +4,7 @@ require "rack/contrib"
module Adamantium module Adamantium
module Middleware module Middleware
class HeaderFix class HeaderFix
HEADERS_KLASS = Rack.release < "3" ? Rack::Utils::HeaderHash : Rack::Headers HEADERS_KLASS = (Rack.release < "3") ? Rack::Utils::HeaderHash : Rack::Headers
private_constant :HEADERS_KLASS private_constant :HEADERS_KLASS
def initialize(app, &block) def initialize(app, &block)
@@ -21,4 +21,4 @@ module Adamantium
end end
end end
end end
end end

View File

@@ -20,7 +20,7 @@ module Micropub
webmentions_repo.create(reply) webmentions_repo.create(reply)
res.body = { res.body = {
"result": "Webmention was successful" result: "Webmention was successful"
}.to_json }.to_json
res.status = 202 res.status = 202
in Failure(:invalid_request) in Failure(:invalid_request)