diff --git a/accounts/templates/common/components/footer.html b/accounts/templates/common/components/footer.html index 2004b55..e82e052 100644 --- a/accounts/templates/common/components/footer.html +++ b/accounts/templates/common/components/footer.html @@ -2,20 +2,6 @@ diff --git a/accounts/views.py b/accounts/views.py index db39aaf..338d619 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -23,6 +23,7 @@ from django.http import HttpResponse from django.views.decorators.csrf import csrf_protect from django.urls import reverse +from dash.utils import footer_ctx from .models import AccountConfirmChallenge from .utils import send_verification_email, ConfirmAccess @@ -35,6 +36,7 @@ def login_view(request): def default_login_ctx(): return { "title": "Login", + "footer": footer_ctx(), } if request.method == "GET": @@ -102,6 +104,7 @@ def register_view(request): "title": "Register", "username": username, "email": username, + "footer": footer_ctx(), } if request.method == "GET": @@ -213,6 +216,7 @@ def sudo(request): def default_login_ctx(): return { "title": "Confirm Access", + "footer": footer_ctx(), } if request.method == "GET": diff --git a/billing/views.py b/billing/views.py index d3cf5ed..d4ab2d3 100644 --- a/billing/views.py +++ b/billing/views.py @@ -24,6 +24,7 @@ from payments import get_payment_model, RedirectNeeded, PaymentStatus from dash.models import Instance from django.db.models import Q from infrastructure.utils import create_vm_if_not_exists +from dash.utils import footer_ctx def default_ctx(title: str, username: str): @@ -33,6 +34,7 @@ def default_ctx(title: str, username: str): return { "title": title, "username": username, + "footer": footer_ctx(), } diff --git a/dash/utils.py b/dash/utils.py index 2f3e3d6..99d45d0 100644 --- a/dash/utils.py +++ b/dash/utils.py @@ -14,7 +14,9 @@ # along with this program. If not, see . from enum import Enum, unique +from git import Repo from django.contrib.auth.models import User +from django.conf import settings from .models import Instance, InstanceConfiguration @@ -55,3 +57,23 @@ def create_instance(vm_name: str, configuration_name: str, user: User) -> Instan instance = Instance(name=vm_name, configuration_id=configuration, owned_by=user) instance.save() return instance + + +source_code = None + + +def footer_ctx(): + global source_code + if source_code is None: + source_code = {"text": "Source Code", "link": settings.HOSTEA["SOURCE_CODE"]} + try: + r = Repo(".") + commit = r.head.commit.hexsha + source_code["text"] = f"v-{commit.hexsha[0:8]}" + except: + pass + + return { + "source_code": source_code, + "admin_email": settings.HOSTEA["INSTANCE_MAINTAINER_CONTACT"], + } diff --git a/dash/views.py b/dash/views.py index 8ab7130..89825eb 100644 --- a/dash/views.py +++ b/dash/views.py @@ -25,7 +25,12 @@ from accounts.decorators import confirm_access from infrastructure.utils import Infra from .models import Instance, InstanceConfiguration -from .utils import create_instance as create_instance_util, VmErrors, VmException +from .utils import ( + create_instance as create_instance_util, + VmErrors, + VmException, + footer_ctx, +) def default_ctx(title: str, username: str): @@ -36,6 +41,7 @@ def default_ctx(title: str, username: str): "title": title, "username": username, "open_instances": "open", + "footer": footer_ctx(), } diff --git a/infrastructure/views.py b/infrastructure/views.py index 8d5c7ad..37a3292 100644 --- a/infrastructure/views.py +++ b/infrastructure/views.py @@ -62,7 +62,7 @@ your new Gitea instance. Great powers come with great responsibilities, so use the admin credentials wisely. When in doubt, consult the Gitea docs or contact support!\n - -username : root + - username : root - password: {gitea_password} """, from_email="No reply Hostea", # TODO read from settings.py diff --git a/static/css/main.css b/static/css/main.css index 4b633f9..d32d1d2 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -34,11 +34,9 @@ h2 { body { width: 100%; min-height: 100vh; - /* display: flex; flex-direction: column; justify-content: space-between; - */ } a:hover { @@ -244,6 +242,8 @@ footer { display: block; font-size: 0.7rem; margin-bottom: 5px; + margin-left: 260px; + width: 100%; } .footer__container { @@ -391,6 +391,8 @@ footer { font-size: 0.7rem; padding: 0; margin: 0; + margin-left: 260px; + width: calc(100vw - 260px); } .footer__container { @@ -607,8 +609,6 @@ fieldset { background-color: #e11d21; } - - /* .form__label { margin: 5px 0; diff --git a/support/views.py b/support/views.py index 0011745..2ad6b69 100644 --- a/support/views.py +++ b/support/views.py @@ -15,6 +15,7 @@ from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required +from dash.utils import footer_ctx from .utils import IssueTracker @@ -28,6 +29,7 @@ def default_ctx(title: str, username: str): "username": username, "open_support": "open", "support": {"list": it.get_issue_tracker(), "new": it.open_issue()}, + "footer": footer_ctx(), }