config: add ability to disable Pleroma FE config management (closes #276)

This commit is contained in:
William Pitcock 2018-09-01 21:03:35 +00:00
parent 2e2f458705
commit c921d99898
2 changed files with 35 additions and 25 deletions

View file

@ -70,7 +70,8 @@ config :pleroma, :instance,
allow_relay: true, allow_relay: true,
rewrite_policy: Pleroma.Web.ActivityPub.MRF.NoOpPolicy, rewrite_policy: Pleroma.Web.ActivityPub.MRF.NoOpPolicy,
public: true, public: true,
quarantined_instances: [] quarantined_instances: [],
managed_config: true
config :pleroma, :fe, config :pleroma, :fe,
theme: "pleroma-dark", theme: "pleroma-dark",

View file

@ -156,30 +156,39 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
|> send_resp(200, response) |> send_resp(200, response)
_ -> _ ->
json(conn, %{ data = %{
site: %{ name: Keyword.get(@instance, :name),
name: Keyword.get(@instance, :name), description: Keyword.get(@instance, :description),
description: Keyword.get(@instance, :description), server: Web.base_url(),
server: Web.base_url(), textlimit: to_string(Keyword.get(@instance, :limit)),
textlimit: to_string(Keyword.get(@instance, :limit)), closed: if(Keyword.get(@instance, :registrations_open), do: "0", else: "1"),
closed: if(Keyword.get(@instance, :registrations_open), do: "0", else: "1"), private: if(Keyword.get(@instance, :public, true), do: "0", else: "1")
private: if(Keyword.get(@instance, :public, true), do: "0", else: "1"), }
pleromafe: %{
theme: Keyword.get(@instance_fe, :theme), pleroma_fe = %{
background: Keyword.get(@instance_fe, :background), theme: Keyword.get(@instance_fe, :theme),
logo: Keyword.get(@instance_fe, :logo), background: Keyword.get(@instance_fe, :background),
logoMask: Keyword.get(@instance_fe, :logo_mask), logo: Keyword.get(@instance_fe, :logo),
logoMargin: Keyword.get(@instance_fe, :logo_margin), logoMask: Keyword.get(@instance_fe, :logo_mask),
redirectRootNoLogin: Keyword.get(@instance_fe, :redirect_root_no_login), logoMargin: Keyword.get(@instance_fe, :logo_margin),
redirectRootLogin: Keyword.get(@instance_fe, :redirect_root_login), redirectRootNoLogin: Keyword.get(@instance_fe, :redirect_root_no_login),
chatDisabled: !Keyword.get(@instance_chat, :enabled), redirectRootLogin: Keyword.get(@instance_fe, :redirect_root_login),
showInstanceSpecificPanel: Keyword.get(@instance_fe, :show_instance_panel), chatDisabled: !Keyword.get(@instance_chat, :enabled),
scopeOptionsEnabled: Keyword.get(@instance_fe, :scope_options_enabled), showInstanceSpecificPanel: Keyword.get(@instance_fe, :show_instance_panel),
collapseMessageWithSubject: scopeOptionsEnabled: Keyword.get(@instance_fe, :scope_options_enabled),
Keyword.get(@instance_fe, :collapse_message_with_subject) collapseMessageWithSubject:
} Keyword.get(@instance_fe, :collapse_message_with_subject)
} }
})
managed_config = Keyword.get(@instance, :managed_config)
data =
if managed_config do
data |> Map.put("pleromafe", pleroma_fe)
else
data
end
json(conn, %{site: data})
end end
end end