Ufoptg commited on
Commit
c2ebe9a
1 Parent(s): b4b96cc

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -2
main.py CHANGED
@@ -90,6 +90,7 @@ DEVELOPER_ID = os.environ["DEVELOPER_ID"]
90
  REVERSE_IMAGE_API = os.environ["REVERSE_IMAGE_API"]
91
  OCR_API_KEY = os.environ["OCR_API_KEY"]
92
  ONLY_DEVELOPER_API_KEYS = os.environ["ONLY_DEVELOPER_API_KEYS"]
 
93
  HUGGING_TOKEN = os.environ["HUGGING_TOKEN"]
94
  ASSISTANT_GOOGLE_API_KEYS = os.environ["ASSISTANT_GOOGLE_API_KEYS"]
95
  #COOKIE_BARD_TOKEN = os.environ["COOKIE_BARD_TOKEN"]
@@ -137,6 +138,10 @@ def validate_api_key_only_devs(api_key: str = Header(...)):
137
  if api_key not in ONLY_DEVELOPER_API_KEYS:
138
  raise HTTPException(status_code=401, detail="Invalid API key")
139
 
 
 
 
 
140
 
141
  @app.get("/UFoP/blacklist-words")
142
  def blacklist_words():
@@ -215,7 +220,7 @@ def sibyl_system_ban(
215
  @app.get("/UFoP/bans")
216
  def sibyl_system(
217
  user_id: int = Query(..., description="User ID in query parameter"),
218
- api_key: None = Depends(validate_api_key) or Depends(validate_api_key_only_devs)
219
  ):
220
  result = db.get_sibyl_system_banned(user_id)
221
  if result is not None:
@@ -236,7 +241,7 @@ def sibyl_system(
236
  @app.post("/UFoP/G-AI", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
237
  def v1beta3_google_ai(
238
  item: ChatgptCustom,
239
- api_key: None = Depends(validate_api_key)
240
  ):
241
  url = SOURCE_ASSISTANT_GOOGLE_AI
242
  token = ASSISTANT_GOOGLE_API_KEYS
 
90
  REVERSE_IMAGE_API = os.environ["REVERSE_IMAGE_API"]
91
  OCR_API_KEY = os.environ["OCR_API_KEY"]
92
  ONLY_DEVELOPER_API_KEYS = os.environ["ONLY_DEVELOPER_API_KEYS"]
93
+ ULT_ONLY_API = os.environ["ULT_ONLY_API"]
94
  HUGGING_TOKEN = os.environ["HUGGING_TOKEN"]
95
  ASSISTANT_GOOGLE_API_KEYS = os.environ["ASSISTANT_GOOGLE_API_KEYS"]
96
  #COOKIE_BARD_TOKEN = os.environ["COOKIE_BARD_TOKEN"]
 
138
  if api_key not in ONLY_DEVELOPER_API_KEYS:
139
  raise HTTPException(status_code=401, detail="Invalid API key")
140
 
141
+ def validate_api_key_only_ULTROID(api_key: str = Header(...)):
142
+ if api_key not in ULT_ONLY_API:
143
+ raise HTTPException(status_code=401, detail="Invalid API key")
144
+
145
 
146
  @app.get("/UFoP/blacklist-words")
147
  def blacklist_words():
 
220
  @app.get("/UFoP/bans")
221
  def sibyl_system(
222
  user_id: int = Query(..., description="User ID in query parameter"),
223
+ api_key: None = Depends(validate_api_key) or Depends(validate_api_key_only_devs) or Depends(validate_api_key_only_ULTROID)
224
  ):
225
  result = db.get_sibyl_system_banned(user_id)
226
  if result is not None:
 
241
  @app.post("/UFoP/G-AI", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
242
  def v1beta3_google_ai(
243
  item: ChatgptCustom,
244
+ api_key: None = Depends(validate_api_key) or Depends(validate_api_key_only_ULTROID)
245
  ):
246
  url = SOURCE_ASSISTANT_GOOGLE_AI
247
  token = ASSISTANT_GOOGLE_API_KEYS