Added infinite scroll

This commit is contained in:
2025-12-15 16:12:46 +01:00
parent 1453a52097
commit 4c8f66db98
5 changed files with 22 additions and 2 deletions
+6 -1
View File
@@ -16,12 +16,17 @@ def feed(page):
posts = database.fetch("SELECT * FROM entry ORDER BY created_at DESC LIMIT ? OFFSET ?", [count, offset])
if len(posts) <= 0:
return """<div id="infinite-scroll-indicator">
<h2>YOU REACHED THE END!</h2>
</div>"""
posts_with_usernames = []
for post in posts:
username = database.fetch("SELECT username FROM user WHERE uid = ?", [post[2]])
posts_with_usernames.append(post + username[0])
return render_template("entry/feed.html", posts=posts_with_usernames)
return render_template("entry/feed.html", posts=posts_with_usernames, page=page)
@app.route("/entry/create", methods=['GET', 'POST'])
def newentry():