Ufoptg commited on
Commit
eaa0384
β€’
1 Parent(s): 123890c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +62 -1
main.py CHANGED
@@ -30,7 +30,6 @@ import json
30
  import io
31
  import g4f
32
  import functions as code
33
- import database as db
34
  import base64
35
 
36
  from typing_extensions import Annotated
@@ -138,6 +137,15 @@ Please modify your search terms and/or try again later thank you for your unders
138
  ~ πŸŒ€ΚŠΚ„βŠ•Φ„πŸŒ€ Team
139
  """
140
 
 
 
 
 
 
 
 
 
 
141
  def validate_api_key(api_key: str = Header(...)):
142
  USERS_API_KEYS = db.get_all_api_keys()
143
  if api_key not in USERS_API_KEYS:
@@ -147,10 +155,63 @@ def validate_api_key_only_devs(api_key: str = Header(...)):
147
  if api_key not in ONLY_DEVELOPER_API_KEYS:
148
  raise HTTPException(status_code=401, detail="Invalid API key")
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  def cybersecuritydb(user_id, mongo_url):
151
  update_doc = {"mongodb": mongo_url}
152
  return collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  @app.get("/UFoP/blacklist-words")
155
  def blacklist_words():
156
  try:
 
30
  import io
31
  import g4f
32
  import functions as code
 
33
  import base64
34
 
35
  from typing_extensions import Annotated
 
137
  ~ πŸŒ€ΚŠΚ„βŠ•Φ„πŸŒ€ Team
138
  """
139
 
140
+ def get_all_api_keys():
141
+ user = collection.find({})
142
+ api_keys = []
143
+ for x in user:
144
+ api_key = x.get("ryuzaki_api_key")
145
+ if api_key:
146
+ api_keys.append(api_key)
147
+ return api_keys
148
+
149
  def validate_api_key(api_key: str = Header(...)):
150
  USERS_API_KEYS = db.get_all_api_keys()
151
  if api_key not in USERS_API_KEYS:
 
155
  if api_key not in ONLY_DEVELOPER_API_KEYS:
156
  raise HTTPException(status_code=401, detail="Invalid API key")
157
 
158
+ RAMDOM_STATUS = [
159
+ "Spammer",
160
+ "wanted",
161
+ "scammer",
162
+ "rogue_agent",
163
+ "pornbot prolly",
164
+ "fugitive",
165
+ "simp"
166
+ ]
167
+
168
+ def remove_sibyl_system_banned(user_id):
169
+ update_doc = {
170
+ "sibyl_ban": None,
171
+ "reason_sibyl": None,
172
+ "is_banned_sibly": None,
173
+ "date_joined_sib": None,
174
+ "sibyl_userid": None
175
+ }
176
+ return collection.update_one({"user_id": user_id}, {"$unset": update_doc}, upsert=True)
177
+
178
+ def new_sibyl_system_banned(user_id, name, reason, date_joined):
179
+ update_doc = {
180
+ "sibyl_ban": name,
181
+ "reason_sibyl": reason,
182
+ "is_banned_sibly": True,
183
+ "date_joined_sib": date_joined,
184
+ "sibyl_userid": user_id
185
+ }
186
+ return collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
187
+
188
  def cybersecuritydb(user_id, mongo_url):
189
  update_doc = {"mongodb": mongo_url}
190
  return collection.update_one({"user_id": user_id}, {"$set": update_doc}, upsert=True)
191
 
192
+ def get_sibyl_system_banned(user_id):
193
+ user = collection.find_one({"user_id": user_id})
194
+ if user:
195
+ sibyl_name = user.get("sibyl_ban")
196
+ reason = user.get("reason_sibyl")
197
+ is_banned = user.get("is_banned_sibly")
198
+ date_joined = user.get("date_joined_sib")
199
+ sibyl_user_id = user.get("sibyl_userid")
200
+ return sibyl_name, reason, is_banned, date_joined, sibyl_user_id
201
+ else:
202
+ return None, None, False, None, None
203
+
204
+ def get_all_banned():
205
+ banned_users = []
206
+
207
+ users = collection.find({})
208
+
209
+ for user_id in users:
210
+ reason = user_id.get("reason_sibyl")
211
+ user_id = user_id.get("sibyl_userid")
212
+ banned_users.append({"user_id": user_id, "reason": reason})
213
+ return banned_users
214
+
215
  @app.get("/UFoP/blacklist-words")
216
  def blacklist_words():
217
  try: