aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-07-22 09:24:16 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-07-22 09:24:16 +0300
commit8d6f7aec2145fc012677cfd9f61cb3e2720edd68 (patch)
treee39c58741a47b98311b3d09e511dd6f52b7b8bc0 /lib
parent5fcb3e873822c602a5f50cbeb159427e02ea1818 (diff)
parentc36113cdf5865cbccbd1da2f7404454134139e43 (diff)
downloadpleroma-8d6f7aec2145fc012677cfd9f61cb3e2720edd68.tar.gz
Merge branch 'develop' into issue/1023
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/gopher/server.ex19
-rw-r--r--lib/pleroma/http/http.ex9
-rw-r--r--lib/pleroma/web/api_spec/operations/account_operation.ex2
-rw-r--r--lib/pleroma/web/mastodon_api/views/instance_view.ex3
-rw-r--r--lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex2
-rw-r--r--lib/pleroma/web/templates/o_auth/mfa/totp.html.eex2
6 files changed, 25 insertions, 12 deletions
diff --git a/lib/pleroma/gopher/server.ex b/lib/pleroma/gopher/server.ex
index 3d56d50a9..e9f54c4c0 100644
--- a/lib/pleroma/gopher/server.ex
+++ b/lib/pleroma/gopher/server.ex
@@ -96,16 +96,18 @@ defmodule Pleroma.Gopher.Server.ProtocolHandler do
def response("/main/public") do
posts =
- ActivityPub.fetch_public_activities(%{"type" => ["Create"], "local_only" => true})
- |> render_activities
+ %{type: ["Create"], local_only: true}
+ |> ActivityPub.fetch_public_activities()
+ |> render_activities()
info("Welcome to the Public Timeline!") <> posts <> ".\r\n"
end
def response("/main/all") do
posts =
- ActivityPub.fetch_public_activities(%{"type" => ["Create"]})
- |> render_activities
+ %{type: ["Create"]}
+ |> ActivityPub.fetch_public_activities()
+ |> render_activities()
info("Welcome to the Federated Timeline!") <> posts <> ".\r\n"
end
@@ -130,13 +132,14 @@ defmodule Pleroma.Gopher.Server.ProtocolHandler do
def response("/users/" <> nickname) do
with %User{} = user <- User.get_cached_by_nickname(nickname) do
params = %{
- "type" => ["Create"],
- "actor_id" => user.ap_id
+ type: ["Create"],
+ actor_id: user.ap_id
}
activities =
- ActivityPub.fetch_public_activities(params)
- |> render_activities
+ params
+ |> ActivityPub.fetch_public_activities()
+ |> render_activities()
info("Posts by #{user.nickname}") <> activities <> ".\r\n"
else
diff --git a/lib/pleroma/http/http.ex b/lib/pleroma/http/http.ex
index 6128bc4cf..b37b3fa89 100644
--- a/lib/pleroma/http/http.ex
+++ b/lib/pleroma/http/http.ex
@@ -69,7 +69,8 @@ defmodule Pleroma.HTTP do
request = build_request(method, headers, options, url, body, params)
adapter = Application.get_env(:tesla, :adapter)
- client = Tesla.client([Pleroma.HTTP.Middleware.FollowRedirects], adapter)
+
+ client = Tesla.client(adapter_middlewares(adapter), adapter)
maybe_limit(
fn ->
@@ -107,4 +108,10 @@ defmodule Pleroma.HTTP do
defp maybe_limit(fun, _, _) do
fun.()
end
+
+ defp adapter_middlewares(Tesla.Adapter.Gun) do
+ [Pleroma.HTTP.Middleware.FollowRedirects]
+ end
+
+ defp adapter_middlewares(_), do: []
end
diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex
index 952d9347b..50c8e0242 100644
--- a/lib/pleroma/web/api_spec/operations/account_operation.ex
+++ b/lib/pleroma/web/api_spec/operations/account_operation.ex
@@ -159,6 +159,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
"Accounts which follow the given account, if network is not hidden by the account owner.",
parameters: [
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
+ Operation.parameter(:id, :query, :string, "ID of the resource owner"),
with_relationships_param() | pagination_params()
],
responses: %{
@@ -177,6 +178,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
"Accounts which the given account is following, if network is not hidden by the account owner.",
parameters: [
%Reference{"$ref": "#/components/parameters/accountIdOrNickname"},
+ Operation.parameter(:id, :query, :string, "ID of the resource owner"),
with_relationships_param() | pagination_params()
],
responses: %{200 => Operation.response("Accounts", "application/json", array_of_accounts())}
diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex
index 5deb0d7ed..cd3bc7f00 100644
--- a/lib/pleroma/web/mastodon_api/views/instance_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex
@@ -41,7 +41,8 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
account_activation_required: Keyword.get(instance, :account_activation_required),
features: features(),
federation: federation(),
- fields_limits: fields_limits()
+ fields_limits: fields_limits(),
+ post_formats: Config.get([:instance, :allowed_post_formats])
},
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
}
diff --git a/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex b/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex
index 750f65386..5ab59b57b 100644
--- a/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex
+++ b/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex
@@ -10,7 +10,7 @@
<%= form_for @conn, mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
<div class="input">
<%= label f, :code, "Recovery code" %>
- <%= text_input f, :code %>
+ <%= text_input f, :code, [autocomplete: false, autocorrect: "off", autocapitalize: "off", autofocus: true, spellcheck: false] %>
<%= hidden_input f, :mfa_token, value: @mfa_token %>
<%= hidden_input f, :state, value: @state %>
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
diff --git a/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex b/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex
index af6e546b0..af85777eb 100644
--- a/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex
+++ b/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex
@@ -10,7 +10,7 @@
<%= form_for @conn, mfa_verify_path(@conn, :verify), [as: "mfa"], fn f -> %>
<div class="input">
<%= label f, :code, "Authentication code" %>
- <%= text_input f, :code %>
+ <%= text_input f, :code, [autocomplete: false, autocorrect: "off", autocapitalize: "off", autofocus: true, pattern: "[0-9]*", spellcheck: false] %>
<%= hidden_input f, :mfa_token, value: @mfa_token %>
<%= hidden_input f, :state, value: @state %>
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>