mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
* move theme picker position in add endgames form * Add branded favicons and web manifest - Replace the placeholder favicon with the knight mark: .ico (16/32/48), SVG, and 16/32 PNGs. - Add opaque apple-touch and Android launcher icons plus a site webmanifest naming the app and using the brand palette. - Link the icon set, manifest, and theme-color from the root layout and the 404/500 pages. - Whitelist the new static files in static_paths/0 and the prelaunch allowlist so they are served in production and behind the gate. - Sync the coming-soon site's favicon.ico and drop the unused Phoenix logo. * Add a public health probe and monitoring runbook Probe https://<PHX_HOST>/health through Cloudflare every two minutes and report to a healthchecks.io check. A healthy run posts the raw health JSON; a tablebase mismatch is a green check-in with the mismatch recorded; a non-200, non-JSON, down database or network failure posts one fail ping with the response body and a loopback cross-check as evidence. --dry-run evaluates the success, degraded, fail, non-JSON and unreachable fixtures without reading config or touching the network. The runbook covers the healthchecks.io check, install, what /health proves, Beszel's blind spot and the drills. * Fix theme picker search after moving it into the endgame form The picker moved inside the endgame form, which nested the component's own <form>. Browsers, and the LiveView test DOM, drop a nested form along with its phx-change and phx-submit bindings, so the search box did nothing and three form tests lost their #theme-form selector. The component now renders no form: phx-change sits on the search input, which works both inside the endgame form and standalone on the bulk importer. The unreachable create_theme_from_search handlers go away; theme creation uses the existing button. Tests search through the input and click that button.
66 lines
1.4 KiB
Elixir
66 lines
1.4 KiB
Elixir
defmodule ChesstrainerWeb.Plugs.Prelaunch do
|
|
@moduledoc """
|
|
Redirects every non-public route to the home page while the app is gated.
|
|
|
|
The allowlist is deliberately small: legal pages, the mailing list, auth
|
|
entry points, admin, crawler files, health, and the static/LiveView plumbing.
|
|
Everything else redirects to `/` with `X-Robots-Tag: noindex, nofollow`.
|
|
|
|
Set `PRELAUNCH=true` to enable the gate.
|
|
"""
|
|
|
|
import Plug.Conn
|
|
|
|
@allowed_exact ~w(
|
|
/
|
|
/privacy
|
|
/terms-conditions
|
|
/mentions-legales
|
|
/health
|
|
/robots.txt
|
|
/sitemap.xml
|
|
/favicon.ico
|
|
/favicon.svg
|
|
/favicon-16x16.png
|
|
/favicon-32x32.png
|
|
/apple-touch-icon.png
|
|
/android-chrome-192x192.png
|
|
/android-chrome-512x512.png
|
|
/site.webmanifest
|
|
)
|
|
|
|
@allowed_prefixes ~w(
|
|
/mailing-list
|
|
/users/log-out
|
|
/users/confirm
|
|
/users/reset-password
|
|
/users/settings
|
|
/admin
|
|
/live
|
|
/assets
|
|
/fonts
|
|
/images
|
|
/dev
|
|
)
|
|
|
|
def init(opts), do: opts
|
|
|
|
def call(conn, _opts) do
|
|
if enabled?() and not allowed?(conn.request_path) do
|
|
conn
|
|
|> put_resp_header("x-robots-tag", "noindex, nofollow")
|
|
|> Phoenix.Controller.redirect(to: "/")
|
|
|> halt()
|
|
else
|
|
conn
|
|
end
|
|
end
|
|
|
|
defp enabled?, do: Application.get_env(:chesstrainer, :prelaunch, false)
|
|
|
|
defp allowed?(path) do
|
|
path in @allowed_exact or
|
|
Enum.any?(@allowed_prefixes, &String.starts_with?(path, &1))
|
|
end
|
|
end
|