[verified] feat: add audio favicon
Co-authored-by: Tom Ernst <tom@citr.one>
This commit was merged in pull request #18.
This commit is contained in:
1 parent
89047732da
commit
fff56a94f9
5 files changed
+38
-1
No files matched your search
@@ -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)"]
|
||||
|
||||
@@ -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,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>
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user