Spaces:
Running
Running
Upload main.py
Browse files
main.py
CHANGED
@@ -107,8 +107,17 @@ app = FastAPI(
|
|
107 |
docs_url="/"
|
108 |
)
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
def validate_api_key(api_key: str = Header(...)):
|
111 |
-
USERS_API_KEYS =
|
112 |
if api_key not in USERS_API_KEYS:
|
113 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
114 |
|
@@ -169,15 +178,6 @@ def get_all_banned():
|
|
169 |
banned_users.append({"user_id": user_id, "reason": reason})
|
170 |
return banned_users
|
171 |
|
172 |
-
def get_all_api_keys():
|
173 |
-
user = collection.find({})
|
174 |
-
api_keys = []
|
175 |
-
for x in user:
|
176 |
-
api_key = x.get("ryuzaki_api_key")
|
177 |
-
if api_key:
|
178 |
-
api_keys.append(api_key)
|
179 |
-
return api_keys
|
180 |
-
|
181 |
def new_profile_clone(
|
182 |
user_id,
|
183 |
first_name,
|
|
|
107 |
docs_url="/"
|
108 |
)
|
109 |
|
110 |
+
def get_all_api_keys():
|
111 |
+
user = collection.find({})
|
112 |
+
api_keys = []
|
113 |
+
for x in user:
|
114 |
+
api_key = x.get("ryuzaki_api_key")
|
115 |
+
if api_key:
|
116 |
+
api_keys.append(api_key)
|
117 |
+
return api_keys
|
118 |
+
|
119 |
def validate_api_key(api_key: str = Header(...)):
|
120 |
+
USERS_API_KEYS = get_all_api_keys()
|
121 |
if api_key not in USERS_API_KEYS:
|
122 |
raise HTTPException(status_code=401, detail="Invalid API key")
|
123 |
|
|
|
178 |
banned_users.append({"user_id": user_id, "reason": reason})
|
179 |
return banned_users
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
def new_profile_clone(
|
182 |
user_id,
|
183 |
first_name,
|