TwitterAPI: present pleroma frontend config in API
authorWilliam Pitcock <nenolod@dereferenced.org>
Tue, 17 Jul 2018 15:20:39 +0000 (15:20 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Tue, 17 Jul 2018 15:46:24 +0000 (15:46 +0000)
config/config.exs
lib/pleroma/web/twitter_api/controllers/util_controller.ex

index 51b953a94b826300bb75d01b3b7e2e8a73e02e5b..9e2a66620e6575ffc075f01c4b25a459418043cd 100644 (file)
@@ -61,6 +61,18 @@ config :pleroma, :instance,
   public: true,
   quarantined_instances: []
 
+config :pleroma, :fe,
+  theme: "pleroma-dark",
+  logo: "/static/logo.png",
+  background: "/static/aurora_borealis.jpg",
+  redirect_root_no_login: "/main/all",
+  redirect_root_login: "/main/friends",
+  show_instance_panel: true,
+  show_who_to_follow_panel: false,
+  who_to_follow_provider: "https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-osa-api.cgi?{{host}}+{{user}}",
+  who_to_follow_link: "https://vinayaka.distsn.org/?{{host}}+{{user}}",
+  scope_options_enabled: false
+
 config :pleroma, :activitypub,
   accept_blocks: true,
   unfollow_blocked: true,
index 7a0c37ce97f1c8a9eeb04cded61518e7042aeaec..47fc79350e2b689be6effd22be906f23807f2d48 100644 (file)
@@ -126,6 +126,8 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
   end
 
   @instance Application.get_env(:pleroma, :instance)
+  @instance_fe Application.get_env(:pleroma, :fe)
+  @instance_chat Application.get_env(:pleroma, :chat)
   def config(conn, _params) do
     case get_format(conn) do
       "xml" ->
@@ -148,9 +150,24 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
         json(conn, %{
           site: %{
             name: Keyword.get(@instance, :name),
+            description: Keyword.get(@instance, :description),
             server: Web.base_url(),
             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"),
+            pleromafe: %{
+              theme: Keyword.get(@instance_fe, :theme),
+              background: Keyword.get(@instance_fe, :background),
+              logo: Keyword.get(@instance_fe, :logo),
+              redirectRootNoLogin: Keyword.get(@instance_fe, :redirect_root_no_login),
+              redirectRootLogin: Keyword.get(@instance_fe, :redirect_root_login),
+              chatDisabled: !Keyword.get(@instance_chat, :enabled),
+              showInstanceSpecificPanel: Keyword.get(@instance_fe, :show_instance_panel),
+              showWhoToFollowPanel: Keyword.get(@instance_fe, :show_who_to_follow_panel),
+              scopeOptionsEnabled: Keyword.get(@instance_fe, :scope_options_enabled),
+              whoToFollowProvider: Keyword.get(@instance_fe, :who_to_follow_provider),
+              whoToFollowLink: Keyword.get(@instance_fe, :who_to_follow_link)
+            }
           }
         })
     end