forked from MarseyWorld/MarseyWorld
add a discord server for api users to help eachother
parent
b84bd72beb
commit
81b762fbc2
|
@ -19,7 +19,7 @@ class OauthApp(Base):
|
|||
description = Column(String)
|
||||
author_id = Column(Integer, ForeignKey("users.id"))
|
||||
|
||||
author = relationship("User")
|
||||
author = relationship("User", back_populates="apps")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<OauthApp(id={self.id})>"
|
||||
|
|
|
@ -138,6 +138,7 @@ class User(Base):
|
|||
blocking = relationship("UserBlock", lazy="dynamic", primaryjoin="User.id==UserBlock.user_id", back_populates="user")
|
||||
blocked = relationship("UserBlock", lazy="dynamic", primaryjoin="User.id==UserBlock.target_id", back_populates="target")
|
||||
authorizations = relationship("ClientAuth", back_populates="user")
|
||||
apps = relationship("OauthApp", back_populates="author")
|
||||
awards = relationship("AwardRelationship", primaryjoin="User.id==AwardRelationship.user_id", back_populates="user")
|
||||
referrals = relationship("User")
|
||||
|
||||
|
|
|
@ -88,6 +88,16 @@ def discord_redirect(v):
|
|||
v.discord_id=x["id"]
|
||||
g.db.add(v)
|
||||
|
||||
if v.apps:
|
||||
url=f"https://discord.com/api/guilds/998387482984980541/members/{x['id']}"
|
||||
name=v.username
|
||||
data={
|
||||
"access_token":token,
|
||||
"nick":name,
|
||||
}
|
||||
requests.put(url, headers=headers, json=data, timeout=5)
|
||||
time.sleep(0.1)
|
||||
|
||||
url=f"https://discord.com/api/guilds/{DISCORD_SERVER_ID}/members/{x['id']}"
|
||||
|
||||
name=v.username
|
||||
|
|
|
@ -141,6 +141,7 @@ def admin_app_approve(v, aid):
|
|||
app = g.db.get(OauthApp, aid)
|
||||
user = app.author
|
||||
|
||||
if not app.client_id:
|
||||
app.client_id = secrets.token_urlsafe(64)[:64]
|
||||
g.db.add(app)
|
||||
|
||||
|
@ -153,7 +154,7 @@ def admin_app_approve(v, aid):
|
|||
|
||||
g.db.add(new_auth)
|
||||
|
||||
send_repeatable_notification(user.id, f"@{v.username} has approved your application `{app.app_name}`. Here's your access token: `{access_token}`\nPlease check the guide [here](/api) if you don't know what to do next.")
|
||||
send_repeatable_notification(user.id, f"@{v.username} has approved your application `{app.app_name}`. Here's your access token: `{access_token}`\nPlease check the guide [here](/api) if you don't know what to do next, and join this [discord server](/discord) if you need help!")
|
||||
|
||||
ma = ModAction(
|
||||
kind="approve_app",
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<div class="d-flex">
|
||||
{% if not app.client_id%}
|
||||
|
||||
<a role="button" class="btn btn-primary ml-auto" onclick="post_toast(this,'/admin/app/approve/{{app.id}}')">Approve</a>
|
||||
<a role="button" class="btn btn-primary ml-auto mr-2" onclick="post_toast(this,'/admin/app/approve/{{app.id}}')">Approve</a>
|
||||
<a role="button" class="btn btn-secondary mr-0" onclick="post_toast(this,'/admin/app/reject/{{app.id}}')">Reject</a>
|
||||
|
||||
{% else %}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<div class="d-flex">
|
||||
{% if not app.client_id %}
|
||||
|
||||
<a role="button" class="btn btn-primary ml-auto" onclick="post_toast(this,'/admin/app/approve/{{app.id}}')">Approve</a>
|
||||
<a role="button" class="btn btn-primary ml-auto mr-2" onclick="post_toast(this,'/admin/app/approve/{{app.id}}')">Approve</a>
|
||||
<a role="button" class="btn btn-secondary mr-0" onclick="post_toast(this,'/admin/app/reject/{{app.id}}')">Reject</a>
|
||||
|
||||
{% else %}
|
||||
|
|
Loading…
Reference in New Issue