Embed PeerTube videos into Wagtail
 
 
Aller au fichier
Jérôme Lebleu e0f34a07ff doc(changelog): release 0.2.0 2021-07-06 15:43:58 +02:00
tests test: add tests for finder and check coverage 2021-07-06 13:01:29 +02:00
wagtailembedpeertube ref(finder): subclass OEmbedFinder instead of own logic 2021-07-06 12:54:29 +02:00
.editorconfig style: configure editorconfig and flake8 with black and isort 2021-07-05 16:37:58 +02:00
.gitignore test: add tests for finder and check coverage 2021-07-06 13:01:29 +02:00
CHANGELOG.md doc(changelog): release 0.2.0 2021-07-06 15:43:58 +02:00
CONTRIBUTORS.txt Initial adding 2018-12-13 12:45:54 +01:00
LICENSE Initial adding 2018-12-13 12:45:54 +01:00
MANIFEST.in doc(setup): move to setup.cfg and use setuptools_scm 2021-07-05 16:37:58 +02:00
Makefile test: add tests for finder and check coverage 2021-07-06 13:01:29 +02:00
README.md doc(readme): describe how to setup a development env 2021-07-06 15:43:38 +02:00
pyproject.toml test: add tests for finder and check coverage 2021-07-06 13:01:29 +02:00
runtests.py test: add tests for finder and check coverage 2021-07-06 13:01:29 +02:00
setup.cfg test: add tests for finder and check coverage 2021-07-06 13:01:29 +02:00
setup.py doc(setup): move to setup.cfg and use setuptools_scm 2021-07-05 16:37:58 +02:00

README.md

wagtailembedpeertube

Embed PeerTube videos into Wagtail.

Introduction

Wagtail has a great support of oEmbed for embedding content. Unfortunately, the oEmbed mechanism is based on services domain names and URI; and this is prone to centralization since it limits to a short list of selected providers.

By the way, there is already hundreds instances and it will probably grow with years - see PeerTube instances.

This app brings oEmbed support for decentralized PeerTube instances. To do this, it only focuses on a string URI filtering, allowing all services from any domain name.

Installation

  1. Install using pip:

    pip install wagtailembedpeertube
    
  2. Add wagtailembedpeertube to your INSTALLED_APPS setting somewhere after wagtail.embeds:

    INSTALLED_APPS = [
        ...
        "wagtail.embeds",
        ...
        "wagtailembedpeertube",
        ...
    ]
    
  3. Configure embed finders in WAGTAILEMBEDS_FINDERS setting to add PeerTube's one at the end, i.e.:

    WAGTAILEMBEDS_FINDERS = [
        {
            "class": "wagtail.embeds.finders.oembed",
        },
        {
            "class": "wagtailembedpeertube.finders",
        },
    ]
    

    Since the first matching finder will be used, wagtailembedpeertube should be declared as last because others finders are matching domain names and may be more precise. See Configuring embed “finders” for more details.

Usage

That's it! You should now be able to embed any PeerTube content using the EmbedBlock:

from wagtail.embeds.blocks import EmbedBlock

class MyStreamField(blocks.StreamBlock):
    ...

    embed = EmbedBlock()

Development

To setup a development environment, clone this repository and follow the installation steps but replace the installation from PyPi by:

pip install -e .[test]

The Python code is formatted and linted thanks to flake8, isort and black. To ease the use of this tools, the following commands are available:

  • make lint: check the Python code syntax and imports order
  • make format: fix the Python code syntax and imports order

License

This extension is mainly developed by Cliss XXI and licensed under the AGPLv3+. Any contribution is welcome!