mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-01-23 09:16:25 +01:00
Add a footer with version+repo link
This commit is contained in:
parent
89995f6419
commit
20eb87dca2
@ -3,6 +3,7 @@
|
||||
Main file
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from flask import Flask, g, redirect, render_template, request, send_file, flash, session, abort
|
||||
from werkzeug.security import generate_password_hash
|
||||
@ -29,6 +30,13 @@ app.register_blueprint(albums.bp)
|
||||
app.register_blueprint(partition.bp)
|
||||
|
||||
|
||||
try:
|
||||
result = subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE)
|
||||
__version__ = result.stdout.decode('utf8')
|
||||
except FileNotFoundError: # In case git not found, which would be strange
|
||||
__version__ = "unknown"
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def home():
|
||||
"""Redirect to home"""
|
||||
@ -108,6 +116,13 @@ def search_thumbnail(uuid):
|
||||
return send_file(os.path.join(app.static_folder, "search-thumbnails", f"{uuid}.jpg"))
|
||||
|
||||
|
||||
@app.context_processor
|
||||
def inject_default_variables():
|
||||
if __version__ == "unknown":
|
||||
return dict(version="")
|
||||
return dict(version=__version__)
|
||||
|
||||
|
||||
@app.after_request
|
||||
def after_request(response):
|
||||
"""Automatically close db after each request"""
|
||||
|
@ -7,8 +7,11 @@
|
||||
min-width: calc(100vw - 100px);
|
||||
}
|
||||
|
||||
/* Make content not scrollable */
|
||||
#content-container {
|
||||
/* Make content not scrollable (vertically),
|
||||
do not collapse thing in a ridiculously small space */
|
||||
#content-container, #footer {
|
||||
overflow: hidden;
|
||||
min-width: 90vw;
|
||||
position: fixed;
|
||||
}
|
||||
}
|
||||
|
@ -141,6 +141,25 @@ body {
|
||||
padding: 0 25px;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: var(--sidebar-size);
|
||||
|
||||
background-color: var(--color-base);
|
||||
-moz-transition: left 0.5s ease;
|
||||
transition: left 0.5s ease;
|
||||
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.album-cover {
|
||||
padding: 5px;
|
||||
margin: 5px;
|
||||
@ -180,6 +199,11 @@ input:checked#slide-sidebar~#content-container {
|
||||
overflow: unset;
|
||||
}
|
||||
|
||||
input:checked#slide-sidebar~#footer {
|
||||
left: 0;
|
||||
overflow: unset;
|
||||
}
|
||||
|
||||
input:checked#slide-sidebar~#sidebar {
|
||||
display: none;
|
||||
transition: display 0s 0.5s;
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>{% block title %}{% endblock %} - PartitionCloud</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
@ -135,6 +135,7 @@
|
||||
{% block content %}{% endblock %}
|
||||
</section>
|
||||
</div>
|
||||
<div id="footer"><a href="https://github.com/partitioncloud/partitioncloud-server">PartitionCloud</a> {{ version }}</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="{{ url_for('static', filename='main.js') }}"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user