Hana Celeste commited on
Commit
f0f1724
·
verified ·
1 Parent(s): c3de8c9

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -11
main.py CHANGED
@@ -5,13 +5,13 @@ from app.enka_logic import EnkaApp
5
  from app.akasa_logic import AkasaApp
6
  from app.fetch import Fetcher
7
  from app.discord_logic import DiscordApp
8
- from app.aternos_api import AternosAPI
9
 
10
  enka = EnkaApp()
11
  akasa = AkasaApp()
12
  fetcher = Fetcher()
13
  discord_app = DiscordApp()
14
- aternos = AternosAPI()
15
 
16
  @asynccontextmanager
17
  async def lifespan(app: FastAPI):
@@ -19,13 +19,13 @@ async def lifespan(app: FastAPI):
19
  await akasa.start()
20
  await fetcher.start()
21
  await discord_app.start()
22
- await aternos.start()
23
  yield
24
  await fetcher.stop()
25
  await akasa.stop()
26
  await enka.stop()
27
  await discord_app.stop()
28
- await aternos.stop()
29
 
30
  app = FastAPI(lifespan=lifespan)
31
 
@@ -49,13 +49,11 @@ async def fetch_url(url: str):
49
  async def get_discord_info(uid: str):
50
  return await discord_app.get_user_info(uid)
51
 
52
- @app.get("/aternos")
53
- async def aternos_control(type: str = Query("login")):
54
- USER = "Celeskry"
55
- PASS = "Saik_yuaik1"
56
-
57
- result = await aternos.run_action(USER, PASS, action_type=type)
58
- return result
59
 
60
  @app.get("/")
61
  def home():
 
5
  from app.akasa_logic import AkasaApp
6
  from app.fetch import Fetcher
7
  from app.discord_logic import DiscordApp
8
+ from app.byps_logic import BypsApp
9
 
10
  enka = EnkaApp()
11
  akasa = AkasaApp()
12
  fetcher = Fetcher()
13
  discord_app = DiscordApp()
14
+ byps = BypsApp()
15
 
16
  @asynccontextmanager
17
  async def lifespan(app: FastAPI):
 
19
  await akasa.start()
20
  await fetcher.start()
21
  await discord_app.start()
22
+ await byps.start()
23
  yield
24
  await fetcher.stop()
25
  await akasa.stop()
26
  await enka.stop()
27
  await discord_app.stop()
28
+ await byps.stop()
29
 
30
  app = FastAPI(lifespan=lifespan)
31
 
 
49
  async def get_discord_info(uid: str):
50
  return await discord_app.get_user_info(uid)
51
 
52
+ @app.get("/api/byps")
53
+ async def bypass_fetch(url: str = Query(..., description="URL needs to scratch data")):
54
+ if not url.startswith("http"):
55
+ return {"ok": False, "msg": "Invalid URL"}
56
+ return await byps.fetch(url)
 
 
57
 
58
  @app.get("/")
59
  def home():