mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
chore(portal): bump phoenix to 1.8 (#10510)
Bumps Phoenix to 1.8 and Phoenix LiveView to 1.1. As part of the bump a number of issues had to be addressed. Comments inline provide more context. Supersedes #10475 Supersedes #10448
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
defmodule API.FallbackController do
|
||||
use Phoenix.Controller
|
||||
use API, :controller
|
||||
|
||||
def call(conn, {:error, :not_found}) do
|
||||
conn
|
||||
|
||||
@@ -43,7 +43,7 @@ defmodule API.MixProject do
|
||||
{:domain, in_umbrella: true},
|
||||
|
||||
# Phoenix deps
|
||||
{:phoenix, "~> 1.7.0"},
|
||||
{:phoenix, "~> 1.8"},
|
||||
{:phoenix_ecto, "~> 4.4"},
|
||||
{:plug_cowboy, "~> 2.7"},
|
||||
|
||||
|
||||
@@ -2,17 +2,14 @@ defmodule Domain.Mailer.Notifications do
|
||||
import Swoosh.Email
|
||||
import Domain.Mailer
|
||||
import Phoenix.Template, only: [embed_templates: 2]
|
||||
import Phoenix.VerifiedRoutes
|
||||
|
||||
@endpoint Web.Endpoint
|
||||
@router Web.Router
|
||||
|
||||
embed_templates "notifications/*.html", suffix: "_html"
|
||||
embed_templates "notifications/*.text", suffix: "_text"
|
||||
|
||||
def outdated_gateway_email(account, gateways, incompatible_client_count, email) do
|
||||
outdated_clients_url =
|
||||
url(~p"/#{account.id}/clients?#{[clients_order_by: "clients:asc:last_seen_version"]}")
|
||||
url_generator = Application.fetch_env!(:domain, :url_generator)
|
||||
|
||||
outdated_clients_url = url_generator.outdated_clients_url(account.id)
|
||||
|
||||
default_email()
|
||||
|> subject("Firezone Gateway Upgrade Available")
|
||||
|
||||
@@ -48,7 +48,7 @@ defmodule Domain.MixProject do
|
||||
{:ecto_sql, "~> 3.7"},
|
||||
|
||||
# PubSub and Presence
|
||||
{:phoenix, "~> 1.7"},
|
||||
{:phoenix, "~> 1.8"},
|
||||
{:phoenix_pubsub, "~> 2.0"},
|
||||
|
||||
# Auth-related deps
|
||||
|
||||
@@ -109,9 +109,7 @@ defmodule Web.Clients.Components do
|
||||
This component is up to date.
|
||||
</p>
|
||||
<p :if={@outdated?}>
|
||||
A newer version
|
||||
<.website_link path="/changelog">{@latest}</.website_link>
|
||||
is available.
|
||||
A newer version <.website_link path="/changelog">{@latest}</.website_link> is available.
|
||||
</p>
|
||||
</:content>
|
||||
</.popover>
|
||||
|
||||
@@ -203,8 +203,7 @@ defmodule Web.RelayGroups.NewToken do
|
||||
|
||||
<div id="connection-status" class="flex justify-between items-center">
|
||||
<p class="text-sm">
|
||||
Relay not connecting? See our
|
||||
<.website_link path="/kb/administer/troubleshooting">
|
||||
Relay not connecting? See our <.website_link path="/kb/administer/troubleshooting">
|
||||
relay troubleshooting guide
|
||||
</.website_link>.
|
||||
</p>
|
||||
|
||||
@@ -38,8 +38,7 @@ defmodule Web.Settings.IdentityProviders.New do
|
||||
Set up SSO authentication using your own identity provider. Directory sync
|
||||
also available for certain providers. <br /> Learn more about
|
||||
<.website_link path="/kb/authenticate/oidc">SSO authentication</.website_link>
|
||||
and
|
||||
<.website_link path="/kb/authenticate/directory-sync">directory sync</.website_link>
|
||||
and <.website_link path="/kb/authenticate/directory-sync">directory sync</.website_link>
|
||||
in our docs.
|
||||
</:help>
|
||||
<:content>
|
||||
|
||||
@@ -273,7 +273,6 @@ defmodule Web.Router do
|
||||
live "/new", New
|
||||
live "/:provider_id", Show
|
||||
live "/:provider_id/edit", Edit
|
||||
live "/:provider_id/sync", Sync
|
||||
|
||||
# OpenID Connection
|
||||
get "/:provider_id/redirect", Connect, :redirect_to_idp
|
||||
|
||||
17
elixir/apps/web/lib/web/url_generator.ex
Normal file
17
elixir/apps/web/lib/web/url_generator.ex
Normal file
@@ -0,0 +1,17 @@
|
||||
defmodule Web.UrlGenerator do
|
||||
@moduledoc """
|
||||
Generates URLs for use in emails and other domain-layer notifications.
|
||||
This breaks the circular dependency between Web and Domain apps.
|
||||
"""
|
||||
|
||||
use Phoenix.VerifiedRoutes,
|
||||
endpoint: Web.Endpoint,
|
||||
router: Web.Router
|
||||
|
||||
@doc """
|
||||
Generates URL for the clients page with outdated clients filter.
|
||||
"""
|
||||
def outdated_clients_url(account_id) do
|
||||
url(~p"/#{account_id}/clients?#{[clients_order_by: "clients:asc:last_seen_version"]}")
|
||||
end
|
||||
end
|
||||
@@ -37,11 +37,11 @@ defmodule Web.MixProject do
|
||||
{:domain, in_umbrella: true},
|
||||
|
||||
# Phoenix/Plug deps
|
||||
{:phoenix, "~> 1.7.0"},
|
||||
{:phoenix, "~> 1.8"},
|
||||
{:phoenix_live_view, "~> 1.1"},
|
||||
{:phoenix_html, "~> 4.0"},
|
||||
{:phoenix_ecto, "~> 4.4"},
|
||||
{:phoenix_live_reload, "~> 1.2", only: :dev},
|
||||
{:phoenix_live_view, "~> 1.0.0-rc.0"},
|
||||
{:plug_cowboy, "~> 2.7"},
|
||||
{:gettext, "~> 0.20"},
|
||||
{:remote_ip, "~> 1.0"},
|
||||
|
||||
@@ -95,7 +95,7 @@ defmodule Web.Live.Policies.NewTest do
|
||||
html = render(form)
|
||||
|
||||
disabled_input = Floki.find(html, "input[name='policy[actor_group_id]_name']")
|
||||
assert Floki.attribute(disabled_input, "disabled") == ["disabled"]
|
||||
assert Floki.attribute(disabled_input, "disabled") == [""]
|
||||
assert Floki.attribute(disabled_input, "value") == [actor_group.name]
|
||||
|
||||
value_input = Floki.find(html, "input[name='policy[actor_group_id]']")
|
||||
@@ -151,7 +151,7 @@ defmodule Web.Live.Policies.NewTest do
|
||||
html = render(form)
|
||||
|
||||
disabled_input = Floki.find(html, "input[name='policy[resource_id]_name']")
|
||||
assert Floki.attribute(disabled_input, "disabled") == ["disabled"]
|
||||
assert Floki.attribute(disabled_input, "disabled") == [""]
|
||||
assert Floki.attribute(disabled_input, "value") == [resource.name]
|
||||
|
||||
value_input = Floki.find(html, "input[name='policy[resource_id]']")
|
||||
|
||||
@@ -169,10 +169,16 @@ defmodule Web.Live.Settings.IdentityProviders.GoogleWorkspace.EditTest do
|
||||
}
|
||||
)
|
||||
|
||||
adapter_config =
|
||||
Map.merge(provider_attrs.adapter_config, %{
|
||||
"client_id" => "",
|
||||
"service_account_json_key" => nil
|
||||
})
|
||||
|
||||
changed_values = %{
|
||||
provider: %{
|
||||
name: String.duplicate("a", 256),
|
||||
adapter_config: %{provider_attrs.adapter_config | "client_id" => ""}
|
||||
adapter_config: adapter_config
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user