StandardRB

This commit is contained in:
2023-12-02 20:32:57 +11:00
parent c6e0c6e832
commit 8501279eaa
15 changed files with 29 additions and 34 deletions

View File

@@ -19,7 +19,7 @@ module Adamantium
end
expose :query do |query:|
query == "" ? nil : query
(query == "") ? nil : query
end
expose :post_years do

View File

@@ -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

View File

@@ -8,7 +8,7 @@ module Adamantium
def call(env)
session = env["rack.session"]
return [403, {'Content-Type' => 'text/html'}, ["Unauthorized | <a href=\"/admin/login\">Login</>"]] unless @auth_proc.call(session[:user_id])
return [403, {"Content-Type" => "text/html"}, ["Unauthorized | <a href=\"/admin/login\">Login</>"]] unless @auth_proc.call(session[:user_id])
@app.call(env)
end

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -12,11 +12,7 @@ module Admin
return nil
end
user_id = token.user_id
if user_id
user_id
end
token.user_id
end
end
end

View File

@@ -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"

View File

@@ -4,7 +4,6 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Adamantium - Micropub</title>
<%= favicon_tag %>
<%= stylesheet_tag "micropub/app" %>
</head>
<body>