Fixed index name too long. Added icon and fixed unfold branding

This commit is contained in:
2026-01-26 16:41:16 +00:00
parent e693a7616c
commit ed2f921b0f
6 changed files with 92 additions and 40 deletions

View File

@@ -70,6 +70,6 @@ class Migration(migrations.Migration):
),
migrations.AddIndex(
model_name="erasurerequest",
index=models.Index(fields=["user", "status"], name="accounts_erasure_user_status_idx"),
index=models.Index(fields=["user", "status"], name="accounts_er_user_status_idx"),
),
]

View File

@@ -45,7 +45,7 @@ class ErasureRequest(models.Model):
ordering = ["-requested_at"]
indexes = [
models.Index(fields=["status", "requested_at"], name="accounts_erasure_status_idx"),
models.Index(fields=["user", "status"], name="accounts_erasure_user_status_idx"),
models.Index(fields=["user", "status"], name="accounts_er_user_status_idx"),
]
def __str__(self) -> str:

View File

@@ -3,6 +3,7 @@ from pathlib import Path
from dotenv import load_dotenv
from django.urls import reverse_lazy
from django.templatetags.static import static
from django.utils.translation import gettext_lazy as _
load_dotenv()
@@ -46,7 +47,8 @@ INSTALLED_APPS = [
"ninja", # Django Ninja API
"mozilla_django_oidc", # OIDC Client
"tailwind",
"theme"
"theme",
"keywarden"
]
MIDDLEWARE = [
@@ -141,8 +143,25 @@ TEMPLATES = [
# AUTHENTICATION_BACKENDS is configured dynamically below based on KEYWARDEN_AUTH_MODE
UNFOLD = {
"SITE_TITLE": "Keywarden Admin",
"SITE_ICON": lambda request: static("branding/keywarden-favicon.svg"),
"SITE_LOGO": lambda request: static("branding/keywarden-favicon.svg"),
"SITE_TITLE": "Admin - Keywarden",
"SITE_HEADER": "Keywarden",
"SITE_FAVICONS": [
{
"rel": "icon",
"sizes": "32x32",
"type": "image/svg+xml",
"href": lambda request: static("branding/keywarden-favicon.svg"),
},
],
"SITE_DROPDOWN": [
{
"icon": "diamond",
"title": _("Gitea"),
"link": "https://git.ntbx.io/boris/keywarden",
},
],
"SHOW_HISTORY": True,
"SITE_URL": "/",
"LOGIN_REDIRECT_URL": "/admin/",
@@ -170,39 +189,39 @@ UNFOLD = {
"STYLES": [
"/static/unfold/css/styles.css",
"/static/unfold/css/simplebar.css",
(lambda request: "/static/unfold/css/keywarden.css"),
],
"TABS": [
{
"models": [
"auth.User",
],
"items": [
{
"title": _("Logs"),
"link": reverse_lazy("admin:audit_auditlog_changelist"),
"attrs": {"hx-boost": "true"},
},
{
"title": _("Event Types"),
"link": reverse_lazy("admin:audit_auditeventtype_changelist"),
"attrs": {"hx-boost": "true"},
},
],
},
{
"models": [
"servers.Server",
],
"items": [
{
"title": _("Servers"),
"link": reverse_lazy("admin:servers_server_changelist"),
"attrs": {"hx-boost": "true"},
},
],
},
#(lambda request: "/static/unfold/css/keywarden.css"),
],
# "TABS": [
# {
# "models": [
# "auth.User",
# ],
# "items": [
# {
# "title": _("Logs"),
# "link": reverse_lazy("admin:audit_auditlog_changelist"),
# "attrs": {"hx-boost": "true"},
# },
# {
# "title": _("Event Types"),
# "link": reverse_lazy("admin:audit_auditeventtype_changelist"),
# "attrs": {"hx-boost": "true"},
# },
# ],
# },
# {
# "models": [
# "servers.Server",
# ],
# "items": [
# {
# "title": _("Servers"),
# "link": reverse_lazy("admin:servers_server_changelist"),
# "attrs": {"hx-boost": "true"},
# },
# ],
# },
# ],
}
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR/"media"

View File

@@ -0,0 +1,27 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Keywarden favicon">
<defs>
<linearGradient id="kw-bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#140b24" />
<stop offset="1" stop-color="#2d1b4a" />
</linearGradient>
<linearGradient id="kw-vault" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#8b5cf6" />
<stop offset="1" stop-color="#6d28d9" />
</linearGradient>
</defs>
<rect x="4" y="4" width="56" height="56" rx="14" fill="url(#kw-bg)" />
<rect x="10" y="10" width="44" height="44" rx="14" fill="#3b1f6b" />
<circle cx="32" cy="32" r="20" fill="url(#kw-vault)" />
<circle cx="32" cy="32" r="15" fill="none" stroke="#e9d5ff" stroke-width="2" opacity="0.85" />
<circle cx="32" cy="32" r="2.6" fill="#f5f3ff" />
<rect x="31.3" y="25" width="1.4" height="14" rx="0.7" fill="#f5f3ff" />
<rect x="25" y="31.3" width="14" height="1.4" rx="0.7" fill="#f5f3ff" />
<circle cx="32" cy="14" r="2" fill="#d9a441" />
<circle cx="49.1" cy="26.4" r="2" fill="#d7c24a" />
<circle cx="42.6" cy="46.6" r="2" fill="#9bbb3c" />
<circle cx="21.4" cy="46.6" r="2" fill="#4fbf7a" />
<circle cx="14.9" cy="26.4" r="2" fill="#35a6a1" />
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -6,16 +6,21 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{% block title %}Keywarden{% endblock %}</title>
<link rel="icon" type="image/svg+xml" href="{% static 'branding/keywarden-favicon.svg' %}">
<link rel="icon" type="image/png" href="{% static 'ninja/favicon.png' %}">
<meta name="theme-color" content="#0b1f24">
<meta property="og:title" content="Keywarden">
<meta name="twitter:card" content="summary">
{% tailwind_css %}
</head>
<body class="min-h-screen bg-gray-50 text-gray-900 antialiased">
<div class="min-h-screen flex flex-col">
<header class="border-b border-gray-200 bg-white">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div class="flex h-16 items-center justify-between">
<div class="flex h-20 items-center justify-between">
<a href="/" class="inline-flex items-center gap-2">
<span class="inline-flex h-8 w-8 items-center justify-center rounded-md bg-purple-600 text-white font-semibold">K</span>
<span class="text-lg font-semibold tracking-tight">Keywarden</span>
<img src="{% static 'branding/keywarden-favicon.svg' %}" alt="Keywarden logo" class="h-10 w-10">
<span class="text-2xl font-semibold tracking-tight">Keywarden</span>
</a>
<nav class="flex items-center gap-4">
{% if request.user.is_authenticated %}
@@ -42,4 +47,3 @@
</div>
</body>
</html>

View File

@@ -5,6 +5,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title|default:"Keywarden API" }}</title>
<link rel="icon" type="image/svg+xml" href="{% static 'branding/keywarden-favicon.svg' %}">
<link rel="icon" type="image/png" href="{% static 'ninja/favicon.png' %}">
<link rel="stylesheet" href="{% static 'ninja/swagger-ui.css' %}">
<style>
.swagger-ui .opblock-summary {