mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-18 15:58:30 +00:00
Preload: Load the correct instance panel
This commit is contained in:
parent
34c9446cb1
commit
2382a2a151
|
@ -6,6 +6,7 @@ defmodule Pleroma.Web.Preload.Providers.Instance do
|
|||
alias Pleroma.Web.MastodonAPI.InstanceView
|
||||
alias Pleroma.Web.Nodeinfo.Nodeinfo
|
||||
alias Pleroma.Web.Preload.Providers.Provider
|
||||
alias Pleroma.Plugs.InstanceStatic
|
||||
|
||||
@behaviour Provider
|
||||
@instance_url :"/api/v1/instance"
|
||||
|
@ -27,7 +28,7 @@ defmodule Pleroma.Web.Preload.Providers.Instance do
|
|||
end
|
||||
|
||||
defp build_panel_tag(acc) do
|
||||
instance_path = Path.join(:code.priv_dir(:pleroma), "static/instance/panel.html")
|
||||
instance_path = InstanceStatic.file_path(@panel_url |> to_string())
|
||||
|
||||
if File.exists?(instance_path) do
|
||||
panel_data = File.read!(instance_path)
|
||||
|
|
1
test/fixtures/preload_static/instance/panel.html
vendored
Normal file
1
test/fixtures/preload_static/instance/panel.html
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
HEY!
|
|
@ -25,6 +25,17 @@ defmodule Pleroma.Web.Preload.Providers.InstanceTest do
|
|||
)
|
||||
end
|
||||
|
||||
test "it works with overrides" do
|
||||
clear_config([:instance, :static_dir], "test/fixtures/preload_static")
|
||||
|
||||
%{"/instance/panel.html": panel} = Instance.generate_terms(nil)
|
||||
|
||||
assert String.contains?(
|
||||
panel,
|
||||
"HEY!"
|
||||
)
|
||||
end
|
||||
|
||||
test "it renders the node_info", %{"/nodeinfo/2.0": nodeinfo} do
|
||||
%{
|
||||
metadata: metadata,
|
||||
|
|
Loading…
Reference in a new issue