From cf219b6addab9fffca0b2e996fa8de1d7fbcd198 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 17 Jul 2018 15:10:14 +0000 Subject: [PATCH 1/3] config: make instance description configurable --- config/config.exs | 1 + lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 2 +- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/config.exs b/config/config.exs index 0616fe4fb..51b953a94 100644 --- a/config/config.exs +++ b/config/config.exs @@ -52,6 +52,7 @@ version: version, name: "Pleroma", email: "example@example.com", + description: "A Pleroma instance, an alternative fediverse server", limit: 5000, upload_limit: 16_000_000, registrations_open: true, diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 09e6b0b59..f521960c2 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -125,7 +125,7 @@ def masto_instance(conn, _params) do response = %{ uri: Web.base_url(), title: Keyword.get(@instance, :name), - description: "A Pleroma instance, an alternative fediverse server", + description: Keyword.get(@instance, :description), version: "#{@mastodon_api_level} (compatible; #{Keyword.get(@instance, :version)})", email: Keyword.get(@instance, :email), urls: %{ diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 12aca4a10..7c67bbf1c 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -43,7 +43,9 @@ def nodeinfo(conn, %{"version" => "2.0"}) do }, metadata: %{ nodeName: Keyword.get(instance, :name), - mediaProxy: Keyword.get(media_proxy, :enabled) + nodeDescription: Keyword.get(instance, :description), + mediaProxy: Keyword.get(media_proxy, :enabled), + private: !Keyword.get(instance, :public, true) } } From b23630076f8d1597c417e98dfc702c972b29a82c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 17 Jul 2018 15:20:39 +0000 Subject: [PATCH 2/3] TwitterAPI: present pleroma frontend config in API --- config/config.exs | 12 ++++++++++++ .../controllers/util_controller.ex | 19 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index 51b953a94..9e2a66620 100644 --- a/config/config.exs +++ b/config/config.exs @@ -61,6 +61,18 @@ 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, diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index 7a0c37ce9..47fc79350 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -126,6 +126,8 @@ def do_remote_follow(%{assigns: %{user: user}} = conn, %{"user" => %{"id" => id} 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 @@ def config(conn, _params) 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 From 2b3f049b06aa2d248028890bd8fdfbeb9e1e279e Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 18 Jul 2018 00:05:36 +0000 Subject: [PATCH 3/3] config: formatting --- config/config.exs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index 9e2a66620..922acea4b 100644 --- a/config/config.exs +++ b/config/config.exs @@ -69,7 +69,8 @@ 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_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