From 4fc0af2d80efa25abe017df0c67d49de702b7050 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sat, 6 May 2017 18:27:35 -0700 Subject: [PATCH] Strip discordrest from embed endpoint --- webapp/titanembeds/blueprints/embed/embed.py | 5 +++-- webapp/titanembeds/templates/embed.html.j2 | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/webapp/titanembeds/blueprints/embed/embed.py b/webapp/titanembeds/blueprints/embed/embed.py index b3c7360..dbb373b 100644 --- a/webapp/titanembeds/blueprints/embed/embed.py +++ b/webapp/titanembeds/blueprints/embed/embed.py @@ -1,6 +1,7 @@ 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.database import db, Guilds from config import config import random @@ -22,7 +23,7 @@ def get_logingreeting(): @embed.route("/") def guild_embed(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", login_greeting=get_logingreeting(), guild_id=guild_id, guild=guild, diff --git a/webapp/titanembeds/templates/embed.html.j2 b/webapp/titanembeds/templates/embed.html.j2 index 115e8cb..05f8188 100644 --- a/webapp/titanembeds/templates/embed.html.j2 +++ b/webapp/titanembeds/templates/embed.html.j2 @@ -10,7 +10,7 @@ - {{ guild['name'] }} - Embed - Titan Embeds for Discord + {{ guild.name }} - Embed - Titan Embeds for Discord {% include 'google_analytics.html.j2' %} @@ -32,16 +32,16 @@