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
This commit is contained in:
parent
ea96df1774
commit
03f2f966d7
22
app.py
22
app.py
|
@ -105,25 +105,19 @@ def updateStreamTitle():
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/update/servertags', methods=['POST'])
|
@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(
|
response = session.post(
|
||||||
stream_data['stream_url'] + '/api/admin/config/tags',
|
stream_data['stream_url'] + '/api/admin/config/tags',
|
||||||
data=json.dumps({
|
data=json.dumps({
|
||||||
'value': tags_list
|
'value': values
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
return response.status_code, json.loads(response.text)
|
return Response(status=response.status_code)
|
||||||
|
|
||||||
|
|
||||||
@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)
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
|
|
Loading…
Reference in New Issue