create const.py

This commit is contained in:
atrc445 2021-08-21 13:06:28 +02:00
parent ed34250b31
commit cac0ebfead
18 changed files with 155 additions and 91 deletions

View file

@ -1,6 +1,7 @@
from files.helpers.wrappers import *
from files.helpers.alerts import *
from files.helpers.get import *
from files.helpers.const import *
from files.classes import *
from flask import *
from files.__main__ import app
@ -47,7 +48,7 @@ def request_api_keys(v):
g.db.add(new_app)
send_admin(1046, f"@{v.username} has requested API keys for `{request.form.get('name')}`. You can approve or deny the request [here](/admin/apps).")
send_admin(NOTIFICATIONS_ACCOUNT, f"@{v.username} has requested API keys for `{request.form.get('name')}`. You can approve or deny the request [here](/admin/apps).")
return redirect('/settings/apps')
@ -105,7 +106,7 @@ def admin_app_approve(v, aid):
g.db.add(new_auth)
send_notification(1046, user, f"Your application `{app.app_name}` has been approved. Here's your access token: `{access_token}`\nPlease check the guide [here](/api) if you don't know what to do next.")
send_notification(NOTIFICATIONS_ACCOUNT, user, f"Your application `{app.app_name}` has been approved. Here's your access token: `{access_token}`\nPlease check the guide [here](/api) if you don't know what to do next.")
return {"message": f"{app.app_name} approved"}
@ -120,7 +121,7 @@ def admin_app_revoke(v, aid):
for auth in g.db.query(ClientAuth).filter_by(oauth_client=app.id).all(): g.db.delete(auth)
g.db.flush()
send_notification(1046, app.author, f"Your application `{app.app_name}` has been revoked.")
send_notification(NOTIFICATIONS_ACCOUNT, app.author, f"Your application `{app.app_name}` has been revoked.")
g.db.delete(app)
@ -137,7 +138,7 @@ def admin_app_reject(v, aid):
for auth in g.db.query(ClientAuth).filter_by(oauth_client=app.id).all(): g.db.delete(auth)
g.db.flush()
send_notification(1046, app.author, f"Your application `{app.app_name}` has been rejected.")
send_notification(NOTIFICATIONS_ACCOUNT, app.author, f"Your application `{app.app_name}` has been rejected.")
g.db.delete(app)
@ -221,4 +222,4 @@ def reroll_oauth_tokens(aid, v):
a.client_id = secrets.token_urlsafe(64)[:64]
g.db.add(a)
return {"message": "Client ID Rerolled", "id": a.client_id}
return {"message": "Client ID Rerolled", "id": a.client_id}