From 402e775a80801b5258d3ab051ce69d04f149dc71 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:28:06 +0000 Subject: [PATCH 01/15] ap -> AP for consistency --- lib/pleroma/web/federator/federator.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex index 57e11b4fb..3cc30cdd9 100644 --- a/lib/pleroma/web/federator/federator.ex +++ b/lib/pleroma/web/federator/federator.ex @@ -71,7 +71,7 @@ def handle(:incoming_doc, doc) do end def handle(:incoming_ap_doc, params) do - Logger.info("Handling incoming ap activity") + Logger.info("Handling incoming AP activity") with {:ok, _user} <- ap_enabled_actor(params["actor"]), nil <- Activity.get_by_ap_id(params["id"]), {:ok, activity} <- Transmogrifier.handle_incoming(params) do From 04395cb9bd52dc37b243880d87577a9052028851 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:31:58 +0000 Subject: [PATCH 02/15] Grammar consistency Most log messages are sentence fragments so make them consistent by removing periods. Log messages that are expressing urgency with ! or pending more work with "..." are OK. --- lib/pleroma/web/activity_pub/activity_pub_controller.ex | 4 ++-- lib/pleroma/web/http_signatures/http_signatures.ex | 2 +- lib/pleroma/web/web_finger/web_finger.ex | 2 +- lib/pleroma/web/websub/websub.ex | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index edbcb938a..85fc95427 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -36,9 +36,9 @@ def inbox(%{assigns: %{valid_signature: true}} = conn, params) do def inbox(conn, params) do headers = Enum.into(conn.req_headers, %{}) if !(String.contains?(headers["signature"] || "", params["actor"])) do - Logger.info("Signature not from author, relayed message, ignoring.") + Logger.info("Signature not from author, relayed message, ignoring") else - Logger.info("Signature error.") + Logger.info("Signature error") Logger.info("Could not validate #{params["actor"]}") Logger.info(inspect(conn.req_headers)) end diff --git a/lib/pleroma/web/http_signatures/http_signatures.ex b/lib/pleroma/web/http_signatures/http_signatures.ex index d0695cb16..0ea3b7554 100644 --- a/lib/pleroma/web/http_signatures/http_signatures.ex +++ b/lib/pleroma/web/http_signatures/http_signatures.ex @@ -36,7 +36,7 @@ def validate_conn(conn) do if validate_conn(conn, public_key) do true else - Logger.debug("Could not validate, re-fetching user and trying one more time.") + Logger.debug("Could not validate, re-fetching user and trying one more time") # Fetch user anew and try one more time with actor_id <- conn.params["actor"], {:ok, _user} <- ActivityPub.make_user_from_ap_id(actor_id), diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger/web_finger.ex index c59a7e82d..9c39cc5a1 100644 --- a/lib/pleroma/web/web_finger/web_finger.ex +++ b/lib/pleroma/web/web_finger/web_finger.ex @@ -122,7 +122,7 @@ def finger(account) do {:ok, data} else e -> - Logger.debug(fn -> "Couldn't finger #{account}." end) + Logger.debug(fn -> "Couldn't finger #{account}" end) Logger.debug(fn -> inspect(e) end) {:error, e} end diff --git a/lib/pleroma/web/websub/websub.ex b/lib/pleroma/web/websub/websub.ex index fa3ab7214..5caa8198c 100644 --- a/lib/pleroma/web/websub/websub.ex +++ b/lib/pleroma/web/websub/websub.ex @@ -98,7 +98,7 @@ def incoming_subscription_request(user, %{"hub.mode" => "subscribe"} = params) d {:ok, websub} else {:error, reason} -> - Logger.debug("Couldn't create subscription.") + Logger.debug("Couldn't create subscription") Logger.debug(inspect(reason)) {:error, reason} From 0cf6f7a54d60c89fe38e6a55ba464497ff5a445c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:38:54 +0000 Subject: [PATCH 03/15] capitalize Salmon protocol name --- lib/pleroma/web/federator/federator.ex | 2 +- lib/pleroma/web/salmon/salmon.ex | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex index 3cc30cdd9..a0f827609 100644 --- a/lib/pleroma/web/federator/federator.ex +++ b/lib/pleroma/web/federator/federator.ex @@ -51,7 +51,7 @@ def handle(:publish, activity) do Logger.info(fn -> "Sending #{activity.data["id"]} out via websub" end) Websub.publish(Pleroma.Web.OStatus.feed_path(actor), actor, activity) - Logger.info(fn -> "Sending #{activity.data["id"]} out via salmon" end) + Logger.info(fn -> "Sending #{activity.data["id"]} out via Salmon" end) Pleroma.Web.Salmon.publish(actor, activity) end diff --git a/lib/pleroma/web/salmon/salmon.ex b/lib/pleroma/web/salmon/salmon.ex index 46ca645d1..61c04e091 100644 --- a/lib/pleroma/web/salmon/salmon.ex +++ b/lib/pleroma/web/salmon/salmon.ex @@ -150,7 +150,7 @@ defp send_to_user(%{info: %{"salmon" => salmon}}, feed, poster) do with {:ok, %{status_code: code}} <- poster.(salmon, feed, [{"Content-Type", "application/magic-envelope+xml"}], timeout: 10000, recv_timeout: 20000) do Logger.debug(fn -> "Pushed to #{salmon}, code #{code}" end) else - e -> Logger.debug(fn -> "Pushing salmon to #{salmon} failed, #{inspect(e)}" end) + e -> Logger.debug(fn -> "Pushing Salmon to #{salmon} failed, #{inspect(e)}" end) end end @@ -178,7 +178,7 @@ def publish(%{info: %{"keys" => keys}} = user, %{data: %{"type" => type}} = acti remote_users(activity) |> Enum.each(fn(remote_user) -> Task.start(fn -> - Logger.debug(fn -> "sending salmon to #{remote_user.ap_id}" end) + Logger.debug(fn -> "sending Salmon to #{remote_user.ap_id}" end) send_to_user(remote_user, feed, poster) end) end) From 25279dba77f2b412692195932e6bdd6cd7db7ccb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:39:12 +0000 Subject: [PATCH 04/15] Capitalize start of log message --- lib/pleroma/web/salmon/salmon.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/salmon/salmon.ex b/lib/pleroma/web/salmon/salmon.ex index 61c04e091..caab5d484 100644 --- a/lib/pleroma/web/salmon/salmon.ex +++ b/lib/pleroma/web/salmon/salmon.ex @@ -178,7 +178,7 @@ def publish(%{info: %{"keys" => keys}} = user, %{data: %{"type" => type}} = acti remote_users(activity) |> Enum.each(fn(remote_user) -> Task.start(fn -> - Logger.debug(fn -> "sending Salmon to #{remote_user.ap_id}" end) + Logger.debug(fn -> "Sending Salmon to #{remote_user.ap_id}" end) send_to_user(remote_user, feed, poster) end) end) From 7f77433c0eb7a63fc4260d884f73beae1820ab60 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:41:04 +0000 Subject: [PATCH 05/15] CamelCase WebSub in log messages --- lib/pleroma/web/federator/federator.ex | 2 +- lib/pleroma/web/websub/websub_controller.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex index a0f827609..93b766270 100644 --- a/lib/pleroma/web/federator/federator.ex +++ b/lib/pleroma/web/federator/federator.ex @@ -48,7 +48,7 @@ def handle(:publish, activity) do with actor when not is_nil(actor) <- User.get_cached_by_ap_id(activity.data["actor"]) do {:ok, actor} = WebFinger.ensure_keys_present(actor) if ActivityPub.is_public?(activity) do - Logger.info(fn -> "Sending #{activity.data["id"]} out via websub" end) + Logger.info(fn -> "Sending #{activity.data["id"]} out via WebSub" end) Websub.publish(Pleroma.Web.OStatus.feed_path(actor), actor, activity) Logger.info(fn -> "Sending #{activity.data["id"]} out via Salmon" end) diff --git a/lib/pleroma/web/websub/websub_controller.ex b/lib/pleroma/web/websub/websub_controller.ex index 6c9164ec8..115b64902 100644 --- a/lib/pleroma/web/websub/websub_controller.ex +++ b/lib/pleroma/web/websub/websub_controller.ex @@ -20,7 +20,7 @@ def websub_subscription_request(conn, %{"nickname" => nickname} = params) do # TODO: Extract this into the Websub module def websub_subscription_confirmation(conn, %{"id" => id, "hub.mode" => "subscribe", "hub.challenge" => challenge, "hub.topic" => topic} = params) do - Logger.debug("Got websub confirmation") + Logger.debug("Got WebSub confirmation") Logger.debug(inspect(params)) lease_seconds = if params["hub.lease_seconds"] do String.to_integer(params["hub.lease_seconds"]) From 7430ff9173f90806d693cbd74180f091b75a43d7 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:44:25 +0000 Subject: [PATCH 06/15] Capitalize Atom --- lib/pleroma/web/ostatus/ostatus.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/ostatus/ostatus.ex b/lib/pleroma/web/ostatus/ostatus.ex index bed15e8c0..72f5b8d52 100644 --- a/lib/pleroma/web/ostatus/ostatus.ex +++ b/lib/pleroma/web/ostatus/ostatus.ex @@ -291,8 +291,8 @@ def get_atom_url(body) do [[_, match]] = Regex.scan(@gs_classic_regex, body) {:ok, match} true -> - Logger.debug(fn -> "Couldn't find atom link in #{inspect(body)}" end) - {:error, "Couldn't find the atom link"} + Logger.debug(fn -> "Couldn't find Atom link in #{inspect(body)}" end) + {:error, "Couldn't find the Atom link"} end end From 4190abbf27d5396230432f713c313d0f930c73fb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:46:53 +0000 Subject: [PATCH 07/15] Another WebSub CamelCase --- lib/pleroma/web/federator/federator.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex index 93b766270..8a8cbc392 100644 --- a/lib/pleroma/web/federator/federator.ex +++ b/lib/pleroma/web/federator/federator.ex @@ -61,7 +61,7 @@ def handle(:publish, activity) do end def handle(:verify_websub, websub) do - Logger.debug(fn -> "Running websub verification for #{websub.id} (#{websub.topic}, #{websub.callback})" end) + Logger.debug(fn -> "Running WebSub verification for #{websub.id} (#{websub.topic}, #{websub.callback})" end) @websub.verify(websub) end From 032ed2b945f926b982b07795ade3b7ee72ffe0cb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:47:51 +0000 Subject: [PATCH 08/15] =?UTF-8?q?This=20log=20message=20was=20do=20do=20?= =?UTF-8?q?=F0=9F=92=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pleroma/web/federator/federator.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex index 8a8cbc392..4082773f3 100644 --- a/lib/pleroma/web/federator/federator.ex +++ b/lib/pleroma/web/federator/federator.ex @@ -105,7 +105,7 @@ def handle(:publish_single_websub, %{xml: xml, topic: topic, callback: callback, def handle(type, _) do Logger.debug(fn -> "Unknown task: #{type}" end) - {:error, "Don't know what do do with this"} + {:error, "Don't know what to do with this"} end def enqueue(type, payload, priority \\ 1) do From 8d561f952fed2b2b4193f6586c865c877c1064ae Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:51:31 +0000 Subject: [PATCH 09/15] Make XML feel special too --- lib/pleroma/web/xml/xml.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/xml/xml.ex b/lib/pleroma/web/xml/xml.ex index 026672ad1..8b28a7e7d 100644 --- a/lib/pleroma/web/xml/xml.ex +++ b/lib/pleroma/web/xml/xml.ex @@ -21,7 +21,7 @@ def parse_document(text) do doc catch :exit, _error -> - Logger.debug("Couldn't parse xml: #{inspect(text)}") + Logger.debug("Couldn't parse XML: #{inspect(text)}") :error end end From 9a858621d603422c4b992b9f9fe76da9331a6d0c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:56:49 +0000 Subject: [PATCH 10/15] AP and WebFinger need love here --- lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 965f2cc9b..e7484974e 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -321,7 +321,7 @@ def make_user_from_nickname(nickname) do with {:ok, %{"ap_id" => ap_id}} when not is_nil(ap_id) <- WebFinger.finger(nickname) do make_user_from_ap_id(ap_id) else - _e -> {:error, "No ap id in webfinger"} + _e -> {:error, "No AP id in WebFinger"} end end From 185c030258e0829bf5b936d014ba88cb249ea970 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:57:58 +0000 Subject: [PATCH 11/15] AP again --- lib/pleroma/user.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index a503a5b3f..5da146014 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -417,7 +417,7 @@ def get_or_fetch_by_ap_id(ap_id) do _ -> case OStatus.make_user(ap_id) do {:ok, user} -> user - _ -> {:error, "Could not fetch by ap id"} + _ -> {:error, "Could not fetch by AP id"} end end end From 2549a73d6dcc41c15034ed11a33a3453c2795431 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 17:58:45 +0000 Subject: [PATCH 12/15] start with a capital --- lib/pleroma/web/oauth/authorization.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/oauth/authorization.ex b/lib/pleroma/web/oauth/authorization.ex index 1ba5be602..ab2dbf60e 100644 --- a/lib/pleroma/web/oauth/authorization.ex +++ b/lib/pleroma/web/oauth/authorization.ex @@ -43,5 +43,5 @@ def use_token(%Authorization{used: false, valid_until: valid_until} = auth) do {:error, "token expired"} end end - def use_token(%Authorization{used: true}), do: {:error, "already used"} + def use_token(%Authorization{used: true}), do: {:error, "Already used"} end From 2702df489fb7bbc2dbb0012f5b7eb8c3278faebe Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 18:00:02 +0000 Subject: [PATCH 13/15] cap again --- lib/pleroma/web/oauth/authorization.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/oauth/authorization.ex b/lib/pleroma/web/oauth/authorization.ex index ab2dbf60e..5a68bd593 100644 --- a/lib/pleroma/web/oauth/authorization.ex +++ b/lib/pleroma/web/oauth/authorization.ex @@ -40,7 +40,7 @@ def use_token(%Authorization{used: false, valid_until: valid_until} = auth) do if NaiveDateTime.diff(NaiveDateTime.utc_now, valid_until) < 0 do Repo.update(use_changeset(auth, %{used: true})) else - {:error, "token expired"} + {:error, "Token expired"} end end def use_token(%Authorization{used: true}), do: {:error, "Already used"} From 96cfc67e053ecbb86d04d3579bc6c71dcd43fb85 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 18:05:53 +0000 Subject: [PATCH 14/15] LRDD, you are special and we love you too --- lib/pleroma/web/web_finger/web_finger.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger/web_finger.ex index 9c39cc5a1..019210124 100644 --- a/lib/pleroma/web/web_finger/web_finger.ex +++ b/lib/pleroma/web/web_finger/web_finger.ex @@ -100,7 +100,7 @@ def find_lrdd_template(domain) do with {:ok, %{body: body}} <- @httpoison.get("https://#{domain}/.well-known/host-meta", []) do get_template_from_xml(body) else - e -> {:error, "Can't find lrdd template: #{inspect(e)}"} + e -> {:error, "Can't find LRDD template: #{inspect(e)}"} end end end From 16d102c1533b3d95570bc1715d5d5b4b8e0c0058 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Mar 2018 18:18:52 +0000 Subject: [PATCH 15/15] Clarify that this error is about a problem decoding the expected JSON payload --- lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index e7484974e..6a78a6bee 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -301,7 +301,7 @@ def fetch_and_prepare_user_from_ap_id(ap_id) do {:ok, data} <- Poison.decode(body) do user_data_from_user_object(data) else - e -> Logger.error("Could not user at fetch #{ap_id}, #{inspect(e)}") + e -> Logger.error("Could not decode user at fetch #{ap_id}, #{inspect(e)}") end end