Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
|
@@ -155,7 +155,7 @@ def get_all_api_keys():
|
|
| 155 |
return api_keys
|
| 156 |
|
| 157 |
def validate_api_key(api_key: str = Header(...)):
|
| 158 |
-
USERS_API_KEYS =
|
| 159 |
if api_key not in USERS_API_KEYS:
|
| 160 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
| 161 |
|
|
@@ -241,7 +241,7 @@ def test():
|
|
| 241 |
|
| 242 |
@app.get("/UFoP/getbanlist")
|
| 243 |
def sibyl_get_all_banlist():
|
| 244 |
-
banned_users =
|
| 245 |
return {
|
| 246 |
"status": "True",
|
| 247 |
"sukuna": {
|
|
@@ -281,8 +281,8 @@ def sibyl_system_ban(
|
|
| 281 |
|
| 282 |
try:
|
| 283 |
date_joined = str(dt.now())
|
| 284 |
-
sibyl_ban = random.choice(
|
| 285 |
-
_, _, is_banned, _, sibyl_user_id =
|
| 286 |
|
| 287 |
if sibyl_user_id is not None and is_banned:
|
| 288 |
return SuccessResponse(
|
|
@@ -290,7 +290,7 @@ def sibyl_system_ban(
|
|
| 290 |
randydev={"message": "User is already banned"}
|
| 291 |
)
|
| 292 |
|
| 293 |
-
|
| 294 |
return SuccessResponse(
|
| 295 |
status="True",
|
| 296 |
randydev={
|
|
@@ -309,7 +309,7 @@ def sibyl_system(
|
|
| 309 |
user_id: int = Query(..., description="User ID in query parameter"),
|
| 310 |
api_key: None = Depends(validate_api_key)
|
| 311 |
):
|
| 312 |
-
result =
|
| 313 |
if result is not None:
|
| 314 |
sibyl_name, reason, is_banned, date_joined, sibyl_user_id = result
|
| 315 |
return {
|
|
|
|
| 155 |
return api_keys
|
| 156 |
|
| 157 |
def validate_api_key(api_key: str = Header(...)):
|
| 158 |
+
USERS_API_KEYS = get_all_api_keys()
|
| 159 |
if api_key not in USERS_API_KEYS:
|
| 160 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
| 161 |
|
|
|
|
| 241 |
|
| 242 |
@app.get("/UFoP/getbanlist")
|
| 243 |
def sibyl_get_all_banlist():
|
| 244 |
+
banned_users = get_all_banned()
|
| 245 |
return {
|
| 246 |
"status": "True",
|
| 247 |
"sukuna": {
|
|
|
|
| 281 |
|
| 282 |
try:
|
| 283 |
date_joined = str(dt.now())
|
| 284 |
+
sibyl_ban = random.choice(RAMDOM_STATUS)
|
| 285 |
+
_, _, is_banned, _, sibyl_user_id = get_sibyl_system_banned(item.user_id)
|
| 286 |
|
| 287 |
if sibyl_user_id is not None and is_banned:
|
| 288 |
return SuccessResponse(
|
|
|
|
| 290 |
randydev={"message": "User is already banned"}
|
| 291 |
)
|
| 292 |
|
| 293 |
+
new_sibyl_system_banned(item.user_id, sibyl_ban, item.reason, date_joined)
|
| 294 |
return SuccessResponse(
|
| 295 |
status="True",
|
| 296 |
randydev={
|
|
|
|
| 309 |
user_id: int = Query(..., description="User ID in query parameter"),
|
| 310 |
api_key: None = Depends(validate_api_key)
|
| 311 |
):
|
| 312 |
+
result = get_sibyl_system_banned(user_id)
|
| 313 |
if result is not None:
|
| 314 |
sibyl_name, reason, is_banned, date_joined, sibyl_user_id = result
|
| 315 |
return {
|