Merge branch 'develop' into gun
authorAlexander Strizhakov <alex.strizhakov@gmail.com>
Fri, 20 Mar 2020 17:47:54 +0000 (20:47 +0300)
committerAlexander Strizhakov <alex.strizhakov@gmail.com>
Fri, 20 Mar 2020 17:47:54 +0000 (20:47 +0300)
12 files changed:
1  2 
CHANGELOG.md
config/config.exs
config/description.exs
docs/configuration/cheatsheet.md
test/http/request_builder_test.exs
test/web/activity_pub/mrf/object_age_policy_test.exs
test/web/activity_pub/mrf/reject_non_public_test.exs
test/web/activity_pub/mrf/simple_policy_test.exs
test/web/activity_pub/relay_test.exs
test/web/admin_api/admin_api_controller_test.exs
test/web/mastodon_api/controllers/notification_controller_test.exs
test/web/streamer/streamer_test.exs

diff --cc CHANGELOG.md
Simple merge
index 154eda48a00007b852137679b8f6e611d28a6d98,2ab9391074f9851c0ff85b29884a63b26da7f174..232a91bf132c8063f8f0f730121bb68eade6ad6f
@@@ -602,49 -624,11 +602,54 @@@ config :pleroma, Pleroma.Repo
    parameters: [gin_fuzzy_search_limit: "500"],
    prepare: :unnamed
  
 +config :pleroma, :connections_pool,
 +  checkin_timeout: 250,
 +  max_connections: 250,
 +  retry: 1,
 +  retry_timeout: 1000,
 +  await_up_timeout: 5_000
 +
 +config :pleroma, :pools,
 +  federation: [
 +    size: 50,
 +    max_overflow: 10,
 +    timeout: 150_000
 +  ],
 +  media: [
 +    size: 50,
 +    max_overflow: 10,
 +    timeout: 150_000
 +  ],
 +  upload: [
 +    size: 25,
 +    max_overflow: 5,
 +    timeout: 300_000
 +  ],
 +  default: [
 +    size: 10,
 +    max_overflow: 2,
 +    timeout: 10_000
 +  ]
 +
 +config :pleroma, :hackney_pools,
 +  federation: [
 +    max_connections: 50,
 +    timeout: 150_000
 +  ],
 +  media: [
 +    max_connections: 50,
 +    timeout: 150_000
 +  ],
 +  upload: [
 +    max_connections: 25,
 +    timeout: 300_000
 +  ]
 +
+ config :pleroma, :restrict_unauthenticated,
+   timelines: %{local: false, federated: false},
+   profiles: %{local: false, remote: false},
+   activities: %{local: false, remote: false}
  # Import environment specific config. This must remain at the bottom
  # of this file so it overrides the configuration defined above.
  import_config "#{Mix.env()}.exs"
index ee10515a74bcdb4b42511008d01083096262425a,3781fb9cb7dcf27a1a5cce96456f879a6c8b0eb8..056f5971d121c1a4ff6db10d05cbf61098c2985a
@@@ -2916,217 -2916,64 +2916,277 @@@ config :pleroma, :config_description, 
        }
      ]
    },
 +  %{
 +    group: :pleroma,
 +    key: :connections_pool,
 +    type: :group,
 +    description: "Advanced settings for `gun` connections pool",
 +    children: [
 +      %{
 +        key: :checkin_timeout,
 +        type: :integer,
 +        description: "Timeout to checkin connection from pool. Default: 250ms.",
 +        suggestions: [250]
 +      },
 +      %{
 +        key: :max_connections,
 +        type: :integer,
 +        description: "Maximum number of connections in the pool. Default: 250 connections.",
 +        suggestions: [250]
 +      },
 +      %{
 +        key: :retry,
 +        type: :integer,
 +        description:
 +          "Number of retries, while `gun` will try to reconnect if connection goes down. Default: 1.",
 +        suggestions: [1]
 +      },
 +      %{
 +        key: :retry_timeout,
 +        type: :integer,
 +        description:
 +          "Time between retries when `gun` will try to reconnect in milliseconds. Default: 1000ms.",
 +        suggestions: [1000]
 +      },
 +      %{
 +        key: :await_up_timeout,
 +        type: :integer,
 +        description: "Timeout while `gun` will wait until connection is up. Default: 5000ms.",
 +        suggestions: [5000]
 +      }
 +    ]
 +  },
 +  %{
 +    group: :pleroma,
 +    key: :pools,
 +    type: :group,
 +    description: "Advanced settings for `gun` workers pools",
 +    children: [
 +      %{
 +        key: :federation,
 +        type: :keyword,
 +        description: "Settings for federation pool.",
 +        children: [
 +          %{
 +            key: :size,
 +            type: :integer,
 +            description: "Number workers in the pool.",
 +            suggestions: [50]
 +          },
 +          %{
 +            key: :max_overflow,
 +            type: :integer,
 +            description: "Number of additional workers if pool is under load.",
 +            suggestions: [10]
 +          },
 +          %{
 +            key: :timeout,
 +            type: :integer,
 +            description: "Timeout while `gun` will wait for response.",
 +            suggestions: [150_000]
 +          }
 +        ]
 +      },
 +      %{
 +        key: :media,
 +        type: :keyword,
 +        description: "Settings for media pool.",
 +        children: [
 +          %{
 +            key: :size,
 +            type: :integer,
 +            description: "Number workers in the pool.",
 +            suggestions: [50]
 +          },
 +          %{
 +            key: :max_overflow,
 +            type: :integer,
 +            description: "Number of additional workers if pool is under load.",
 +            suggestions: [10]
 +          },
 +          %{
 +            key: :timeout,
 +            type: :integer,
 +            description: "Timeout while `gun` will wait for response.",
 +            suggestions: [150_000]
 +          }
 +        ]
 +      },
 +      %{
 +        key: :upload,
 +        type: :keyword,
 +        description: "Settings for upload pool.",
 +        children: [
 +          %{
 +            key: :size,
 +            type: :integer,
 +            description: "Number workers in the pool.",
 +            suggestions: [25]
 +          },
 +          %{
 +            key: :max_overflow,
 +            type: :integer,
 +            description: "Number of additional workers if pool is under load.",
 +            suggestions: [5]
 +          },
 +          %{
 +            key: :timeout,
 +            type: :integer,
 +            description: "Timeout while `gun` will wait for response.",
 +            suggestions: [300_000]
 +          }
 +        ]
 +      },
 +      %{
 +        key: :default,
 +        type: :keyword,
 +        description: "Settings for default pool.",
 +        children: [
 +          %{
 +            key: :size,
 +            type: :integer,
 +            description: "Number workers in the pool.",
 +            suggestions: [10]
 +          },
 +          %{
 +            key: :max_overflow,
 +            type: :integer,
 +            description: "Number of additional workers if pool is under load.",
 +            suggestions: [2]
 +          },
 +          %{
 +            key: :timeout,
 +            type: :integer,
 +            description: "Timeout while `gun` will wait for response.",
 +            suggestions: [10_000]
 +          }
 +        ]
 +      }
 +    ]
 +  },
 +  %{
 +    group: :pleroma,
 +    key: :hackney_pools,
 +    type: :group,
 +    description: "Advanced settings for `hackney` connections pools",
 +    children: [
 +      %{
 +        key: :federation,
 +        type: :keyword,
 +        description: "Settings for federation pool.",
 +        children: [
 +          %{
 +            key: :max_connections,
 +            type: :integer,
 +            description: "Number workers in the pool.",
 +            suggestions: [50]
 +          },
 +          %{
 +            key: :timeout,
 +            type: :integer,
 +            description: "Timeout while `hackney` will wait for response.",
 +            suggestions: [150_000]
 +          }
 +        ]
 +      },
 +      %{
 +        key: :media,
 +        type: :keyword,
 +        description: "Settings for media pool.",
 +        children: [
 +          %{
 +            key: :max_connections,
 +            type: :integer,
 +            description: "Number workers in the pool.",
 +            suggestions: [50]
 +          },
 +          %{
 +            key: :timeout,
 +            type: :integer,
 +            description: "Timeout while `hackney` will wait for response.",
 +            suggestions: [150_000]
 +          }
 +        ]
 +      },
 +      %{
 +        key: :upload,
 +        type: :keyword,
 +        description: "Settings for upload pool.",
 +        children: [
 +          %{
 +            key: :max_connections,
 +            type: :integer,
 +            description: "Number workers in the pool.",
 +            suggestions: [25]
 +          },
 +          %{
 +            key: :timeout,
 +            type: :integer,
 +            description: "Timeout while `hackney` will wait for response.",
 +            suggestions: [300_000]
 +          }
 +        ]
 +      }
 +    ]
++  },
+   %{
+     group: :pleroma,
+     key: :restrict_unauthenticated,
+     type: :group,
+     description:
+       "Disallow viewing timelines, user profiles and statuses for unauthenticated users.",
+     children: [
+       %{
+         key: :timelines,
+         type: :map,
+         description: "Settings for public and federated timelines.",
+         children: [
+           %{
+             key: :local,
+             type: :boolean,
+             description: "Disallow view public timeline."
+           },
+           %{
+             key: :federated,
+             type: :boolean,
+             description: "Disallow view federated timeline."
+           }
+         ]
+       },
+       %{
+         key: :profiles,
+         type: :map,
+         description: "Settings for user profiles.",
+         children: [
+           %{
+             key: :local,
+             type: :boolean,
+             description: "Disallow view local user profiles."
+           },
+           %{
+             key: :remote,
+             type: :boolean,
+             description: "Disallow view remote user profiles."
+           }
+         ]
+       },
+       %{
+         key: :activities,
+         type: :map,
+         description: "Settings for statuses.",
+         children: [
+           %{
+             key: :local,
+             type: :boolean,
+             description: "Disallow view local statuses."
+           },
+           %{
+             key: :remote,
+             type: :boolean,
+             description: "Disallow view remote statuses."
+           }
+         ]
+       }
+     ]
    }
  ]
Simple merge
index f6eeac6c07c08c82196dda21f38da1e1e9bfbd75,bf3a15ebe43af04ca2d8516aebc87b463b829d15..f11528c3feb5138cc4710f03cee047056e0f90f0
@@@ -10,11 -8,11 +10,11 @@@ defmodule Pleroma.HTTP.RequestBuilderTe
    alias Pleroma.HTTP.RequestBuilder
  
    describe "headers/2" do
-     clear_config([:http, :send_user_agent])
-     clear_config([:http, :user_agent])
+     setup do: clear_config([:http, :send_user_agent])
+     setup do: clear_config([:http, :user_agent])
  
      test "don't send pleroma user agent" do
 -      assert RequestBuilder.headers(%{}, []) == %{headers: []}
 +      assert RequestBuilder.headers(%Request{}, []) == %Request{headers: []}
      end
  
      test "send pleroma user agent" do
Simple merge
Simple merge