diff --git a/partitioncloud/__init__.py b/partitioncloud/__init__.py index da1dc38..7ac8f61 100644 --- a/partitioncloud/__init__.py +++ b/partitioncloud/__init__.py @@ -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""" diff --git a/partitioncloud/static/mobile.css b/partitioncloud/static/mobile.css index 774f756..c68e7ac 100644 --- a/partitioncloud/static/mobile.css +++ b/partitioncloud/static/mobile.css @@ -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; } } diff --git a/partitioncloud/static/style.css b/partitioncloud/static/style.css index 9fd6292..28da7b8 100644 --- a/partitioncloud/static/style.css +++ b/partitioncloud/static/style.css @@ -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; diff --git a/partitioncloud/templates/base.html b/partitioncloud/templates/base.html index 8cc5c2e..d3b8a1c 100644 --- a/partitioncloud/templates/base.html +++ b/partitioncloud/templates/base.html @@ -2,7 +2,7 @@
- +