Commit 7ef4559b authored by Mikko Ahlroth's avatar Mikko Ahlroth

Bump Phoenix version to 1.4

parent 4fe97b0e
Pipeline #39447214 failed with stage
in 6 minutes and 20 seconds
...@@ -11,7 +11,6 @@ config :logger, level: :warn ...@@ -11,7 +11,6 @@ config :logger, level: :warn
# Configure your database # Configure your database
config :code_stats, CodeStats.Repo, config :code_stats, CodeStats.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres", username: "postgres",
password: "postgres", password: "postgres",
database: "code_stats_ci", database: "code_stats_ci",
......
...@@ -87,8 +87,6 @@ config :phoenix, :template_engines, ...@@ -87,8 +87,6 @@ config :phoenix, :template_engines,
eex: Appsignal.Phoenix.Template.EExEngine, eex: Appsignal.Phoenix.Template.EExEngine,
exs: Appsignal.Phoenix.Template.ExsEngine exs: Appsignal.Phoenix.Template.ExsEngine
config :code_stats, CodeStats.Repo, loggers: [Appsignal.Ecto, Ecto.LogEntry]
config :appsignal, :config, config :appsignal, :config,
filter_parameters: [ filter_parameters: [
"password", "password",
...@@ -115,6 +113,9 @@ config :mbu, ...@@ -115,6 +113,9 @@ config :mbu,
import_config "appsignal.exs" import_config "appsignal.exs"
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
# Import environment specific config. This must remain at the bottom # Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above. # of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs" import_config "#{Mix.env()}.exs"
...@@ -35,7 +35,7 @@ config :phoenix, :stacktrace_depth, 20 ...@@ -35,7 +35,7 @@ config :phoenix, :stacktrace_depth, 20
# Configure your database # Configure your database
config :code_stats, CodeStats.Repo, config :code_stats, CodeStats.Repo,
adapter: Ecto.Adapters.Postgres, log: :debug,
username: "postgres", username: "postgres",
password: "postgres", password: "postgres",
database: "code_stats_dev", database: "code_stats_dev",
......
...@@ -11,7 +11,6 @@ config :logger, level: :warn ...@@ -11,7 +11,6 @@ config :logger, level: :warn
# Configure your database # Configure your database
config :code_stats, CodeStats.Repo, config :code_stats, CodeStats.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres", username: "postgres",
password: "postgres", password: "postgres",
database: "code_stats_test", database: "code_stats_test",
......
defmodule CodeStats.Repo do defmodule CodeStats.Repo do
use Ecto.Repo, otp_app: :code_stats use Ecto.Repo, otp_app: :code_stats, adapter: Ecto.Adapters.Postgres
end end
...@@ -45,7 +45,7 @@ defmodule CodeStats.User do ...@@ -45,7 +45,7 @@ defmodule CodeStats.User do
|> validate_length(:password, min: 1, max: 255) |> validate_length(:password, min: 1, max: 255)
|> validate_format(:username, ~r/^[^\/#%?&=+]+$/) |> validate_format(:username, ~r/^[^\/#%?&=+]+$/)
|> validate_latest_terms() |> validate_latest_terms()
|> validations() |> common_validations()
|> unique_constraint(:username) |> unique_constraint(:username)
|> unique_constraint(:lower_username) |> unique_constraint(:lower_username)
end end
...@@ -56,7 +56,7 @@ defmodule CodeStats.User do ...@@ -56,7 +56,7 @@ defmodule CodeStats.User do
def updating_changeset(data, params \\ %{}) do def updating_changeset(data, params \\ %{}) do
data data
|> cast(params, [:email, :private_profile]) |> cast(params, [:email, :private_profile])
|> validations() |> common_validations()
end end
@doc """ @doc """
...@@ -317,7 +317,7 @@ defmodule CodeStats.User do ...@@ -317,7 +317,7 @@ defmodule CodeStats.User do
end end
# Common validations for creating and editing users # Common validations for creating and editing users
defp validations(changeset) do defp common_validations(changeset) do
changeset changeset
|> validate_format(:email, ~r/^$|@/) |> validate_format(:email, ~r/^$|@/)
end end
......
...@@ -24,7 +24,7 @@ defmodule CodeStatsWeb do ...@@ -24,7 +24,7 @@ defmodule CodeStatsWeb do
import Ecto import Ecto
import Ecto.Query, only: [from: 1, from: 2] import Ecto.Query, only: [from: 1, from: 2]
import CodeStatsWeb.Router.Helpers alias CodeStatsWeb.Router.Helpers, as: Routes
import CodeStatsWeb.Gettext import CodeStatsWeb.Gettext
end end
end end
...@@ -47,7 +47,7 @@ defmodule CodeStatsWeb do ...@@ -47,7 +47,7 @@ defmodule CodeStatsWeb do
# Use all HTML functionality (forms, tags, etc) # Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML use Phoenix.HTML
import CodeStatsWeb.Router.Helpers alias CodeStatsWeb.Router.Helpers, as: Routes
import CodeStatsWeb.ErrorHelpers import CodeStatsWeb.ErrorHelpers
import CodeStatsWeb.Gettext import CodeStatsWeb.Gettext
end end
......
...@@ -11,10 +11,6 @@ defmodule CodeStatsWeb.LiveUpdateSocket do ...@@ -11,10 +11,6 @@ defmodule CodeStatsWeb.LiveUpdateSocket do
channel("users:*", CodeStatsWeb.ProfileChannel) channel("users:*", CodeStatsWeb.ProfileChannel)
channel("frontpage", CodeStatsWeb.FrontpageChannel) channel("frontpage", CodeStatsWeb.FrontpageChannel)
## Transports
transport(:websocket, Phoenix.Transports.WebSocket)
# transport :longpoll, Phoenix.Transports.LongPoll
# Socket params are passed from the client and can # Socket params are passed from the client and can
# be used to verify and authenticate a user. After # be used to verify and authenticate a user. After
# verification, you can put default assigns into # verification, you can put default assigns into
......
...@@ -28,7 +28,7 @@ defmodule CodeStatsWeb.AuthController do ...@@ -28,7 +28,7 @@ defmodule CodeStatsWeb.AuthController do
with %User{} = user <- User.get_by_username(username, true), with %User{} = user <- User.get_by_username(username, true),
%Plug.Conn{} = conn <- AuthUtils.auth_user(conn, user, password), %Plug.Conn{} = conn <- AuthUtils.auth_user(conn, user, password),
%Plug.Conn{} = conn <- maybe_remember_me(conn, user, params) do %Plug.Conn{} = conn <- maybe_remember_me(conn, user, params) do
redirect(conn, to: profile_path(conn, :my_profile)) redirect(conn, to: Routes.profile_path(conn, :my_profile))
else else
ret -> ret ->
# If ret is nil, user was not found -> run dummy auth to prevent user enumeration # If ret is nil, user was not found -> run dummy auth to prevent user enumeration
...@@ -68,7 +68,7 @@ defmodule CodeStatsWeb.AuthController do ...@@ -68,7 +68,7 @@ defmodule CodeStatsWeb.AuthController do
:success, :success,
"Great success! Your account was created and you can now log in with the details you provided." "Great success! Your account was created and you can now log in with the details you provided."
) )
|> redirect(to: auth_path(conn, :render_login)) |> redirect(to: Routes.auth_path(conn, :render_login))
end end
end end
...@@ -76,7 +76,7 @@ defmodule CodeStatsWeb.AuthController do ...@@ -76,7 +76,7 @@ defmodule CodeStatsWeb.AuthController do
conn conn
|> AuthUtils.unauth_user() |> AuthUtils.unauth_user()
|> RememberMePlug.kill_cookie() |> RememberMePlug.kill_cookie()
|> redirect(to: page_path(conn, :index)) |> redirect(to: Routes.page_path(conn, :index))
end end
def render_forgot(conn, _params) do def render_forgot(conn, _params) do
...@@ -104,7 +104,7 @@ defmodule CodeStatsWeb.AuthController do ...@@ -104,7 +104,7 @@ defmodule CodeStatsWeb.AuthController do
:info, :info,
"A password reset email will be sent shortly to the email address linked to the account, if the account had one. If you do not receive an email, please check that you typed the account name correctly." "A password reset email will be sent shortly to the email address linked to the account, if the account had one. If you do not receive an email, please check that you typed the account name correctly."
) )
|> redirect(to: auth_path(conn, :render_forgot)) |> redirect(to: Routes.auth_path(conn, :render_forgot))
end end
def render_reset(conn, %{"token" => token}) do def render_reset(conn, %{"token" => token}) do
...@@ -135,7 +135,7 @@ defmodule CodeStatsWeb.AuthController do ...@@ -135,7 +135,7 @@ defmodule CodeStatsWeb.AuthController do
:success, :success,
"Password reset successfully. You can now log in with the new password." "Password reset successfully. You can now log in with the new password."
) )
|> redirect(to: auth_path(conn, :render_login)) |> redirect(to: Routes.auth_path(conn, :render_login))
else else
_ -> _ ->
conn conn
...@@ -143,7 +143,7 @@ defmodule CodeStatsWeb.AuthController do ...@@ -143,7 +143,7 @@ defmodule CodeStatsWeb.AuthController do
:error, :error,
"Unable to reset password. The password reset token may have expired. Please try requesting a new token." "Unable to reset password. The password reset token may have expired. Please try requesting a new token."
) )
|> redirect(to: auth_path(conn, :render_login)) |> redirect(to: Routes.auth_path(conn, :render_login))
end end
end end
......
...@@ -28,7 +28,7 @@ defmodule CodeStatsWeb.MachineController do ...@@ -28,7 +28,7 @@ defmodule CodeStatsWeb.MachineController do
%Machine{} -> %Machine{} ->
conn conn
|> put_flash(:success, "Machine added successfully.") |> put_flash(:success, "Machine added successfully.")
|> redirect(to: machine_path(conn, :list)) |> redirect(to: Routes.machine_path(conn, :list))
%Changeset{} = changeset -> %Changeset{} = changeset ->
conn conn
...@@ -57,7 +57,7 @@ defmodule CodeStatsWeb.MachineController do ...@@ -57,7 +57,7 @@ defmodule CodeStatsWeb.MachineController do
conn conn
|> single_machine_assigns(machine) |> single_machine_assigns(machine)
|> put_flash(:success, "Machine edited successfully.") |> put_flash(:success, "Machine edited successfully.")
|> redirect(to: machine_path(conn, :view_single, machine.id)) |> redirect(to: Routes.machine_path(conn, :view_single, machine.id))
else else
{:error, changeset} -> {:error, changeset} ->
conn conn
...@@ -77,7 +77,7 @@ defmodule CodeStatsWeb.MachineController do ...@@ -77,7 +77,7 @@ defmodule CodeStatsWeb.MachineController do
%Machine{} = machine <- edit_api_key_or_flash(conn, changeset) do %Machine{} = machine <- edit_api_key_or_flash(conn, changeset) do
conn conn
|> put_flash(:success, "API key regenerated for machine #{machine.name}.") |> put_flash(:success, "API key regenerated for machine #{machine.name}.")
|> redirect(to: machine_path(conn, :list)) |> redirect(to: Routes.machine_path(conn, :list))
end end
end end
...@@ -101,12 +101,12 @@ defmodule CodeStatsWeb.MachineController do ...@@ -101,12 +101,12 @@ defmodule CodeStatsWeb.MachineController do
:success, :success,
"The machine has been deactivated and will be deleted in a few moments." "The machine has been deactivated and will be deleted in a few moments."
) )
|> redirect(to: machine_path(conn, :list)) |> redirect(to: Routes.machine_path(conn, :list))
{:error, _} -> {:error, _} ->
conn conn
|> put_flash(:error, "Machine could not be deleted.") |> put_flash(:error, "Machine could not be deleted.")
|> redirect(to: machine_path(conn, :list)) |> redirect(to: Routes.machine_path(conn, :list))
end end
end end
end end
...@@ -127,7 +127,7 @@ defmodule CodeStatsWeb.MachineController do ...@@ -127,7 +127,7 @@ defmodule CodeStatsWeb.MachineController do
with {:ok, machine} <- do_activate(machine, active) do with {:ok, machine} <- do_activate(machine, active) do
conn conn
|> put_flash(:success, "Machine #{machine.name} #{verb}.") |> put_flash(:success, "Machine #{machine.name} #{verb}.")
|> redirect(to: machine_path(conn, :list)) |> redirect(to: Routes.machine_path(conn, :list))
else else
{:error, changeset} -> {:error, changeset} ->
conn conn
...@@ -183,7 +183,7 @@ defmodule CodeStatsWeb.MachineController do ...@@ -183,7 +183,7 @@ defmodule CodeStatsWeb.MachineController do
{:error, _} -> {:error, _} ->
conn conn
|> put_flash(:error, "Error regenerating API key.") |> put_flash(:error, "Error regenerating API key.")
|> redirect(to: machine_path(conn, :list)) |> redirect(to: Routes.machine_path(conn, :list))
end end
end end
......
...@@ -21,7 +21,7 @@ defmodule CodeStatsWeb.PreferencesController do ...@@ -21,7 +21,7 @@ defmodule CodeStatsWeb.PreferencesController do
%User{} -> %User{} ->
conn conn
|> put_flash(:success, "Preferences updated!") |> put_flash(:success, "Preferences updated!")
|> redirect(to: preferences_path(conn, :edit)) |> redirect(to: Routes.preferences_path(conn, :edit))
%Ecto.Changeset{} = error_changeset -> %Ecto.Changeset{} = error_changeset ->
conn conn
...@@ -41,17 +41,17 @@ defmodule CodeStatsWeb.PreferencesController do ...@@ -41,17 +41,17 @@ defmodule CodeStatsWeb.PreferencesController do
%User{} -> %User{} ->
conn conn
|> put_flash(:success, "Password changed.") |> put_flash(:success, "Password changed.")
|> redirect(to: preferences_path(conn, :edit)) |> redirect(to: Routes.preferences_path(conn, :edit))
%Ecto.Changeset{} -> %Ecto.Changeset{} ->
conn conn
|> put_flash(:error, "Error changing password.") |> put_flash(:error, "Error changing password.")
|> redirect(to: preferences_path(conn, :edit)) |> redirect(to: Routes.preferences_path(conn, :edit))
end end
else else
conn conn
|> put_flash(:error, "Old password was wrong!") |> put_flash(:error, "Old password was wrong!")
|> redirect(to: preferences_path(conn, :edit)) |> redirect(to: Routes.preferences_path(conn, :edit))
end end
end end
...@@ -60,7 +60,7 @@ defmodule CodeStatsWeb.PreferencesController do ...@@ -60,7 +60,7 @@ defmodule CodeStatsWeb.PreferencesController do
""" """
@spec delete(Plug.Conn.t(), map) :: Plug.Conn.t() @spec delete(Plug.Conn.t(), map) :: Plug.Conn.t()
def delete(conn, params) do def delete(conn, params) do
AuthUtils.delete_user_action(conn, params, {&preferences_path/2, :edit}) AuthUtils.delete_user_action(conn, params, {&Routes.preferences_path/2, :edit})
end end
defp common_edit_assigns(conn) do defp common_edit_assigns(conn) do
......
...@@ -8,7 +8,7 @@ defmodule CodeStatsWeb.ProfileController do ...@@ -8,7 +8,7 @@ defmodule CodeStatsWeb.ProfileController do
def my_profile(conn, _params) do def my_profile(conn, _params) do
user = AuthUtils.get_current_user(conn) user = AuthUtils.get_current_user(conn)
redirect(conn, to: profile_path(conn, :profile, user.username)) redirect(conn, to: Routes.profile_path(conn, :profile, user.username))
end end
def profile(conn, %{"username" => username}) do def profile(conn, %{"username" => username}) do
...@@ -165,7 +165,7 @@ defmodule CodeStatsWeb.ProfileController do ...@@ -165,7 +165,7 @@ defmodule CodeStatsWeb.ProfileController do
end end
defp render_or_redirect(conn, user, _, _, redirect_action) do defp render_or_redirect(conn, user, _, _, redirect_action) do
redirect(conn, to: profile_path(conn, redirect_action, user.username)) redirect(conn, to: Routes.profile_path(conn, redirect_action, user.username))
end end
# Fix the username specified in the URL by converting plus characters to spaces. # Fix the username specified in the URL by converting plus characters to spaces.
......
...@@ -30,7 +30,7 @@ defmodule CodeStatsWeb.TermsController do ...@@ -30,7 +30,7 @@ defmodule CodeStatsWeb.TermsController do
:ok -> :ok ->
conn conn
|> put_flash(:success, "You have accepted the new legal terms.") |> put_flash(:success, "You have accepted the new legal terms.")
|> redirect(to: profile_path(conn, :my_profile)) |> redirect(to: Routes.profile_path(conn, :my_profile))
val -> val ->
Logger.error("Error storing consent: #{inspect(val)}") Logger.error("Error storing consent: #{inspect(val)}")
...@@ -57,6 +57,6 @@ defmodule CodeStatsWeb.TermsController do ...@@ -57,6 +57,6 @@ defmodule CodeStatsWeb.TermsController do
""" """
@spec delete_account(Plug.Conn.t(), map) :: Plug.Conn.t() @spec delete_account(Plug.Conn.t(), map) :: Plug.Conn.t()
def delete_account(conn, params) do def delete_account(conn, params) do
AuthUtils.delete_user_action(conn, params, {&terms_path/2, :ask_consent}) AuthUtils.delete_user_action(conn, params, {&Routes.terms_path/2, :ask_consent})
end end
end end
defmodule CodeStatsWeb.Endpoint do defmodule CodeStatsWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :code_stats use Phoenix.Endpoint, otp_app: :code_stats
socket("/live_update_socket", CodeStatsWeb.LiveUpdateSocket) socket("/live_update_socket", CodeStatsWeb.LiveUpdateSocket, websocket: true)
plug(CodeStatsWeb.RequestTimePlug) plug(CodeStatsWeb.RequestTimePlug)
......
<div class="stripe"> <div class="stripe">
<h1>Request a password reset token</h1> <h1>Request a password reset token</h1>
<%= form_for(@changeset, auth_path(@conn, :render_forgot), fn f -> %> <%= form_for(@changeset, Routes.auth_path(@conn, :render_forgot), fn f -> %>
<label for="username" class="<%= if f.errors[:username], do: "has-error" %>">Username (required)</label> <label for="username" class="<%= if f.errors[:username], do: "has-error" %>">Username (required)</label>
<div class="input"> <div class="input">
<%= text_input(f, :username, required: true) %> <%= text_input(f, :username, required: true) %>
......
...@@ -16,6 +16,6 @@ ...@@ -16,6 +16,6 @@
<h2>Forgot your password?</h2> <h2>Forgot your password?</h2>
<p> <p>
If you forgot your password, <a href="<%= auth_path(@conn, :render_forgot) %>">proceed to the password reset form</a>. If you have not added an email address to your account, it cannot be recovered. If you forgot your password, <a href="<%= Routes.auth_path(@conn, :render_forgot) %>">proceed to the password reset form</a>. If you have not added an email address to your account, it cannot be recovered.
</p> </p>
</div> </div>
<div class="stripe"> <div class="stripe">
<h1>Reset your password</h1> <h1>Reset your password</h1>
<%= form_for(@changeset, auth_path(@conn, :reset, @token), fn f -> %> <%= form_for(@changeset, Routes.auth_path(@conn, :reset, @token), fn f -> %>
<label for="password" class="<%= if f.errors[:password], do: "has-error" %>">Password (required)</label> <label for="password" class="<%= if f.errors[:password], do: "has-error" %>">Password (required)</label>
<div class="input"> <div class="input">
<%= password_input(f, :password, required: true) %> <%= password_input(f, :password, required: true) %>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div class="stripe"> <div class="stripe">
<h2 id="signup-form">Sign up</h2> <h2 id="signup-form">Sign up</h2>
<%= form_for(@changeset, auth_path(@conn, :signup) <> "#signup-form", fn f -> %> <%= form_for(@changeset, Routes.auth_path(@conn, :signup) <> "#signup-form", fn f -> %>
<label for="user_username" class="<%= if f.errors[:username], do: "has-error" %>">Username (required)</label> <label for="user_username" class="<%= if f.errors[:username], do: "has-error" %>">Username (required)</label>
<div class="input"> <div class="input">
<%= text_input(f, :username, required: true) %> <%= text_input(f, :username, required: true) %>
......
...@@ -35,10 +35,10 @@ ...@@ -35,10 +35,10 @@
<%= if assigns[:id], do: raw(~s(id="#{@id}")), else: "" %> <%= if assigns[:id], do: raw(~s(id="#{@id}")), else: "" %>
<%= if assigns[:class], do: raw(~s(class="#{@class}")), else: "" %> <%= if assigns[:class], do: raw(~s(class="#{@class}")), else: "" %>
> >
<source srcset="<%= static_path(@conn, no_ext <> ".webp") %>" type="image/webp" /> <source srcset="<%= Routes.static_path(@conn, no_ext <> ".webp") %>" type="image/webp" />
<source srcset="<%= static_path(@conn, @src) %>" type="<%= type %>" /> <source srcset="<%= Routes.static_path(@conn, @src) %>" type="<%= type %>" />
<img <img
src=<%= static_path(@conn, @src) %> src=<%= Routes.static_path(@conn, @src) %>
alt="<%= @alt %>" alt="<%= @alt %>"
title="<%= @title %>" title="<%= @title %>"
<%= if assigns[:img_id], do: raw(~s(id="#{@img_id}")), else: "" %> <%= if assigns[:img_id], do: raw(~s(id="#{@img_id}")), else: "" %>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</p> </p>
<p> <p>
<a href="<%= auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %>"><%= auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %></a> <a href="<%= Routes.auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %>"><%= Routes.auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %></a>
</p> </p>
<p> <p>
......
A password reset was requested for an account registered with this email address. To reset your password, please open the following link: A password reset was requested for an account registered with this email address. To reset your password, please open the following link:
<%= auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %> <%= Routes.auth_url(CodeStatsWeb.Endpoint, :render_reset, @token) %>
This link is valid for <%= CodeStats.User.PasswordReset.token_max_life() %> hours. This link is valid for <%= CodeStats.User.PasswordReset.token_max_life() %> hours.
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<meta charset="utf-8"> <meta charset="utf-8">
<!-- Preload resources for MAXIMUM SPEED --> <!-- Preload resources for MAXIMUM SPEED -->
<link rel="preload" href="<%= static_path(@conn, "/css/frontend.css") %>" as="style"> <link rel="preload" href="<%= Routes.static_path(@conn, "/css/frontend.css") %>" as="style">
<link rel="preload" href="<%= static_path(@conn, "/js/frontend.js") %>" as="script"> <link rel="preload" href="<%= Routes.static_path(@conn, "/js/frontend.js") %>" as="script">
<link rel="preload" href="<%= static_path(@conn, "/assets/frontend/images/Logo.svg") %>" as="image"> <link rel="preload" href="<%= Routes.static_path(@conn, "/assets/frontend/images/Logo.svg") %>" as="image">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<meta name="author" content="Mikko Ahlroth"> <meta name="author" content="Mikko Ahlroth">
<title><%= get_title(@conn) %></title> <title><%= get_title(@conn) %></title>
<link rel="stylesheet" href="<%= static_path(@conn, "/css/frontend.css") %>"> <link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/frontend.css") %>">
<link rel="apple-touch-icon" sizes="57x57" href="/assets/frontend/apple-touch-icon-57x57.png"> <link rel="apple-touch-icon" sizes="57x57" href="/assets/frontend/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/assets/frontend/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon" sizes="60x60" href="/assets/frontend/apple-touch-icon-60x60.png">
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
<body> <body>
<header id="nav-stripe" class="stripe"> <header id="nav-stripe" class="stripe">
<a id="header-logo" class="logo" href="<%= page_path(@conn, :index) %>"> <a id="header-logo" class="logo" href="<%= Routes.page_path(@conn, :index) %>">
<img <img
src="<%= static_path(@conn, "/assets/frontend/images/Logo.svg") %>" src="<%= Routes.static_path(@conn, "/assets/frontend/images/Logo.svg") %>"
alt="<%= get_conf(:site_name) %> logo" alt="<%= get_conf(:site_name) %> logo"
title="<%= get_conf(:site_name) %>" title="<%= get_conf(:site_name) %>"
/> />
...@@ -54,13 +54,13 @@ ...@@ -54,13 +54,13 @@
<nav id="header-nav" role="navigation"> <nav id="header-nav" role="navigation">
<%= if is_authed?(@conn) do %> <%= if is_authed?(@conn) do %>
<a href="<%= profile_path(@conn, :my_profile) %>">Profile</a> <a href="<%= Routes.profile_path(@conn, :my_profile) %>">Profile</a>
<a href="<%= preferences_path(@conn, :edit) %>">Preferences</a> <a href="<%= Routes.preferences_path(@conn, :edit) %>">Preferences</a>
<a href="<%= machine_path(@conn, :list) %>">Machines</a> <a href="<%= Routes.machine_path(@conn, :list) %>">Machines</a>
<a href="<%= auth_path(@conn, :logout) %>">Log out</a> <a href="<%= Routes.auth_path(@conn, :logout) %>">Log out</a>
<% else %> <% else %>
<a href="<%= auth_path(@conn, :render_login) %>">Log in</a> <a href="<%= Routes.auth_path(@conn, :render_login) %>">Log in</a>
<a href="<%= auth_path(@conn, :render_signup) %>">Sign up</a> <a href="<%= Routes.auth_path(@conn, :render_signup) %>">Sign up</a>
<% end %> <% end %>
</nav> </nav>
</header> </header>
...@@ -107,10 +107,10 @@ ...@@ -107,10 +107,10 @@
<footer id="footer-stripe" class="stripe stripe-accent"> <footer id="footer-stripe" class="stripe stripe-accent">
<section> <section>
<h6 class="no-margin"><%= CodeStatsWeb.RequestTimePlug.calculate_time(@conn) %>, <%= inspect(self()) %></h6> <h6 class="no-margin"><%= CodeStatsWeb.RequestTimePlug.calculate_time(@conn) %>, <%= inspect(self()) %></h6>
<a href="<%= page_path(@conn, :changes)%>"><%= get_conf(:version) %>-<%= get_conf(:commit_hash) %></a> <a href="<%= Routes.page_path(@conn, :changes)%>"><%= get_conf(:version) %>-<%= get_conf(:commit_hash) %></a>
<a href="<%= page_path(@conn, :plugins) %>">Plugins</a> <a href="<%= Routes.page_path(@conn, :plugins) %>">Plugins</a>
<a href="<%= page_path(@conn, :api_docs) %>">API docs</a> <a href="<%= Routes.page_path(@conn, :api_docs) %>">API docs</a>
<a href="<%= page_path(@conn, :terms) %>">Legal</a> <a href="<%= Routes.page_path(@conn, :terms) %>">Legal</a>
</section> </section>
<%= if not Enum.empty?(get_conf(:social_links)) do %> <%= if not Enum.empty?(get_conf(:social_links)) do %>
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
<script type="text/javascript"> <script type="text/javascript">
window.moment = {}; window.moment = {};
</script> </script>
<script async type="text/javascript" src="<%= static_path(@conn, "/js/frontend.js") %>"></script> <script async type="text/javascript" src="<%= Routes.static_path(@conn, "/js/frontend.js") %>"></script>
<%= raw get_conf(:analytics_code) %> <%= raw get_conf(:analytics_code) %>
</body> </body>
</html> </html>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<meta name="author" content="Mikko Ahlroth"> <meta name="author" content="Mikko Ahlroth">
<title><%= get_conf(:site_name) %> Battle Mode</title> <title><%= get_conf(:site_name) %> Battle Mode</title>
<link rel="stylesheet" href="<%= static_path(@conn, "/battle/css/battle.css") %>"> <link rel="stylesheet" href="<%= Routes.static_path(@conn, "/battle/css/battle.css") %>">
<link rel="apple-touch-icon" sizes="57x57" href="/frontend/assets/apple-touch-icon-57x57.png"> <link rel="apple-touch-icon" sizes="57x57" href="/frontend/assets/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/frontend/assets/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon" sizes="60x60" href="/frontend/assets/apple-touch-icon-60x60.png">
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<body> <body>
<%= render @view_module, @view_template, assigns %> <%= render @view_module, @view_template, assigns %>
<script type="text/javascript" src="<%= static_path(@conn, "/battle/js/battle.js") %>"></script> <script type="text/javascript" src="<%= Routes.static_path(@conn, "/battle/js/battle.js") %>"></script>
<%= raw get_conf(:analytics_code) %> <%= raw get_conf(:analytics_code) %>
</body> </body>
</html> </html>