feat: differentiate between commit and html-formatted commit
This commit is contained in:
@@ -17,7 +17,7 @@ def index():
|
|||||||
}
|
}
|
||||||
return render_template('index.html', goals=stats['goals'], assists=stats['assists'],
|
return render_template('index.html', goals=stats['goals'], assists=stats['assists'],
|
||||||
matches=stats['matches'], matches_list=stats['matches_list'],
|
matches=stats['matches'], matches_list=stats['matches_list'],
|
||||||
commit=lewy_globals.getCommit())
|
commit_in_html=lewy_globals.getCommitInFormattedHTML())
|
||||||
|
|
||||||
@app.route('/mecze')
|
@app.route('/mecze')
|
||||||
def mecze():
|
def mecze():
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
from git import Repo # hash ostatniego commitu
|
from git import Repo # hash ostatniego commitu
|
||||||
|
|
||||||
def getCommit():
|
def getCommit():
|
||||||
repo = "<p>Brak informacji o wersji skryptu</p>"
|
|
||||||
try:
|
try:
|
||||||
repo = Repo(search_parent_directories=True).head.object.hexsha
|
return Repo(search_parent_directories=True).head.object.hexsha
|
||||||
repo = f"<p>Commit: <a href='https://gitea.7o7.cx/roberteam/lewangoalski/commit/{repo}'>{repo[:11]}</a></p>"
|
|
||||||
except:
|
except:
|
||||||
pass
|
return None
|
||||||
|
|
||||||
|
def getCommitInFormattedHTML():
|
||||||
|
repo = "<p>Brak informacji o wersji skryptu</p>"
|
||||||
|
commit = getCommit()
|
||||||
|
|
||||||
|
if commit is not None:
|
||||||
|
repo = f"<p>Commit: <a href='https://gitea.7o7.cx/roberteam/lewangoalski/commit/{commit}'>{commit[:11]}</a></p>"
|
||||||
|
|
||||||
return repo
|
return repo
|
||||||
@@ -3,13 +3,13 @@ from FlaskWebProject import app
|
|||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
# Odczyt ciasteczka "darkMode" <EFBFBD> domy<EFBFBD>lnie "disabled"
|
# Odczyt ciasteczka "darkMode" – domyślnie "disabled"
|
||||||
dark_mode = request.cookies.get('darkMode', 'disabled')
|
dark_mode = request.cookies.get('darkMode', 'disabled')
|
||||||
return render_template('index.html', dark_mode=dark_mode)
|
return render_template('index.html', dark_mode=dark_mode)
|
||||||
|
|
||||||
@app.route('/toggle_dark_mode')
|
@app.route('/toggle_dark_mode')
|
||||||
def toggle_dark_mode():
|
def toggle_dark_mode():
|
||||||
# Prze<EFBFBD><EFBFBD>cz tryb i zapisz w ciasteczku
|
# Przełącz tryb i zapisz w ciasteczku
|
||||||
dark_mode = request.cookies.get('darkMode', 'disabled')
|
dark_mode = request.cookies.get('darkMode', 'disabled')
|
||||||
new_mode = 'enabled' if dark_mode == 'disabled' else 'disabled'
|
new_mode = 'enabled' if dark_mode == 'disabled' else 'disabled'
|
||||||
response = make_response("OK")
|
response = make_response("OK")
|
||||||
|
|||||||
@@ -14,5 +14,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block footer %}
|
{% block footer %}
|
||||||
{{ commit | safe }}
|
{{ commit_in_html | safe }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user