Adds a counter of indexed torrents on the homepage
This commit is contained in:
parent
f9cb28f31a
commit
28109eb586
@ -67,7 +67,17 @@ def requires_auth(f):
|
|||||||
@app.route("/")
|
@app.route("/")
|
||||||
@requires_auth
|
@requires_auth
|
||||||
def home_page():
|
def home_page():
|
||||||
return flask.render_template("homepage.html")
|
magneticod_db = get_magneticod_db()
|
||||||
|
context = {}
|
||||||
|
|
||||||
|
with magneticod_db:
|
||||||
|
cur = magneticod_db.execute(
|
||||||
|
"SELECT"
|
||||||
|
" count(id) "
|
||||||
|
"FROM torrents ;")
|
||||||
|
context["counter"] = cur.fetchall()
|
||||||
|
|
||||||
|
return flask.render_template("homepage.html",**context)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/torrents/")
|
@app.route("/torrents/")
|
||||||
|
@ -21,3 +21,10 @@ main form input {
|
|||||||
main > div {
|
main > div {
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin-top: 0.833em;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
@ -15,5 +15,9 @@
|
|||||||
<input type="search" name="search" placeholder="Search the BitTorrent DHT" autofocus>
|
<input type="search" name="search" placeholder="Search the BitTorrent DHT" autofocus>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<div>Now with {{counter[0][0]}} torrents available !</div>
|
||||||
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user