Added an embeded error message system to show when / why stuff might not be working

This commit is contained in:
Robin Universe 2021-07-04 05:08:36 -05:00
parent 334e8f8ff1
commit 6b4fbf97f0
2 changed files with 16 additions and 2 deletions

14
templates/default.html Normal file
View file

@ -0,0 +1,14 @@
{% extends 'base.html' %}
{% block head %}
<title>TwitFix</title>
<meta content="TwitFix" property="og:title" />
<meta content="{{ message }}" property="og:description" />
<meta content="https://github.com/robinuniverse/TwitFix" property="og:url" />
<meta content="#43B581" data-react-helmet="true" name="theme-color" />
<meta http-equiv = "refresh" content = "0; url = https://github.com/robinuniverse/TwitFix" />
{% endblock %}
{% block body %}
You will be redirected to this projects github page in a moment.
{% endblock %}

View file

@ -43,12 +43,12 @@ def twitfix(subpath):
except Exception: # Just to keep from 500s that are messy except Exception: # Just to keep from 500s that are messy
print(Exception) print(Exception)
return "Bad twitter link, try again" return render_template('default.html', message="Failed to scan your twitter link! ( there is a chance I ran out of api calls.. wait a bit and try again )")
return render_template('index.html', vidurl=result['url'], tweet=result['description'], pic=result['thumbnail'], user=result['uploader'], tweeturl=twitter_url) return render_template('index.html', vidurl=result['url'], tweet=result['description'], pic=result['thumbnail'], user=result['uploader'], tweeturl=twitter_url)
else: else:
print("Link invalid") print("Link invalid")
return "Please use a twitter link" return render_template('default.html', message="Please use a twitter link!")
@app.route('/info/<path:subpath>') @app.route('/info/<path:subpath>')
def info(subpath): def info(subpath):