remotes/1693045480750635534/spooky-22
Aevann1 2021-08-03 18:51:35 +02:00
parent e67ccbe66d
commit 50a3fdb5dc
5 changed files with 13 additions and 101 deletions

View File

@ -436,16 +436,6 @@ def admin_removed(v):
)
@app.get("/admin/appdata")
@admin_level_required(4)
def admin_appdata(v):
return render_template(
"admin/app_data.html",
v=v,
thing=get_post(4020)
)
@app.post("/admin/image_purge")
@admin_level_required(5)
def admin_image_purge(v):

View File

@ -135,7 +135,8 @@ def login_post():
@app.get("/@me")
@auth_required
def me(v):
return redirect(v.url)
if request.headers.get("Authorization"): v.json
else: redirect(v.url)
@app.post("/logout")
@ -367,10 +368,6 @@ def sign_up_post(v):
session["user_id"] = new_user.id
session["session_id"] = token_hex(16)
redir = request.form.get("redirect", None)
# #print(f"Signup event: @{new_user.username}")
return redirect("/")

View File

@ -92,12 +92,6 @@ def edit_oauth_app(v, aid):
return redirect('/settings/apps')
@app.route("/identity")
@auth_required
def api_v1_identity(v):
return v.json
@app.post("/admin/app/approve/<aid>")
@admin_level_required(3)
@validate_formkey
@ -110,8 +104,16 @@ def admin_app_approve(v, aid):
g.db.add(app)
u = get_account(app.author_id, v=v)
send_notification(1046, u, f"Your application `{app.app_name}` has been approved.")
access_token = secrets.token_urlsafe(128)[:128]
new_auth = ClientAuth(
oauth_client = app.id,
user_id = v.id,
access_token=access_token
)
g.db.add(new_auth)
send_notification(1046, v, f"Your application `{app.app_name}` has been approved. Here's your access token: `{access_token}`")
return {"message": f"{app.app_name} approved"}

View File

@ -23,8 +23,7 @@
* [Remove image from imgur and from cloudflare cache](/admin/image_purge)
* [Perceptive Hash Image Ban](/admin/image_ban)
* [Multi Vote Analysis](/admin/alt_votes)
* [App Queue](/admin/apps)
* [App Data](/admin/appdata)
* [Apps](/admin/apps)
* [Badges](/admin/badge_grant)
* [Content Stats](/admin/content_stats)

View File

@ -1,76 +0,0 @@
{% extends "default.html" %}
{% block title %}
<title>{{"SITE_NAME" | app_config}}</title>
<meta name="description" content="{{"SITE_NAME" | app_config}} Help">
{% endblock %}
{% block content %}
<pre>
</pre>
<h5>App Info</h5>
<form action="/admin/appdata" method="get" class="mb-6">
<label for="link-input">Paste permalink</label>
<input id="link-input" type="text" class="form-control mb-2" name="link" value="{{thing.permalink if thing else ''}}">
<input type="submit" value="Submit" class="btn btn-primary">
</form>
{% if thing %}
<h1>Info</h1>
<p><a href="{{thing.permalink}}">{{thing.permalink}}</a></p>
<p><b>Author:</b> <a href="{{thing.author.permalink}}">@{{thing.author.username}}</a></p>
{% if thing.oauth_app %}
<div class="settings-section rounded">
<div class="d-lg-flex">
<div class="title w-lg-25">
<label for="over18"><a href="{{thing.oauth_app.permalink}}" target="_blank">{{thing.oauth_app.app_name}}</a></label>
</div>
<div class="body w-lg-100">
<label for="edit-{{thing.oauth_app.id}}-author" class="mb-0 w-lg-25">User</label>
<input id="edit-{{thing.oauth_app.id}}-author" class="form-control" type="text" name="name" value="{{thing.oauth_app.author.username}}" readonly=readonly>
<label for="edit-{{thing.oauth_app.id}}-name" class="mb-0 w-lg-25">App Name</label>
<input id="edit-{{thing.oauth_app.id}}-name" class="form-control" type="text" name="name" value="{{thing.oauth_app.app_name}}" readonly=readonly>
<label for="edit-{{thing.oauth_app.id}}-redirect" class="mb-0 w-lg-25">Redirect URI</label>
<input id="edit-{{thing.oauth_app.id}}-redirect" class="form-control" type="text" name="redirect_uri" value="{{thing.oauth_app.redirect_uri}}" readonly="readonly">
<label for="edit-{{thing.oauth_app.id}}-desc" class="mb-0 w-lg-25">Description</label>
<textarea form="edit-app-{{thing.oauth_app.id}}" class="form-control" name="description" id="edit-{{thing.oauth_app.id}}-desc" maxlength="256" readonly="readonly">{{thing.oauth_app.description}}</textarea>
</div>
</div>
<div class="footer">
<div class="d-flex">
{% if not thing.oauth_app.client_secret %}
<a href="javascript:void(0)" class="btn btn-primary ml-auto" onclick="post_toast('/admin/app/approve/{{thing.oauth_app.id}}')">Approve</a>
<a href="javascript:void(0)" class="btn btn-secondary mr-0" onclick="post_toast('/admin/app/reject/{{thing.oauth_app.id}}')">Reject</a>
{% else %}
<a href="javascript:void(0)" class="btn btn-primary ml-auto" onclick="post_toast('/admin/app/revoke/{{thing.oauth_app.id}}')">Revoke</a>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% endif %}
{% endblock %}