From 107620a501a931ce0f10fda0f745503f1b311e39 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sun, 23 Apr 2017 20:10:33 -0700 Subject: [PATCH 1/2] Redis stats --- titanembeds/app.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/titanembeds/app.py b/titanembeds/app.py index 96976c5..acff020 100644 --- a/titanembeds/app.py +++ b/titanembeds/app.py @@ -35,3 +35,13 @@ def embed_get(guildid, channelid): if 'username' not in session: return redirect(url_for("get_set_username", guildid=guildid, channelid=channelid)) return render_template("embed.html") + +if config.get("redis-stats-endpoint"): + from redislite import Redis + @app.route("/redis-stats") + def redis_stats(): + redis = Redis("redislite.db") + data = [] + for key in redis.keys(): + data.append({"key": key, "value": redis.get(key), "expiration": redis.ttl(key)}) + return jsonify(redis=data) From 687f959512752eae3a977dc1be4c10027f8a2945 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sun, 23 Apr 2017 20:22:02 -0700 Subject: [PATCH 2/2] Remove old code from app --- titanembeds/app.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/titanembeds/app.py b/titanembeds/app.py index acff020..613c328 100644 --- a/titanembeds/app.py +++ b/titanembeds/app.py @@ -29,19 +29,3 @@ app.register_blueprint(blueprints.embed.embed, url_prefix="/embed", template_fol @app.route("/") def index(): return render_template("index.html.j2") - -@app.route("/oldembed//") -def embed_get(guildid, channelid): - if 'username' not in session: - return redirect(url_for("get_set_username", guildid=guildid, channelid=channelid)) - return render_template("embed.html") - -if config.get("redis-stats-endpoint"): - from redislite import Redis - @app.route("/redis-stats") - def redis_stats(): - redis = Redis("redislite.db") - data = [] - for key in redis.keys(): - data.append({"key": key, "value": redis.get(key), "expiration": redis.ttl(key)}) - return jsonify(redis=data)