about page (start work)
This commit is contained in:
parent
46d1d7b307
commit
aeb1403a6c
4 changed files with 37 additions and 2 deletions
10
app/app.py
10
app/app.py
|
@ -10,6 +10,8 @@ from sqlalchemy.orm import scoped_session,sessionmaker
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.sql import text
|
from sqlalchemy.sql import text
|
||||||
|
|
||||||
|
import git
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('config.ini')
|
config.read('config.ini')
|
||||||
|
|
||||||
|
@ -26,6 +28,9 @@ db = scoped_session(sessionmaker(bind=engine))
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
repo = git.Repo(search_parent_directories=True)
|
||||||
|
sha = repo.head.object.hexsha
|
||||||
|
|
||||||
class User(Base):
|
class User(Base):
|
||||||
__tablename__ = 'users'
|
__tablename__ = 'users'
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
|
@ -105,7 +110,7 @@ def register():
|
||||||
{"username": username, "password": password})
|
{"username": username, "password": password})
|
||||||
db.commit()
|
db.commit()
|
||||||
return redirect('/auth/login/') # redirect to login page after successful registration
|
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/')
|
@app.route('/auth/logout/')
|
||||||
def logout():
|
def logout():
|
||||||
|
@ -120,6 +125,9 @@ def private_profile():
|
||||||
def index_css():
|
def index_css():
|
||||||
return send_from_directory('static/assets/css', '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_dirs = ['app/templates', 'static/assets/css']
|
||||||
extra_files = extra_dirs[:]
|
extra_files = extra_dirs[:]
|
||||||
|
|
25
app/templates/about.j2
Normal file
25
app/templates/about.j2
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{% from 'header.j2' import header_home %}
|
||||||
|
{% from 'imports.j2' import imports_main %}
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>{{ instanceBranding }} - Register</title>
|
||||||
|
{{ imports_main() }}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{ header_home() }}
|
||||||
|
<div style="text-align:center">
|
||||||
|
<h1>
|
||||||
|
NyxAsk at {{ instanceBranding }}
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
NyxAsk version {{ version }} (commit {{ commit }})
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Source code: <a href="https://git.everypizza.im/n/nyxask/">https://git.everypizza.im/n/nyxask/</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Made with <3 by Nyx Tutt. Licensed under the Unlicense.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,3 +1,4 @@
|
||||||
flask
|
flask
|
||||||
flask-sqlalchemy
|
flask-sqlalchemy
|
||||||
psycopg2
|
psycopg2
|
||||||
|
gitpython
|
|
@ -7,6 +7,7 @@ in pkgs.mkShell {
|
||||||
flask
|
flask
|
||||||
flask-sqlalchemy
|
flask-sqlalchemy
|
||||||
psycopg2
|
psycopg2
|
||||||
|
gitpython
|
||||||
]))
|
]))
|
||||||
];
|
];
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue