diff --git a/apiserver/server.py b/apiserver/server.py index de25328..3815d3e 100644 --- a/apiserver/server.py +++ b/apiserver/server.py @@ -175,12 +175,19 @@ def story(sid): @flask_app.route('/') @flask_app.route('/search') def index(): + stories_json = database.get_stories(settings.FEED_LENGTH, 0) + stories = [json.loads(s) for s in stories_json] + for s in stories: + url = urlparse(s.get('url') or s.get('link') or '').hostname or '' + s['hostname'] = url.replace('www.', '') + return render_template('index.html', title='QotNews', url='news.t0.vc', description='Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode', robots='index', css_file=css_file, + stories=stories, ) @flask_app.route('/', strict_slashes=False) diff --git a/webclient/public/index.html b/webclient/public/index.html index 4bbd15b..1d81871 100644 --- a/webclient/public/index.html +++ b/webclient/public/index.html @@ -108,6 +108,30 @@ + {% elif stories %} +
+ {% for story in stories %} +
+ +
+ {{ story.score }} points + by {{ story.author }} + ​ {{ story.date | fromnow }} + ​ on {{ story.source }} | ​ + + {{ story.num_comments }} comment{{ 's' if story.num_comments != 1 }} + +
+
+ {% endfor %} +
{% endif %}