commit: 60f0ff38e70b4566c41d2b021c7314a329a2cb16
parent: 53e3e22b06fded1806dd9c73f4f9b09953b74342
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 1 Mar 2019 23:26:36 +0100
mix.deps: Change auto_linker to my branch
Diffstat:
6 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex
@@ -13,7 +13,9 @@ defmodule Pleroma.Formatter do
@auto_linker_config hashtag: true,
hashtag_handler: &Pleroma.Formatter.hashtag_handler/4,
mention: true,
- mention_handler: &Pleroma.Formatter.mention_handler/4
+ mention_handler: &Pleroma.Formatter.mention_handler/4,
+ phone: false,
+ extra_prefixes: Pleroma.Config.get([:uri_schemes, :valid_schemes])
def escape_mention_handler("@" <> nickname = mention, buffer, _, _) do
case User.get_cached_by_nickname(nickname) do
diff --git a/lib/pleroma/web/rich_media/helpers.ex b/lib/pleroma/web/rich_media/helpers.ex
@@ -14,7 +14,7 @@ defmodule Pleroma.Web.RichMedia.Helpers do
validate_tld = Application.get_env(:auto_linker, :opts)[:validate_tld]
page_url
- |> AutoLinker.Parser.url?(scheme: true, validate_tld: validate_tld)
+ |> AutoLinker.Parser.is_url?(scheme: true, validate_tld: validate_tld)
|> parse_uri(page_url)
end
diff --git a/mix.exs b/mix.exs
@@ -139,9 +139,7 @@ defmodule Pleroma.Mixfile do
{:ex_syslogger, github: "slashmili/ex_syslogger", tag: "1.4.0"},
{:timex, "~> 3.5"},
{:ueberauth, "~> 0.4"},
- {:auto_linker,
- git: "https://git.pleroma.social/pleroma/auto_linker.git",
- ref: "95e8188490e97505c56636c1379ffdf036c1fdde"},
+ {:auto_linker, git: "https://hacktivis.me/git/auto_linker.git", branch: "lanodan/master"},
{:http_signatures,
git: "https://git.pleroma.social/pleroma/http_signatures.git",
ref: "293d77bb6f4a67ac8bde1428735c3b42f22cbb30"},
diff --git a/mix.lock b/mix.lock
@@ -1,6 +1,6 @@
%{
"accept": {:hex, :accept, "0.3.5", "b33b127abca7cc948bbe6caa4c263369abf1347cfa9d8e699c6d214660f10cd1", [:rebar3], [], "hexpm"},
- "auto_linker": {:git, "https://git.pleroma.social/pleroma/auto_linker.git", "95e8188490e97505c56636c1379ffdf036c1fdde", [ref: "95e8188490e97505c56636c1379ffdf036c1fdde"]},
+ "auto_linker": {:git, "https://hacktivis.me/git/auto_linker.git", "71425bb5a4c0d8755b00a469763b75db8ce77899", [branch: "lanodan/master"]},
"base62": {:hex, :base62, "1.2.1", "4866763e08555a7b3917064e9eef9194c41667276c51b59de2bc42c6ea65f806", [:mix], [{:custom_base, "~> 0.2.1", [hex: :custom_base, repo: "hexpm", optional: false]}], "hexpm"},
"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm"},
"bbcode": {:hex, :bbcode, "0.1.1", "0023e2c7814119b2e620b7add67182e3f6019f92bfec9a22da7e99821aceba70", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs
@@ -154,14 +154,15 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
{:ok, user} =
UserBuilder.insert(%{nickname: "user__test", ap_id: "http://foo.com/user__test"})
- text = "**hello world**\n\n*another @user__test and @user__test google.com paragraph*"
+ text =
+ "**hello world**\n\n*another @user__test and @user__test http://google.com paragraph*"
expected =
~s(<p><strong>hello world</strong></p>\n<p><em>another <span class="h-card"><a data-user="#{
user.id
}" class="u-url mention" href="http://foo.com/user__test" rel="ugc">@<span>user__test</span></a></span> and <span class="h-card"><a data-user="#{
user.id
- }" class="u-url mention" href="http://foo.com/user__test" rel="ugc">@<span>user__test</span></a></span> <a href="http://google.com" rel="ugc">google.com</a> paragraph</em></p>\n)
+ }" class="u-url mention" href="http://foo.com/user__test" rel="ugc">@<span>user__test</span></a></span> <a href="http://google.com" rel="ugc">http://google.com</a> paragraph</em></p>\n)
{output, _, _} = Utils.format_input(text, "text/markdown")
diff --git a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs b/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs
@@ -338,7 +338,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
fields = [
%{"name" => "<a href=\"http://google.com\">foo</a>", "value" => "<script>bar</script>"},
- %{"name" => "link", "value" => "cofe.io"}
+ %{"name" => "link", "value" => "http://cofe.io"}
]
account =
@@ -349,7 +349,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
assert account["fields"] == [
%{"name" => "foo", "value" => "bar"},
- %{"name" => "link", "value" => ~S(<a href="http://cofe.io" rel="ugc">cofe.io</a>)}
+ %{
+ "name" => "link",
+ "value" => ~S(<a href="http://cofe.io" rel="ugc">http://cofe.io</a>)
+ }
]
assert account["source"]["fields"] == [
@@ -357,13 +360,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
"name" => "<a href=\"http://google.com\">foo</a>",
"value" => "<script>bar</script>"
},
- %{"name" => "link", "value" => "cofe.io"}
+ %{"name" => "link", "value" => "http://cofe.io"}
]
fields =
[
"fields_attributes[1][name]=link",
- "fields_attributes[1][value]=cofe.io",
+ "fields_attributes[1][value]=http://cofe.io",
"fields_attributes[0][name]=<a href=\"http://google.com\">foo</a>",
"fields_attributes[0][value]=bar"
]
@@ -378,7 +381,10 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
assert account["fields"] == [
%{"name" => "foo", "value" => "bar"},
- %{"name" => "link", "value" => ~S(<a href="http://cofe.io" rel="ugc">cofe.io</a>)}
+ %{
+ "name" => "link",
+ "value" => ~S(<a href="http://cofe.io" rel="ugc">http://cofe.io</a>)
+ }
]
assert account["source"]["fields"] == [
@@ -386,7 +392,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
"name" => "<a href=\"http://google.com\">foo</a>",
"value" => "bar"
},
- %{"name" => "link", "value" => "cofe.io"}
+ %{"name" => "link", "value" => "http://cofe.io"}
]
name_limit = Pleroma.Config.get([:instance, :account_field_name_length])
@@ -416,7 +422,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
fields = [
%{"name" => "<b>foo<b>", "value" => "<i>bar</i>"},
- %{"name" => "link", "value" => "cofe.io"}
+ %{"name" => "link", "value" => "http://cofe.io"}
]
assert %{"error" => "Invalid request"} ==