Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Jannik Hellenkamp
website
Commits
7e19a60f
Commit
7e19a60f
authored
7 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Implemented legacy stream handler, closes #253
parent
f9a8cd41
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
livestreams.py
+34
-0
34 additions, 0 deletions
livestreams.py
with
34 additions
and
0 deletions
livestreams.py
+
34
−
0
View file @
7e19a60f
...
...
@@ -7,3 +7,37 @@ def livestream_thumbnail():
for
v
in
genlive
(
livestreams
):
sorter
.
schedule_thumbnail
(
v
[
'
lecture_id
'
],
v
[
'
path
'
])
@app.route
(
'
/internal/streaming/legacy_auth
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
streamauth
():
internal
=
False
for
net
in
config
.
get
(
'
FSMPI_IP_RANGES
'
,
[]):
if
ip_address
(
request
.
headers
[
'
X-Real-IP
'
])
in
ip_network
(
net
):
internal
=
True
if
request
.
values
[
'
app
'
]
!=
'
live
'
:
return
'
Bad request
'
,
400
if
not
internal
:
return
'
Forbidden
'
,
403
if
request
.
values
[
'
pass
'
]
!=
'
caisoh8aht0wuSu
'
:
return
'
Forbidden
'
,
403
if
request
.
values
[
'
call
'
]
==
'
publish
'
:
matches
=
query
(
"
SELECT lectures.* FROM lectures JOIN courses ON lectures.course_id = courses.id WHERE courses.handle = ? ORDER BY lectures.time DESC
"
,
request
.
values
[
'
name
'
])
now
=
datetime
.
now
()
match
=
{
'
id
'
:
-
1
}
for
lecture
in
matches
:
if
lecture
[
'
time
'
]
-
timedelta
(
minutes
=
30
)
<=
now
and
\
now
<=
lecture
[
'
time
'
]
+
timedelta
(
minutes
=
lecture
[
'
duration
'
]):
match
=
lecture
break
if
'
lecture
'
in
request
.
values
:
match
=
{
'
id
'
:
request
.
values
[
'
lecture
'
]}
try
:
modify
(
"
INSERT INTO streams (handle, active, visible, lecture_id, description, poster) VALUES (?, 0, 1, -1,
""
,
""
)
"
,
request
.
values
[
'
name
'
])
except
:
pass
modify
(
"
UPDATE streams SET active = 1, lecture_id = ? WHERE handle = ?
"
,
match
[
'
id
'
],
request
.
values
[
'
name
'
])
elif
request
.
values
[
'
call
'
]
==
'
publish_done
'
:
modify
(
"
UPDATE streams SET active = 0 WHERE handle = ?
"
,
request
.
values
[
'
name
'
])
else
:
return
'
Bad request
'
,
400
return
'
OK
'
,
200
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