From 705bfe39e937a562e734bc0b9471c63c2c7300ff Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 8 Nov 2018 19:34:01 +0100 Subject: [PATCH 1/6] priv/static/litepub-1.0.jsonld: Local copy of https://litepub.github.io/litepub/context.jsonld --- priv/static/litepub-1.0.jsonld | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 priv/static/litepub-1.0.jsonld diff --git a/priv/static/litepub-1.0.jsonld b/priv/static/litepub-1.0.jsonld new file mode 100644 index 000000000..819d25c38 --- /dev/null +++ b/priv/static/litepub-1.0.jsonld @@ -0,0 +1,23 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1", + { + "Emoji": "toot:Emoji", + "Hashtag": "as:Hashtag", + "PropertyValue": "schema:PropertyValue", + "atomUri": "ostatus:atomUri", + "conversation": { + "@id": "ostatus:conversation", + "@type": "@id" + }, + "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", + "ostatus": "http://ostatus.org#", + "schema": "http://schema.org", + "toot": "http://joinmastodon.org/ns#", + "totalItems": "as:totalItems", + "value": "schema:value", + "sensitive": "as:sensitive" + } + ] +} From abcacec97d1002e92696c8c7f69b05130420b18f Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 8 Nov 2018 19:38:38 +0100 Subject: [PATCH 2/6] Pleroma.Web.ActivityPub.Utils: Use locally-served JSON-LD Litepub context instead of Github-hosted one --- lib/pleroma/web/activity_pub/utils.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex index d81c824f0..174906537 100644 --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@ -70,7 +70,7 @@ def make_json_ld_header do %{ "@context" => [ "https://www.w3.org/ns/activitystreams", - "https://litepub.github.io/litepub/context.jsonld" + "#{Web.base_url()}/litepub-1.0.jsonld" ] } end From 934125695d640a08de136ef3924909aaa81fdcc1 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 8 Nov 2018 20:21:45 +0100 Subject: [PATCH 3/6] Move /litepub-1.0.jsonld to /schemas/litepub-0.1.jsonld --- lib/pleroma/web/activity_pub/utils.ex | 2 +- priv/static/{litepub-1.0.jsonld => schemas/litepub-0.1.jsonld} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename priv/static/{litepub-1.0.jsonld => schemas/litepub-0.1.jsonld} (100%) diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex index 174906537..152bb5a8d 100644 --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@ -70,7 +70,7 @@ def make_json_ld_header do %{ "@context" => [ "https://www.w3.org/ns/activitystreams", - "#{Web.base_url()}/litepub-1.0.jsonld" + "#{Web.base_url()}/schemas/litepub-0.1.jsonld" ] } end diff --git a/priv/static/litepub-1.0.jsonld b/priv/static/schemas/litepub-0.1.jsonld similarity index 100% rename from priv/static/litepub-1.0.jsonld rename to priv/static/schemas/litepub-0.1.jsonld From 2fab32ab61d305bbea13c27ac23b1180b638c4cd Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 8 Nov 2018 20:22:12 +0100 Subject: [PATCH 4/6] Pleroma.Web.Endpoint: Whitelist schemas directory --- lib/pleroma/web/endpoint.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 6673ab576..b38f33863 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -17,7 +17,7 @@ defmodule Pleroma.Web.Endpoint do Plug.Static, at: "/", from: :pleroma, - only: ~w(index.html static finmoji emoji packs sounds images instance sw.js favicon.png) + only: ~w(index.html static finmoji emoji packs sounds images instance sw.js favicon.png schemas) ) # Code reloading can be explicitly enabled under the From 03a9990baf64cfa1abc9fb914ff4b3b24a71d416 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 10 Nov 2018 11:18:25 +0000 Subject: [PATCH 5/6] endpoint: fix formatting --- lib/pleroma/web/endpoint.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index b38f33863..2469d7283 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -17,7 +17,8 @@ defmodule Pleroma.Web.Endpoint do Plug.Static, at: "/", from: :pleroma, - only: ~w(index.html static finmoji emoji packs sounds images instance sw.js favicon.png schemas) + only: + ~w(index.html static finmoji emoji packs sounds images instance sw.js favicon.png schemas) ) # Code reloading can be explicitly enabled under the From 4f87b8362b44cf1b628248dbf38eabf670575ca2 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 10 Nov 2018 11:23:50 +0000 Subject: [PATCH 6/6] endpoint: move CORSPlug in front of Plug.Static --- lib/pleroma/web/endpoint.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 2469d7283..cb5de087b 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -11,6 +11,8 @@ defmodule Pleroma.Web.Endpoint do # # You should set gzip to true if you are running phoenix.digest # when deploying your static files in production. + plug(CORSPlug) + plug(Plug.Static, at: "/media", from: Pleroma.Uploaders.Local.upload_path(), gzip: false) plug( @@ -57,7 +59,6 @@ defmodule Pleroma.Web.Endpoint do extra: "SameSite=Strict" ) - plug(CORSPlug) plug(Pleroma.Web.Router) @doc """