Strip discordrest from embed endpoint

This commit is contained in:
Jeremy Zhang 2017-05-06 18:27:35 -07:00
parent fc169c2063
commit 4fc0af2d80
2 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,7 @@
from flask import Blueprint, render_template, abort, redirect, url_for, session from flask import Blueprint, render_template, abort, redirect, url_for, session
from titanembeds.utils import check_guild_existance, discord_api, guild_query_unauth_users_bool from titanembeds.utils import check_guild_existance, guild_query_unauth_users_bool
from titanembeds.oauth import generate_guild_icon_url, generate_avatar_url from titanembeds.oauth import generate_guild_icon_url, generate_avatar_url
from titanembeds.database import db, Guilds
from config import config from config import config
import random import random
@ -22,7 +23,7 @@ def get_logingreeting():
@embed.route("/<string:guild_id>") @embed.route("/<string:guild_id>")
def guild_embed(guild_id): def guild_embed(guild_id):
if check_guild_existance(guild_id): if check_guild_existance(guild_id):
guild = discord_api.get_guild(guild_id)['content'] guild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
return render_template("embed.html.j2", return render_template("embed.html.j2",
login_greeting=get_logingreeting(), login_greeting=get_logingreeting(),
guild_id=guild_id, guild=guild, guild_id=guild_id, guild=guild,

View File

@ -10,7 +10,7 @@
<!--Let browser know website is optimized for mobile--> <!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{{ guild['name'] }} - Embed - Titan Embeds for Discord</title> <title>{{ guild.name }} - Embed - Titan Embeds for Discord</title>
{% include 'google_analytics.html.j2' %} {% include 'google_analytics.html.j2' %}
</head> </head>
<body> <body>
@ -32,16 +32,16 @@
<ul id="guild-nav" class="side-nav"> <ul id="guild-nav" class="side-nav">
<li> <li>
<div class="userView"> <div class="userView">
{% if guild['icon'] %} {% if guild.icon %}
<img class="circle" src="{{ generate_guild_icon( guild['id'], guild['icon'] ) }}"> <img class="circle" src="{{ generate_guild_icon( guild.id, guild.icon ) }}">
{% endif %} {% endif %}
<span class="name">{{ guild['name'] }}</span> <span class="name">{{ guild.name }}</span>
</div> </div>
</li> </li>
<li><a class="subheader">Actions</a></li> <li><a class="subheader">Actions</a></li>
<li><a href="{{ url_for("user.administrate_guild", guild_id=guild['id']) }}" class="waves-effect" target="_blank" id="administrate_link" style="display: none;">Manage Guild Embed</a></li> <li><a href="{{ url_for("user.administrate_guild", guild_id=guild.id) }}" class="waves-effect" target="_blank" id="administrate_link" style="display: none;">Manage Guild Embed</a></li>
<li><a href="https://discordapp.com/channels/{{ guild['id'] }}/" class="waves-effect" target="_blank">Open Server on Discordapp</a></li> <li><a href="https://discordapp.com/channels/{{ guild.id }}/" class="waves-effect" target="_blank">Open Server on Discordapp</a></li>
<li><div class="divider"></div></li> <li><div class="divider"></div></li>