From 3c288c58582f0f5b3017a95734d695107d6d174f Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 15 Nov 2023 18:15:21 +0100 Subject: [PATCH] fix: build pictures at correct location and fix Plug.Static Signed-off-by: Thomas Citharel --- lib/web/endpoint.ex | 30 +++++++++++++++--------------- lib/web/router.ex | 1 - scripts/build/pictures.sh | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/web/endpoint.ex b/lib/web/endpoint.ex index 1f53c865e..d8bf794bf 100644 --- a/lib/web/endpoint.ex +++ b/lib/web/endpoint.ex @@ -10,6 +10,21 @@ defmodule Mobilizon.Web.Endpoint do use Phoenix.Endpoint, otp_app: :mobilizon use Absinthe.Phoenix.Endpoint + # Serve at "/" the static files from "priv/static" directory. + # + # You should set gzip to true if you are running phoenix.digest + # when deploying your static files in production. + plug( + Plug.Static, + at: "/", + from: {:mobilizon, "priv/static"}, + gzip: false, + only: Mobilizon.Web.static_paths() + # only_matching: ["precache-manifest"] + ) + + plug(Mobilizon.Web.Plugs.UploadedMedia) + plug(Mobilizon.Web.Plugs.DetectLocalePlug) if Application.compile_env(:mobilizon, :env) !== :dev do @@ -37,21 +52,6 @@ defmodule Mobilizon.Web.Endpoint do do: RemoteIp ) - plug(Mobilizon.Web.Plugs.UploadedMedia) - - # Serve at "/" the static files from "priv/static" directory. - # - # You should set gzip to true if you are running phoenix.digest - # when deploying your static files in production. - plug( - Plug.Static, - at: "/", - from: {:mobilizon, "priv/static"}, - gzip: false, - only: Mobilizon.Web.static_paths(), - only_matching: ["precache-manifest"] - ) - # Code reloading can be explicitly enabled under the # :code_reloader configuration of your endpoint. if code_reloading? do diff --git a/lib/web/router.ex b/lib/web/router.ex index 037d256c1..c290d2683 100644 --- a/lib/web/router.ex +++ b/lib/web/router.ex @@ -72,7 +72,6 @@ defmodule Mobilizon.Web.Router do pipeline :browser do plug(:put_request_context) - plug(Plug.Static, at: "/", from: "priv/static") plug(Mobilizon.Web.Plugs.SetLocalePlug) diff --git a/scripts/build/pictures.sh b/scripts/build/pictures.sh index 999d136ef..ef0d3422a 100755 --- a/scripts/build/pictures.sh +++ b/scripts/build/pictures.sh @@ -2,7 +2,7 @@ set -eu -output_dir="../priv/static/img/pics" +output_dir="priv/static/img/pics" resolutions=( 480 1024