From 8dde08ac6d032c34c00b113ffe8c3e59f52d7239 Mon Sep 17 00:00:00 2001 From: Xaekai Date: Wed, 26 Jan 2022 15:59:39 -0800 Subject: [PATCH] Use child iframe for BitChute By using an iframe we can take advantage of the referrer meta tag, while still being able to scaffold everything relatively easily because it's same-origin --- bin/build-player.js | 1 + player/bitchute.coffee | 92 ++++++++++++++++++++++++++++++++++++++++ player/update.coffee | 2 +- src/web/routes/iframe.js | 7 +++ src/web/webserver.js | 1 + templates/iframe.pug | 36 ++++++++++++++++ 6 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 player/bitchute.coffee create mode 100644 src/web/routes/iframe.js create mode 100644 templates/iframe.pug diff --git a/bin/build-player.js b/bin/build-player.js index 83bfcf14..c82605fe 100755 --- a/bin/build-player.js +++ b/bin/build-player.js @@ -23,6 +23,7 @@ var order = [ 'hls.coffee', 'twitchclip.coffee', 'peertube.coffee', + 'bitchute.coffee', 'update.coffee' ]; diff --git a/player/bitchute.coffee b/player/bitchute.coffee new file mode 100644 index 00000000..4a85139a --- /dev/null +++ b/player/bitchute.coffee @@ -0,0 +1,92 @@ +window.BitChutePlayer = class BitChutePlayer extends Player + constructor: (data) -> + if not (this instanceof BitChutePlayer) + return new BitChutePlayer(data) + + @load(data) + + load: (data) -> + @setMediaProperties(data) + @ready = false + + waitUntilDefined(window, 'playerjs', => + iframe = $('