forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-02-14 18:38:24 +02:00
parent 936827a072
commit 7775f41081
5 changed files with 10 additions and 90 deletions

View File

@ -305,39 +305,6 @@ def monthly(v):
return {"message": "Monthly coins granted"}
# @app.get('/admin/sidebar')
# @admin_level_required(3)
# def get_sidebar(v):
# try:
# with open(f'files/templates/sidebar_{SITE_NAME}.html', 'r', encoding="utf-8") as f: sidebar = f.read()
# except:
# sidebar = None
# return render_template('admin/sidebar.html', v=v, sidebar=sidebar)
# @app.post('/admin/sidebar')
# @limiter.limit("1/second;30/minute;200/hour;1000/day")
# @admin_level_required(3)
# def post_sidebar(v):
# text = request.values.get('sidebar', '').strip()
# with open(f'files/templates/sidebar_{SITE_NAME}.html', 'w+', encoding="utf-8") as f: f.write(text)
# with open(f'files/templates/sidebar_{SITE_NAME}.html', 'r', encoding="utf-8") as f: sidebar = f.read()
# ma = ModAction(
# kind="change_sidebar",
# user_id=v.id,
# )
# g.db.add(ma)
# g.db.commit()
# return render_template('admin/sidebar.html', v=v, sidebar=sidebar, msg='Sidebar edited successfully!')
@app.get("/admin/shadowbanned")
@auth_required
def shadowbanned(v):

View File

@ -52,11 +52,6 @@
<li><a href="/chart">Stat Chart</a></li>
</ul>
<h4>Configuration</h4>
<ul>
<li><a href="/admin/sidebar">Edit Sidebar</a></li>
</ul>
{% if v.admin_level > 2 %}
<div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="disable_signups" name="disable_signups" {% if x == "yes" %}checked{% endif %} onchange="post_toast(this,'/admin/disable_signups');">

View File

@ -1,42 +0,0 @@
{% extends "default.html" %}
{% block pagetitle %}Edit {{SITE_NAME}} sidebar{% endblock %}
{% block content %}
{% if msg %}
<div class="alert alert-success alert-dismissible fade show my-3" role="alert">
<i class="fas fa-check-circle my-auto" aria-hidden="true"></i>
<span>
{{msg}}
</span>
<button class="close" data-bs-dismiss="alert" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span>
</button>
</div>
{% endif %}
<div class="row my-5">
<div class="col col-md-8">
<div class="settings">
<div id="description">
<h2>Edit Sidebar</h2>
<br>
</div>
<div class="body d-lg-flex">
<div class="w-lg-100">
<form id="profile-settings" action="/admin/sidebar" method="post">
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<textarea autocomplete="off" maxlength="10000" class="form-control rounded" id="bio-text" aria-label="With textarea" placeholder="Enter sidebar here..." rows="50" name="sidebar" form="profile-settings">{% if sidebar %}{{sidebar}}{% endif %}</textarea>
<div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -14,17 +14,17 @@
<pre></pre>
<p>This page explains how to obtain and use an access token. </p>
<h2>Step 1: Create your Application</h2>
<p>In the <a href="/settings/apps">apps tab of Drama settings</a>, fill in and submit the form to request an access token. You will need:</p>
<p>In the <a href="/settings/apps">apps tab of {{SITE_NAME}} settings</a>, fill in and submit the form to request an access token. You will need:</p>
<ul>
<li>an application name</li>
<li>a Redirect URI. May not use HTTP unless using localhost (use HTTPS instead).</li>
<li>a brief description of what your bot is intended to do</li>
</ul>
<p>Don't worry too much about accuracy; you will be able to change all of these later.</p>
<p>Drama administrators will review and approve or deny your request for an access token. You'll know when your request has been approved when you get a private message with an access token tied to your account.</p>
<p>{{SITE_NAME}} administrators will review and approve or deny your request for an access token. You'll know when your request has been approved when you get a private message with an access token tied to your account.</p>
<p>DO NOT reveal your Client ID or Access Token. Anyone with these information will be able to pretend to be you. You are responsible for keeping them a secret!</p>
<h2>Step 2: Using the Access Token</h2>
<p>To use the access token, include the following header in subsequent API requests to Drama: <code>Authorization: access_token_goes_here</code></p>
<p>To use the access token, include the following header in subsequent API requests to {{SITE_NAME}}: <code>Authorization: access_token_goes_here</code></p>
<p>Python example:</p>
<pre> import requests
@ -48,25 +48,25 @@
</pre>
<h1>API Guide for Applications</h1>
<pre></pre>
<p>The OAuth2 authorization flow is used to enable users to authorize third-party applications to access their Drama account without having to provide their login information to the application.</p>
<p>The OAuth2 authorization flow is used to enable users to authorize third-party applications to access their {{SITE_NAME}} account without having to provide their login information to the application.</p>
<p>This page explains how to obtain API application keys, how to prompt a user for authorization, and how to obtain and use access tokens. </p>
<h2>Step 1: Create your Application</h2>
<p>In the <a href="/settings/apps">apps tab of Drama settings</a>, fill in and submit the form to request new API keys. You will need:</p>
<p>In the <a href="/settings/apps">apps tab of {{SITE_NAME}} settings</a>, fill in and submit the form to request new API keys. You will need:</p>
<ul>
<li>an application name</li>
<li>a Redirect URI. May not use HTTP unless using localhost (use HTTPS instead).</li>
<li>a brief description of what your application is intended to do</li>
</ul>
<p>Don't worry too much about accuracy; you will be able to change all of these later.</p>
<p>Drama administrators will review and approve or deny your request for API keys. You'll know when your request has been approved when you get a private message with an access token tied to your account.</p>
<p>{{SITE_NAME}} administrators will review and approve or deny your request for API keys. You'll know when your request has been approved when you get a private message with an access token tied to your account.</p>
<p>DO NOT reveal your Client ID or Access Token. Anyone with these information will be able to pretend to be you. You are responsible for keeping them a secret!</p>
<h2>Step 2: Prompt Your User for Authorization</h2>
<p>Send your user to <code>{{SITE_FULL}}/authorize/?client_id=YOUR_CLIENT_ID</code></p>
<p>If done correctly, the user will see that your application wants to access their Drama account, and be prompted to approve or deny the request.</p>
<p>If done correctly, the user will see that your application wants to access their {{SITE_NAME}} account, and be prompted to approve or deny the request.</p>
<h2>Step 3: Catch the redirect</h2>
<p>The user clicks "Authorize". Drama will redirect the user's browser to GET the designated redirect URI. The access token URL parameter will be included in the redirect, which your server should process.</p>
<p>The user clicks "Authorize". {{SITE_NAME}} will redirect the user's browser to GET the designated redirect URI. The access token URL parameter will be included in the redirect, which your server should process.</p>
<h2>Step 4: Using the Access Token</h2>
<p>To use the access token, include the following header in subsequent API requests to Drama: <code>Authorization: access_token_goes_here</code></p>
<p>To use the access token, include the following header in subsequent API requests to {{SITE_NAME}}: <code>Authorization: access_token_goes_here</code></p>
<p>Python example:</p>
<pre> import requests

View File

@ -11,7 +11,7 @@
</pre>
<div class="mx-4 mt-2 mb-6">
<h1 class="text-muted text-uppercase">Sidebar{% if v and v.admin_level > 2 %} <a href="/admin/sidebar" class="btn btn-link text-lowercase"><i class="far fa-fw fa-pencil"></i> Edit sidebar</a>{% endif %}</h5>
<h1 class="text-muted text-uppercase">Sidebar</h5>
<div id="sidebar" class="my-3">
{% include "sidebar_" + SITE_NAME + ".html" %}