Configure admin title and deploy docs
This commit is contained in:
@@ -45,7 +45,7 @@ BASE_DIR = Path(__file__).resolve().parent
|
||||
PROJECT_ROOT = BASE_DIR.parents[1]
|
||||
FAVICON_PATH = PROJECT_ROOT / "favi.png"
|
||||
templates = Jinja2Templates(directory=str(BASE_DIR / "templates"))
|
||||
app = FastAPI(title="VK Parser Admin")
|
||||
app = FastAPI(title=settings.display_admin_title)
|
||||
LOCAL_TZ = ZoneInfo("Asia/Yekaterinburg")
|
||||
MODEL_CACHE: dict[str, Any] = {"key": "", "at": 0.0, "models": []}
|
||||
UPLOAD_ROOT = Path("uploads").resolve()
|
||||
@@ -444,7 +444,7 @@ def require_csrf(user: dict, csrf_token: str) -> None:
|
||||
|
||||
|
||||
def base_context(request: Request, user: dict | None, **extra: Any) -> dict[str, Any]:
|
||||
ctx = {"request": request, "user": user, "app_env": settings.app_env}
|
||||
ctx = {"request": request, "user": user, "app_env": settings.app_env, "app_title": settings.display_admin_title}
|
||||
ctx.update(extra)
|
||||
return ctx
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
class Settings(BaseSettings):
|
||||
app_env: str = "production"
|
||||
app_secret_key: str = "change-me"
|
||||
admin_app_title: str = "Редакторская"
|
||||
admin_bootstrap_login: str = "admin"
|
||||
admin_bootstrap_password: str = ""
|
||||
|
||||
@@ -37,6 +38,10 @@ class Settings(BaseSettings):
|
||||
f"@{self.db_host}:{self.db_port}/{self.db_name}"
|
||||
)
|
||||
|
||||
@property
|
||||
def display_admin_title(self) -> str:
|
||||
return self.admin_app_title.strip() or "Редакторская"
|
||||
|
||||
@property
|
||||
def vk_storage_owner_id(self) -> int:
|
||||
return -abs(int(self.vk_storage_group_id))
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/png" href="/favi.png">
|
||||
<title>{{ title or "VK Parser Admin" }}</title>
|
||||
<title>{{ title or app_title or "Редакторская" }}</title>
|
||||
|
||||
<!-- Fonts: Fira Sans (UI) & Fira Code (Data) -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
@@ -162,8 +162,7 @@
|
||||
<div class="p-4">
|
||||
<div class="flex items-center gap-3 text-app-textMain font-bold text-lg tracking-wide" :class="expanded ? 'justify-between' : 'justify-center'">
|
||||
<div class="flex items-center gap-3 min-w-0">
|
||||
<i data-lucide="zap" class="w-6 h-6 text-app-primary flex-shrink-0"></i>
|
||||
<span x-show="expanded" x-cloak class="truncate">Parser Admin</span>
|
||||
<span x-show="expanded" x-cloak class="truncate">{{ app_title or "Редакторская" }}</span>
|
||||
</div>
|
||||
<button type="button" class="btn btn-ghost btn-icon flex-shrink-0" @click="expanded = !expanded" :aria-label="expanded ? 'Свернуть меню' : 'Развернуть меню'" :title="expanded ? 'Свернуть меню' : 'Развернуть меню'">
|
||||
<i data-lucide="panel-left" class="w-5 h-5"></i>
|
||||
@@ -223,8 +222,7 @@
|
||||
<!-- Mobile Topbar (Visible only on small screens) -->
|
||||
<div class="md:hidden fixed top-0 left-0 right-0 h-16 bg-app-surface border-b border-app-border z-50 flex items-center justify-between px-4">
|
||||
<div class="flex items-center gap-2 font-bold text-app-textMain">
|
||||
<i data-lucide="zap" class="w-5 h-5 text-app-primary"></i>
|
||||
Parser
|
||||
{{ app_title or "Редакторская" }}
|
||||
</div>
|
||||
<button class="btn btn-ghost btn-icon" onclick="document.getElementById('mobile-menu').classList.toggle('hidden')">
|
||||
<i data-lucide="menu" class="w-6 h-6"></i>
|
||||
|
||||
@@ -205,8 +205,7 @@
|
||||
<div>
|
||||
<button class="btn btn-ghost btn-sm text-app-error hover:bg-app-errorBg hover:text-app-error" type="button"
|
||||
hx-post="/editor/{{ p.id }}/reject" hx-target="#post-container-{{ p.id }}" hx-swap="outerHTML"
|
||||
hx-vals='{"csrf_token": "{{ user.csrf_token }}"}'
|
||||
onclick="return confirm('Отклонить пост?')">
|
||||
hx-vals='{"csrf_token": "{{ user.csrf_token }}"}'>
|
||||
<i data-lucide="x" class="w-4 h-4"></i> Отклонить
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user