修复bug

This commit is contained in:
LeonspaceX
2025-10-12 18:47:08 +08:00
parent 9289a0b6c7
commit 8e0e783343
2 changed files with 811 additions and 415 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -100,7 +100,7 @@ BANNED_KEYWORDS = [
"割腕", "跳楼"
]
ADMIN_TOKEN = "LeonXieNeko14235^"
ADMIN_TOKEN = "I_Love_SFLS_128936^"
UPLOAD_FOLDER = "img"
ALLOWED_EXTENSIONS = {"png", "jpg", "jpeg", "gif", "webp"}
@@ -371,8 +371,6 @@ def get_post_info():
return jsonify({
"id": submission.id,
"content": submission.content,
"created_at": submission.created_at.isoformat(),
"updated_at": submission.updated_at.isoformat(),
"upvotes": submission.upvotes,
"downvotes": submission.downvotes
}), 200
@@ -415,8 +413,7 @@ def get_comments():
"id": comment.id,
"nickname": comment.nickname,
"content": comment.content,
"parent_comment_id": comment.parent_comment_id,
"created_at": comment.created_at.isoformat()
"parent_comment_id": comment.parent_comment_id
}
comments = [serialize_comment(c) for c in submission.comments]
@@ -447,11 +444,8 @@ def get_10_info():
return jsonify([{
"id": s.id,
"content": s.content,
"created_at": s.created_at.isoformat(),
"updated_at": s.updated_at.isoformat(),
"upvotes": s.upvotes,
"downvotes": s.downvotes,
"status": s.status
"downvotes": s.downvotes
} for s in page_posts]), 200
@@ -471,6 +465,11 @@ def get_statics():
def return_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'])
def get_api_info():
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
@app.route('/admin/test', methods=['GET', 'POST'])
@require_admin
def admin_return_200():
return 'Admin API OK!!!', 200
# === 数据库初始化 ===
def initialize_database():
"""若数据库不存在则创建并初始化"""