favicons
This commit is contained in:
@@ -30,7 +30,6 @@ def _wants_json_response() -> bool:
|
||||
|
||||
|
||||
def register_error_pages(app: Flask) -> None:
|
||||
# Notatka: własne strony błędów zastępują generyczne 404/500 i zachowują JSON dla API.
|
||||
@app.errorhandler(404)
|
||||
def not_found(error):
|
||||
if _wants_json_response():
|
||||
@@ -92,7 +91,6 @@ def create_app() -> Flask:
|
||||
return url_for("static", filename=filename)
|
||||
|
||||
def frontend_asset_url(key: str) -> str:
|
||||
# Notatka: helper przełącza szablony między CDN i lokalnymi plikami bez duplikowania logiki.
|
||||
path = asset_path(key)
|
||||
return path if path.startswith("http") else static_url(path)
|
||||
|
||||
@@ -108,12 +106,16 @@ def create_app() -> Flask:
|
||||
|
||||
@app.after_request
|
||||
def cache_headers(response):
|
||||
response.headers.pop('Content-Disposition', None)
|
||||
|
||||
if request.endpoint == "static":
|
||||
response.headers.pop("Content-Disposition", None)
|
||||
|
||||
static_file = request.path.startswith("/static/")
|
||||
tracker_icon = request.path.startswith("/static/tracker_favicons/")
|
||||
|
||||
if static_file and not tracker_icon:
|
||||
response.headers["Cache-Control"] = "public, max-age=31536000, immutable"
|
||||
else:
|
||||
response.headers["Cache-Control"] = "no-store, private"
|
||||
|
||||
return response
|
||||
|
||||
from .routes.main import bp as main_bp
|
||||
|
||||
@@ -9,7 +9,6 @@ bp = Blueprint("main", __name__)
|
||||
|
||||
|
||||
def _asset_url(key: str) -> str:
|
||||
# Notatka: API docs korzysta z tego samego przełącznika CDN/offline co reszta aplikacji.
|
||||
path = asset_path(key)
|
||||
return path if path.startswith("http") else url_for("static", filename=path)
|
||||
|
||||
|
||||
9
pytorrent/static/favicon.svg
Normal file
9
pytorrent/static/favicon.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<rect x="14" y="20" width="36" height="30" rx="8" fill="#f8fafc" stroke="#0f172a" stroke-width="4"></rect>
|
||||
<rect x="22" y="30" width="6" height="6" rx="3" fill="#0f172a"></rect>
|
||||
<rect x="36" y="30" width="6" height="6" rx="3" fill="#0f172a"></rect>
|
||||
<path d="M25 42h14" stroke="#0f172a" stroke-width="4" stroke-linecap="round"></path>
|
||||
<path d="M32 20V10" stroke="#0f172a" stroke-width="4" stroke-linecap="round"></path>
|
||||
<circle cx="32" cy="8" r="4" fill="#0f172a"></circle>
|
||||
<path d="M14 34H8M56 34h-6" stroke="#0f172a" stroke-width="4" stroke-linecap="round"></path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 647 B |
@@ -4,6 +4,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>pyTorrent {{ code }}</title>
|
||||
<link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
|
||||
<link rel="shortcut icon" href="/static/favicon.svg" type="image/svg+xml">
|
||||
<link href="{{ bootstrap_theme_url('default') }}" rel="stylesheet">
|
||||
<link href="{{ frontend_asset_url('fontawesome_css') }}" rel="stylesheet">
|
||||
<link href="{{ static_url('styles.css') }}" rel="stylesheet">
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>pyTorrent</title>
|
||||
<link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
|
||||
<link rel="shortcut icon" href="/static/favicon.svg" type="image/svg+xml">
|
||||
<link id="bootstrapThemeStylesheet" href="{{ bootstrap_theme_url(prefs.bootstrap_theme if prefs else 'default') }}" rel="stylesheet">
|
||||
<link href="{{ frontend_asset_url('fontawesome_css') }}" rel="stylesheet">
|
||||
<link href="{{ frontend_asset_url('flag_icons_css') }}" rel="stylesheet">
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>pyTorrent login</title>
|
||||
<link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
|
||||
<link rel="shortcut icon" href="/static/favicon.svg" type="image/svg+xml">
|
||||
<link href="{{ bootstrap_theme_url('default') }}" rel="stylesheet">
|
||||
<link href="{{ frontend_asset_url('fontawesome_css') }}" rel="stylesheet">
|
||||
<link href="{{ static_url('styles.css') }}" rel="stylesheet">
|
||||
|
||||
Reference in New Issue
Block a user