Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: show redirect URL in forge connection form

Display the OAuth callback URL as a read-only field so users know what
to configure in their forge's OAuth application settings. Extract
redirect_url/0 in Sower.Forge.Oauth to avoid duplicating the URL
construction.

sow-114

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+19 -2
+5 -2
apps/sower/lib/sower/forge/oauth.ex
··· 6 6 7 7 # client 8 8 9 + def redirect_url do 10 + "#{Application.fetch_env!(:sower, :public_url)}/forges/oauth/callback" 11 + end 12 + 9 13 def start_link(_) do 10 14 GenServer.start_link(__MODULE__, [], name: __MODULE__) 11 15 end ··· 39 43 forge.client_id, 40 44 forge.client_secret, 41 45 %{ 42 - redirect_uri: 43 - "#{Application.fetch_env!(:sower, :public_url)}/forges/oauth/callback", 46 + redirect_uri: redirect_url(), 44 47 require_pkce: true, 45 48 pkce_verifier: verifier 46 49 }
+12
apps/sower/lib/sower_web/live/forge/connection_live/form_component.ex
··· 30 30 /> 31 31 <.input field={@form[:client_id]} type="text" label="Client" /> 32 32 <.input field={@form[:client_secret]} type="text" label="Client secret" /> 33 + <div> 34 + <.label>Redirect URL</.label> 35 + <div class="mt-1 flex items-center gap-2"> 36 + <code class="block w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900"> 37 + {@redirect_url} 38 + </code> 39 + </div> 40 + <p class="mt-1 text-sm text-zinc-500"> 41 + Use this as the redirect URI when creating the OAuth application on your forge. 42 + </p> 43 + </div> 33 44 <:actions> 34 45 <.button phx-disable-with="Saving...">Save Connection</.button> 35 46 </:actions> ··· 43 54 {:ok, 44 55 socket 45 56 |> assign(assigns) 57 + |> assign(:redirect_url, Sower.Forge.Oauth.redirect_url()) 46 58 |> assign_new(:form, fn -> 47 59 to_form(Forge.change_connection(connection)) 48 60 end)}
+2
apps/sower/test/test_helper.exs
··· 1 + Application.put_env(:sower, :public_url, "http://localhost:4000") 2 + 1 3 ExUnit.start() 2 4 Faker.start() 3 5 Ecto.Adapters.SQL.Sandbox.mode(Sower.Repo, :manual)