Skip to content

Commit

Permalink
add support for peertube
Browse files Browse the repository at this point in the history
  • Loading branch information
bezumkin committed May 12, 2024
1 parent d900ea2 commit fa0a26c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/Controllers/Poster.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ protected function downloadFile(string $service, string $key): string
if ($meta = $this->getOgTags('https://vk.com/video' . $key)) {
$url = $meta['image'];
}
} elseif ($service === 'peertube') {
if ($meta = $this->getOgTags('https://peertube.tv/w/' . $key)) {
$url = $meta['image'];
}
}

if ($url) {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/editor/blocks/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default class implements BlockTool {
vimeo: /https?:\/\/(?:player\.)?vimeo\.com\/(?:video\/)?(\d+).*/,
rutube: /https?:\/\/rutube\.ru\/(?:video|play\/embed)\/(\w+).*/,
vk: /https?:\/\/vk\.com\/video(?:\?z=video)?(-?\d+_\d+).*/,
peertube: /https?:\/\/peertube\.tv\/(?:w|videos\/embed)\/([\w-]+).*/,
youtube:
/(?:https?:\/\/)?(?:www\.)?(?:(youtu\.be\/)|(youtube\.com)\/(?:v\/|u\/\w\/|embed\/|watch))(?:(?:\?v=)?([^#&?=]*))?((?:[?&]\w*=\w*)*)/,
},
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/utils/vesp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export function getEmbedLink(service?: string, id?: string, autoplay: boolean =
} else if (service === 'vk') {
const parts = id.split('_')
url = 'https://vk.com/video_ext.php?oid=' + parts[0] + '&id=' + parts[1]
} else if (service === 'peertube') {
url = 'https://peertube.tv/videos/embed/' + id
}

if (url && autoplay) {
Expand Down

0 comments on commit fa0a26c

Please sign in to comment.