REFACTOR: Documentation for some Flask routes & nginx.conf
This commit is contained in:
@@ -144,6 +144,12 @@ def following_your_categories():
|
||||
def user_live_status(username):
|
||||
"""
|
||||
Returns a streamer's status, if they are live or not and their most recent stream (as a vod) (their current stream if live)
|
||||
Returns:
|
||||
{
|
||||
"is_live": bool,
|
||||
"most_recent_stream": dict,
|
||||
"user_id": int
|
||||
}
|
||||
"""
|
||||
user_id = get_user_id(username)
|
||||
|
||||
@@ -154,8 +160,6 @@ def user_live_status(username):
|
||||
# If there is no most recent vod, set it to None
|
||||
if not most_recent_vod:
|
||||
most_recent_vod = None
|
||||
else:
|
||||
most_recent_vod = most_recent_vod['vod_id']
|
||||
|
||||
return jsonify({
|
||||
"is_live": is_live,
|
||||
@@ -165,10 +169,30 @@ def user_live_status(username):
|
||||
|
||||
|
||||
# VOD Routes
|
||||
@stream_bp.route('/vods/<int:vod_id>')
|
||||
def vod(vod_id):
|
||||
"""
|
||||
Returns a JSON of a vod
|
||||
"""
|
||||
vod = get_vod(vod_id)
|
||||
return jsonify(vod)
|
||||
|
||||
@stream_bp.route('/vods/<string:username>')
|
||||
def vods(username):
|
||||
"""
|
||||
Returns a JSON of all the vods of a streamer
|
||||
Returns:
|
||||
[
|
||||
{
|
||||
"vod_id": int,
|
||||
"title": str,
|
||||
"datetime": str,
|
||||
"category_name": str,
|
||||
"length": int (in seconds),
|
||||
"views": int
|
||||
}
|
||||
]
|
||||
|
||||
"""
|
||||
user_id = get_user_id(username)
|
||||
vods = get_user_vods(user_id)
|
||||
|
||||
@@ -45,6 +45,7 @@ def user_stream_key(username: str):
|
||||
def user_profile_picture_save():
|
||||
"""
|
||||
Saves user profile picture
|
||||
Returns the path to the saved image
|
||||
"""
|
||||
username = session.get("username")
|
||||
thumbnail_path = path_manager.get_profile_picture_file_path(username)
|
||||
@@ -58,7 +59,7 @@ def user_profile_picture_save():
|
||||
image.convert('RGB')
|
||||
image.save(thumbnail_path, "PNG")
|
||||
|
||||
return jsonify({"message": "Profile picture saved"})
|
||||
return jsonify({"message": "Profile picture saved", "path": thumbnail_path})
|
||||
|
||||
@login_required
|
||||
@user_bp.route('/user/same/<string:username>')
|
||||
|
||||
Reference in New Issue
Block a user