Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pitube
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
pitube
Commits
daaf177a
Verified
Commit
daaf177a
authored
3 years ago
by
Andrej Ramašeuski
Browse files
Options
Downloads
Patches
Plain Diff
Oprava chyby stavu nahravani
parent
40d6717c
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/PiTube/Controller/Nginx.pm
+21
-7
21 additions, 7 deletions
lib/PiTube/Controller/Nginx.pm
with
21 additions
and
7 deletions
lib/PiTube/Controller/Nginx.pm
+
21
−
7
View file @
daaf177a
package
PiTube::Controller::
Nginx
;
use
feature
'
signatures
';
no
warnings
qw{ experimental::signatures }
;
use
Mojo::
Base
'
Mojolicious::Controller
';
use
Mojo::Pg::
PubSub
;
use
constant
HLS
=>
qr/hls\/
([
a
-
z0
-
9
\-
]
+
)(
_
\
w
+
)?(
\
/\w+)?\.(m3u8|ts)$/i
;
sub
callback_rtmp
{
my
$c
=
shift
;
sub
callback_rtmp
($c) {
my
$pubsub
=
Mojo::Pg::
PubSub
->
new
(
pg
=>
$c
->
pg
);
if
(
$c
->
param
('
call
')
=~
/publish/
)
{
my
$name
=
$c
->
param
('
name
');
my
$name
=
$c
->
param
('
name
');
my
$event
=
'
start
';
$event
=
$
1
if
$c
->
param
('
call
')
=~
/(update|done)/
;
# stream
my
$stream
=
$c
->
schema
->
resultset
('
Stream
')
->
find
({
...
...
@@ -37,6 +43,11 @@ sub callback_rtmp {
is_live
=>
(
$c
->
param
('
call
')
=~
/done/
)
?
'
f
':'
t
',
});
# pri zahajeni a ukonceni vysulani smazat priznak nahravani
if
(
$event
ne
'
update
'
)
{
$stream
->
update
({
recording
=>
'
f
'});
}
$pubsub
->
json
('
streams
')
->
notify
(
streams
=>
{
call
=>
$c
->
param
('
call
'),
stream_id
=>
$stream
->
id
,
...
...
@@ -46,8 +57,7 @@ sub callback_rtmp {
$c
->
render
(
status
=>
204
,
text
=>
''
);
}
sub
callback_recorder
{
my
$c
=
shift
;
sub
callback_recorder
($c) {
my
$name
=
$c
->
param
('
name
');
...
...
@@ -83,12 +93,16 @@ sub callback_recorder {
$c
->
render
(
status
=>
204
,
text
=>
''
);
}
sub
callback_hls
{
my
$c
=
shift
;
sub
callback_hls
($c) {
my
$code
=
403
;
$c
->
app
->
log
->
error
(
$c
->
req
->
headers
->
to_string
);
if
(
$c
->
req
->
headers
->
header
('
X-Original-URI
')
=~
HLS
)
{
$c
->
app
->
log
->
error
('
>>>>>>>>>>>>
'
.
$
1
);
if
(
$c
->
session
->
{
user
}
)
{
$code
=
204
if
$c
->
session
->
{
user
}{
acl
}{
$
1
}
&
4
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment