|
|
|
@ -2362,6 +2362,44 @@ def api_post_directories_extend(scrape_id): |
|
|
|
|
return jsonify(create_json_return('200')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@api.route('/scrape/directories', methods=['DELETE']) |
|
|
|
|
def api_delete_scrape_directories(): |
|
|
|
|
"""To Update Later |
|
|
|
|
This is using docstrings for specifications. |
|
|
|
|
--- |
|
|
|
|
tags: |
|
|
|
|
- scrape |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
user = current_user |
|
|
|
|
|
|
|
|
|
if not user.is_authenticated: |
|
|
|
|
if not request.json: |
|
|
|
|
return jsonify(create_json_return('400')) |
|
|
|
|
if "api_key" not in request.json: |
|
|
|
|
return jsonify(create_json_return('400')) |
|
|
|
|
if request.json['api_key'] == "": |
|
|
|
|
return jsonify(create_json_return('100')) |
|
|
|
|
|
|
|
|
|
user = database.session \ |
|
|
|
|
.query(database.Users) \ |
|
|
|
|
.filter(database.Users.api_key == request.json['api_key']) \ |
|
|
|
|
.first() |
|
|
|
|
|
|
|
|
|
if user is None: |
|
|
|
|
return jsonify(create_json_return('100')) |
|
|
|
|
|
|
|
|
|
if user.role != 'admin': |
|
|
|
|
return jsonify(create_json_return('401')) |
|
|
|
|
|
|
|
|
|
database.session \ |
|
|
|
|
.query(database.ScrapeItems) \ |
|
|
|
|
.delete() |
|
|
|
|
|
|
|
|
|
database.session.commit() |
|
|
|
|
|
|
|
|
|
return jsonify(create_json_return('200')) |
|
|
|
|
|
|
|
|
|
""" --- PLUGIN UPLOAD/INSTALL --- """ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|