Add welcome page
This commit is contained in:
parent
4ddbb7ecec
commit
eb0042a694
3
.gitignore
vendored
3
.gitignore
vendored
@ -144,4 +144,5 @@ dmypy.json
|
|||||||
# pytype static type analyzer
|
# pytype static type analyzer
|
||||||
.pytype/
|
.pytype/
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/python
|
# Added
|
||||||
|
data_export.json
|
||||||
|
@ -37,6 +37,11 @@ ALLOWED_EXTENSIONS = {'json'}
|
|||||||
@app.route('/index')
|
@app.route('/index')
|
||||||
@login_required
|
@login_required
|
||||||
def index():
|
def index():
|
||||||
|
return render_template('home.html')
|
||||||
|
|
||||||
|
@app.route('/twitter')
|
||||||
|
@login_required
|
||||||
|
def twitter():
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
followingList = current_user.twitter_following_list()
|
followingList = current_user.twitter_following_list()
|
||||||
followCount = len(followingList)
|
followCount = len(followingList)
|
||||||
@ -50,7 +55,7 @@ def index():
|
|||||||
else:
|
else:
|
||||||
profilePic = posts[0].userProfilePic
|
profilePic = posts[0].userProfilePic
|
||||||
print("--- {} seconds fetching twitter feed---".format(time.time() - start_time))
|
print("--- {} seconds fetching twitter feed---".format(time.time() - start_time))
|
||||||
return render_template('index.html', title='Home', posts=posts, avatar=avatarPath, profilePic = profilePic, followedCount=followCount, form=form)
|
return render_template('twitter.html', title='Home', posts=posts, avatar=avatarPath, profilePic = profilePic, followedCount=followCount, form=form)
|
||||||
|
|
||||||
@app.route('/savePost/<url>', methods=['POST'])
|
@app.route('/savePost/<url>', methods=['POST'])
|
||||||
@login_required
|
@login_required
|
||||||
@ -300,7 +305,7 @@ def channel(id):
|
|||||||
def watch():
|
def watch():
|
||||||
id = request.args.get('v', None)
|
id = request.args.get('v', None)
|
||||||
ydl = YoutubeDL()
|
ydl = YoutubeDL()
|
||||||
data = ydl.extract_info("{id}".format(id=id), download=False)
|
data = ydl.extract_info(id, False)
|
||||||
if data['formats'][-1]['url'].find("manifest.googlevideo") > 0:
|
if data['formats'][-1]['url'].find("manifest.googlevideo") > 0:
|
||||||
flash("Livestreams are not yet supported!")
|
flash("Livestreams are not yet supported!")
|
||||||
return redirect(url_for('youtube'))
|
return redirect(url_for('youtube'))
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="ui stackable menu">
|
<div class="ui stackable menu">
|
||||||
<div class="item">
|
<a href="{{ url_for('index') }}"><div class="item">
|
||||||
<img src="{{ url_for('static',filename='img/logo.png') }}">
|
<img src="{{ url_for('static',filename='img/logo.png') }}">
|
||||||
</div>
|
</div></a>
|
||||||
{% if current_user.is_anonymous %}
|
{% if current_user.is_anonymous %}
|
||||||
<a href="{{ url_for('login') }}" class="item">Login</a>
|
<a href="{{ url_for('login') }}" class="item">Login</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ url_for('index') }}" class="twitter item">Twitter</a>
|
<a href="{{ url_for('twitter') }}" class="twitter item">Twitter</a>
|
||||||
<a href="{{ url_for('search') }}" class="twitter item">Search</a>
|
<a href="{{ url_for('search') }}" class="twitter item">Search</a>
|
||||||
<a href="{{ url_for('saved') }}" class="twitter item">Saved</a>
|
<a href="{{ url_for('saved') }}" class="twitter item">Saved</a>
|
||||||
<a href="{{ url_for('youtube') }}" class="youtube item">Youtube</a>
|
<a href="{{ url_for('youtube') }}" class="youtube item">Youtube</a>
|
||||||
|
19
app/templates/home.html
Normal file
19
app/templates/home.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div style="margin: 2em" class="ui one column centered grid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="column">
|
||||||
|
<h2 class="ui center aligned header">
|
||||||
|
Welcome back, {{current_user.username}}!
|
||||||
|
<div class="sub header">Choose a platform</div>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a style="padding: .2em" href="{{ url_for('twitter') }}"><button class="massive teal ui button">Twitter</button></a>
|
||||||
|
<a style="padding: .2em" href="{{ url_for('youtube') }}"><button class="massive red ui button">Youtube</button></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Reference in New Issue
Block a user