修复bug
This commit is contained in:
@@ -100,7 +100,7 @@ BANNED_KEYWORDS = [
|
|||||||
"割腕", "跳楼"
|
"割腕", "跳楼"
|
||||||
]
|
]
|
||||||
|
|
||||||
ADMIN_TOKEN = "LeonXieNeko14235^"
|
ADMIN_TOKEN = "I_Love_SFLS_128936^"
|
||||||
|
|
||||||
UPLOAD_FOLDER = "img"
|
UPLOAD_FOLDER = "img"
|
||||||
ALLOWED_EXTENSIONS = {"png", "jpg", "jpeg", "gif", "webp"}
|
ALLOWED_EXTENSIONS = {"png", "jpg", "jpeg", "gif", "webp"}
|
||||||
@@ -371,8 +371,6 @@ def get_post_info():
|
|||||||
return jsonify({
|
return jsonify({
|
||||||
"id": submission.id,
|
"id": submission.id,
|
||||||
"content": submission.content,
|
"content": submission.content,
|
||||||
"created_at": submission.created_at.isoformat(),
|
|
||||||
"updated_at": submission.updated_at.isoformat(),
|
|
||||||
"upvotes": submission.upvotes,
|
"upvotes": submission.upvotes,
|
||||||
"downvotes": submission.downvotes
|
"downvotes": submission.downvotes
|
||||||
}), 200
|
}), 200
|
||||||
@@ -415,8 +413,7 @@ def get_comments():
|
|||||||
"id": comment.id,
|
"id": comment.id,
|
||||||
"nickname": comment.nickname,
|
"nickname": comment.nickname,
|
||||||
"content": comment.content,
|
"content": comment.content,
|
||||||
"parent_comment_id": comment.parent_comment_id,
|
"parent_comment_id": comment.parent_comment_id
|
||||||
"created_at": comment.created_at.isoformat()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
comments = [serialize_comment(c) for c in submission.comments]
|
comments = [serialize_comment(c) for c in submission.comments]
|
||||||
@@ -447,11 +444,8 @@ def get_10_info():
|
|||||||
return jsonify([{
|
return jsonify([{
|
||||||
"id": s.id,
|
"id": s.id,
|
||||||
"content": s.content,
|
"content": s.content,
|
||||||
"created_at": s.created_at.isoformat(),
|
|
||||||
"updated_at": s.updated_at.isoformat(),
|
|
||||||
"upvotes": s.upvotes,
|
"upvotes": s.upvotes,
|
||||||
"downvotes": s.downvotes,
|
"downvotes": s.downvotes
|
||||||
"status": s.status
|
|
||||||
} for s in page_posts]), 200
|
} for s in page_posts]), 200
|
||||||
|
|
||||||
|
|
||||||
@@ -471,6 +465,11 @@ def get_statics():
|
|||||||
def return_418():
|
def return_418():
|
||||||
abort(418)
|
abort(418)
|
||||||
|
|
||||||
|
# === Admin测试API接口 ===
|
||||||
|
@app.route('/test', methods=['GET', 'POST'])
|
||||||
|
def return_200():
|
||||||
|
return 'API OK!!!', 200
|
||||||
|
|
||||||
@app.route('/get/api_info', methods=['GET'])
|
@app.route('/get/api_info', methods=['GET'])
|
||||||
def get_api_info():
|
def get_api_info():
|
||||||
return '<a>Sycamore_whisper API v1.0.0</a> Made with ❤️ By <a href="https://leonxie.cn">Leonxie</a>', 200
|
return '<a>Sycamore_whisper API v1.0.0</a> Made with ❤️ By <a href="https://leonxie.cn">Leonxie</a>', 200
|
||||||
@@ -803,6 +802,11 @@ def admin_pending_reports():
|
|||||||
} for r in reports]), 200
|
} for r in reports]), 200
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/admin/test', methods=['GET', 'POST'])
|
||||||
|
@require_admin
|
||||||
|
def admin_return_200():
|
||||||
|
return 'Admin API OK!!!', 200
|
||||||
|
|
||||||
# === 数据库初始化 ===
|
# === 数据库初始化 ===
|
||||||
def initialize_database():
|
def initialize_database():
|
||||||
"""若数据库不存在则创建并初始化"""
|
"""若数据库不存在则创建并初始化"""
|
||||||
|
|||||||
Reference in New Issue
Block a user