This commit is contained in:
codl 2017-08-07 15:44:21 +02:00
parent 625dc31a53
commit f7b36ad257
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
2 changed files with 10 additions and 12 deletions

View File

@ -32,7 +32,7 @@ def touch_viewer(resp):
def index():
if g.viewer:
return render_template('logged_in.html', scales=lib.interval_scales,
error=request.args.get('error', None))
tweet_archive_failed = 'tweet_archive_failed' in request.args)
else:
return render_template('index.html')
@ -77,7 +77,7 @@ def upload_tweet_archive():
return redirect(url_for('index', _anchor='recent_archives'))
except (BadZipFile, AssertionError):
return redirect(url_for('index', error='The file you uploaded is not a valid tweet archive. No posts have been imported.'))
return redirect(url_for('index', tweet_archive_failed='', _anchor='tweet_archive_import'))
@app.route('/settings', methods=('POST',))
@require_auth

View File

@ -2,12 +2,6 @@
{% extends 'lib/layout.html' %}
{% block body -%}
{% if error %}
<section class=banners>
<div class="banner error">{{ error }}</div>
</section>
{% endif %}
<section class=viewer>
<p>Hello,
<img class=avatar src="{{g.viewer.account.avatar_url}}"/>
@ -68,15 +62,19 @@
{% if g.viewer.account.service == 'twitter' %}
<section>
<h2>Tweet archive import</h2>
<h2 id='tweet_archive_import'>Tweet archive import</h2>
<p>
Twitter's API only lets us access up to 3200 of your most recent tweets. If you have more tweets than that, you can request an archive of your tweets from
<a href="https://twitter.com/settings/account">Twitter's settings page</a>,
and upload it here.
</p>
<form action='{{url_for('upload_tweet_archive')}}' method='post' enctype='multipart/form-data'>
<input type="file" name='file'><input type="submit" value="Upload">
</form>
<form action='{{url_for('upload_tweet_archive')}}' method='post' enctype='multipart/form-data'>
<input type="file" name='file'><input type="submit" value="Upload">
</form>
{% if tweet_archive_failed %}
<div class="banner error">The file you uploaded is not a valid tweet archive. No posts have been imported.</div>
{% endif %}
{% if g.viewer.account.twitter_archives %}
<h3 id="recent_archives">Recent archives</h3>