mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-14 01:51:22 +01:00
Fix a few stuff in dashboard
This commit is contained in:
parent
53c06ed050
commit
3e884fa2fa
@ -4,6 +4,7 @@ from flask import Flask, render_template, request, session, url_for, redirect, j
|
||||
from titanembeds.utils import cache
|
||||
import blueprints.api
|
||||
import blueprints.user
|
||||
import blueprints.embed
|
||||
import os
|
||||
|
||||
|
||||
@ -18,6 +19,7 @@ cache.init_app(app, config={'CACHE_TYPE': 'simple'})
|
||||
|
||||
app.register_blueprint(blueprints.api.api, url_prefix="/api", template_folder="/templates")
|
||||
app.register_blueprint(blueprints.user.user, url_prefix="/user", template_folder="/templates")
|
||||
app.register_blueprint(blueprints.embed.embed, url_prefix="/embed", template_folder="/templates")
|
||||
|
||||
@app.route("/set_username/<guildid>/<channelid>", methods=["GET"])
|
||||
def get_set_username(guildid, channelid):
|
||||
@ -32,7 +34,7 @@ def post_set_username(guildid, channelid):
|
||||
def index():
|
||||
return render_template("index.html.j2")
|
||||
|
||||
@app.route("/embed/<guildid>/<channelid>")
|
||||
@app.route("/oldembed/<guildid>/<channelid>")
|
||||
def embed_get(guildid, channelid):
|
||||
if 'username' not in session:
|
||||
return redirect(url_for("get_set_username", guildid=guildid, channelid=channelid))
|
||||
|
1
titanembeds/blueprints/embed/__init__.py
Normal file
1
titanembeds/blueprints/embed/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from embed import embed
|
@ -0,0 +1,7 @@
|
||||
from flask import Blueprint
|
||||
|
||||
embed = Blueprint("embed", __name__)
|
||||
|
||||
@embed.route("/<guild_id>")
|
||||
def guild_embed(guild_id):
|
||||
return guild_id
|
@ -162,7 +162,7 @@ def administrate_guild(guild_id):
|
||||
guild = discord_api.get_guild(guild_id)
|
||||
if guild['code'] != 200:
|
||||
return redirect(generate_bot_invite_url(guild_id))
|
||||
db_guild = Guilds.query.filter_by(guild_id=guild_id).first()
|
||||
db_guild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
|
||||
if not db_guild:
|
||||
db_guild = Guilds(guild_id)
|
||||
db.session.add(db_guild)
|
||||
@ -177,7 +177,9 @@ def administrate_guild(guild_id):
|
||||
all_members = db.session.query(UnauthenticatedUsers).filter(UnauthenticatedUsers.guild_id == guild_id).all()
|
||||
all_bans = db.session.query(UnauthenticatedBans).filter(UnauthenticatedBans.guild_id == guild_id).all()
|
||||
users = prepare_guild_members_list(all_members, all_bans)
|
||||
return render_template("administrate_guild.html.j2", guild=guild['content'], members=users, permissions=permissions)
|
||||
users.reverse()
|
||||
dbguild_dict = {"unauth_users": db_guild.unauth_users}
|
||||
return render_template("administrate_guild.html.j2", guild=guild['content'], dbguild=dbguild_dict, members=users, permissions=permissions)
|
||||
|
||||
@user.route('/me')
|
||||
@discord_users_only()
|
||||
|
@ -20,8 +20,9 @@
|
||||
<div class="card-stacked">
|
||||
<div class="card-content">
|
||||
<p class="flow-text">Direct Link</p>
|
||||
<input disabled value="http://localhost:3000/embed/{{ guild['id'] }}" id="disabled" type="text"> <!-- Switch to url_for later -->
|
||||
<input disabled value="{{ url_for("embed.guild_embed", guild_id=guild['id'], _external=True) }}" id="disabled" type="text"> <!-- Switch to url_for later -->
|
||||
<p class="flow-text">iFrame Embed</p>
|
||||
<input disabled value=" <iframe src="{{ url_for("embed.guild_embed", guild_id=guild['id'], _external=True) }}" height="200" width="300" /> " id="disabled" type="text"> <!-- Switch to url_for later -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -38,7 +39,7 @@
|
||||
<div class="switch">
|
||||
<label>
|
||||
Disable
|
||||
<input type="checkbox" id="unauth_users" name="unauth_users">
|
||||
<input type="checkbox" id="unauth_users" name="unauth_users" {% if dbguild['unauth_users'] %}checked{% endif %} >
|
||||
<span class="lever"></span>
|
||||
Enable
|
||||
</label>
|
||||
|
Loading…
Reference in New Issue
Block a user