From 07c864b7e9cb1b645d3e710b24dc4ec588bbd09e Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Sat, 28 Mar 2026 19:55:30 +0300 Subject: [PATCH] feat: video playr support in attachments --- lib/Service/BBCodeService.php | 21 +++++++++++++++++++++ src/style.scss | 13 +++++++++++++ 2 files changed, 34 insertions(+) diff --git a/lib/Service/BBCodeService.php b/lib/Service/BBCodeService.php index 3f42ba9..3c88b6e 100644 --- a/lib/Service/BBCodeService.php +++ b/lib/Service/BBCodeService.php @@ -426,6 +426,27 @@ class BBCodeService { $escapedFileName, $escapedFileName ); + } elseif (str_starts_with($mimeType, 'video/')) { + // Generate download URL for video (used as source) + $videoUrl = $this->urlGenerator->linkToRouteAbsolute( + 'forum.file.download', + ['postId' => $postId, 'filePath' => $filePath] + ); + + $escapedFileName = htmlspecialchars($fileName, ENT_QUOTES | ENT_HTML5, 'UTF-8'); + $escapedUrl = htmlspecialchars($videoUrl, ENT_QUOTES | ENT_HTML5, 'UTF-8'); + $escapedMimeType = htmlspecialchars($mimeType, ENT_QUOTES | ENT_HTML5, 'UTF-8'); + + return sprintf( + '
' + . '' + . '
', + $escapedFileName, + $escapedUrl, + $escapedMimeType + ); } else { // Generate download URL for non-image files using proxy endpoint $downloadUrl = $this->urlGenerator->linkToRouteAbsolute( diff --git a/src/style.scss b/src/style.scss index 0098554..22606d6 100644 --- a/src/style.scss +++ b/src/style.scss @@ -65,6 +65,19 @@ } } + &-video { + display: inline-block; + max-width: 100%; + + video { + max-width: 100%; + max-height: 480px; + border-radius: 8px; + border: 1px solid var(--color-border); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + } + } + &-file { display: flex; align-items: center;