Skip to content

Commit

Permalink
Add about page
Browse files Browse the repository at this point in the history
show running version, source code, license, etc
Not shown in navbar if there is no space (mobile device)
  • Loading branch information
kmille committed Jun 25, 2024
1 parent ec3d23b commit b603d21
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
16 changes: 15 additions & 1 deletion freetar/backend.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import waitress
from flask import Flask, render_template, request
from flask_minify import Minify

from freetar.ug import ug_search, ug_tab
import waitress
from freetar.utils import get_version


app = Flask(__name__)
Minify(app=app, html=True, js=True, cssless=True)


@app.context_processor
def export_variables():
return {
'version': get_version(),
}


@app.route("/")
def index():
return render_template("index.html", favs=True)
Expand Down Expand Up @@ -49,6 +58,11 @@ def show_favs():
favs=True)


@app.route("/about")
def show_about():
return render_template('about.html')


def main():
host = "0.0.0.0"
port = 22000
Expand Down
12 changes: 12 additions & 0 deletions freetar/templates/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "base.html" %}
{% block content %}

<div>
<strong>freetar</strong> is an open source alternative front-end to ultimate-guitar.com<br>
Running version v{{ version }}<br>
License: <a href="https://github.com/kmille/freetar/blob/main/LICENSE">GPL 3.0</a><br>
Source Code: <a href="https://github.com/kmille/freetar">https://github.com/kmille/freetar</a><br>
Any problems? Wishes? Create an <a href="https://github.com/kmille/freetar/issues/new">issue</a>.<br>
</div>

{% endblock %}
7 changes: 7 additions & 0 deletions freetar/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{% import 'macros.j2' as macros %}



<head>
<!-- Required meta tags -->
<meta charset="utf-8">
Expand All @@ -20,6 +21,7 @@
<meta property="og:type" content=website>
<meta property="og:image" content=https://freetar.de/static/guitar.png>


<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
Expand Down Expand Up @@ -53,6 +55,11 @@
<span class="d-inline d-md-none">Favs</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">
<span class="d-none d-md-inline">About</span>
</a>
</li>
<li class="nav-item ms-4">
<a class="nav-link">
<span role="button" title="enable/disable dark mode" id="dark_mode">
Expand Down
5 changes: 5 additions & 0 deletions freetar/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import importlib.metadata


def get_version():
return importlib.metadata.version(__package__)

0 comments on commit b603d21

Please sign in to comment.