From e313aa0977fc6023067d6580b36a7dc71a4d1b5a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 1 May 2020 21:15:43 +0200 Subject: [PATCH] static-fe.css: Restore and move to /priv/static/static-fe --- lib/pleroma/constants.ex | 5 +++++ lib/pleroma/plugs/instance_static.ex | 7 +++---- lib/pleroma/web/endpoint.ex | 5 +++-- .../web/templates/layout/static_fe.html.eex | 2 +- priv/static/static-fe/static-fe.css | Bin 0 -> 2715 bytes 5 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 priv/static/static-fe/static-fe.css diff --git a/lib/pleroma/constants.ex b/lib/pleroma/constants.ex index 4ba39b53f..3a9eec5ea 100644 --- a/lib/pleroma/constants.ex +++ b/lib/pleroma/constants.ex @@ -20,4 +20,9 @@ defmodule Pleroma.Constants do "deleted_activity_id" ] ) + + const(static_only_files, + do: + ~w(index.html robots.txt static static-fe finmoji emoji packs sounds images instance sw.js sw-pleroma.js favicon.png schemas doc) + ) end diff --git a/lib/pleroma/plugs/instance_static.ex b/lib/pleroma/plugs/instance_static.ex index 927fa2663..7516f75c3 100644 --- a/lib/pleroma/plugs/instance_static.ex +++ b/lib/pleroma/plugs/instance_static.ex @@ -3,6 +3,8 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Plugs.InstanceStatic do + require Pleroma.Constants + @moduledoc """ This is a shim to call `Plug.Static` but with runtime `from` configuration. @@ -21,9 +23,6 @@ def file_path(path) do end end - @only ~w(index.html robots.txt static emoji packs sounds images instance favicon.png sw.js - sw-pleroma.js) - def init(opts) do opts |> Keyword.put(:from, "__unconfigured_instance_static_plug") @@ -31,7 +30,7 @@ def init(opts) do |> Plug.Static.init() end - for only <- @only do + for only <- Pleroma.Constants.static_only_files() do at = Plug.Router.Utils.split("/") def call(%{request_path: "/" <> unquote(only) <> _} = conn, opts) do diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 72cb3ee27..226d42c2c 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -5,6 +5,8 @@ defmodule Pleroma.Web.Endpoint do use Phoenix.Endpoint, otp_app: :pleroma + require Pleroma.Constants + socket("/socket", Pleroma.Web.UserSocket) plug(Pleroma.Plugs.SetLocalePlug) @@ -34,8 +36,7 @@ defmodule Pleroma.Web.Endpoint do Plug.Static, at: "/", from: :pleroma, - only: - ~w(index.html robots.txt static finmoji emoji packs sounds images instance sw.js sw-pleroma.js favicon.png schemas doc), + only: Pleroma.Constants.static_only_files(), # credo:disable-for-previous-line Credo.Check.Readability.MaxLineLength gzip: true, cache_control_for_etags: @static_cache_control, diff --git a/lib/pleroma/web/templates/layout/static_fe.html.eex b/lib/pleroma/web/templates/layout/static_fe.html.eex index 819632cec..dc0ee2a5c 100644 --- a/lib/pleroma/web/templates/layout/static_fe.html.eex +++ b/lib/pleroma/web/templates/layout/static_fe.html.eex @@ -5,7 +5,7 @@ <%= Pleroma.Config.get([:instance, :name]) %> <%= Phoenix.HTML.raw(assigns[:meta] || "") %> - +
diff --git a/priv/static/static-fe/static-fe.css b/priv/static/static-fe/static-fe.css new file mode 100644 index 0000000000000000000000000000000000000000..db61ff2665ba2aef7f33dbfa8dbf29b7f6cdcba7 GIT binary patch literal 2715 zcmc&#+iuh_5PjdTu&9s#H6febrQ0B0p!6pY50335W*s|noVE+%-x*(bmn@)Gm1tku zaprQ)oSCT=-J>511V1$G4B$&#CDubo~yVymi2oa@kgBolIxy zS}j+b^~!tHN>ipYjVYf-@UxMifR14>|JM?7Obox{CJ}t5QcHZoykz|e3t6po^~c!{V#H8X2okdx z_Fyu~h|<__1ydrG^b-^WjH^!FF@5Ce4WY`JKa4Naf`=eE<>MgmK9jg-r~Sx`8bUj5 zm&1n@s)ZsuuLu|1W(Vf(E5wB0!^lVfc(8YzQYO81#@gFAXvf%qSg*cu)M(YCn!$vl zjti{0nntll-PAJl=I!FN+=Et+r4jpd`fV;b**zMh9i8a-cUn_h@?jDpbHfn$46<^j zC_*9dFh;_?C@NHVio(+Ko6w4583G-BXU%0W$7Ot7V@9?VOXTnJr+j~Bmd4| zX&gw3#5a1W$8w=ZTtun#Xt$H)%2c=7d=#?;$-g0kWvd=!sofY0yqdU;(_>X|xs z2aoyk3bvMiv}lzY=jPvNxb;>k6`F>DX@W;sP&Uqq2scHLx3dPS--TnGW5G1+IV{_B zlb^!I#SI*W;!^-T=i~PFro1VinU8~H9}SqxCSJiO!7YkSdHwN^a6jIB-rR