diff --git a/app/Http/Controllers/VideoController.php b/app/Http/Controllers/VideoController.php index 0b1efd5..18b7545 100644 --- a/app/Http/Controllers/VideoController.php +++ b/app/Http/Controllers/VideoController.php @@ -26,7 +26,7 @@ class VideoController extends Controller { public function __construct() { - $this->middleware('auth')->except(['index', 'show', 'search', 'stream', 'hls', 'trending', 'shorts', 'download', 'downloadMp3', 'recordShare', 'ogImage', 'vsPreview', 'accessShare', 'showByToken', 'recommendations', 'slideshowProgress', 'playerData', 'streamAudioTrack', 'lyricsProgress', 'translateDescription', 'feedMore']); + $this->middleware('auth')->except(['index', 'show', 'search', 'stream', 'hls', 'trending', 'shorts', 'shortsFocused', 'download', 'downloadMp3', 'recordShare', 'ogImage', 'vsPreview', 'accessShare', 'showByToken', 'recommendations', 'slideshowProgress', 'playerData', 'streamAudioTrack', 'lyricsProgress', 'translateDescription', 'feedMore']); } /** @@ -2190,7 +2190,7 @@ class VideoController extends Controller ]); } - public function shorts(Request $request) + public function shorts(Request $request, ?int $startId = null) { $videos = Video::public() ->where('is_shorts', true) @@ -2199,7 +2199,23 @@ class VideoController extends Controller ->latest() ->get(); - return view('videos.shorts', compact('videos')); + return view('videos.shorts', [ + 'videos' => $videos, + 'startId' => $startId, // the id to auto-scroll to, if any + ]); + } + + /** + * /shorts/{video}: deep-link to a specific short in the vertical feed. + * The feed itself is the same ordered list; the view uses ?start= / the + * $startId prop to scroll into position on load. + */ + public function shortsFocused(Video $video) + { + if (! $video->is_shorts || ! $video->canView(Auth::user())) { + abort(404); + } + return $this->shorts(request(), $video->id); } public function stream(Video $video) diff --git a/resources/views/videos/shorts.blade.php b/resources/views/videos/shorts.blade.php index 6a26b88..3bcccaf 100644 --- a/resources/views/videos/shorts.blade.php +++ b/resources/views/videos/shorts.blade.php @@ -432,9 +432,22 @@