From 26f6611ca8b9968021dc67bd69ca7258d68698a0 Mon Sep 17 00:00:00 2001 From: Xaekai Date: Mon, 24 Jan 2022 09:19:45 -0800 Subject: [PATCH] Options to autoembed PeerTube --- player/peertube.coffee | 12 ++++++++++++ templates/useroptions.pug | 1 + www/js/data.js | 1 + www/js/util.js | 2 ++ 4 files changed, 16 insertions(+) diff --git a/player/peertube.coffee b/player/peertube.coffee index 3fab9c76..bbd96601 100644 --- a/player/peertube.coffee +++ b/player/peertube.coffee @@ -6,6 +6,8 @@ PEERTUBE_EMBED_WARNING = 'This channel is embedding PeerTube content from %link% third parties on your behalf.

If you understand the risks, wish to assume all liability, and continue to the content, click "Embed" below to allow the content to be embedded.
' +PEERTUBE_RISK = false + window.PeerPlayer = class PeerPlayer extends Player constructor: (data) -> if not (this instanceof PeerPlayer) @@ -14,6 +16,9 @@ window.PeerPlayer = class PeerPlayer extends Player @warn(data) warn: (data) -> + if USEROPTS.peertube_risk or PEERTUBE_RISK + return @load(data) + site = new URL(document.URL).hostname embedSrc = data.meta.embed.domain link = "#{embedSrc}" @@ -26,6 +31,13 @@ window.PeerPlayer = class PeerPlayer extends Player @load(data) ) .appendTo(alert.find('.alert')) + $('