From 03f2f966d7708f3abcffd80a1958fc5f4df9d7e9 Mon Sep 17 00:00:00 2001 From: arianagiroux Date: Thu, 4 Aug 2022 17:41:40 -0600 Subject: [PATCH] Updates python to update tags on owncast server - removes the nsfw tag function - adds functionality to the tags update endpoint to process raw data from client --- app.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/app.py b/app.py index 4d3de8c..1b3c2f5 100755 --- a/app.py +++ b/app.py @@ -105,25 +105,19 @@ def updateStreamTitle(): @app.route('/api/update/servertags', methods=['POST']) -def updateServerTags(tags_list: list): +def updateServerTags(): + """ An endpoint to allow the user to update the stream title. + + :returns: the status code of the post request made to the server. + """ + values = [i.strip() for i in request.get_json(force=True).split(',')] response = session.post( stream_data['stream_url'] + '/api/admin/config/tags', data=json.dumps({ - 'value': tags_list + 'value': values }) ) - return response.status_code, json.loads(response.text) - - -@app.route('/api/update/nsfw', methods=['POST']) -def updateServerNSFW(boolean: bool): - response = session.post( - stream_data['stream_url'] + '/api/admin/config/nsfw', - data=json.dumps({ - 'value': boolean - }) - ) - return response.status_code, json.loads(response.text) + return Response(status=response.status_code) @app.route("/")