StandardRb
This commit is contained in:
@@ -22,7 +22,7 @@ module Adamantium
|
|||||||
handle_exception ROM::TupleCountMismatchError => :not_found
|
handle_exception ROM::TupleCountMismatchError => :not_found
|
||||||
handle_exception StandardError => :handle_error
|
handle_exception StandardError => :handle_error
|
||||||
|
|
||||||
def cache(key:, params: [], content_proc:, expiry: TimeMath.min.advance(Time.now, +10))
|
def cache(key:, content_proc:, params: [], expiry: TimeMath.min.advance(Time.now, +10))
|
||||||
cacher.call(key: key, params: params, content_proc: content_proc, expiry: expiry)
|
cacher.call(key: key, params: params, content_proc: content_proc, expiry: expiry)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ Hanami.app.register_provider :clients, namespace: true do
|
|||||||
register "blue_sky", Adamantium::Client::BlueSky.new
|
register "blue_sky", Adamantium::Client::BlueSky.new
|
||||||
register "omdb", Adamantium::Client::Omdb.new(api_key: target["settings"].omdb_api_key)
|
register "omdb", Adamantium::Client::Omdb.new(api_key: target["settings"].omdb_api_key)
|
||||||
register "gist", Adamantium::Client::Gist.new(token: target["settings"].gist_client_token)
|
register "gist", Adamantium::Client::Gist.new(token: target["settings"].gist_client_token)
|
||||||
|
|
||||||
require "redis"
|
require "redis"
|
||||||
register "redis", Redis.new
|
register "redis", Redis.new
|
||||||
end
|
end
|
||||||
|
@@ -14,7 +14,7 @@ module Adamantium
|
|||||||
return unless mail.subject == "About that post of yours"
|
return unless mail.subject == "About that post of yours"
|
||||||
|
|
||||||
reply_content, in_reply_to = mail.body.decoded.split("---")
|
reply_content, in_reply_to = mail.body.decoded.split("---")
|
||||||
post_url = URI.join(settings.micropub_site_url, in_reply_to.match(URI::DEFAULT_PARSER.make_regexp)[7]&.gsub(")", "")).to_s
|
post_url = URI.join(settings.micropub_site_url, in_reply_to.match(URI::DEFAULT_PARSER.make_regexp)[7]&.delete(")")).to_s
|
||||||
|
|
||||||
slug = post_url.split("/").last
|
slug = post_url.split("/").last
|
||||||
post = post_repo.fetch!(slug)
|
post = post_repo.fetch!(slug)
|
||||||
|
@@ -15,4 +15,3 @@ module Adamantium
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -4,9 +4,9 @@ module Main
|
|||||||
class Index < Action
|
class Index < Action
|
||||||
include Deps["views.posts.index"]
|
include Deps["views.posts.index"]
|
||||||
def handle(req, res)
|
def handle(req, res)
|
||||||
res.body = cache(key: "posts_index",
|
res.body = cache(key: "posts_index",
|
||||||
params: [req.params[:q]],
|
params: [req.params[:q]],
|
||||||
content_proc: ->(q) { index.call(context: Main::Views::Context.new(request: req), query: q) })
|
content_proc: ->(q) { index.call(context: Main::Views::Context.new(request: req), query: q) })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -60,9 +60,9 @@ module Main
|
|||||||
"📷"
|
"📷"
|
||||||
else
|
else
|
||||||
@prefix_emoji ||= if (match = content.match(Unicode::Emoji::REGEX))
|
@prefix_emoji ||= if (match = content.match(Unicode::Emoji::REGEX))
|
||||||
match
|
match
|
||||||
else
|
else
|
||||||
"💬"
|
"💬"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user