1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-28 12:02:48 +02:00

Lint code

This commit is contained in:
Alexandre Iooss
2020-09-14 15:04:54 +02:00
parent c937c1624a
commit b0eefa8590
3 changed files with 44 additions and 2 deletions

View File

@ -1,20 +1,23 @@
from flask import Flask, request, redirect, render_template
from flask import Flask, redirect, render_template, request
import ldap
app = Flask(__name__)
app.logger.setLevel(20) # log info
app.config.from_object('ghostream.default_settings')
@app.route('/')
def index():
"""Welcome page"""
return render_template('index.html')
@app.route('/<path:path>')
def viewer(path):
"""Show stream that match this path"""
return render_template('viewer.html', path=path)
@app.route('/app/auth', methods=['POST'])
def auth():
"""Authentication on stream start"""
@ -38,6 +41,6 @@ def auth():
app.logger.info("%s logged in successfully", name)
# Remove "?pass=xxx" from RTMP URL
return redirect(f"rtmp://127.0.0.1:1925/app/{name}", code=302)
except:
except Exception:
app.logger.warning("%s failed to log in", name)
return 'Incorrect credentials', 401