Update app.py
Signed-off-by: 아르페 <aki@nrma.cc>
This commit is contained in:
parent
f81819eba1
commit
333c34eddc
1 changed files with 5 additions and 5 deletions
10
app.py
10
app.py
|
@ -49,11 +49,11 @@ async def startup():
|
||||||
async def shutdown():
|
async def shutdown():
|
||||||
await client.close()
|
await client.close()
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/roles")
|
||||||
async def root():
|
async def root():
|
||||||
return RedirectResponse(url="https://github.com/CloudToys/Achievement-Promotion")
|
return RedirectResponse(url="https://github.com/CloudToys/Achievement-Promotion")
|
||||||
|
|
||||||
@app.get("/verify")
|
@app.get("/roles/verify")
|
||||||
async def link():
|
async def link():
|
||||||
steam_openid_url = "https://steamcommunity.com/openid/login"
|
steam_openid_url = "https://steamcommunity.com/openid/login"
|
||||||
u = {
|
u = {
|
||||||
|
@ -68,7 +68,7 @@ async def link():
|
||||||
auth_url = steam_openid_url + "?" + query_string
|
auth_url = steam_openid_url + "?" + query_string
|
||||||
return RedirectResponse(auth_url)
|
return RedirectResponse(auth_url)
|
||||||
|
|
||||||
@app.get('/callback/steam')
|
@app.get('/roles/callback/steam')
|
||||||
async def setup(request: Request):
|
async def setup(request: Request):
|
||||||
valid = await validate(dict(request.query_params))
|
valid = await validate(dict(request.query_params))
|
||||||
if not valid:
|
if not valid:
|
||||||
|
@ -104,7 +104,7 @@ async def validate(data: dict) -> bool:
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@app.get('/callback/discord')
|
@app.get('/roles/callback/discord')
|
||||||
async def update_metadata(response: Response, code: str, steam_id: str = Cookie()):
|
async def update_metadata(response: Response, code: str, steam_id: str = Cookie()):
|
||||||
token = await client.get_access_token(code)
|
token = await client.get_access_token(code)
|
||||||
user = await client.fetch_user(token)
|
user = await client.fetch_user(token)
|
||||||
|
@ -144,4 +144,4 @@ async def update_metadata(response: Response, code: str, steam_id: str = Cookie(
|
||||||
return "Successfully connected! Now go back to Discord and check result."
|
return "Successfully connected! Now go back to Discord and check result."
|
||||||
|
|
||||||
|
|
||||||
uvicorn.run(app, host="0.0.0.0", port=4278)
|
uvicorn.run(app, host="0.0.0.0", port=4278)
|
||||||
|
|
Reference in a new issue