From 76185e3b57ea8d46089c8de875922503b980bf46 Mon Sep 17 00:00:00 2001 From: Inhji Date: Sun, 28 May 2023 22:35:36 +0200 Subject: [PATCH] add indieweb endpoint meta tags --- config/config.exs | 15 ++++++++++++++- .../components/layouts/root_public.html.heex | 4 ++++ lib/chiya_web/global_assigns.ex | 9 ++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/config/config.exs b/config/config.exs index 3b30196..92945a5 100644 --- a/config/config.exs +++ b/config/config.exs @@ -18,7 +18,8 @@ config :chiya, ChiyaWeb.Endpoint, layout: false ], pubsub_server: Chiya.PubSub, - live_view: [signing_salt: "OJncEkwy"] + live_view: [signing_salt: "OJncEkwy"], + user_agent: "Chiya/0.x +https://inhji.de" # Configures the mailer # @@ -63,6 +64,18 @@ config :waffle, # Configure Timezones with :tz config :elixir, :time_zone_database, Tz.TimeZoneDatabase +config :chiya, :indie, + token_endpoint: "https://tokens.indieauth.com/token", + auth_endpoint: "https://indieauth.com/auth", + supported_scopes: [ + # Micropub scopes + "create", + "update", + "delete", + "undelete", + "media" + ] + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{config_env()}.exs" diff --git a/lib/chiya_web/components/layouts/root_public.html.heex b/lib/chiya_web/components/layouts/root_public.html.heex index 2f6db51..a2577ef 100644 --- a/lib/chiya_web/components/layouts/root_public.html.heex +++ b/lib/chiya_web/components/layouts/root_public.html.heex @@ -10,6 +10,10 @@ <.favicon /> + + + + <%= for identity <- @identities do %> <% end %> diff --git a/lib/chiya_web/global_assigns.ex b/lib/chiya_web/global_assigns.ex index 6c350f5..c2cbc17 100644 --- a/lib/chiya_web/global_assigns.ex +++ b/lib/chiya_web/global_assigns.ex @@ -1,9 +1,16 @@ defmodule ChiyaWeb.GlobalAssigns do import Plug.Conn + @token_endpoint Application.compile_env!(:chiya, [:indie, :token_endpoint]) + @auth_endpoint Application.compile_env!(:chiya, [:indie, :auth_endpoint]) + def fetch_settings(conn, _opts) do settings = Chiya.Site.get_settings() - assign(conn, :settings, settings) + + conn + |> assign(:token_endpoint, @token_endpoint) + |> assign(:auth_endpoint, @auth_endpoint) + |> assign(:settings, settings) end def fetch_identities(conn, _opts) do