Extension:PeerTubeEmbed

MediaWiki extensions manual
PeerTubeEmbed
Release status: stable
Implementation Tag
Description A extension for embedding PeerTube videos in MediaWiki articles.
Author(s) Alex (AllUsernamesArePickedtalk)
Latest version 1.0.5
MediaWiki 1.27+
Database changes No
License GNU General Public License 2.0 or later
Download PeerTubeEmbed/releases
$wgPeerTubeEmbedDisableP2P $wgPeerTubeEmbedHostFilterMode $wgPeerTubeEmbedHostFilterList
<peertube>
Warning Warning: Versions before 1.0.5 are very likely vulnerable to Cross-Site Scripting due to no escaping being done at all on the user input prior to inclusion in the iframe tag! See this pull request for information. You're encouraged to upgrade.

The PeerTubeEmbed extension allows embedding PeerTube videos in MediaWiki articles.

Please read the entirety of this page before installing the extension.

Installation

edit
  • Download the latest version and place the file(s) in a directory called PeerTubeEmbed in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'PeerTubeEmbed' );
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration parameters

edit
$wgPeerTubeEmbedDisableP2P
Disables P2P on all embeds if set to true. See the privacy section below.
$wgPeerTubeEmbedHostFilterMode
Controls the behavior of the host filter. Accepts two values: 'allow', which only allows embeds from hosts in the host filter, and 'deny', which refuses to create embeds from hosts in the host filter. See the security section below.
$wgPeerTubeEmbedHostFilterList
An array of hosts. You can add new entries as follows:
$wgPeerTubeEmbedHostFilterList[] = 'domain.tld';
$wgPeerTubeEmbedHostFilterList[] = 'anotherdomain.online';
$wgPeerTubeEmbedHostFilterList[] = 'subdomain.yetanotherdomain.org';

Usage

edit

Add <peertube>URL to the video</peertube> where you want the video to be embedded.

For example: <peertube>https://video.blender.org/w/s6dVWgGVCAYJQkbZZJvY1c</peertube>.

Embeds created by this extension have the PeerTubeEmbed class. You can use CSS to modify their style:

.PeerTubeEmbed {
/* Insert properties here */
}

Security

edit

TL;DR: Configure the host filter to only allow known, trusted PeerTube instances and, if possible, setup CSP on your wiki.

Unlike centralized services like YouTube, PeerTube instances may be on any valid hostname. While the extension tries its best to make sure it is only embedding something that resembles a PeerTube URL, if the host filter isn't configured, it is trivial to use this extension to embed any arbitrary content on your wiki, regardless of any checks the extension does on URLs.

You should take a look at what instances are out there, and decide which ones you're comfortable allowing on your wiki.

For example, if you only want to allow embedding videos from TILvids, the configuration may look as follows:

wfLoadExtension( 'PeerTubeEmbed' );
$wgPeerTubeEmbedHostFilterMode = 'allow'; //ONLY allow hosts in the host filter
$wgPeerTubeEmbedHostFilterList[] = 'tilvids.com';

Additionally, consider setting up a Content Security Policy. How to do this depends on what setup you have, you could set it up at the webserver level, or use the experimental $wgCSPHeader at the MediaWiki level.

Privacy

edit

One of the defining features of PeerTube is the usage of P2P technology when viewing videos. Viewers share pieces of the video with each other.

However, like BitTorrent, this means that the IP addresses of the viewers are revealed to others when watching the videos, as they need to connect with each other. If you're not comfortable with this, you can disable P2P on all embeds by adding the following to your LocalSettings.php after loading the extension:

$wgPeerTubeEmbedDisableP2P = true;

See also

edit