Merge branch 'develop' into gun
authorMark Felder <feld@FreeBSD.org>
Tue, 18 Feb 2020 15:06:27 +0000 (09:06 -0600)
committerMark Felder <feld@FreeBSD.org>
Tue, 18 Feb 2020 15:06:27 +0000 (09:06 -0600)
1  2 
docs/API/admin_api.md
lib/pleroma/config/transfer_task.ex
lib/pleroma/web/rel_me.ex
lib/pleroma/web/rich_media/parser.ex
mix.exs
mix.lock
test/web/admin_api/admin_api_controller_test.exs

Simple merge
Simple merge
index 0ae92637518d7303a62d7da2ae3a0a4292ff4761,540fa65dffba1ce8702509acac42b065f214390a..b33dd64ddc9e51a4c1d69500d519befe50d3c5eb
@@@ -23,21 -25,12 +23,22 @@@ defmodule Pleroma.Web.RelMe d
    def parse(_), do: {:error, "No URL provided"}
  
    defp parse_url(url) do
 +    opts =
 +      if Application.get_env(:tesla, :adapter) == Tesla.Adapter.Hackney do
 +        Keyword.merge(@options,
 +          recv_timeout: 2_000,
 +          with_body: true
 +        )
 +      else
 +        @options
 +      end
 +
      with {:ok, %Tesla.Env{body: html, status: status}} when status in 200..299 <-
 -           Pleroma.HTTP.get(url, [], adapter: @hackney_options),
 +           Pleroma.HTTP.get(url, [], adapter: opts),
+          {:ok, html_tree} <- Floki.parse_document(html),
           data <-
-            Floki.attribute(html, "link[rel~=me]", "href") ++
-              Floki.attribute(html, "a[rel~=me]", "href") do
+            Floki.attribute(html_tree, "link[rel~=me]", "href") ++
+              Floki.attribute(html_tree, "a[rel~=me]", "href") do
        {:ok, data}
      end
    rescue
index 9deb038451e2e8a8cdd63af7e891653a426017cf,9702e90f19b8ed02ce5569b2576731e204d0ab00..e05a0a204662a952ce8ba138bb0cd9e9e6dd4a21
@@@ -75,21 -77,11 +75,21 @@@ defmodule Pleroma.Web.RichMedia.Parser 
    end
  
    defp parse_url(url) do
 +    opts =
 +      if Application.get_env(:tesla, :adapter) == Tesla.Adapter.Hackney do
 +        Keyword.merge(@options,
 +          recv_timeout: 2_000,
 +          with_body: true
 +        )
 +      else
 +        @options
 +      end
 +
      try do
 -      {:ok, %Tesla.Env{body: html}} = Pleroma.HTTP.get(url, [], adapter: @hackney_options)
 +      {:ok, %Tesla.Env{body: html}} = Pleroma.HTTP.get(url, [], adapter: opts)
  
        html
-       |> parse_html
+       |> parse_html()
        |> maybe_parse()
        |> Map.put(:url, url)
        |> clean_parsed_data()
diff --cc mix.exs
Simple merge
diff --cc mix.lock
index 158a87e4787230c8f57dbf516b703db03e08c187,5a667055f0cf4cac4aabbf923b8750944c771760..12ce1afac3f0228d202427f0b05a03ef378abad2
+++ b/mix.lock
    "gen_smtp": {:hex, :gen_smtp, "0.15.0", "9f51960c17769b26833b50df0b96123605a8024738b62db747fece14eb2fbfcc", [:rebar3], [], "hexpm", "29bd14a88030980849c7ed2447b8db6d6c9278a28b11a44cafe41b791205440f"},
    "gen_stage": {:hex, :gen_stage, "0.14.3", "d0c66f1c87faa301c1a85a809a3ee9097a4264b2edf7644bf5c123237ef732bf", [:mix], [], "hexpm"},
    "gen_state_machine": {:hex, :gen_state_machine, "2.0.5", "9ac15ec6e66acac994cc442dcc2c6f9796cf380ec4b08267223014be1c728a95", [:mix], [], "hexpm"},
 -  "gettext": {:hex, :gettext, "0.17.4", "f13088e1ec10ce01665cf25f5ff779e7df3f2dc71b37084976cf89d1aa124d5c", [:mix], [], "hexpm"},
 +  "gettext": {:hex, :gettext, "0.17.4", "f13088e1ec10ce01665cf25f5ff779e7df3f2dc71b37084976cf89d1aa124d5c", [:mix], [], "hexpm", "3c75b5ea8288e2ee7ea503ff9e30dfe4d07ad3c054576a6e60040e79a801e14d"},
 +  "gun": {:git, "https://github.com/ninenines/gun.git", "bd6425ab87428cf4c95f4d23e0a48fd065fbd714", [ref: "bd6425ab87428cf4c95f4d23e0a48fd065fbd714"]},
    "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "e0100f8ef7d1124222c11ad362c857d3df7cb5f4204054f9f0f4a728666591fc"},
-   "html_entities": {:hex, :html_entities, "0.5.1", "1c9715058b42c35a2ab65edc5b36d0ea66dd083767bef6e3edb57870ef556549", [:mix], [], "hexpm", "30efab070904eb897ff05cd52fa61c1025d7f8ef3a9ca250bc4e6513d16c32de"},
+   "html_entities": {:hex, :html_entities, "0.5.1", "1c9715058b42c35a2ab65edc5b36d0ea66dd083767bef6e3edb57870ef556549", [:mix], [], "hexpm"},
    "html_sanitize_ex": {:hex, :html_sanitize_ex, "1.3.0", "f005ad692b717691203f940c686208aa3d8ffd9dd4bb3699240096a51fa9564e", [:mix], [{:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm"},
    "http_signatures": {:git, "https://git.pleroma.social/pleroma/http_signatures.git", "293d77bb6f4a67ac8bde1428735c3b42f22cbb30", [ref: "293d77bb6f4a67ac8bde1428735c3b42f22cbb30"]},
-   "httpoison": {:hex, :httpoison, "1.6.2", "ace7c8d3a361cebccbed19c283c349b3d26991eff73a1eaaa8abae2e3c8089b6", [:mix], [{:hackney, "~> 1.15 and >= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "aa2c74bd271af34239a3948779612f87df2422c2fdcfdbcec28d9c105f0773fe"},
+   "httpoison": {:hex, :httpoison, "1.6.2", "ace7c8d3a361cebccbed19c283c349b3d26991eff73a1eaaa8abae2e3c8089b6", [:mix], [{:hackney, "~> 1.15 and >= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
    "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"},
    "inet_cidr": {:hex, :inet_cidr, "1.0.4", "a05744ab7c221ca8e395c926c3919a821eb512e8f36547c062f62c4ca0cf3d6e", [:mix], [], "hexpm", "64a2d30189704ae41ca7dbdd587f5291db5d1dda1414e0774c29ffc81088c1bc"},
    "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fdf843bca858203ae1de16da2ee206f53416bbda5dc8c9e78f43243de4bc3afe"},