feat(web): brand logo 'news flow', favicon set and OG image
@@ -52,6 +52,26 @@ tpl = Environment(loader=FileSystemLoader(str(TPL_DIR)))
|
||||
tpl.filters["from_json"] = lambda s: json.loads(s or "[]")
|
||||
|
||||
|
||||
@app.get("/favicon.ico", include_in_schema=False)
|
||||
def favicon() -> FileResponse:
|
||||
"""Фавикон по корневому пути: браузеры спрашивают его всегда, /static/img — не всегда."""
|
||||
return FileResponse(STATIC_DIR / "img" / "favicon.ico", media_type="image/x-icon")
|
||||
|
||||
|
||||
@app.middleware("http")
|
||||
async def static_no_cache(request: Request, call_next):
|
||||
"""Статика без хешей в имени: браузер обязан перепроверять её (304 дёшев).
|
||||
|
||||
Без Cache-Control браузер применяет эвристику (доля от возраста файла) и может
|
||||
показать старый CSS после деплоя — уже случалось при переходе с Bootstrap.
|
||||
"""
|
||||
response = await call_next(request)
|
||||
path = request.url.path
|
||||
if path.startswith("/static/") or path == "/favicon.ico":
|
||||
response.headers.setdefault("Cache-Control", "no-cache")
|
||||
return response
|
||||
|
||||
|
||||
def md_filter(text: str) -> Markup:
|
||||
"""Markdown → безопасный HTML (экранируем HTML до парсинга, XSS-safe)."""
|
||||
if not text:
|
||||
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 788 B |
|
After Width: | Height: | Size: 660 B |
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">
|
||||
<rect width="32" height="32" rx="7" fill="#000000"/>
|
||||
<rect x="7" y="9" width="18" height="4" rx="2" fill="#FFFFFF"/>
|
||||
<rect x="7" y="15" width="14" height="4" rx="2" fill="#FFFFFF"/>
|
||||
<rect x="7" y="21" width="20" height="4" rx="2" fill="#00A6F4"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 346 B |
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 80" width="320" height="80" role="img" aria-label="вести — новостной конвейер">
|
||||
<!-- Знак: полосы (currentColor), нижняя — фирменная синяя -->
|
||||
<rect x="12" y="14" width="56" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="12" y="34" width="44" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="12" y="54" width="64" height="12" rx="3" fill="#00A6F4"/>
|
||||
<!-- Слово -->
|
||||
<text x="96" y="46" font-family="Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif"
|
||||
font-size="34" font-weight="800" fill="currentColor" letter-spacing="-1">вести</text>
|
||||
<!-- Подпись -->
|
||||
<text x="98" y="64" font-family="Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif"
|
||||
font-size="13" fill="currentColor" opacity="0.6" letter-spacing="2">НОВОСТНОЙ КОНВЕЙЕР</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 962 B |
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 232 56" width="232" height="56" role="img" aria-label="вести — новостной конвейер">
|
||||
<!-- Знак: полосы (currentColor), нижняя — фирменная синяя -->
|
||||
<rect x="0" y="4" width="56" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="0" y="22" width="44" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="0" y="40" width="64" height="12" rx="3" fill="#00A6F4"/>
|
||||
<!-- Текст -->
|
||||
<text x="80" y="41" font-family="Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif"
|
||||
font-size="34" font-weight="800" fill="currentColor" letter-spacing="-1">вести</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 706 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 52" width="64" height="52" role="img" aria-label="вести">
|
||||
<rect x="0" y="0" width="56" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="0" y="20" width="44" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="0" y="40" width="64" height="12" rx="3" fill="#00A6F4"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 339 B |
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,44 @@
|
||||
{% macro logo(variant='header', cls='') -%}
|
||||
{%- if variant == 'mark' -%}
|
||||
<svg class="h-7 w-auto {{ cls }}" viewBox="0 0 64 52" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
||||
<rect x="0" y="0" width="56" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="0" y="20" width="44" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="0" y="40" width="64" height="12" rx="3" fill="#00A6F4"/>
|
||||
</svg>
|
||||
{%- elif variant == 'header' -%}
|
||||
<svg class="h-9 w-auto {{ cls }}" viewBox="0 0 232 56" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
||||
<rect x="0" y="4" width="56" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="0" y="22" width="44" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="0" y="40" width="64" height="12" rx="3" fill="#00A6F4"/>
|
||||
<text x="80" y="41" font-family="Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif"
|
||||
font-size="34" font-weight="800" fill="currentColor" letter-spacing="-1">вести</text>
|
||||
</svg>
|
||||
{%- else -%}
|
||||
<svg class="h-14 w-auto {{ cls }}" viewBox="0 0 320 80" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
||||
<rect x="12" y="14" width="56" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="12" y="34" width="44" height="12" rx="3" fill="currentColor"/>
|
||||
<rect x="12" y="54" width="64" height="12" rx="3" fill="#00A6F4"/>
|
||||
<text x="96" y="46" font-family="Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif"
|
||||
font-size="34" font-weight="800" fill="currentColor" letter-spacing="-1">вести</text>
|
||||
<text x="98" y="64" font-family="Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif"
|
||||
font-size="13" fill="currentColor" opacity="0.6" letter-spacing="2">НОВОСТНОЙ КОНВЕЙЕР</text>
|
||||
</svg>
|
||||
{%- endif -%}
|
||||
{%- endmacro %}
|
||||
|
||||
{# Иконки вкладки и OG-мета: одинаковы для всех страниц. #}
|
||||
{% macro head_brand(title, description) -%}
|
||||
<link rel="icon" href="/favicon.ico" sizes="32x32">
|
||||
<link rel="icon" type="image/svg+xml" href="/static/img/favicon.svg">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/img/favicon-32.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/img/favicon-dark-32.png" media="(prefers-color-scheme: dark)">
|
||||
<link rel="apple-touch-icon" href="/static/img/apple-touch-icon.png">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:site_name" content="вести">
|
||||
<meta property="og:title" content="{{ title }}">
|
||||
<meta property="og:description" content="{{ description }}">
|
||||
<meta property="og:image" content="https://vesti.nixg.ru/static/img/og.png">
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="630">
|
||||
{%- endmacro %}
|
||||
@@ -4,12 +4,17 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>VESTI — {% block title %}Управление{% endblock %}</title>
|
||||
{% from '_logo.html' import logo, head_brand %}
|
||||
{{ head_brand('вести — новостной конвейер', 'Отбор, перевод и публикация новостей') }}
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<body class="bg-neutral-100 text-neutral-900" data-page="{% block page %}x{% endblock %}">
|
||||
<header class="sticky top-0 z-40 bg-neutral-900 text-neutral-100 shadow-sm">
|
||||
<div class="flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2">
|
||||
<a class="font-semibold no-underline text-white whitespace-nowrap" href="/candidates">📰 VESTI</a>
|
||||
<a class="no-underline text-white whitespace-nowrap" href="/candidates" aria-label="вести — новостной конвейер">
|
||||
{{ logo('mark', 'sm:hidden') }}
|
||||
{{ logo('header', 'hidden sm:block') }}
|
||||
</a>
|
||||
<nav class="flex flex-wrap items-center gap-x-3 gap-y-1 text-sm">
|
||||
<a class="no-underline text-neutral-300 hover:text-white" href="/candidates">Кандидаты</a>
|
||||
<a class="no-underline text-neutral-300 hover:text-white" href="/selected">⭐ Отобранные</a>
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>VESTI — Вход</title>
|
||||
{% from '_logo.html' import logo, head_brand %}
|
||||
{{ head_brand('вести — вход', 'Новостной конвейер: вход в панель управления') }}
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<body class="bg-neutral-100 flex items-center justify-center min-h-screen">
|
||||
<div class="w-full max-w-sm px-4">
|
||||
<div class="card card-outline shadow-sm">
|
||||
<div class="card-content">
|
||||
<h4 class="card-title text-lg mb-4">📰 VESTI — вход</h4>
|
||||
<h1 class="card-title mb-4 text-neutral-900" aria-label="вести — вход">{{ logo('full') }}</h1>
|
||||
{% if request.query_params.get('error') %}<div class="alert alert-error mb-4">Неверный пароль</div>{% endif %}
|
||||
<form method="post" action="/login" class="flex flex-col gap-4">
|
||||
<div class="flex flex-col gap-2">
|
||||
|
||||