Add some flasktools.required_fields where missing.

This commit is contained in:
voussoir 2021-10-26 11:57:55 -07:00
parent 2d2a45a2a1
commit c435b1ada5
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 5 additions and 4 deletions

View file

@ -147,6 +147,7 @@ def post_refresh_all_channels():
common.ycdldb.refresh_all_channels(force=force, skip_failures=True, commit=True)
return flasktools.json_response({})
@flasktools.required_fields(['state'], forbid_whitespace=True)
@site.route('/channel/<channel_id>/set_automark', methods=['POST'])
def post_set_automark(channel_id):
state = request.form['state']
@ -173,6 +174,7 @@ def post_set_autorefresh(channel_id):
return flasktools.json_response({})
@flasktools.required_fields(['download_directory'], forbid_whitespace=False)
@site.route('/channel/<channel_id>/set_download_directory', methods=['POST'])
def post_set_download_directory(channel_id):
download_directory = request.form['download_directory']
@ -202,6 +204,7 @@ def post_set_name(channel_id):
response = {'name': channel.name}
return flasktools.json_response(response)
@flasktools.required_fields(['extension'], forbid_whitespace=False)
@site.route('/channel/<channel_id>/set_queuefile_extension', methods=['POST'])
def post_set_queuefile_extension(channel_id):
extension = request.form['extension']

View file

@ -8,10 +8,9 @@ from .. import common
site = common.site
@flasktools.required_fields(['video_ids', 'state'], forbid_whitespace=True)
@site.route('/mark_video_state', methods=['POST'])
def post_mark_video_state():
if 'video_ids' not in request.form or 'state' not in request.form:
flask.abort(400)
video_ids = request.form['video_ids']
state = request.form['state']
try:
@ -31,10 +30,9 @@ def post_mark_video_state():
return flasktools.json_response({'video_ids': video_ids, 'state': state})
@flasktools.required_fields(['video_ids'], forbid_whitespace=True)
@site.route('/start_download', methods=['POST'])
def post_start_download():
if 'video_ids' not in request.form:
flask.abort(400)
video_ids = request.form['video_ids']
try:
video_ids = video_ids.split(',')