From 66dfcfba3b7e47c4085ac10df711abb639d30cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Thu, 15 Oct 2020 22:48:38 +0200 Subject: [PATCH] Neposilame soubory --- lib/PiTube/Controller/Stream.pm | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/lib/PiTube/Controller/Stream.pm b/lib/PiTube/Controller/Stream.pm index 56982b5..5e80a69 100644 --- a/lib/PiTube/Controller/Stream.pm +++ b/lib/PiTube/Controller/Stream.pm @@ -53,33 +53,8 @@ sub player { $c->render(); } -sub hls { - my $c = shift; - - if ( $c->req->url !~ /^\/hls\/([a-z0-9\-]+)(_\w+)?(\/\w+)?\.(m3u8|ts)$/i ) { - $c->render( status => 404, text => ''); - return; - } - my ($key, $type, $file) = ($1, $4, $c->req->url); - - if ( ! -f $file ) { - $c->render( status => 404, text => '' ); - return; - } - - if ( $type eq 'ts' ) { # manifesty necheckujeme - if ( ! $c->session->{user}{acl}{ $key } ) { - $c->render( status => 403, text => ''); - return; - } - } - - $c->res->headers->content_type(CONTENT_TYPE->{$type}); - $c->res->headers->cache_control('max-age=0, no-cache'); - $c->res->headers->access_control_allow_origin('*'); - $c->reply->file($file); +1; -} +__END__ -1; -- GitLab