feat: add audio favicon #18

Merged
tom merged 1 commits from feat/add-favicon into main 2026-09-11 22:52:44 +00:00
5 changed files with 38 additions and 1 deletions

No files matched your search

+2
View File
@@ -5,6 +5,8 @@ RUN addgroup --system app && adduser --system --ingroup app app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app ./app
COPY THIRD_PARTY_NOTICES.md ./THIRD_PARTY_NOTICES.md
RUN test -s /app/app/static/favicon.ico && test -s /app/THIRD_PARTY_NOTICES.md
USER app
EXPOSE 5000
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 CMD ["python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:5000/health', timeout=2)"]
+15
View File
@@ -0,0 +1,15 @@
# Third-Party Notices
## Lucide `volume-2` icon
The application favicon is based on the Lucide `volume-2` icon and has been modified with the Sonos-Web color palette and background.
Source: https://lucide.dev/icons/volume-2
ISC License
Copyright (c) 2026 Lucide Icons and Contributors
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
<!doctype html>
<html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Sonos Steuerung</title><link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}"></head>
<title>Sonos Steuerung</title><link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}" sizes="16x16 32x32 48x48 64x64"><link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}"></head>
<body><header><div><h1>Sonos <span>NestControl</span></h1></div><button id="refresh">↻ Räume suchen</button></header>
<main><div id="notice" role="status" aria-live="polite"></div><section><div id="zones" class="grid"><p class="muted">Räume werden gesucht …</p></div></section>
<section class="panel"><h2>Gruppe erstellen</h2><div class="form-grid"><label>Coordinator<select id="coordinator"></select></label><fieldset><legend>Mitglieder</legend><div id="members" class="checks"></div></fieldset></div><button id="group">Gruppe bilden</button></section>
+20
View File
@@ -1,4 +1,5 @@
import math
import struct
import threading
from pathlib import Path
from types import SimpleNamespace
@@ -217,6 +218,25 @@ def test_api_never_discovers_real_devices(monkeypatch, zone):
discover.assert_called_once()
def test_favicon_is_linked_and_served(service):
client = create_app({"TESTING": True}, service).test_client()
page = client.get("/")
assert b'rel="icon" type="image/x-icon" href="/static/favicon.ico"' in page.data
assert b'sizes="16x16 32x32 48x48 64x64"' in page.data
favicon = client.get("/static/favicon.ico")
assert favicon.status_code == 200
assert favicon.mimetype in {"image/vnd.microsoft.icon", "image/x-icon"}
reserved, image_type, image_count = struct.unpack_from("<HHH", favicon.data)
assert (reserved, image_type, image_count) == (0, 1, 4)
entries = [struct.unpack_from("<BBBBHHII", favicon.data, 6 + index * 16) for index in range(image_count)]
dimensions = {(width or 256, height or 256) for width, height, *_ in entries}
assert dimensions == {(16, 16), (32, 32), (48, 48), (64, 64)}
for *_, byte_count, image_offset in entries:
assert byte_count > 0
assert image_offset >= 6 + image_count * 16
assert image_offset + byte_count <= len(favicon.data)
@pytest.mark.parametrize("name,value", [
("SONOS_OPERATION_TIMEOUT", 0), ("SONOS_OPERATION_TIMEOUT", math.inf),
("SONOS_DISCOVERY_TIMEOUT", -1), ("SONOS_DISCOVERY_TIMEOUT", math.nan),