From d516c5ebfcf39a7dd27b85aa7df9986f336eca0a Mon Sep 17 00:00:00 2001 From: Xaekai Date: Wed, 19 Jan 2022 06:30:00 -0800 Subject: [PATCH] Add PeerTube support --- bin/build-player.js | 1 + player/peertube.coffee | 113 +++++++++++++++++++++++++++++++++++++++++ player/update.coffee | 1 + src/get-info.js | 11 ++++ src/utilities.js | 3 ++ templates/channel.pug | 1 + www/js/peertube.js | 1 + www/js/util.js | 19 +++++++ 8 files changed, 150 insertions(+) create mode 100644 player/peertube.coffee create mode 100644 www/js/peertube.js diff --git a/bin/build-player.js b/bin/build-player.js index db4112de..83bfcf14 100755 --- a/bin/build-player.js +++ b/bin/build-player.js @@ -22,6 +22,7 @@ var order = [ 'rtmp.coffee', 'hls.coffee', 'twitchclip.coffee', + 'peertube.coffee', 'update.coffee' ]; diff --git a/player/peertube.coffee b/player/peertube.coffee new file mode 100644 index 00000000..3fab9c76 --- /dev/null +++ b/player/peertube.coffee @@ -0,0 +1,113 @@ +PEERTUBE_EMBED_WARNING = 'This channel is embedding PeerTube content from %link%. + PeerTube instances may use P2P technology that will expose your IP address to third parties, including but not + limited to other users in this channel. It is also conceivable that if the content in question is in violation of + copyright laws your IP address could be potentially be observed by legal authorities monitoring the tracker of + this PeerTube instance. The operators of %site% are not responsible for the data sent by the embedded player to + 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.
' + +window.PeerPlayer = class PeerPlayer extends Player + constructor: (data) -> + if not (this instanceof PeerPlayer) + return new PeerPlayer(data) + + @warn(data) + + warn: (data) -> + site = new URL(document.URL).hostname + embedSrc = data.meta.embed.domain + link = "#{embedSrc}" + alert = makeAlert('Privacy Advisory', PEERTUBE_EMBED_WARNING.replace('%link%', link).replace('%site%', site), + 'alert-warning') + .removeClass('col-md-12') + $('