Spaces:
Running
Running
Upload 2 files
Browse files- app.py +4 -0
- router_messages.py +2 -2
app.py
CHANGED
|
@@ -24,6 +24,10 @@ from models_sql import Ownership
|
|
| 24 |
|
| 25 |
app = FastAPI(title="ComfyUI Ranking Community API")
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
@app.on_event("startup")
|
| 28 |
def on_startup():
|
| 29 |
init_sql_db()
|
|
|
|
| 24 |
|
| 25 |
app = FastAPI(title="ComfyUI Ranking Community API")
|
| 26 |
|
| 27 |
+
@app.get("/")
|
| 28 |
+
def health_check():
|
| 29 |
+
return {"status": "ok", "message": "ComfyUI Ranking API is running perfectly!"}
|
| 30 |
+
|
| 31 |
@app.on_event("startup")
|
| 32 |
def on_startup():
|
| 33 |
init_sql_db()
|
router_messages.py
CHANGED
|
@@ -22,7 +22,7 @@ class SystemAnnouncement(BaseModel):
|
|
| 22 |
@router.post("/api/system/announcement")
|
| 23 |
async def publish_announcement(ann: SystemAnnouncement):
|
| 24 |
# 硬编码限制仅超级管理员账号可发布
|
| 25 |
-
if ann.admin_account != "
|
| 26 |
raise HTTPException(status_code=403, detail="无权发布系统公告")
|
| 27 |
|
| 28 |
announcements_db = db.load_data("announcements.json", default_data=[])
|
|
@@ -30,7 +30,7 @@ async def publish_announcement(ann: SystemAnnouncement):
|
|
| 30 |
new_ann = {
|
| 31 |
"id": f"sys_{int(time.time())}_{uuid.uuid4().hex[:6]}",
|
| 32 |
"type": "system",
|
| 33 |
-
"from_user": "
|
| 34 |
"from_name": "官方团队",
|
| 35 |
"from_avatar": "https://via.placeholder.com/150/FF9800/FFFFFF?text=Sys",
|
| 36 |
"content": ann.content,
|
|
|
|
| 22 |
@router.post("/api/system/announcement")
|
| 23 |
async def publish_announcement(ann: SystemAnnouncement):
|
| 24 |
# 硬编码限制仅超级管理员账号可发布
|
| 25 |
+
if ann.admin_account != "123456":
|
| 26 |
raise HTTPException(status_code=403, detail="无权发布系统公告")
|
| 27 |
|
| 28 |
announcements_db = db.load_data("announcements.json", default_data=[])
|
|
|
|
| 30 |
new_ann = {
|
| 31 |
"id": f"sys_{int(time.time())}_{uuid.uuid4().hex[:6]}",
|
| 32 |
"type": "system",
|
| 33 |
+
"from_user": "123456",
|
| 34 |
"from_name": "官方团队",
|
| 35 |
"from_avatar": "https://via.placeholder.com/150/FF9800/FFFFFF?text=Sys",
|
| 36 |
"content": ann.content,
|