Files
archived-teslamate/lib/teslamate_web/templates/layout/root.html.heex
T
b1c1l1 97cfb79493 feat: Add URL_PATH environment variable for reverse proxy deployments (#3771)
* Add URL_PATH environment variable for reverse proxy deployments

For example, this can be used to run TeslaMate behind a reverse proxy, using a
URL path such as "/teslamate".

* gettext: update pot and po files

Generated using:
  mix gettext.extract --merge

* web: run mix format

* gettext: update pot and po files

Re-generating gettext files after running mix format.

Generated using:
  mix gettext.extract --merge
2024-03-25 09:21:34 +01:00

175 lines
6.4 KiB
Plaintext

<!DOCTYPE html>
<html lang={Plug.Conn.get_session(@conn, :locale)}>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<%= live_title_tag(assigns[:page_title] || "Home", suffix: " · TeslaMate") %>
<link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/assets/app.css")} />
<link
rel="apple-touch-icon"
sizes="180x180"
href={Routes.static_path(@conn, "/apple-touch-icon.png?v=5AB53N3ALo")}
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href={Routes.static_path(@conn, "/favicon-32x32.png?v=5AB53N3ALo")}
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href={Routes.static_path(@conn, "/favicon-16x16.png?v=5AB53N3ALo")}
/>
<link
rel="manifest"
href={Routes.static_path(@conn, "/site.webmanifest?v=5AB53N3ALo")}
crossorigin="use-credentials"
/>
<link
rel="mask-icon"
href={Routes.static_path(@conn, "/safari-pinned-tab.svg?v=5AB53N3ALo")}
color="#363636"
/>
<link rel="shortcut icon" href={Routes.static_path(@conn, "/favicon.ico?v=5AB53N3ALo")} />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="theme-color" content="#363636" />
<%= csrf_meta_tag() %>
<script>
window.LIVE_PATH = "<%= Routes.static_path(@conn, "/live") %>";
</script>
<script
defer
phx-track-static
type="text/javascript"
src={Routes.static_path(@conn, "/assets/app.js")}
>
</script>
</head>
<body tabIndex="0">
<nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item" href={Routes.static_path(@conn, "/")}>
<%= img_tag(Routes.static_path(@conn, "/images/logo.svg"),
alt: "TeslaMate",
width: "90px"
) %>
</a>
<a
role="button"
class="navbar-burger burger"
aria-label="menu"
aria-expanded="false"
data-target="navbar"
>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbar" class="navbar-menu">
<div class="navbar-end">
<%= if grafana_url = @conn.assigns.settings.grafana_url do %>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link is-arrowless">
<span class="icon"><i class="mdi mdi-view-dashboard"></i></span>&nbsp;<span><%= gettext "Dashboards" %></span>
</a>
<div class="navbar-dropdown">
<%= for %{"title" => title, "uid" => uid} <- list_dashboards() do %>
<%= link(title,
to: "#{grafana_url}/d/#{uid}",
class: "navbar-item",
data_uid: uid,
target: "_blank"
) %>
<% end %>
</div>
</div>
<% end %>
<%= live_redirect [to: Routes.live_path(@conn, TeslaMateWeb.GeoFenceLive.Index), class: "navbar-item mr-5"] do %>
<span class="icon"><i class="mdi mdi-map-marker-radius"></i></span>&nbsp;<span><%= gettext("Geo-Fences") %></span>
<% end %>
<%= live_redirect [to: Routes.live_path(@conn, TeslaMateWeb.SettingsLive.Index), class: "navbar-item mr-5"] do %>
<span class="icon"><i class="mdi mdi-cog"></i></span>&nbsp;<span><%= gettext("Settings") %></span>
<% end %>
</div>
</div>
</div>
</nav>
<% update = TeslaMate.Updater.get_update() %>
<main
role="main"
style="overflow: hidden;"
class={["section", if(update, do: " full-height")]}
>
<div class="container">
<%= if not TeslaMate.Vault.encryption_key_provided?() or
(not TeslaMate.Api.signed_in?() and not TeslaMate.Auth.can_decrypt_tokens?()) do %>
<% docs_link =
link("docs.teslamate.org",
to: "https://docs.teslamate.org",
target: "_blank",
rel: "noopener noreferrer"
) %>
<div class="notification is-warning">
<p class="title is-5 is-spaced">
<span class="icon"><i class="mdi mdi-shield-alert"></i></span>&nbsp;<%= gettext(
"No encryption key provided"
) %>
</p>
<p class="subtitle is-6">
<%= raw(
gettext(
"To ensure that your <strong>Tesla API tokens are stored securely</strong>, an encryption key must be provided to TeslaMate via the <code>ENCRYPTION_KEY</code> environment variable. Otherwise, a <strong>login will be required after every restart</strong>."
)
) %>
</p>
<p class="subtitle is-6">
<%= raw(
gettext(
"The automatically generated encryption key used for the current session can be found <strong>in the application logs</strong>."
)
) %>
</p>
<p class="subtitle is-6">
<%= raw(
gettext("For more information, see the updated installation guides on %{link}",
link: safe_to_string(docs_link)
)
) %>
</p>
</div>
<% end %>
<%= Enum.map(@flash, fn {flash_key, flash_message} -> %>
<p class={"notification is-#{flash_key}"}><%= flash_message %></p>
<% end) %>
<%= @inner_content %>
</div>
</main>
<footer class="footer">
<div class="content has-text-centered">
<%= if update do %>
<%= link to: "https://github.com/teslamate-org/teslamate/releases",
class: "button is-rounded is-text is-small has-text-grey", type: "button",
target: "_blank", rel: "noopener noreferrer" do %>
<span class="icon"><i class="mdi mdi-gift"></i></span>
<strong><%= [gettext("Update available"), ": ", update] %></strong>
<% end %>
<% end %>
</div>
</footer>
</body>
</html>