From f4bfc628ca16582ee064a2753e6a32fd891803d4 Mon Sep 17 00:00:00 2001 From: href Date: Tue, 19 Feb 2019 18:56:57 +0100 Subject: [PATCH] Player: allow styles on CSP, loop videos --- lib/pleroma/web/metadata/player_view.ex | 8 ++++---- lib/pleroma/web/metadata/twitter_card.ex | 4 ++-- lib/pleroma/web/ostatus/ostatus_controller.ex | 2 +- lib/pleroma/web/templates/layout/metadata_player.html.eex | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/pleroma/web/metadata/player_view.ex b/lib/pleroma/web/metadata/player_view.ex index 68b0a3507..e9a8cfc8d 100644 --- a/lib/pleroma/web/metadata/player_view.ex +++ b/lib/pleroma/web/metadata/player_view.ex @@ -3,10 +3,10 @@ defmodule Pleroma.Web.Metadata.PlayerView do import Phoenix.HTML.Tag, only: [content_tag: 3, tag: 2] def render("player.html", %{"mediaType" => type, "href" => href}) do - tag_type = + {tag_type, tag_attrs} = case type do - "audio" <> _ -> :audio - "video" <> _ -> :video + "audio" <> _ -> {:audio, []} + "video" <> _ -> {:video, [loop: true]} end content_tag( @@ -15,7 +15,7 @@ defmodule Pleroma.Web.Metadata.PlayerView do tag(:source, src: href, type: type), "Your browser does not support #{type} playback." ], - controls: true + [controls: true] ++ tag_attrs ) end end diff --git a/lib/pleroma/web/metadata/twitter_card.ex b/lib/pleroma/web/metadata/twitter_card.ex index e7f5760a9..d672b397f 100644 --- a/lib/pleroma/web/metadata/twitter_card.ex +++ b/lib/pleroma/web/metadata/twitter_card.ex @@ -104,8 +104,8 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCard do [ {:meta, [property: "twitter:card", content: "player"], []}, {:meta, [property: "twitter:player", content: player_url(id)], []}, - {:meta, [property: "twitter:player:width", content: "1280"], []}, - {:meta, [property: "twitter:player:height", content: "720"], []} + {:meta, [property: "twitter:player:width", content: "480"], []}, + {:meta, [property: "twitter:player:height", content: "480"], []} | acc ] diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/ostatus/ostatus_controller.ex index 4877e032b..0490a32d3 100644 --- a/lib/pleroma/web/ostatus/ostatus_controller.ex +++ b/lib/pleroma/web/ostatus/ostatus_controller.ex @@ -197,7 +197,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do |> put_resp_header("x-frame-options", "ALLOW") |> put_resp_header( "content-security-policy", - "default-src 'none'; img-src 'self' data: https:; media-src 'self' https:;" + "default-src 'none';style-src 'self' 'unsafe-inline';img-src 'self' data: https:; media-src 'self' https:;" ) |> put_view(Pleroma.Web.Metadata.PlayerView) |> render("player.html", url) diff --git a/lib/pleroma/web/templates/layout/metadata_player.html.eex b/lib/pleroma/web/templates/layout/metadata_player.html.eex index 7a1705515..460f28094 100644 --- a/lib/pleroma/web/templates/layout/metadata_player.html.eex +++ b/lib/pleroma/web/templates/layout/metadata_player.html.eex @@ -3,10 +3,10 @@ -- 2.45.2