feat: Render homepage feed server-side

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2025-12-04 18:42:14 +00:00
parent 1fefc149e2
commit df0e66ad08
2 changed files with 31 additions and 0 deletions

View File

@@ -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('/<sid>', strict_slashes=False)