diff --git a/app/app.py b/app/app.py index 41cb9ed..d1ce0ff 100644 --- a/app/app.py +++ b/app/app.py @@ -10,6 +10,8 @@ from sqlalchemy.orm import scoped_session,sessionmaker from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.sql import text +import git + config = configparser.ConfigParser() config.read('config.ini') @@ -26,6 +28,9 @@ db = scoped_session(sessionmaker(bind=engine)) Base = declarative_base() +repo = git.Repo(search_parent_directories=True) +sha = repo.head.object.hexsha + class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) @@ -105,7 +110,7 @@ def register(): {"username": username, "password": password}) db.commit() return redirect('/auth/login/') # redirect to login page after successful registration - return render_template('register.j2', instanceLocation=instanceLocation, instanceBranding=instanceBranding) + return render_template('register.j2', instanceLocation=instanceLocation, instanceBranding=instanceBranding, commit=str(sha)) @app.route('/auth/logout/') def logout(): @@ -120,6 +125,9 @@ def private_profile(): def index_css(): return send_from_directory('static/assets/css', 'index.css') +@app.route('/about') +def about(): + return render_template('about.j2', version="0.0.0", instanceBranding=instanceBranding) extra_dirs = ['app/templates', 'static/assets/css'] extra_files = extra_dirs[:] diff --git a/app/templates/about.j2 b/app/templates/about.j2 new file mode 100644 index 0000000..bada6e2 --- /dev/null +++ b/app/templates/about.j2 @@ -0,0 +1,25 @@ +{% from 'header.j2' import header_home %} +{% from 'imports.j2' import imports_main %} + + + {{ instanceBranding }} - Register + {{ imports_main() }} + + + {{ header_home() }} +
+

+ NyxAsk at {{ instanceBranding }} +

+

+ NyxAsk version {{ version }} (commit {{ commit }}) +

+

+ Source code: https://git.everypizza.im/n/nyxask/ +

+

+ Made with <3 by Nyx Tutt. Licensed under the Unlicense. +

+
+ + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 3b5a9d0..2f4e86f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ flask flask-sqlalchemy -psycopg2 \ No newline at end of file +psycopg2 +gitpython \ No newline at end of file diff --git a/shell.nix b/shell.nix index 8ba2e7e..51c1ed5 100644 --- a/shell.nix +++ b/shell.nix @@ -7,6 +7,7 @@ in pkgs.mkShell { flask flask-sqlalchemy psycopg2 + gitpython ])) ]; } \ No newline at end of file