diff --git a/app/repos/post_repo.rb b/app/repos/post_repo.rb
index 7c5155b..893122d 100644
--- a/app/repos/post_repo.rb
+++ b/app/repos/post_repo.rb
@@ -186,12 +186,12 @@ module Adamantium
.order(:year)
.to_a
end
-
+
def search(term:)
posts
.where(post_type: "post", location: nil)
.published
- .search(term: term)
+ .search(term: term)
.combine(:tags)
.order(Sequel.desc(:published_at))
.to_a
diff --git a/app/views/posts/index.rb b/app/views/posts/index.rb
index 4d8911d..c53193f 100644
--- a/app/views/posts/index.rb
+++ b/app/views/posts/index.rb
@@ -17,9 +17,9 @@ module Adamantium
post_repo.post_listing
end
end
-
+
expose :query do |query:|
- query == "" ? nil : query
+ (query == "") ? nil : query
end
expose :post_years do
diff --git a/config.ru b/config.ru
index 7a75380..afe4924 100644
--- a/config.ru
+++ b/config.ru
@@ -7,10 +7,10 @@ use Rack::Static, urls: ["/assets", "/media"], root: "public"
raise StandardError.new("No secret key") unless ENV["SESSION_SECRET"]
use Rack::Session::Cookie,
- :domain => URI.parse(ENV["MICROPUB_SITE_URL"]).host,
- :path => '/',
- :expire_after => 3600*24,
- :secret => ENV["SESSION_SECRET"]
+ domain: URI.parse(ENV["MICROPUB_SITE_URL"]).host,
+ path: "/",
+ expire_after: 3600 * 24,
+ secret: ENV["SESSION_SECRET"]
require "rack/rewrite"
use Rack::Rewrite do
diff --git a/config/settings.rb b/config/settings.rb
index eb99d23..f347223 100644
--- a/config/settings.rb
+++ b/config/settings.rb
@@ -53,10 +53,10 @@ module Adamantium
setting :micropub_authorization_endpoint
setting :micropub_token_endpoint
- setting :microblog_auth_endpoint, default: nil
+ setting :microblog_auth_endpoint, default: nil
- setting :overcast_username, default: nil
- setting :overcast_password, default: nil
+ setting :overcast_username, default: nil
+ setting :overcast_password, default: nil
setting :mastodon_token, default: nil
setting :mastodon_server, default: nil
diff --git a/lib/adamantium/middleware/authenticate.rb b/lib/adamantium/middleware/authenticate.rb
index b8cae7b..d7f7009 100644
--- a/lib/adamantium/middleware/authenticate.rb
+++ b/lib/adamantium/middleware/authenticate.rb
@@ -8,7 +8,7 @@ module Adamantium
def call(env)
session = env["rack.session"]
- return [403, {'Content-Type' => 'text/html'}, ["Unauthorized | Login>"]] unless @auth_proc.call(session[:user_id])
+ return [403, {"Content-Type" => "text/html"}, ["Unauthorized | Login>"]] unless @auth_proc.call(session[:user_id])
@app.call(env)
end
diff --git a/lib/adamantium/overcast_scrobbler.rb b/lib/adamantium/overcast_scrobbler.rb
index fb4a446..aa0b324 100644
--- a/lib/adamantium/overcast_scrobbler.rb
+++ b/lib/adamantium/overcast_scrobbler.rb
@@ -20,7 +20,7 @@ module Adamantium
podcast_list = []
doc.xpath("//outline[@type='rss']").each_with_object(podcast_list) do |rss, memo|
- podcasts = rss.xpath("outline[@type='podcast-episode']").select{|ep| ep.get_attribute("played") == "1" }
+ podcasts = rss.xpath("outline[@type='podcast-episode']").select { |ep| ep.get_attribute("played") == "1" }
name = rss.get_attribute("title")
@@ -43,4 +43,4 @@ module Adamantium
end
end
end
-end
+end
diff --git a/slices/admin/actions/sessions/create.rb b/slices/admin/actions/sessions/create.rb
index af72d91..9da1533 100644
--- a/slices/admin/actions/sessions/create.rb
+++ b/slices/admin/actions/sessions/create.rb
@@ -5,7 +5,7 @@ module Admin
include Deps["commands.sessions.create"]
def handle(req, res)
- create.(email: req.params[:email])
+ create.call(email: req.params[:email])
res.redirect_to "/admin"
end
diff --git a/slices/admin/actions/sessions/validate.rb b/slices/admin/actions/sessions/validate.rb
index dfb361f..10e0ee8 100644
--- a/slices/admin/actions/sessions/validate.rb
+++ b/slices/admin/actions/sessions/validate.rb
@@ -5,7 +5,7 @@ module Admin
include Deps["commands.sessions.validate"]
def handle(req, res)
- user_id = validate.(token: req.params[:token])
+ user_id = validate.call(token: req.params[:token])
session = req.env["rack.session"]
session[:user_id] = user_id
diff --git a/slices/admin/commands/bookmarks/cache.rb b/slices/admin/commands/bookmarks/cache.rb
index 5c2a449..19da37c 100644
--- a/slices/admin/commands/bookmarks/cache.rb
+++ b/slices/admin/commands/bookmarks/cache.rb
@@ -9,7 +9,7 @@ module Admin
bookmark = bookmark_repo.fetch(id: bookmark_id)
page_cacher.call(url: bookmark.url) do |content|
- bookmark_repo.update(id: bookmark_id, params: { cached_content: content })
+ bookmark_repo.update(id: bookmark_id, params: {cached_content: content})
end
Success()
diff --git a/slices/admin/commands/sessions/create.rb b/slices/admin/commands/sessions/create.rb
index 0d0e4d9..e0cb585 100644
--- a/slices/admin/commands/sessions/create.rb
+++ b/slices/admin/commands/sessions/create.rb
@@ -5,8 +5,8 @@ module Admin
module Sessions
class Create
include Deps[
- "repos.login_tokens_repo",
- "repos.user_repo"
+ "repos.login_tokens_repo",
+ "repos.user_repo"
]
def call(email:)
@@ -37,7 +37,7 @@ module Admin
body "#{app_settings.micropub_site_url}/admin/login/#{token.token}"
end
- mail[:to] = email
+ mail[:to] = user.email
mail[:from] = app_settings.from_email
mail.deliver
diff --git a/slices/admin/commands/sessions/validate.rb b/slices/admin/commands/sessions/validate.rb
index 291567a..7b6514a 100644
--- a/slices/admin/commands/sessions/validate.rb
+++ b/slices/admin/commands/sessions/validate.rb
@@ -12,13 +12,9 @@ module Admin
return nil
end
- user_id = token.user_id
-
- if user_id
- user_id
- end
+ token.user_id
end
end
end
end
-end
\ No newline at end of file
+end
diff --git a/slices/admin/config/authenticated_admin_action.rb b/slices/admin/config/authenticated_admin_action.rb
index 56b891b..267b806 100644
--- a/slices/admin/config/authenticated_admin_action.rb
+++ b/slices/admin/config/authenticated_admin_action.rb
@@ -3,7 +3,7 @@ require "adamantium/middleware/authenticate"
module Adamantium
class AuthenticatedAdminAction
def self.call(action:)
- auth_proc = -> (id) { Admin::Container["repos.user_repo"].exists(id) }
+ auth_proc = ->(id) { Admin::Container["repos.user_repo"].exists(id) }
action_proc = ->(env) { Admin::Container["actions.#{action}"].call(env) }
Adamantium::Middleware::Authenticate.new(action_proc, auth_proc)
diff --git a/slices/admin/templates/layouts/app.html.slim b/slices/admin/templates/layouts/app.html.slim
index 3fa073c..db56bc3 100644
--- a/slices/admin/templates/layouts/app.html.slim
+++ b/slices/admin/templates/layouts/app.html.slim
@@ -8,10 +8,10 @@ html
title Admin // Daniel Nitsikopoulos
- = stylesheet_tag "app"
+ = stylesheet_tag "admin/app"
link rel="icon" type="image/x-icon" href="/assets/favicon.ico"
- = javascript_tag "app"
+ = javascript_tag "admin/app"
script src="https://unpkg.com/htmx.org@1.9.2/dist/htmx.min.js" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"
script src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.0/dist/cdn.min.js" defer="true"
diff --git a/slices/micropub/action.rb b/slices/micropub/action.rb
index eab7567..9151a88 100644
--- a/slices/micropub/action.rb
+++ b/slices/micropub/action.rb
@@ -4,10 +4,10 @@
module Micropub
class Action < Adamantium::Action
include Deps["logger",
- "settings",
- not_found_view: "views.not_found",
- error_view: "views.error",
- sentry: "sentry.client"]
+ "settings",
+ not_found_view: "views.not_found",
+ error_view: "views.error",
+ sentry: "sentry.client"]
include Dry::Matcher.for(:handle, with: Dry::Matcher::ResultMatcher)
include Dry::Monads[:result]
diff --git a/slices/micropub/templates/layouts/app.html.erb b/slices/micropub/templates/layouts/app.html.erb
index abec571..7a15c65 100644
--- a/slices/micropub/templates/layouts/app.html.erb
+++ b/slices/micropub/templates/layouts/app.html.erb
@@ -4,7 +4,6 @@
Adamantium - Micropub
- <%= favicon_tag %>
<%= stylesheet_tag "micropub/app" %>