Added PeerTubeEmbedded videos
rodzic
9200e554be
commit
b1803814fc
|
@ -256,3 +256,13 @@ LOGGING = {
|
||||||
}
|
}
|
||||||
|
|
||||||
PRODUCTS_CSV_PATH = os.environ.get("PRODUCTS_CSV_PATH", "products.csv")
|
PRODUCTS_CSV_PATH = os.environ.get("PRODUCTS_CSV_PATH", "products.csv")
|
||||||
|
|
||||||
|
|
||||||
|
WAGTAILEMBEDS_FINDERS = [
|
||||||
|
{
|
||||||
|
"class": "wagtail.embeds.finders.oembed",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class": "blog.finders",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
import re
|
||||||
|
|
||||||
|
from wagtail.embeds.finders.oembed import OEmbedFinder
|
||||||
|
|
||||||
|
|
||||||
|
class PeerTubeFinder(OEmbedFinder):
|
||||||
|
|
||||||
|
ENDPOINT = '/services/oembed'
|
||||||
|
|
||||||
|
# TODO - this should be configurable from admin - TO be added with setup extension
|
||||||
|
PATTERNS = [
|
||||||
|
re.compile(
|
||||||
|
r'^(https?://[^/]+)/w/.*'
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
def _get_endpoint(self, url):
|
||||||
|
for pattern in self.PATTERNS:
|
||||||
|
m = pattern.match(url)
|
||||||
|
if m is not None:
|
||||||
|
return m.group(1) + self.ENDPOINT
|
||||||
|
|
||||||
|
|
||||||
|
embed_finder_class = PeerTubeFinder
|
Ładowanie…
Reference in New Issue