Options to autoembed PeerTube
This commit is contained in:
parent
6b831bc367
commit
26f6611ca8
|
@ -6,6 +6,8 @@ PEERTUBE_EMBED_WARNING = 'This channel is embedding PeerTube content from %link%
|
|||
third parties on your behalf.<br><br> 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.<hr>'
|
||||
|
||||
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 = "<a href=\"http://#{embedSrc}\" target=\"_blank\"><strong>#{embedSrc}</strong></a>"
|
||||
|
@ -26,6 +31,13 @@ window.PeerPlayer = class PeerPlayer extends Player
|
|||
@load(data)
|
||||
)
|
||||
.appendTo(alert.find('.alert'))
|
||||
$('<button/>').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) ->
|
||||
|
|
|
@ -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 <a href="https://github.com/calzoneman/sync/issues/726" rel="noopener noreferer" target="_blank">this GitHub issue</a> for details.
|
||||
+rcheckbox("us-peertube", "Accept PeerTube embeds automatically")
|
||||
|
||||
mixin us-chat
|
||||
#us-chat.tab-pane
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue