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'))
+ $('').addClass('btn btn-default pull-right')
+ .text('Embed and dont ask again for this session')
+ .on('click', =>
+ PEERTUBE_RISK = true
+ @load(data)
+ )
+ .appendTo(alert.find('.alert'))
removeOld(alert)
load: (data) ->
diff --git a/templates/useroptions.pug b/templates/useroptions.pug
index 0191146d..8c2faf8e 100644
--- a/templates/useroptions.pug
+++ b/templates/useroptions.pug
@@ -91,6 +91,7 @@ mixin us-playback
.col-sm-4
.col-sm-8
p.text-info Due to technical changes on YouTube's side, the CyTube quality preference can no longer be automatically applied on YouTube videos. See this GitHub issue for details.
+ +rcheckbox("us-peertube", "Accept PeerTube embeds automatically")
mixin us-chat
#us-chat.tab-pane
diff --git a/www/js/data.js b/www/js/data.js
index 22c3c15d..eddfe26a 100644
--- a/www/js/data.js
+++ b/www/js/data.js
@@ -126,6 +126,7 @@ var USEROPTS = {
default_quality : getOrDefault("default_quality", "auto"),
qbtn_hide : getOrDefault("qbtn_hide", false),
qbtn_idontlikechange : getOrDefault("qbtn_idontlikechange", false),
+ peertube_risk : getOrDefault("peertube_risk", false),
// Chat tab
show_timestamps : getOrDefault("show_timestamps", true),
sort_rank : getOrDefault("sort_rank", true),
diff --git a/www/js/util.js b/www/js/util.js
index e148fa9a..dbb40f9b 100644
--- a/www/js/util.js
+++ b/www/js/util.js
@@ -646,6 +646,7 @@ function showUserOptions() {
$("#us-playlistbuttons").prop("checked", USEROPTS.qbtn_hide);
$("#us-oldbtns").prop("checked", USEROPTS.qbtn_idontlikechange);
$("#us-default-quality").val(USEROPTS.default_quality || "auto");
+ $("#us-peertube").prop("checked", USEROPTS.peertube_risk);
$("#us-chat-timestamp").prop("checked", USEROPTS.show_timestamps);
$("#us-sort-rank").prop("checked", USEROPTS.sort_rank);
@@ -683,6 +684,7 @@ function saveUserOptions() {
USEROPTS.qbtn_hide = $("#us-playlistbuttons").prop("checked");
USEROPTS.qbtn_idontlikechange = $("#us-oldbtns").prop("checked");
USEROPTS.default_quality = $("#us-default-quality").val();
+ USEROPTS.peertube_risk = $("#us-peertube").prop("checked");
USEROPTS.show_timestamps = $("#us-chat-timestamp").prop("checked");
USEROPTS.sort_rank = $("#us-sort-rank").prop("checked");