Merge pull request #24 from g-goessel/add_index_counter

Adds a counter of indexed torrents on the homepage
This commit is contained in:
Bora M. Alper 2017-04-14 00:14:10 +04:00 committed by GitHub
commit 98fac967d2
3 changed files with 20 additions and 3 deletions

View File

@ -67,7 +67,13 @@ def requires_auth(f):
@app.route("/")
@requires_auth
def home_page():
return flask.render_template("homepage.html")
magneticod_db = get_magneticod_db()
with magneticod_db:
cur = magneticod_db.execute("SELECT count() FROM torrents ;")
n_torrents = cur.fetchone()[0]
return flask.render_template("homepage.html", n_torrents=n_torrents)
@app.route("/torrents/")

View File

@ -20,4 +20,11 @@ main form input {
main > div {
margin-right: 0.5em;
}
}
footer {
margin-top: 0.833em;
display: flex;
justify-content: space-between;
}

View File

@ -15,5 +15,9 @@
<input type="search" name="search" placeholder="Search the BitTorrent DHT" autofocus>
</form>
</main>
<footer>
Now with {{n_torrents}} torrents available !
</footer>
</body>
</html>
</html>