diff --git a/NTFY_BLUEPRINT.md b/NTFY_BLUEPRINT.md new file mode 100644 index 0000000..8c306c4 --- /dev/null +++ b/NTFY_BLUEPRINT.md @@ -0,0 +1,245 @@ +# Ntfy blueprint for a Django tasks and health tracker + +This is a portable version of this project's `/settings` integration. It gives each user a topic URL, a test button, an enable switch, and one function that task or health code can call. Replace `accounts` with the app that owns your user preferences. The examples assume an authenticated `/settings/` page and Django's standard CSRF and messages middleware. + +## 1. Store preferences + +In `accounts/models.py` (merge these fields into an existing per-user settings model if you have one): + +```python +from django.conf import settings +from django.db import models + +class NotificationSettings(models.Model): + user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + ntfy_url = models.URLField(blank=True) + ntfy_enabled = models.BooleanField(default=False) + ntfy_last_tested_at = models.DateTimeField(null=True, blank=True) +``` + +Run `python manage.py makemigrations accounts` and `python manage.py migrate`. + +## 2. Add the sender + +Create `notifications/services.py` (and an empty `notifications/__init__.py` if needed): + +```python +import socket +from urllib.error import HTTPError, URLError +from urllib.request import Request, urlopen + +class NotificationError(Exception): + """A delivery error safe to display to a user.""" + +def send_ntfy_notification(url, title, message, timeout=10): + request = Request( + url, + data=message.encode("utf-8"), + headers={"Content-Type": "text/plain; charset=utf-8", "Title": title}, + method="POST", + ) + try: + with urlopen(request, timeout=timeout) as response: + status = response.getcode() + except HTTPError as error: + raise NotificationError(f"ntfy server responded with HTTP {error.code}.") from error + except (TimeoutError, socket.timeout): + raise NotificationError("Connection to the ntfy server timed out.") from None + except URLError as error: + raise NotificationError("Could not connect to the ntfy server.") from error + except OSError as error: + raise NotificationError("Could not connect to the ntfy server.") from error + if not 200 <= status < 300: + raise NotificationError(f"ntfy server responded with HTTP {status}.") + +def send_notification(user, title, message): + from accounts.models import NotificationSettings + preferences = NotificationSettings.objects.filter(user=user).first() + if not preferences or not preferences.ntfy_enabled or not preferences.ntfy_url: + return False + send_ntfy_notification(preferences.ntfy_url, title, message) + return True +``` + +The URL is a destination and may contain a private topic name. Keep it out of logs and error messages. A user supplied server URL also lets the server make outbound requests; restrict destinations or allow only your trusted ntfy host if your deployment needs that boundary. Add authentication headers if your ntfy server requires them; this example uses a topic URL only. + +## 3. Form, views, and routes + +In `accounts/forms.py`: + +```python +from django import forms +from .models import NotificationSettings + +class NotificationSettingsForm(forms.ModelForm): + class Meta: + model = NotificationSettings + fields = ["ntfy_url", "ntfy_enabled"] + widgets = {"ntfy_url": forms.URLInput(attrs={"id": "ntfy-url", "placeholder": "https://ntfy.example.com/my-topic"})} + + def clean_ntfy_url(self): + return self.cleaned_data["ntfy_url"].strip() + + def clean(self): + data = super().clean() + if data.get("ntfy_enabled") and not data.get("ntfy_url"): + self.add_error("ntfy_url", "Enter a topic URL before enabling notifications.") + return data +``` + +In `accounts/views.py`: + +```python +from hashlib import sha256 + +from django.contrib import messages +from django.contrib.auth.decorators import login_required +from django.core.exceptions import ValidationError +from django.core.validators import URLValidator +from django.shortcuts import redirect, render +from django.utils import timezone +from django.views.decorators.http import require_POST + +from notifications.services import NotificationError, send_ntfy_notification +from .forms import NotificationSettingsForm +from .models import NotificationSettings + +def test_key(user): + return f"ntfy_tested_url_fingerprint:{user.pk}" + +def fingerprint(url): + return sha256(url.encode("utf-8")).hexdigest() + +@login_required +def settings_page(request): + preferences, _ = NotificationSettings.objects.get_or_create(user=request.user) + old_url = preferences.ntfy_url + form = NotificationSettingsForm(request.POST or None, instance=preferences) + if request.method == "POST" and form.is_valid(): + url = form.cleaned_data["ntfy_url"] + just_tested = bool(url) and request.session.get(test_key(request.user)) == fingerprint(url) + previously_tested = url == old_url and preferences.ntfy_last_tested_at is not None + if form.cleaned_data["ntfy_enabled"] and not (just_tested or previously_tested): + form.add_error("ntfy_url", "Test this URL successfully before enabling notifications.") + else: + preferences = form.save(commit=False) + if not url: + preferences.ntfy_enabled = False + preferences.ntfy_last_tested_at = None + elif just_tested: + preferences.ntfy_last_tested_at = timezone.now() + elif url != old_url: + preferences.ntfy_last_tested_at = None + preferences.save() + request.session.pop(test_key(request.user), None) + messages.success(request, "Notification settings saved.") + return redirect("settings_page") + return render(request, "accounts/settings.html", {"form": form}) + +@login_required +@require_POST +def test_ntfy(request): + url = request.POST.get("ntfy_url", "").strip() + try: + URLValidator(schemes=["http", "https"])(url) + except ValidationError: + return render(request, "accounts/ntfy_test_result.html", {"error": "Enter a valid HTTP or HTTPS topic URL."}, status=400) + try: + send_ntfy_notification(url, "Tasks & Health", "Test notification sent successfully.") + except NotificationError as error: + return render(request, "accounts/ntfy_test_result.html", {"error": str(error)}, status=502) + request.session[test_key(request.user)] = fingerprint(url) + return render(request, "accounts/ntfy_test_result.html", {"success": True}) +``` + +In `accounts/urls.py`, include these routes under `/settings/` in the project URLconf: + +```python +from django.urls import path +from . import views + +urlpatterns = [ + path("", views.settings_page, name="settings_page"), + path("notifications/ntfy/test/", views.test_ntfy, name="ntfy_test"), +] +``` + +## 4. Settings UI + +Put this section inside your existing `/settings/` template. It uses htmx for the inline test response; load htmx once in the page layout (or replace `hx-post` with a small `fetch` handler). Keep the CSRF input inside the form. + +```html +
+ {% csrf_token %} +
+

Notifications / ntfy

+

Use a topic URL from your ntfy server. Test it before enabling notifications.

+ + {{ form.ntfy_url }} {{ form.ntfy_url.errors }} +
+ {{ form.ntfy_enabled }} + +
+ +
+
+ +
+ +``` + +`accounts/ntfy_test_result.html`: + +```html +{% if success %}
✓ Test notification sent successfully.
+{% else %}
Could not send the test notification: {{ error }}
{% endif %} +``` + +Suggested CSS, scoped to your existing settings styles: + +```css +#ntfy-url { width: 100%; box-sizing: border-box; min-height: 2.8rem; } +.check { display: flex; gap: .6rem; align-items: center; } +.check label { margin: 0; } +.alert { margin-top: 1rem; padding: .75rem; border-radius: .55rem; } +.alert--success { color: #d1fae5; background: #14532d; } +.alert--error { color: #fee2e2; background: #7f1d1d; } +``` + +## 5. Trigger from tasks or health events + +Call the provider agnostic `send_notification` after a meaningful state change. Put delivery on a background worker for normal operation, since the HTTP call can take up to ten seconds. Queue the job after the database commit so it cannot announce a rolled back change. + +```python +from django.db import transaction + +# After saving a task completion, missed deadline, check-in, or health alert: +user_id = task.user_id +task_id = task.pk +transaction.on_commit(lambda: enqueue_task_event_notification(user_id, task_id)) +``` + +`enqueue_task_event_notification` is your existing Celery, RQ, or job queue entry point. In its worker, reload the user and task, confirm that the event still qualifies, then call `send_notification(user, "Task due", "Your task is due today.")`. Catch `NotificationError`, log a safe error without the topic URL, and retry according to your queue policy. Use an event ID or unique job key if duplicate delivery matters. If you have no worker yet, a management command run by cron can drain a small notification outbox instead. + +Typical mapping for this app: + +| App event | Suggested message | Trigger location | +| --- | --- | --- | +| Task due | “Your task is due today.” | Scheduled due-date job | +| Task completed | “Task completed.” | Completion service, after commit | +| Check-in missed | “Your daily check-in is still open.” | Scheduled reminder job | +| Health threshold crossed | “A tracked value crossed your chosen threshold.” | Threshold evaluator, after commit | + +Avoid including sensitive health measurements in the notification unless the user explicitly opts in. Define the event's recipient and idempotency rule in the app service, rather than in the ntfy sender. + +## 6. Minimum verification + +Test an invalid URL, a failed test, a successful test followed by save, a changed URL requiring a new test, and disabled settings suppressing sends. Mock `urlopen` or `send_ntfy_notification`; do not send real notifications in tests. Check one actual device delivery manually with a private topic before enabling event triggers. + +Source implementation in this repo: `members/views.py`, `members/forms.py`, `members/models.py`, `members/templates/members/user_settings.html`, `notifications/services.py`, and `fireworks_detect/signals.py`. The source app groups Pending events by minute with `PendingNotificationBatch` and a scheduled command; use that pattern if your tracker needs digest notifications. diff --git a/README.md b/README.md index 07d3cf7..d837784 100644 --- a/README.md +++ b/README.md @@ -121,3 +121,32 @@ server mode requires an audio file or browser mode. Browser assets are loaded only after the user enables the toggle and selects a file. Regenerate the self-hosted model using [the YAMNet build guide](scripts/BROWSER_YAMNET.md), then run `npm run build` and `python manage.py collectstatic --noinput`. +# Pending event notifications + +Users can test and enable an ntfy topic in Settings. New Pending events are +counted by source (manual or sensor) in one-minute batches per enabled user. +Run `python manage.py send_pending_notifications` once per minute with the +application's Python environment and working directory. For example, a cron +entry can use `* * * * * cd /path/to/django && /path/to/python manage.py send_pending_notifications`. +It sends completed minute batches, +then removes them; failed deliveries remain queued for the next run. + +For a systemd user timer on the laptop, install the units in +[`deploy/systemd/`](deploy/systemd/) and start the timer: + +```sh +cd /home/jorenmartijn/python/django +/usr/bin/python3 -m venv /home/jorenmartijn/python/.venv-notifications +/home/jorenmartijn/python/.venv-notifications/bin/python -m pip install -r requirements.txt +/home/jorenmartijn/python/.venv-notifications/bin/python manage.py check +mkdir -p ~/.config/systemd/user +cp deploy/systemd/send-pending-notifications.service deploy/systemd/send-pending-notifications.timer ~/.config/systemd/user/ +systemctl --user daemon-reload +systemctl --user enable --now send-pending-notifications.timer +systemctl --user list-timers send-pending-notifications.timer +``` + +The service runs `/home/jorenmartijn/python/.venv-notifications/bin/python` with this +project as its working directory. To keep the user timer running after logout, +run `sudo loginctl enable-linger jorenmartijn` once on the laptop. Check a run +with `journalctl --user -u send-pending-notifications.service -n 30`. diff --git a/db.sqlite3 b/db.sqlite3 index 4fd0c49..1a4a67e 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/deploy/systemd/send-pending-notifications.service b/deploy/systemd/send-pending-notifications.service new file mode 100644 index 0000000..048ce4d --- /dev/null +++ b/deploy/systemd/send-pending-notifications.service @@ -0,0 +1,7 @@ +[Unit] +Description=Send batched Pending event ntfy notifications + +[Service] +Type=oneshot +WorkingDirectory=/home/jorenmartijn/python/django +ExecStart=/home/jorenmartijn/python/.venv-notifications/bin/python /home/jorenmartijn/python/django/manage.py send_pending_notifications diff --git a/deploy/systemd/send-pending-notifications.timer b/deploy/systemd/send-pending-notifications.timer new file mode 100644 index 0000000..4915e3f --- /dev/null +++ b/deploy/systemd/send-pending-notifications.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Send Pending event ntfy summaries every minute + +[Timer] +OnCalendar=*-*-* *:*:00 +AccuracySec=1s +Persistent=true +Unit=send-pending-notifications.service + +[Install] +WantedBy=timers.target diff --git a/fireworks_detect/__pycache__/__init__.cpython-312.pyc b/fireworks_detect/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..c0ee1f4 Binary files /dev/null and b/fireworks_detect/__pycache__/__init__.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/admin.cpython-312.pyc b/fireworks_detect/__pycache__/admin.cpython-312.pyc new file mode 100644 index 0000000..622d47d Binary files /dev/null and b/fireworks_detect/__pycache__/admin.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/admin.cpython-313.pyc b/fireworks_detect/__pycache__/admin.cpython-313.pyc index 558168b..bb4fb7e 100644 Binary files a/fireworks_detect/__pycache__/admin.cpython-313.pyc and b/fireworks_detect/__pycache__/admin.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/apps.cpython-312.pyc b/fireworks_detect/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000..665280a Binary files /dev/null and b/fireworks_detect/__pycache__/apps.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/apps.cpython-313.pyc b/fireworks_detect/__pycache__/apps.cpython-313.pyc index bd66233..a4cc009 100644 Binary files a/fireworks_detect/__pycache__/apps.cpython-313.pyc and b/fireworks_detect/__pycache__/apps.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/browser_policy.cpython-312.pyc b/fireworks_detect/__pycache__/browser_policy.cpython-312.pyc new file mode 100644 index 0000000..eca82e3 Binary files /dev/null and b/fireworks_detect/__pycache__/browser_policy.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/browser_policy.cpython-313.pyc b/fireworks_detect/__pycache__/browser_policy.cpython-313.pyc new file mode 100644 index 0000000..16e6bcd Binary files /dev/null and b/fireworks_detect/__pycache__/browser_policy.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/classification_urls.cpython-312.pyc b/fireworks_detect/__pycache__/classification_urls.cpython-312.pyc new file mode 100644 index 0000000..e54f3f9 Binary files /dev/null and b/fireworks_detect/__pycache__/classification_urls.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/h3_utils.cpython-312.pyc b/fireworks_detect/__pycache__/h3_utils.cpython-312.pyc new file mode 100644 index 0000000..364e792 Binary files /dev/null and b/fireworks_detect/__pycache__/h3_utils.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/models.cpython-312.pyc b/fireworks_detect/__pycache__/models.cpython-312.pyc new file mode 100644 index 0000000..7e25a08 Binary files /dev/null and b/fireworks_detect/__pycache__/models.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/models.cpython-313.pyc b/fireworks_detect/__pycache__/models.cpython-313.pyc index c61d6d5..d229d42 100644 Binary files a/fireworks_detect/__pycache__/models.cpython-313.pyc and b/fireworks_detect/__pycache__/models.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/signals.cpython-312.pyc b/fireworks_detect/__pycache__/signals.cpython-312.pyc new file mode 100644 index 0000000..5cdfdf9 Binary files /dev/null and b/fireworks_detect/__pycache__/signals.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/signals.cpython-313.pyc b/fireworks_detect/__pycache__/signals.cpython-313.pyc new file mode 100644 index 0000000..0000fd0 Binary files /dev/null and b/fireworks_detect/__pycache__/signals.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/tests.cpython-313.pyc b/fireworks_detect/__pycache__/tests.cpython-313.pyc index 65ad8bf..b3b517e 100644 Binary files a/fireworks_detect/__pycache__/tests.cpython-313.pyc and b/fireworks_detect/__pycache__/tests.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/urls.cpython-312.pyc b/fireworks_detect/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000..143cbe3 Binary files /dev/null and b/fireworks_detect/__pycache__/urls.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/urls.cpython-313.pyc b/fireworks_detect/__pycache__/urls.cpython-313.pyc index e3de382..47a3633 100644 Binary files a/fireworks_detect/__pycache__/urls.cpython-313.pyc and b/fireworks_detect/__pycache__/urls.cpython-313.pyc differ diff --git a/fireworks_detect/__pycache__/views.cpython-312.pyc b/fireworks_detect/__pycache__/views.cpython-312.pyc new file mode 100644 index 0000000..79a9eef Binary files /dev/null and b/fireworks_detect/__pycache__/views.cpython-312.pyc differ diff --git a/fireworks_detect/__pycache__/views.cpython-313.pyc b/fireworks_detect/__pycache__/views.cpython-313.pyc index b19e98a..099e138 100644 Binary files a/fireworks_detect/__pycache__/views.cpython-313.pyc and b/fireworks_detect/__pycache__/views.cpython-313.pyc differ diff --git a/fireworks_detect/apps.py b/fireworks_detect/apps.py index 87d8f25..9e5dd38 100644 --- a/fireworks_detect/apps.py +++ b/fireworks_detect/apps.py @@ -3,3 +3,6 @@ from django.apps import AppConfig class FireworksDetectConfig(AppConfig): name = 'fireworks_detect' + + def ready(self): + from . import signals # noqa: F401 diff --git a/fireworks_detect/migrations/__pycache__/0009_browserprocessingsettings.cpython-313.pyc b/fireworks_detect/migrations/__pycache__/0009_browserprocessingsettings.cpython-313.pyc new file mode 100644 index 0000000..5575e5e Binary files /dev/null and b/fireworks_detect/migrations/__pycache__/0009_browserprocessingsettings.cpython-313.pyc differ diff --git a/fireworks_detect/migrations/__pycache__/0010_create_browser_processing_settings.cpython-313.pyc b/fireworks_detect/migrations/__pycache__/0010_create_browser_processing_settings.cpython-313.pyc new file mode 100644 index 0000000..7973cea Binary files /dev/null and b/fireworks_detect/migrations/__pycache__/0010_create_browser_processing_settings.cpython-313.pyc differ diff --git a/fireworks_detect/signals.py b/fireworks_detect/signals.py new file mode 100644 index 0000000..55e88d4 --- /dev/null +++ b/fireworks_detect/signals.py @@ -0,0 +1,19 @@ +from django.db.models import F +from django.db.models.signals import post_save +from django.dispatch import receiver +from django.utils import timezone + +from members.models import PendingNotificationBatch, UserSettings + +from .models import PendingEvent + + +@receiver(post_save, sender=PendingEvent) +def count_new_pending_event(sender, instance, created, **kwargs): + if not created: + return + minute = timezone.now().replace(second=0, microsecond=0) + field = "manual_count" if instance.source_type == PendingEvent.SourceType.MANUAL else "sensor_count" + for user_id in UserSettings.objects.filter(ntfy_enabled=True).exclude(ntfy_url="").values_list("user_id", flat=True): + batch, _ = PendingNotificationBatch.objects.get_or_create(user_id=user_id, minute=minute) + PendingNotificationBatch.objects.filter(pk=batch.pk).update(**{field: F(field) + 1}) diff --git a/fireworks_detect/templates/fireworks_detect/home.html b/fireworks_detect/templates/fireworks_detect/home.html index 381951e..9333e1a 100644 --- a/fireworks_detect/templates/fireworks_detect/home.html +++ b/fireworks_detect/templates/fireworks_detect/home.html @@ -27,7 +27,7 @@
{% include "fireworks_detect/includes/audio_upload_form.html" %} -
+ diff --git a/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html b/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html index 16f9374..4df18ea 100644 --- a/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html +++ b/fireworks_detect/templates/fireworks_detect/includes/manual_report_form.html @@ -35,4 +35,17 @@
+ diff --git a/fireworks_detect/templates/fireworks_detect/includes/navigation.html b/fireworks_detect/templates/fireworks_detect/includes/navigation.html index 04ff6ee..689a1f8 100644 --- a/fireworks_detect/templates/fireworks_detect/includes/navigation.html +++ b/fireworks_detect/templates/fireworks_detect/includes/navigation.html @@ -7,6 +7,14 @@ {% trans "Analyse" %} {% trans "Map" %} {% trans "Events" %} + {% if request.user.is_authenticated %} +
+ {% csrf_token %} + +
+ {% else %} + {% trans "Sign in" %} + {% endif %} {% if not request.user.is_authenticated %}
diff --git a/fireworks_detect/tests.py b/fireworks_detect/tests.py index ca637f7..2f4f40e 100644 --- a/fireworks_detect/tests.py +++ b/fireworks_detect/tests.py @@ -160,6 +160,8 @@ class ManualPendingEventTests(TestCase): self.assertContains(response, "I heard fireworks — send to Pending") self.assertContains(response, "Capture direction") self.assertContains(response, 'manual-direction-panel" hidden') + self.assertContains(response, 'id="manual-compass"') + self.assertContains(response, 'aria-label="Compass direction" hidden') self.assertContains(response, "htmx.min.js") self.assertContains(response, "/static/vite/") self.assertContains(response, 'type="module"') diff --git a/frontend/src/entries/dashboard.js b/frontend/src/entries/dashboard.js index ea932f4..b46c809 100644 --- a/frontend/src/entries/dashboard.js +++ b/frontend/src/entries/dashboard.js @@ -3,6 +3,7 @@ import "../styles/pages/fireworks-home.css"; import "../styles/pages/map.css"; import "../styles/pages/dashboard.css"; import "../styles/components/burst-listener.css"; +import "../styles/components/manual-compass.css"; import "../styles/theme.css"; import "../scripts/theme.js"; import "../scripts/manual-report.js"; diff --git a/frontend/src/entries/home.js b/frontend/src/entries/home.js index 3e7f320..86ab9fe 100644 --- a/frontend/src/entries/home.js +++ b/frontend/src/entries/home.js @@ -1,5 +1,6 @@ import "../styles/pages/home.css"; import "../styles/components/burst-listener.css"; +import "../styles/components/manual-compass.css"; import "../styles/theme.css"; import "../scripts/theme.js"; import "../scripts/manual-report.js"; diff --git a/frontend/src/entries/settings.js b/frontend/src/entries/settings.js index b13a20d..a010aff 100644 --- a/frontend/src/entries/settings.js +++ b/frontend/src/entries/settings.js @@ -1,4 +1,5 @@ import "../styles/pages/settings.css"; +import "../styles/components/fireworks-navigation.css"; import "../styles/theme.css"; import "../scripts/theme.js"; import "../scripts/user-settings.js"; diff --git a/frontend/src/scripts/manual-report.js b/frontend/src/scripts/manual-report.js index e6ea915..1dc1964 100644 --- a/frontend/src/scripts/manual-report.js +++ b/frontend/src/scripts/manual-report.js @@ -11,11 +11,15 @@ const captureDirectionButton = document.querySelector("#manual-capture-direction"); const directionStatus = document.querySelector("#manual-direction-status"); const directionPanel = document.querySelector("#manual-direction-panel"); + const compass = document.querySelector("#manual-compass"); + const compassRose = document.querySelector("#manual-compass-rose"); + const compassHeading = document.querySelector("#manual-compass-heading"); const isMobileDevice = /Android|iPhone|iPad|iPod|IEMobile|Opera Mini/.test(navigator.userAgent) || (navigator.userAgent.includes("Macintosh") && navigator.maxTouchPoints > 1); if (isMobileDevice) directionPanel.hidden = false; let orientationListener; let compassUnavailableTimeout; + let compassRotation = null; const burstListener = createBurstListener(); const isUsableNumber = (value) => Number.isFinite(value); @@ -27,6 +31,27 @@ window.clearTimeout(compassUnavailableTimeout); orientationListener = null; compassUnavailableTimeout = null; + compass.hidden = true; + compassRotation = null; + }; + + const updateCompass = (heading) => { + const targetRotation = -heading; + if (compassRotation === null) { + compassRotation = targetRotation; + compassRose.style.transition = "none"; + compassRose.style.transform = `rotate(${compassRotation}deg)`; + // Restore the short rotation animation after the initial reading. + compassRose.offsetWidth; + compassRose.style.transition = ""; + } else { + const change = ((targetRotation - compassRotation + 540) % 360) - 180; + compassRotation += change; + compassRose.style.transform = `rotate(${compassRotation}deg)`; + } + compassHeading.textContent = `${displayDegrees(heading)}° · ${cardinalDirection(heading)}`; + compass.setAttribute("aria-label", `${t.compassDirection || "Compass direction"} ${displayDegrees(heading)}° ${cardinalDirection(heading)}`); + compass.hidden = false; }; const showCapturedDirection = (heading, accuracy) => { @@ -53,6 +78,7 @@ directionDegrees.value = heading; directionAccuracy.value = accuracy === null ? "" : accuracy; showCapturedDirection(heading, accuracy); + updateCompass(heading); window.clearTimeout(compassUnavailableTimeout); }; window.addEventListener("deviceorientation", orientationListener); diff --git a/frontend/src/scripts/user-settings.js b/frontend/src/scripts/user-settings.js index ae5fc1e..63259f9 100644 --- a/frontend/src/scripts/user-settings.js +++ b/frontend/src/scripts/user-settings.js @@ -1 +1,10 @@ -document.querySelector("#ntfy-url").addEventListener("input", () => { document.querySelector("#ntfy-test-result").replaceChildren(); }); \ No newline at end of file +document.querySelector("#ntfy-url")?.addEventListener("input", () => { + document.querySelector("#ntfy-test-result")?.replaceChildren(); +}); + +document.addEventListener("click", async (event) => { + const button = event.target.closest("[data-copy-sensor-token]"); + if (!button) return; + const token = document.querySelector("#sensor-token")?.textContent; + if (token) await navigator.clipboard.writeText(token); +}); diff --git a/frontend/src/styles/components/fireworks-navigation.css b/frontend/src/styles/components/fireworks-navigation.css index 403207c..736e11b 100644 --- a/frontend/src/styles/components/fireworks-navigation.css +++ b/frontend/src/styles/components/fireworks-navigation.css @@ -37,7 +37,8 @@ background: #111a31d9; box-shadow: 0 .5rem 1.5rem #03071440; } -.fireworks-nav a { +.fireworks-nav a, +.fireworks-nav button { padding: .5rem .75rem; border-radius: .5rem; color: var(--muted, var(--m, #aab9d8)); @@ -45,7 +46,10 @@ font-weight: 750; text-decoration: none; } -.fireworks-nav a:hover { color: var(--ink, var(--i, #eef3ff)); background: #20345f; } +.fireworks-nav form { display: flex; margin: 0; } +.fireworks-nav button { border: 0; background: transparent; font: inherit; cursor: pointer; } +.fireworks-nav a:hover, +.fireworks-nav button:hover { color: var(--ink, var(--i, #eef3ff)); background: #20345f; } .fireworks-nav a[aria-current="page"] { color: var(--ink, var(--i, #eef3ff)); background: #2a3b67; } .theme-toggle--inline { position: static; @@ -59,8 +63,10 @@ background: #edf4ff; box-shadow: 0 .45rem 1.25rem rgba(34, 68, 117, .12); } -:root[data-theme="light"] .fireworks-nav a { color: #47617f; } -:root[data-theme="light"] .fireworks-nav a:hover { color: #234a7b; background: #dceaff; } +:root[data-theme="light"] .fireworks-nav a, +:root[data-theme="light"] .fireworks-nav button { color: #47617f; } +:root[data-theme="light"] .fireworks-nav a:hover, +:root[data-theme="light"] .fireworks-nav button:hover { color: #234a7b; background: #dceaff; } :root[data-theme="light"] .fireworks-nav a[aria-current="page"] { color: #173d6a; background: #cfe3ff; @@ -89,6 +95,10 @@ .fireworks-header__controls { display: none; flex-basis: 100%; width: 100%; flex-direction: column; align-items: stretch; } .fireworks-menu-toggle[aria-expanded="true"] ~ .fireworks-header__controls { display: flex; } .fireworks-nav { flex-direction: column; } - .fireworks-nav a { padding: .75rem; } + .fireworks-nav a, + .fireworks-nav button { padding: .75rem; } + .fireworks-nav form, + .fireworks-nav button { width: 100%; } + .fireworks-nav button { text-align: left; } .theme-toggle--inline { width: 100%; } } diff --git a/frontend/src/styles/components/manual-compass.css b/frontend/src/styles/components/manual-compass.css new file mode 100644 index 0000000..5c270be --- /dev/null +++ b/frontend/src/styles/components/manual-compass.css @@ -0,0 +1,55 @@ +.manual-compass { + display: grid; + justify-items: center; + width: 7rem; + margin: .6rem 0 0 auto; + color: #fff3d7; + font-size: .78rem; + font-weight: 850; + font-variant-numeric: tabular-nums; +} +.manual-compass[hidden] { display: none; } +.manual-compass__dial { + position: relative; + width: 5.75rem; + aspect-ratio: 1; + border: 2px solid #f2d7a8; + border-radius: 50%; + background: radial-gradient(circle, #342441 0 28%, #211a32 75%); + box-shadow: 0 .35rem 1rem #09061566, inset 0 0 0 .25rem #ffffff12; +} +.manual-compass__rose { position: absolute; inset: 0; transition: transform 120ms ease-out; } +.manual-compass__rose span { position: absolute; line-height: 1; } +.manual-compass__north { top: .38rem; left: 50%; color: #ff9e78; transform: translateX(-50%); } +.manual-compass__east { right: .47rem; top: 50%; transform: translateY(-50%); } +.manual-compass__south { bottom: .38rem; left: 50%; transform: translateX(-50%); } +.manual-compass__west { left: .47rem; top: 50%; transform: translateY(-50%); } +.manual-compass__pointer { + position: absolute; + top: -.55rem; + left: 50%; + width: 0; + height: 0; + border-right: .37rem solid transparent; + border-bottom: .65rem solid #ffbd62; + border-left: .37rem solid transparent; + transform: translateX(-50%); + filter: drop-shadow(0 .1rem .15rem #160d1b); +} +.manual-compass__center { + position: absolute; + top: 50%; + left: 50%; + width: .5rem; + aspect-ratio: 1; + border-radius: 50%; + background: #ffbd62; + transform: translate(-50%, -50%); +} +.manual-compass__heading { margin-top: .5rem; white-space: nowrap; } +:root[data-theme="light"] .manual-compass { color: #43243d; } +:root[data-theme="light"] .manual-compass__dial { border-color: #996a9b; background: radial-gradient(circle, #f8ebf8 0 28%, #e8d7e9 75%); } +:root[data-theme="light"] .manual-compass__east, +:root[data-theme="light"] .manual-compass__south, +:root[data-theme="light"] .manual-compass__west { color: #43243d; } +@media (prefers-reduced-motion: reduce) { .manual-compass__rose { transition: none; } } diff --git a/frontend/src/styles/pages/settings.css b/frontend/src/styles/pages/settings.css index daef905..c24a633 100644 --- a/frontend/src/styles/pages/settings.css +++ b/frontend/src/styles/pages/settings.css @@ -1,11 +1,51 @@ -body{min-width:320px;margin:0;padding:2rem;color:#eef3ff;font-family:Inter,system-ui,sans-serif;background:#090e1d}.card{width:min(100%,42rem);margin:auto;padding:2rem;border:1px solid #2b3d68;border-radius:1rem;background:#172443}h1{margin-top:0}h2{margin:0}.intro,.help{color:#aab9d8;line-height:1.5}.section{margin-top:2rem;padding-top:1.5rem;border-top:1px solid #2b3d68}label{display:block;margin:.9rem 0 .35rem;font-weight:700}input[type=url]{width:100%;min-height:2.8rem;padding:.65rem;border:1px solid #526b9f;border-radius:.55rem;color:#eef3ff;font:inherit;background:#0a1123}.check{display:flex;gap:.6rem;align-items:center}.check label{margin:0}.button{min-height:2.8rem;margin-top:1rem;padding:.6rem 1rem;border:0;border-radius:.55rem;color:#17132b;font:inherit;font-weight:800;background:#a6ccff;cursor:pointer}.button--secondary{margin-right:.7rem;background:#d8c1fb}.alert,.errorlist{margin-top:1rem;padding:.75rem;border-radius:.55rem}.alert--success{color:#d1fae5;background:#14532d}.alert--error,.errorlist{color:#fee2e2;background:#7f1d1d}.messages{padding:0;list-style:none}@media(max-width:32rem){body{padding:1rem}.card{padding:1.4rem}} -.sensor-card{margin:1rem 0;padding:1rem;border:1px solid var(--theme-line);border-radius:.7rem;background:var(--theme-surface-raised)} -.sensor-card p{margin:.5rem 0;color:var(--theme-muted)} -.sensor-card .button{display:inline-block;text-decoration:none} -.sensor-status{display:inline-block;margin-left:.5rem;color:#ef4444;font-weight:700} -.sensor-status--online{color:#22c55e}.sensor-status--delayed{color:#f59e0b} -input[type=text]{box-sizing:border-box;width:100%;min-height:2.8rem;padding:.65rem;border:1px solid var(--theme-line);border-radius:.55rem;color:var(--theme-ink);font:inherit;background:var(--theme-input)} -.token-once{margin:1rem 0;padding:1rem;border:1px solid #f59e0b;border-radius:.7rem;background:var(--theme-surface-raised)} -.token-once code{display:block;overflow-wrap:anywhere;margin-top:.7rem;padding:.7rem;border-radius:.4rem;background:var(--theme-input);user-select:all} -.button--danger{color:#fff;background:#991b1b} -:root[data-theme=light] .sensor-status:not(.sensor-status--online):not(.sensor-status--delayed){color:#b91c1c} +/* Settings cards follow the shared blue and violet theme. */ +*{box-sizing:border-box} +body{min-height:100vh;padding:0;color:var(--theme-ink);background:var(--theme-bg)} +.settings-shell{width:min(100% - 3.5rem,73.75rem);margin:auto;padding:4rem 0 5rem} +.settings-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2.25rem 2rem;width:100%} +.settings-heading,.messages{grid-column:1/-1} +.settings-heading{margin-bottom:0} +.eyebrow{margin:0 0 .7rem;color:#9fc5ff;font-size:.74rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase} +h1,h2{font-family:Georgia,ui-serif,serif;font-weight:700} +h1{margin:0;font-size:clamp(2.3rem,4vw,3.5rem);letter-spacing:-.045em;line-height:1.12} +h2{margin:0 0 .45rem;font-size:1.5rem;letter-spacing:-.02em} +.intro,.help{margin:.45rem 0 0;color:var(--theme-muted);line-height:1.55} +.card{min-width:0;width:100%;margin:0;padding:1.75rem;border:1px solid var(--theme-line);border-radius:1.125rem;background:var(--theme-surface);box-shadow:0 1.125rem 2.8rem #02071429} +.settings-form{display:flex;flex-direction:column;gap:1rem}.settings-form h2+.field{margin-top:.4rem} +.settings-form>.button[type=submit]{margin-top:auto} +.field label{display:block;margin:0 0 .375rem;font-size:.85rem;font-weight:700} +.field input,.field select{display:block;width:100%;min-height:2.625rem;padding:.55rem .625rem;border:1px solid var(--theme-line);border-radius:.56rem;color:var(--theme-ink);background:var(--theme-input);font:inherit} +.field input:focus-visible,.field select:focus-visible,.button:focus-visible,.switch-control input:focus-visible+.switch-track{outline:3px solid #80b6ff;outline-offset:3px} +.errorlist{margin:.5rem 0 0;padding:.7rem .9rem;border-radius:.55rem;color:#fee2e2;background:#7f1d1d} +.button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:2.875rem;margin:0;padding:.65rem 1.2rem;border:1px solid transparent;border-radius:999px;color:#111c30;background:#a6ccff;font:inherit;font-size:.9rem;font-weight:800;text-align:center;text-decoration:none;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease} +.button:hover{transform:translateY(-1px);background:#c0ddff;box-shadow:0 .45rem 1rem #5899f733} +.button--secondary{border-color:#6386bd;color:#d7e8ff;background:#223755}.button--secondary:hover{color:#111c30;background:#a6ccff} +.switch-row{display:flex;align-items:center;justify-content:space-between;gap:1.125rem;min-height:4.375rem;padding:.8rem 1rem;border:1px solid #3d5879;border-radius:.94rem;background:#1a2a43;cursor:pointer} +.switch-row:hover{border-color:#739ad0;background:#203554}.switch-copy{display:grid;gap:.2rem;min-width:0}.switch-copy strong{font-size:.92rem}.switch-copy small{color:var(--theme-muted);font-size:.77rem;line-height:1.35} +.switch-control{position:relative;display:block;flex:0 0 3.1875rem;width:3.1875rem;height:1.9375rem}.switch-control input{position:absolute;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.switch-track{display:block;width:100%;height:100%;border-radius:999px;background:#62758b;pointer-events:none;transition:background .16s ease} +.switch-track::after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0004;transition:transform .16s ease}.switch-control input:checked+.switch-track{background:#34c76a}.switch-control input:checked+.switch-track::after{transform:translateX(20px)} +.messages{margin:0;padding:0;list-style:none}.alert{margin:.5rem 0 0;padding:.75rem 1rem;border-radius:.65rem;line-height:1.45}#ntfy-test-result:empty{display:none} +.sensor-list__intro{padding-bottom:1.25rem;border-bottom:1px solid var(--theme-line)}.sensor-list__intro .eyebrow{margin-bottom:.35rem} +.sensor-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;margin:1.5rem 0}.sensor-card{display:flex;flex-direction:column;min-width:0;margin:0;padding:1.3rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)} +.sensor-card__heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem 1rem}.sensor-card__heading h3{margin:0;font-family:Georgia,ui-serif,serif;font-size:1.25rem;overflow-wrap:anywhere}.sensor-card .sensor-status{display:inline-flex;padding:.32rem .65rem;border-radius:999px;background:var(--theme-input);font-size:.78rem;white-space:nowrap} +.sensor-status{color:var(--theme-muted);font-weight:700}.sensor-status--online{color:#64dca0}.sensor-status--delayed{color:#f5c46b}.sensor-status--offline{color:#f49aa7} +.sensor-access{align-self:flex-start;margin-top:.7rem;padding:.25rem .55rem;border:1px solid #3d806b;border-radius:999px;color:#8be0b9;font-size:.72rem;font-weight:800}.sensor-access--off{border-color:#806b75;color:#d4b9c5} +.sensor-card__facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem 1rem;margin:1.3rem 0}.sensor-card__facts div{min-width:0}.sensor-card__facts dt{margin-bottom:.25rem;color:var(--theme-muted);font-size:.75rem;font-weight:700}.sensor-card__facts dd{margin:0;font-size:.88rem;font-weight:600;overflow-wrap:anywhere}.sensor-card__facts code{font:inherit}.sensor-card__facts div:last-child{grid-column:1/-1} +.sensor-card .button{margin-top:auto}.sensor-empty{grid-column:1/-1;margin:0;padding:1.5rem;border:1px dashed var(--theme-line);border-radius:1rem;color:var(--theme-muted);text-align:center;line-height:1.5} +.sensor-form{margin-top:1.5rem;padding:1.3rem;border:1px dashed #6386bd;border-radius:1rem;background:var(--theme-surface-raised)}.sensor-form h3{margin:0;font-family:Georgia,ui-serif,serif;font-size:1.2rem}.sensor-form .help{margin-top:.3rem}.sensor-form__controls{display:grid;grid-template-columns:minmax(0,1fr) 11rem;align-items:end;gap:1rem} +.settings-content>#sensor-card{grid-column:1/-1} +.sensor-detail__header{display:flex;align-items:start;justify-content:space-between;gap:1rem;padding-bottom:1.2rem;border-bottom:1px solid var(--theme-line)}.sensor-detail__header .eyebrow{margin-bottom:.35rem}.sensor-detail__header h2{margin:0;font-size:clamp(1.6rem,3vw,2rem);overflow-wrap:anywhere}.sensor-close{display:inline-flex;align-items:center;gap:.35rem;flex:none;padding:.45rem .85rem;border:1px solid var(--theme-line);border-radius:999px;color:var(--theme-ink);background:var(--theme-surface-raised);font-size:.85rem;font-weight:700;text-decoration:none}.sensor-close:hover{border-color:#86ade0;background:#2b4266}.sensor-close:focus-visible{outline:3px solid #80b6ff;outline-offset:3px} +.sensor-detail__overview{margin:1.25rem 0 1.5rem;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__overview>.sensor-status{display:inline-flex;margin:0 0 1rem;padding:.35rem .7rem;border-radius:999px;background:var(--theme-input);font-size:.85rem} +.sensor-detail__facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem 1.5rem;margin:0}.sensor-detail__facts div{min-width:0}.sensor-detail__facts dt{margin:0 0 .3rem;color:var(--theme-muted);font-size:.78rem;font-weight:700}.sensor-detail__facts dd{margin:0;overflow-wrap:anywhere;font-size:.92rem;font-weight:600}.sensor-detail__facts code{font:inherit} +.sensor-detail__actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.sensor-detail__section{display:flex;flex-direction:column;min-width:0;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__section h3{margin:0 0 .35rem;font-family:Georgia,ui-serif,serif;font-size:1.15rem}.sensor-detail__section>.help{margin:0}.sensor-detail__section form{display:flex;flex:1;flex-direction:column;gap:.8rem;margin-top:1rem}.sensor-detail__section form .button{margin-top:auto}.sensor-detail__section .field{width:100%}.sensor-detail__section:last-child{border-color:#945f68;background:#392432}.sensor-detail__section:last-child .button--danger{border-color:#dc7b89;color:#fff;background:#a43c50}.sensor-detail__section:last-child .button--danger:hover{background:#bd4a60} +.sensor-confirm{display:flex;align-items:start;gap:.6rem;line-height:1.4;font-size:.82rem;cursor:pointer}.sensor-confirm input{flex:none;width:1.1rem;height:1.1rem;margin:.15rem 0 0;accent-color:#84baff}.sensor-confirm input:focus-visible{outline:3px solid #80b6ff;outline-offset:3px} +.sensor-messages{margin-top:1rem}.token-once{margin:1.25rem 0;padding:1rem;border:1px solid #e4ad55;border-radius:.8rem;background:var(--theme-surface-raised)}.token-once code{display:block;margin:.75rem 0;padding:.7rem;border-radius:.5rem;background:var(--theme-input);overflow-wrap:anywhere;user-select:all} +.button--danger{color:#fff;background:#991b1b}.button--danger:hover{color:#fff;background:#b91c1c} +:root[data-theme=light] .eyebrow{color:#23578d}:root[data-theme=light] .card{box-shadow:0 1.125rem 2.8rem #20365c1a}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger){color:#fff;background:#245b96}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger):hover{background:#174877}:root[data-theme=light] .button--secondary{border-color:#9cc0ed;color:#245b96;background:#edf4ff}:root[data-theme=light] .button--secondary:hover{color:#fff;background:#245b96}:root[data-theme=light] .switch-row{border-color:#d4e0ef;background:#f2f7fe}:root[data-theme=light] .switch-row:hover{border-color:#9cc0ed;background:#eaf3ff}:root[data-theme=light] .switch-track{background:#c1cbd8}:root[data-theme=light] .switch-control input:checked+.switch-track{background:#34c76a} +:root[data-theme=light] .sensor-close:hover{background:#e4efff}:root[data-theme=light] .sensor-detail__section:last-child{border-color:#ecc6cb;background:#fff5f6}:root[data-theme=light] .sensor-detail__section:last-child .button--danger{color:#fff;background:#a43c50} +:root[data-theme=light] .sensor-access{border-color:#b8dfca;color:#256147;background:#ecf8f0}:root[data-theme=light] .sensor-access--off{border-color:#dbcbd3;color:#80556a;background:#fbf4f7}:root[data-theme=light] .sensor-form{border-color:#9cc0ed} +@media(max-width:48rem){.settings-content{grid-template-columns:minmax(0,1fr)}.settings-shell{width:min(100% - 2.25rem,73.75rem);padding:2.5rem 0 3rem}} +@media(max-width:48rem){.sensor-detail__actions,.sensor-list{grid-template-columns:minmax(0,1fr)}} +@media(max-width:30rem){.sensor-detail__facts{grid-template-columns:minmax(0,1fr)}.sensor-detail__header{align-items:start}.sensor-close span{display:none}} +@media(max-width:35rem){.card{padding:1.25rem}.sensor-form__controls{grid-template-columns:minmax(0,1fr)}} +@media(prefers-reduced-motion:reduce){.button,.switch-track,.switch-track::after{transition:none}.button:hover{transform:none}} diff --git a/frontend/tests/manual-compass.test.mjs b/frontend/tests/manual-compass.test.mjs new file mode 100644 index 0000000..f2620b4 --- /dev/null +++ b/frontend/tests/manual-compass.test.mjs @@ -0,0 +1,60 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { JSDOM } from "jsdom"; + +test("compass stays hidden until permission and a heading, then rotates and hides when stopped", async () => { + const dom = new JSDOM(` + + + + + +
+
+ +

+
+
+ + `, { url: "https://example.test/" }); + const { window } = dom; + Object.defineProperty(window, "isSecureContext", { value: true }); + let resolvePermission; + class MockOrientation {} + MockOrientation.requestPermission = () => new Promise((resolve) => { resolvePermission = resolve; }); + window.DeviceOrientationEvent = MockOrientation; + const previous = Object.fromEntries(["window", "document", "navigator", "DeviceOrientationEvent"].map((key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)])); + for (const [key, value] of Object.entries({ window, document: window.document, navigator: window.navigator, DeviceOrientationEvent: MockOrientation })) { + Object.defineProperty(globalThis, key, { configurable: true, writable: true, value }); + } + try { + await import("../src/scripts/manual-report.js?compass=visual"); + const compass = window.document.querySelector("#manual-compass"); + const rose = window.document.querySelector("#manual-compass-rose"); + const button = window.document.querySelector("#manual-capture-direction"); + assert.equal(compass.hidden, true); + button.click(); + assert.equal(compass.hidden, true); + resolvePermission("granted"); + await new Promise((resolve) => setTimeout(resolve, 0)); + const reading = (heading) => { + const event = new window.Event("deviceorientation"); + Object.defineProperty(event, "webkitCompassHeading", { value: heading }); + window.dispatchEvent(event); + }; + reading(359); + assert.equal(compass.hidden, false); + assert.equal(rose.style.transform, "rotate(-359deg)"); + reading(1); + assert.equal(rose.style.transform, "rotate(-361deg)"); + assert.equal(window.document.querySelector("#manual-direction-degrees").value, "1"); + button.click(); + assert.equal(compass.hidden, true); + } finally { + for (const [key, descriptor] of Object.entries(previous)) { + if (descriptor === undefined) delete globalThis[key]; + else Object.defineProperty(globalThis, key, descriptor); + } + dom.window.close(); + } +}); diff --git a/hello/__pycache__/__init__.cpython-312.pyc b/hello/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..7e9d592 Binary files /dev/null and b/hello/__pycache__/__init__.cpython-312.pyc differ diff --git a/hello/__pycache__/admin.cpython-312.pyc b/hello/__pycache__/admin.cpython-312.pyc new file mode 100644 index 0000000..995ec9f Binary files /dev/null and b/hello/__pycache__/admin.cpython-312.pyc differ diff --git a/hello/__pycache__/apps.cpython-312.pyc b/hello/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000..2238ec2 Binary files /dev/null and b/hello/__pycache__/apps.cpython-312.pyc differ diff --git a/hello/__pycache__/models.cpython-312.pyc b/hello/__pycache__/models.cpython-312.pyc new file mode 100644 index 0000000..8a671fb Binary files /dev/null and b/hello/__pycache__/models.cpython-312.pyc differ diff --git a/hello/__pycache__/views.cpython-312.pyc b/hello/__pycache__/views.cpython-312.pyc new file mode 100644 index 0000000..5c45b64 Binary files /dev/null and b/hello/__pycache__/views.cpython-312.pyc differ diff --git a/locale/nl/LC_MESSAGES/django.mo b/locale/nl/LC_MESSAGES/django.mo index 8b6f43a..6b08bad 100644 Binary files a/locale/nl/LC_MESSAGES/django.mo and b/locale/nl/LC_MESSAGES/django.mo differ diff --git a/locale/nl/LC_MESSAGES/django.po b/locale/nl/LC_MESSAGES/django.po index ae322e5..da4f931 100644 --- a/locale/nl/LC_MESSAGES/django.po +++ b/locale/nl/LC_MESSAGES/django.po @@ -924,9 +924,20 @@ msgid "Notifications / ntfy" msgstr "Meldingen / ntfy" #: members/templates/members/user_settings.html:30 -msgid "" -"Use a topic URL from your ntfy server. Test the current URL before saving it." -msgstr "Gebruik een onderwerp-URL van je ntfy-server. Test de URL voordat je hem opslaat." +msgid "Use a topic URL from your ntfy server. Test the URL before enabling notifications." +msgstr "Gebruik een onderwerp-URL van je ntfy-server. Test de URL voordat je meldingen inschakelt." + +msgid "Pending events" +msgstr "Wachtende meldingen" + +msgid "%(count)d manual" +msgstr "%(count)d handmatig" + +msgid "%(count)d sensor" +msgstr "%(count)d sensor" + +msgid "%(count)d new Pending event(s): %(sources)s." +msgstr "%(count)d nieuwe wachtende melding(en): %(sources)s." #: members/templates/members/user_settings.html:31 msgid "Topic URL" diff --git a/media/fireworks_audio/2026/10/01/dragon-studio-fireworks-11-419030.mp3 b/media/fireworks_audio/2026/10/01/dragon-studio-fireworks-11-419030.mp3 deleted file mode 100644 index f9bcda9..0000000 Binary files a/media/fireworks_audio/2026/10/01/dragon-studio-fireworks-11-419030.mp3 and /dev/null differ diff --git a/media/fireworks_audio/2026/10/01/sound-signal-manual-20261001-210123-2797aabd.wav b/media/fireworks_audio/2026/10/01/sound-signal-manual-20261001-210123-2797aabd.wav deleted file mode 100644 index dfd0d55..0000000 Binary files a/media/fireworks_audio/2026/10/01/sound-signal-manual-20261001-210123-2797aabd.wav and /dev/null differ diff --git a/media/fireworks_audio/2026/10/02/sound-signal-manual-20261002-131804-53ed07c9.wav b/media/fireworks_audio/2026/10/02/sound-signal-manual-20261002-131804-53ed07c9.wav deleted file mode 100644 index 08bc09b..0000000 Binary files a/media/fireworks_audio/2026/10/02/sound-signal-manual-20261002-131804-53ed07c9.wav and /dev/null differ diff --git a/media/fireworks_audio/2026/10/03/sample.wav b/media/fireworks_audio/2026/10/03/sample.wav new file mode 100644 index 0000000..6a8dc96 --- /dev/null +++ b/media/fireworks_audio/2026/10/03/sample.wav @@ -0,0 +1 @@ +RIFF0000WAVEdata \ No newline at end of file diff --git a/media/fireworks_audio/2026/10/03/sample_VjcvHNd.wav b/media/fireworks_audio/2026/10/03/sample_VjcvHNd.wav new file mode 100644 index 0000000..6a8dc96 --- /dev/null +++ b/media/fireworks_audio/2026/10/03/sample_VjcvHNd.wav @@ -0,0 +1 @@ +RIFF0000WAVEdata \ No newline at end of file diff --git a/members/__pycache__/__init__.cpython-312.pyc b/members/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..bcdb768 Binary files /dev/null and b/members/__pycache__/__init__.cpython-312.pyc differ diff --git a/members/__pycache__/admin.cpython-312.pyc b/members/__pycache__/admin.cpython-312.pyc new file mode 100644 index 0000000..139973c Binary files /dev/null and b/members/__pycache__/admin.cpython-312.pyc differ diff --git a/members/__pycache__/apps.cpython-312.pyc b/members/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000..e6447f2 Binary files /dev/null and b/members/__pycache__/apps.cpython-312.pyc differ diff --git a/members/__pycache__/forms.cpython-312.pyc b/members/__pycache__/forms.cpython-312.pyc new file mode 100644 index 0000000..0fc4691 Binary files /dev/null and b/members/__pycache__/forms.cpython-312.pyc differ diff --git a/members/__pycache__/language_views.cpython-312.pyc b/members/__pycache__/language_views.cpython-312.pyc new file mode 100644 index 0000000..0301b3f Binary files /dev/null and b/members/__pycache__/language_views.cpython-312.pyc differ diff --git a/members/__pycache__/middleware.cpython-312.pyc b/members/__pycache__/middleware.cpython-312.pyc new file mode 100644 index 0000000..cbff4e1 Binary files /dev/null and b/members/__pycache__/middleware.cpython-312.pyc differ diff --git a/members/__pycache__/models.cpython-312.pyc b/members/__pycache__/models.cpython-312.pyc new file mode 100644 index 0000000..861811d Binary files /dev/null and b/members/__pycache__/models.cpython-312.pyc differ diff --git a/members/__pycache__/models.cpython-313.pyc b/members/__pycache__/models.cpython-313.pyc index 01dba99..5beeb76 100644 Binary files a/members/__pycache__/models.cpython-313.pyc and b/members/__pycache__/models.cpython-313.pyc differ diff --git a/members/__pycache__/sensor_views.cpython-312.pyc b/members/__pycache__/sensor_views.cpython-312.pyc new file mode 100644 index 0000000..313c3ea Binary files /dev/null and b/members/__pycache__/sensor_views.cpython-312.pyc differ diff --git a/members/__pycache__/sensor_views.cpython-313.pyc b/members/__pycache__/sensor_views.cpython-313.pyc index d2bd4a8..e45e8ab 100644 Binary files a/members/__pycache__/sensor_views.cpython-313.pyc and b/members/__pycache__/sensor_views.cpython-313.pyc differ diff --git a/members/__pycache__/settings_urls.cpython-312.pyc b/members/__pycache__/settings_urls.cpython-312.pyc new file mode 100644 index 0000000..83750ca Binary files /dev/null and b/members/__pycache__/settings_urls.cpython-312.pyc differ diff --git a/members/__pycache__/settings_urls.cpython-313.pyc b/members/__pycache__/settings_urls.cpython-313.pyc index b48fac4..4b0280b 100644 Binary files a/members/__pycache__/settings_urls.cpython-313.pyc and b/members/__pycache__/settings_urls.cpython-313.pyc differ diff --git a/members/__pycache__/test_sensors.cpython-313.pyc b/members/__pycache__/test_sensors.cpython-313.pyc index 0a372ef..24dc709 100644 Binary files a/members/__pycache__/test_sensors.cpython-313.pyc and b/members/__pycache__/test_sensors.cpython-313.pyc differ diff --git a/members/__pycache__/tests.cpython-313.pyc b/members/__pycache__/tests.cpython-313.pyc index 6782362..e7c78cd 100644 Binary files a/members/__pycache__/tests.cpython-313.pyc and b/members/__pycache__/tests.cpython-313.pyc differ diff --git a/members/__pycache__/urls.cpython-312.pyc b/members/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000..092f158 Binary files /dev/null and b/members/__pycache__/urls.cpython-312.pyc differ diff --git a/members/__pycache__/views.cpython-312.pyc b/members/__pycache__/views.cpython-312.pyc new file mode 100644 index 0000000..43b5bf9 Binary files /dev/null and b/members/__pycache__/views.cpython-312.pyc differ diff --git a/members/__pycache__/views.cpython-313.pyc b/members/__pycache__/views.cpython-313.pyc index a712bd7..676e064 100644 Binary files a/members/__pycache__/views.cpython-313.pyc and b/members/__pycache__/views.cpython-313.pyc differ diff --git a/members/management/__init__.py b/members/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/members/management/__pycache__/__init__.cpython-312.pyc b/members/management/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..a2bdea5 Binary files /dev/null and b/members/management/__pycache__/__init__.cpython-312.pyc differ diff --git a/members/management/__pycache__/__init__.cpython-313.pyc b/members/management/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..8748ac0 Binary files /dev/null and b/members/management/__pycache__/__init__.cpython-313.pyc differ diff --git a/members/management/commands/__init__.py b/members/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/members/management/commands/__pycache__/__init__.cpython-312.pyc b/members/management/commands/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..e40f52a Binary files /dev/null and b/members/management/commands/__pycache__/__init__.cpython-312.pyc differ diff --git a/members/management/commands/__pycache__/__init__.cpython-313.pyc b/members/management/commands/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..4571eaf Binary files /dev/null and b/members/management/commands/__pycache__/__init__.cpython-313.pyc differ diff --git a/members/management/commands/__pycache__/send_pending_notifications.cpython-312.pyc b/members/management/commands/__pycache__/send_pending_notifications.cpython-312.pyc new file mode 100644 index 0000000..c4220f7 Binary files /dev/null and b/members/management/commands/__pycache__/send_pending_notifications.cpython-312.pyc differ diff --git a/members/management/commands/__pycache__/send_pending_notifications.cpython-313.pyc b/members/management/commands/__pycache__/send_pending_notifications.cpython-313.pyc new file mode 100644 index 0000000..87262a0 Binary files /dev/null and b/members/management/commands/__pycache__/send_pending_notifications.cpython-313.pyc differ diff --git a/members/management/commands/send_pending_notifications.py b/members/management/commands/send_pending_notifications.py new file mode 100644 index 0000000..592209c --- /dev/null +++ b/members/management/commands/send_pending_notifications.py @@ -0,0 +1,37 @@ +import logging + +from django.core.management.base import BaseCommand +from django.utils import timezone +from django.utils import translation +from django.utils.translation import gettext as _ + +from members.models import PendingNotificationBatch, UserSettings +from notifications.services import NotificationError, send_notification + +logger = logging.getLogger(__name__) + + +class Command(BaseCommand): + help = "Send one ntfy summary per user for each completed minute of Pending arrivals." + + def handle(self, *args, **options): + current_minute = timezone.now().replace(second=0, microsecond=0) + batches = PendingNotificationBatch.objects.filter(minute__lt=current_minute).select_related("user").order_by("minute", "pk") + for batch in batches.iterator(): + if not UserSettings.objects.filter(user=batch.user, ntfy_enabled=True).exclude(ntfy_url="").exists(): + batch.delete() + continue + try: + with translation.override(batch.user.notification_settings.preferred_language): + parts = [] + if batch.manual_count: + parts.append(_("%(count)d manual") % {"count": batch.manual_count}) + if batch.sensor_count: + parts.append(_("%(count)d sensor") % {"count": batch.sensor_count}) + total = batch.manual_count + batch.sensor_count + message = _("%(count)d new Pending event(s): %(sources)s.") % {"count": total, "sources": ", ".join(parts)} + send_notification(batch.user, _("Pending events"), message) + except NotificationError as error: + logger.warning("Could not send Pending notification for user %s: %s", batch.user_id, error) + continue + batch.delete() diff --git a/members/migrations/0004_pendingnotificationbatch.py b/members/migrations/0004_pendingnotificationbatch.py new file mode 100644 index 0000000..1a77e53 --- /dev/null +++ b/members/migrations/0004_pendingnotificationbatch.py @@ -0,0 +1,27 @@ +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ("members", "0003_usersettings_preferred_language"), + ] + + operations = [ + migrations.CreateModel( + name="PendingNotificationBatch", + fields=[ + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("minute", models.DateTimeField()), + ("manual_count", models.PositiveIntegerField(default=0)), + ("sensor_count", models.PositiveIntegerField(default=0)), + ("user", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.AddConstraint( + model_name="pendingnotificationbatch", + constraint=models.UniqueConstraint(fields=("user", "minute"), name="unique_pending_notification_minute"), + ), + ] diff --git a/members/migrations/__pycache__/0004_pendingnotificationbatch.cpython-313.pyc b/members/migrations/__pycache__/0004_pendingnotificationbatch.cpython-313.pyc new file mode 100644 index 0000000..c404ffd Binary files /dev/null and b/members/migrations/__pycache__/0004_pendingnotificationbatch.cpython-313.pyc differ diff --git a/members/models.py b/members/models.py index 702c26c..4263e22 100644 --- a/members/models.py +++ b/members/models.py @@ -29,3 +29,15 @@ class UserSettings(models.Model): def __str__(self): return _("Settings for %(user)s") % {"user": self.user} + + +class PendingNotificationBatch(models.Model): + """One minute of new Pending events for one notification recipient.""" + + user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + minute = models.DateTimeField() + manual_count = models.PositiveIntegerField(default=0) + sensor_count = models.PositiveIntegerField(default=0) + + class Meta: + constraints = [models.UniqueConstraint(fields=["user", "minute"], name="unique_pending_notification_minute")] diff --git a/members/sensor_views.py b/members/sensor_views.py index aa996f0..2ad9e1a 100644 --- a/members/sensor_views.py +++ b/members/sensor_views.py @@ -19,13 +19,33 @@ def owned_sensor(request, pk): return get_object_or_404(Sensor, pk=pk, owner=request.user, archived_at__isnull=True) +def is_htmx(request): + return request.headers.get("HX-Request") == "true" + + +def render_sensor_list(request): + return render(request, "members/partials/sensor_list.html", { + "sensors": Sensor.objects.filter(owner=request.user, archived_at__isnull=True), + }) + + def render_sensor(request, sensor, form=None, token=None): - return render(request, "members/sensor_manage.html", { + response = render(request, "members/partials/sensor_detail.html" if is_htmx(request) else "members/sensor_manage.html", { "sensor": sensor, "form": form or SensorForm(instance=sensor), "token": token, "heartbeat": sensor.heartbeat_status(), }) + if token: + response["Cache-Control"] = "no-store" + return response + + +@login_required +def sensor_list(request): + if is_htmx(request): + return render_sensor_list(request) + return redirect("user_settings") @login_required @@ -35,6 +55,8 @@ def create_sensor(request): form = SensorForm(request.POST) if not form.is_valid(): messages.error(request, _("Enter a valid sensor name. Names must be unique.")) + if is_htmx(request): + return render_sensor_list(request) return redirect("user_settings") sensor = form.save(commit=False) sensor.owner = request.user @@ -57,6 +79,8 @@ def rename_sensor(request, pk): if form.is_valid(): form.save() messages.success(request, _("Sensor renamed.")) + if is_htmx(request): + return render_sensor(request, sensor) return redirect("manage_sensor", pk=pk) return render_sensor(request, sensor, form=form) @@ -67,6 +91,8 @@ def toggle_sensor(request, pk): sensor = owned_sensor(request, pk) sensor.is_active = not sensor.is_active sensor.save(update_fields=["is_active"]) + if is_htmx(request): + return render_sensor(request, sensor) return redirect("manage_sensor", pk=pk) @@ -77,6 +103,8 @@ def rotate_sensor(request, pk): sensor = owned_sensor(request, pk) if request.POST.get("confirm") != "rotate": messages.error(request, _("Confirm token rotation first.")) + if is_htmx(request): + return render_sensor(request, sensor) return redirect("manage_sensor", pk=pk) token = sensor.issue_token() return render_sensor(request, sensor, token=token) @@ -88,7 +116,11 @@ def remove_sensor(request, pk): sensor = owned_sensor(request, pk) if request.POST.get("confirm") != "remove": messages.error(request, _("Confirm sensor removal first.")) + if is_htmx(request): + return render_sensor(request, sensor) return redirect("manage_sensor", pk=pk) sensor.archive() messages.success(request, _("Sensor removed. Historical events were preserved.")) + if is_htmx(request): + return render_sensor_list(request) return redirect("user_settings") diff --git a/members/settings_urls.py b/members/settings_urls.py index e53d8e9..05ce564 100644 --- a/members/settings_urls.py +++ b/members/settings_urls.py @@ -8,6 +8,7 @@ urlpatterns = [ path("", views.user_settings, name="user_settings"), path("notifications/ntfy/test/", views.test_ntfy_notification, name="ntfy_test_notification"), path("sensors/create/", sensor_views.create_sensor, name="create_sensor"), + path("sensors/", sensor_views.sensor_list, name="sensor_list"), path("sensors//", sensor_views.manage_sensor, name="manage_sensor"), path("sensors//rename/", sensor_views.rename_sensor, name="rename_sensor"), path("sensors//toggle/", sensor_views.toggle_sensor, name="toggle_sensor"), diff --git a/members/templates/members/login.html b/members/templates/members/login.html index 25249c6..015ca2a 100644 --- a/members/templates/members/login.html +++ b/members/templates/members/login.html @@ -24,6 +24,7 @@ {% if next %}{% endif %} +

{% trans "New here?" %} {% trans "Create an account" %}

{% trans "You will return to the page you requested." %}

diff --git a/members/templates/members/partials/sensor_detail.html b/members/templates/members/partials/sensor_detail.html new file mode 100644 index 0000000..3dc7ea6 --- /dev/null +++ b/members/templates/members/partials/sensor_detail.html @@ -0,0 +1,50 @@ +{% load i18n %} +
+
+

{% trans "Sensor settings" %}

{{ sensor.name }}

+ {% trans "Close" %} +
+ {% if messages %}
    {% for message in messages %}
  • {{ message }}
  • {% endfor %}
{% endif %} + {% if token %}
+ {% trans "Copy this token now. For security reasons it will not be shown again." %} + {{ token }} + +
{% endif %} +
+ {% with status=heartbeat %}● {{ status.1 }}{% endwith %} +
+
{% trans "Last heartbeat" %}
{{ sensor.last_heartbeat|date:"j M Y, H:i"|default:"—" }}
+
{% trans "Last submission" %}
{{ sensor.last_submission|date:"j M Y, H:i"|default:"—" }}
+
{% trans "Token prefix" %}
{{ sensor.token_prefix|default:"—" }}
+
{% trans "Created" %}
{{ sensor.created_at|date:"j M Y, H:i" }}
+
+
+
+

{% trans "Rename" %}

+
{% csrf_token %} +
{{ form.name }}{{ form.name.errors }}
+ +
+
+

{% trans "Device access" %}

+

{% if sensor.is_active %}{% trans "Enabled" %}{% else %}{% trans "Disabled" %}{% endif %}

+
{% csrf_token %} + +
+
+

{% trans "Reissue API token" %}

+

{% trans "The old token will immediately stop authenticating." %}

+
{% csrf_token %} + + +
+
+

{% trans "Remove sensor" %}

+

{% trans "This disables the device and revokes its token. Historical events remain linked to it." %}

+
{% csrf_token %} + + +
+
+
+
diff --git a/members/templates/members/partials/sensor_list.html b/members/templates/members/partials/sensor_list.html new file mode 100644 index 0000000..fa2b646 --- /dev/null +++ b/members/templates/members/partials/sensor_list.html @@ -0,0 +1,27 @@ +{% load i18n %} +

{% trans "Connected devices" %}

{% trans "My sensors" %}

{% trans "Manage the devices that authenticate with BoomCast." %}

+{% if messages %}
    {% for message in messages %}
  • {{ message }}
  • {% endfor %}
{% endif %} +
+ {% for sensor in sensors %} +
+

{{ sensor.name }}

{% with status=sensor.heartbeat_status %}● {{ status.1 }}{% endwith %}
+ {% if sensor.is_active %}{% trans "Enabled" %}{% else %}{% trans "Disabled" %}{% endif %} +
+
{% trans "Last heartbeat" %}
{{ sensor.last_heartbeat|date:"j M Y, H:i"|default:"—" }}
+
{% trans "Created" %}
{{ sensor.created_at|date:"j M Y" }}
+
{% trans "Token prefix" %}
{{ sensor.token_prefix|default:"—" }}
+
+ {% trans "Manage" %} +
+ {% empty %} +

{% trans "No sensors yet. Add a device to receive an API token for hardware submissions." %}

+ {% endfor %} +
+
+ {% csrf_token %} +

{% trans "Add a sensor" %}

{% trans "Give your device a name so you can recognise it later." %}

+
+
+ +
+
diff --git a/members/templates/members/register.html b/members/templates/members/register.html new file mode 100644 index 0000000..b730d84 --- /dev/null +++ b/members/templates/members/register.html @@ -0,0 +1,31 @@ +{% load i18n vite %} + + + + + + {% trans "Create an account · Sound Signal" %} + {% vite_asset "frontend/src/entries/login.js" %} + {% include "js_translations.html" %} + + +
+

✦ Sound Signal

+

{% trans "Create an account" %}

+

{% trans "Only a username and password are needed." %}

+
+ {% csrf_token %} + {% if next %}{% endif %} + {{ form.non_field_errors }} + + {{ form.username }} {{ form.username.errors }} + + {{ form.password1 }} {{ form.password1.errors }} + + {{ form.password2 }} {{ form.password2.errors }} + +
+

{% trans "Already have an account?" %} {% trans "Sign in" %}

+
+ + diff --git a/members/templates/members/sensor_manage.html b/members/templates/members/sensor_manage.html index 3636b5a..0194853 100644 --- a/members/templates/members/sensor_manage.html +++ b/members/templates/members/sensor_manage.html @@ -5,48 +5,17 @@ {{ sensor.name }} · {% trans "Settings" %} + {% vite_asset "frontend/src/entries/settings.js" %} + {% include "js_translations.html" %} -
- ← {% trans "Settings" %} -

{{ sensor.name }}

- {% if messages %}
    {% for message in messages %}
  • {{ message }}
  • {% endfor %}
{% endif %} - {% if token %}
- {% trans "Copy this token now. For security reasons it will not be shown again." %} - {{ token }} - -
{% endif %} -
- {% with status=heartbeat %}

● {{ status.1 }}

{% endwith %} -

{% trans "Last heartbeat" %}: {{ sensor.last_heartbeat|date:"j M Y, H:i"|default:"—" }}

-

{% trans "Last submission" %}: {{ sensor.last_submission|date:"j M Y, H:i"|default:"—" }}

-

{% trans "Token prefix" %}: {{ sensor.token_prefix|default:"—" }}

-

{% trans "Created" %}: {{ sensor.created_at|date:"j M Y, H:i" }}

-
-

{% trans "Rename" %}

-
{% csrf_token %} - {{ form.name }}{{ form.name.errors }} - -
-
-

{% trans "Device access" %}

-

{% if sensor.is_active %}{% trans "Enabled" %}{% else %}{% trans "Disabled" %}{% endif %}

-
{% csrf_token %} - -
-
-

{% trans "Reissue API token" %}

-

{% trans "The old token will immediately stop authenticating." %}

-
{% csrf_token %} -
- -
-
-

{% trans "Remove sensor" %}

-

{% trans "This disables the device and revokes its token. Historical events remain linked to it." %}

-
{% csrf_token %} -
- -
-
-
+ +
+ {% include "fireworks_detect/includes/navigation.html" %} +
+

{% trans "Your preferences" %}

{% trans "Settings" %}

+
{% include "members/partials/sensor_detail.html" %}
+
+
+ + diff --git a/members/templates/members/user_settings.html b/members/templates/members/user_settings.html index 7141100..5a9b2ca 100644 --- a/members/templates/members/user_settings.html +++ b/members/templates/members/user_settings.html @@ -9,55 +9,46 @@ {% vite_asset "frontend/src/entries/settings.js" %} {% include "js_translations.html" %} -
-

{% trans "Settings" %}

-

{% trans "Manage your personal preferences." %}

- {% if messages %}
    {% for message in messages %}
  • {{ message }}
  • {% endfor %}
{% endif %} -
- {% csrf_token %} -
+
+ {% include "fireworks_detect/includes/navigation.html" %} +
+
+

{% trans "Your preferences" %}

+

{% trans "Settings" %}

+

{% trans "Manage your personal preferences." %}

+
+ {% if messages %}
    {% for message in messages %}
  • {{ message }}
  • {% endfor %}
{% endif %} + + {% csrf_token %}

{% trans "Language" %}

- - {{ language_form.preferred_language }} - {{ language_form.preferred_language.errors }} -
- -
-
- {% csrf_token %} -
+
+ + {{ language_form.preferred_language }} + {{ language_form.preferred_language.errors }} +
+ + +
+ {% csrf_token %}

{% trans "Notifications / ntfy" %}

-

{% trans "Use a topic URL from your ntfy server. Test the current URL before saving it." %}

- - {{ form.ntfy_url }} - {{ form.ntfy_url.errors }} -
{{ form.ntfy_enabled }}
+

{% trans "Use a topic URL from your ntfy server. Test the URL before enabling notifications." %}

+
+ + {{ form.ntfy_url }} + {{ form.ntfy_url.errors }} +
+
-
- - -
-

{% trans "My sensors" %}

-

{% trans "Manage the devices that authenticate with BoomCast." %}

- {% for sensor in sensors %} -
- {{ sensor.name }} - {% with status=sensor.heartbeat_status %}● {{ status.1 }}{% endwith %} -

{% if sensor.is_active %}{% trans "Enabled" %}{% else %}{% trans "Disabled" %}{% endif %} · {% trans "Token prefix" %}: {{ sensor.token_prefix|default:"—" }}

-

{% trans "Last heartbeat" %}: {{ sensor.last_heartbeat|date:"j M Y, H:i"|default:"—" }} · {% trans "Created" %}: {{ sensor.created_at|date:"j M Y" }}

- {% trans "Manage" %} -
- {% empty %} -

{% trans "No sensors yet. Add a device to receive an API token for hardware submissions." %}

- {% endfor %} -
- {% csrf_token %} - - - +
-
+
+
{% include "members/partials/sensor_list.html" %}
+
+
diff --git a/members/test_sensors.py b/members/test_sensors.py index c460bf1..1e8f4aa 100644 --- a/members/test_sensors.py +++ b/members/test_sensors.py @@ -39,6 +39,41 @@ class SensorSettingsTests(TestCase): self.assertContains(listing, "Bob's device") self.assertNotContains(listing, "Balcony") + def test_htmx_sensor_card_opens_updates_and_closes(self): + sensor = Sensor.objects.create(name="Balcony", owner=self.alice) + headers = {"HTTP_HX_REQUEST": "true"} + + detail = self.client.get(reverse("manage_sensor", args=[sensor.pk]), **headers) + self.assertContains(detail, "Balcony") + self.assertContains(detail, reverse("sensor_list")) + self.assertNotContains(detail, "") + + renamed = self.client.post(reverse("rename_sensor", args=[sensor.pk]), {"name": "Roof"}, **headers) + self.assertContains(renamed, "Roof") + self.assertNotContains(renamed, "") + + listing = self.client.get(reverse("sensor_list"), **headers) + self.assertContains(listing, "Roof") + self.assertContains(listing, reverse("manage_sensor", args=[sensor.pk])) + + full_page = self.client.get(reverse("manage_sensor", args=[sensor.pk])) + self.assertContains(full_page, "") + self.assertContains(full_page, "settings-shell") + + def test_htmx_create_shows_token_once_and_remove_restores_list(self): + headers = {"HTTP_HX_REQUEST": "true"} + created = self.client.post(reverse("create_sensor"), {"name": "Portable"}, **headers) + sensor = Sensor.objects.get(name="Portable") + token = created.context["token"] + self.assertContains(created, token) + self.assertIn("no-store", created["Cache-Control"]) + self.assertNotContains(self.client.get(reverse("manage_sensor", args=[sensor.pk]), **headers), token) + + removed = self.client.post(reverse("remove_sensor", args=[sensor.pk]), {"confirm": "remove"}, **headers) + self.assertContains(removed, "My sensors") + self.assertNotContains(removed, "Portable") + self.assertEqual(self.client.get(reverse("manage_sensor", args=[sensor.pk]), **headers).status_code, 404) + def test_owner_can_manage_rotate_and_archive_preserving_history(self): sensor = Sensor.objects.create(name="Balcony", owner=self.alice) old_token = sensor.issue_token() diff --git a/members/tests.py b/members/tests.py index 78d80b4..b0a0d87 100644 --- a/members/tests.py +++ b/members/tests.py @@ -4,13 +4,14 @@ from urllib.error import HTTPError, URLError from django.contrib.auth import get_user_model from django.conf import settings +from django.core.management import call_command from django.test import SimpleTestCase, TestCase from django.urls import reverse from django.utils import translation from notifications.services import NotificationError, send_notification, send_ntfy_notification -from .models import UserSettings +from .models import PendingNotificationBatch, UserSettings @@ -90,6 +91,58 @@ class UserSettingsNtfyTests(TestCase): self.assertFalse(settings.ntfy_enabled) self.assertEqual(settings.ntfy_url, "") + def test_unchecked_url_can_be_saved_without_testing_then_requires_test_to_enable(self): + response = self.client.post(reverse("user_settings"), {"ntfy_url": self.url}) + self.assertRedirects(response, reverse("user_settings")) + saved = UserSettings.objects.get(user=self.user) + self.assertEqual(saved.ntfy_url, self.url) + self.assertFalse(saved.ntfy_enabled) + self.assertIsNone(saved.ntfy_last_tested_at) + response = self.client.post(reverse("user_settings"), {"ntfy_url": self.url, "ntfy_enabled": "on"}) + self.assertContains(response, "Test deze URL") + + @patch("notifications.services.send_ntfy_notification") + def test_pending_arrivals_are_grouped_by_minute_and_source(self, mock_send): + from datetime import timedelta + from django.utils import timezone + from fireworks_detect.models import PendingEvent + + UserSettings.objects.create(user=self.user, ntfy_url=self.url, ntfy_enabled=True) + PendingEvent.objects.create(original_filename="manual", classifier_response={}, source_type=PendingEvent.SourceType.MANUAL) + PendingEvent.objects.create(original_filename="sensor", classifier_response={}) + PendingEvent.objects.create(original_filename="sensor2", classifier_response={}) + batch = PendingNotificationBatch.objects.get(user=self.user) + self.assertEqual((batch.manual_count, batch.sensor_count), (1, 2)) + call_command("send_pending_notifications") + mock_send.assert_not_called() + PendingNotificationBatch.objects.filter(pk=batch.pk).update(minute=timezone.now() - timedelta(minutes=2)) + call_command("send_pending_notifications") + mock_send.assert_called_once() + self.assertIn("1 handmatig", mock_send.call_args.args[2]) + self.assertIn("2 sensor", mock_send.call_args.args[2]) + self.assertFalse(PendingNotificationBatch.objects.exists()) + PendingEvent.objects.create(original_filename="next", classifier_response={}) + self.assertEqual(PendingNotificationBatch.objects.get(user=self.user).sensor_count, 1) + + @patch("notifications.services.send_ntfy_notification", side_effect=NotificationError("Could not connect")) + def test_failed_summary_is_kept_for_retry(self, mock_send): + from datetime import timedelta + from django.utils import timezone + from fireworks_detect.models import PendingEvent + + UserSettings.objects.create(user=self.user, ntfy_url=self.url, ntfy_enabled=True) + PendingEvent.objects.create(original_filename="manual", classifier_response={}, source_type=PendingEvent.SourceType.MANUAL) + PendingNotificationBatch.objects.update(minute=timezone.now() - timedelta(minutes=2)) + call_command("send_pending_notifications") + self.assertEqual(PendingNotificationBatch.objects.get().manual_count, 1) + + def test_disabled_user_does_not_accumulate_pending_summaries(self): + from fireworks_detect.models import PendingEvent + + UserSettings.objects.create(user=self.user, ntfy_url=self.url, ntfy_enabled=False) + PendingEvent.objects.create(original_filename="manual", classifier_response={}, source_type=PendingEvent.SourceType.MANUAL) + self.assertFalse(PendingNotificationBatch.objects.exists()) + @patch("members.views.send_ntfy_notification") def test_successfully_tested_url_can_be_saved(self, mock_send): self.client.post(reverse("ntfy_test_notification"), {"ntfy_url": self.url}) @@ -145,13 +198,54 @@ class FrontendAuthenticationTests(TestCase): self.assertEqual(response.status_code, 200) self.assertContains(response, "Sign in") + self.assertContains(response, reverse("register")) self.assertContains(response, "csrfmiddlewaretoken") + def test_registration_creates_minimal_account_and_signs_in(self): + response = self.client.post(reverse("register"), { + "username": "new-user", + "password1": "long-unique-password-5842", + "password2": "long-unique-password-5842", + }) + + self.assertRedirects(response, "/") + user = get_user_model().objects.get(username="new-user") + self.assertEqual(user.email, "") + self.assertEqual(str(self.client.session["_auth_user_id"]), str(user.pk)) + + def test_registration_preserves_safe_login_destination(self): + login_page = self.client.get(reverse("login"), {"next": "/settings/"}) + self.assertContains(login_page, "/register/?next=/settings/") + + response = self.client.post(reverse("register"), { + "username": "another-new-user", + "password1": "long-unique-password-5842", + "password2": "long-unique-password-5842", + "next": "/settings/", + }) + self.assertRedirects(response, "/settings/") + + def test_registration_rejects_external_destination(self): + response = self.client.post(reverse("register"), { + "username": "safe-user", + "password1": "long-unique-password-5842", + "password2": "long-unique-password-5842", + "next": "https://example.com/steal", + }) + self.assertRedirects(response, "/") + def test_frontend_login_authenticates_and_returns_home(self): response = self.client.post(reverse("login"), {"username": "profile-user", "password": "secret"}) self.assertRedirects(response, "/") + def test_frontend_logout_uses_post_and_returns_home(self): + self.client.force_login(self.user) + self.assertEqual(self.client.get(reverse("logout")).status_code, 405) + response = self.client.post(reverse("logout")) + self.assertRedirects(response, "/") + self.assertNotIn("_auth_user_id", self.client.session) + def test_protected_settings_redirects_to_frontend_login(self): response = self.client.get(reverse("user_settings")) @@ -160,11 +254,14 @@ class FrontendAuthenticationTests(TestCase): def test_profile_circle_is_visible_only_for_authenticated_users(self): anonymous_response = self.client.get(reverse("hello")) self.assertNotContains(anonymous_response, "class=\"profile-circle\"") + self.assertContains(anonymous_response, f'href="{reverse("login")}"') self.client.force_login(self.user) authenticated_response = self.client.get(reverse("hello")) self.assertContains(authenticated_response, "class=\"profile-circle\"") self.assertContains(authenticated_response, reverse("user_settings")) + self.assertContains(authenticated_response, f'action="{reverse("logout")}"') + self.assertNotContains(authenticated_response, f'href="{reverse("login")}"') class LanguageSettingsTests(TestCase): diff --git a/members/views.py b/members/views.py index fab8435..72c2cd1 100644 --- a/members/views.py +++ b/members/views.py @@ -1,11 +1,14 @@ from hashlib import sha256 from django.contrib import messages +from django.contrib.auth import login from django.contrib.auth.decorators import login_required +from django.contrib.auth.forms import UserCreationForm from django.core.exceptions import ValidationError from django.core.validators import URLValidator from django.shortcuts import render, redirect from django.utils import timezone +from django.utils.http import url_has_allowed_host_and_scheme from django.utils.translation import gettext as _ from django.views.decorators.http import require_POST @@ -14,6 +17,20 @@ from fireworks_detect.models import Sensor from .forms import LanguageSettingsForm, MemberForm, UserSettingsForm from .models import Member, UserSettings + +def register(request): + if request.user.is_authenticated: + return redirect("hello") + next_url = request.POST.get("next") or request.GET.get("next", "") + if not url_has_allowed_host_and_scheme(next_url, allowed_hosts={request.get_host()}, require_https=request.is_secure()): + next_url = "" + form = UserCreationForm(request.POST or None) + if request.method == "POST" and form.is_valid(): + user = form.save() + login(request, user) + return redirect(next_url or "hello") + return render(request, "members/register.html", {"form": form, "next": next_url}) + def member_create(request): if request.method == "POST": form = MemberForm(request.POST) @@ -84,7 +101,7 @@ def user_settings(request): url = form.cleaned_data["ntfy_url"] tested_fingerprint = request.session.get(_ntfy_test_session_key(request.user)) was_previously_tested = saved_ntfy_url == url and settings.ntfy_last_tested_at is not None - if url and tested_fingerprint != _url_fingerprint(url) and not was_previously_tested: + if form.cleaned_data["ntfy_enabled"] and url and tested_fingerprint != _url_fingerprint(url) and not was_previously_tested: form.add_error("ntfy_url", _("Test this URL successfully before saving notification settings.")) else: settings = form.save(commit=False) @@ -93,6 +110,8 @@ def user_settings(request): settings.ntfy_last_tested_at = None elif tested_fingerprint == _url_fingerprint(url): settings.ntfy_last_tested_at = timezone.now() + elif saved_ntfy_url != url: + settings.ntfy_last_tested_at = None settings.save() request.session.pop(_ntfy_test_session_key(request.user), None) messages.success(request, _("Notification settings saved.")) diff --git a/myproject/__pycache__/__init__.cpython-312.pyc b/myproject/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..b88f5c6 Binary files /dev/null and b/myproject/__pycache__/__init__.cpython-312.pyc differ diff --git a/myproject/__pycache__/settings.cpython-312.pyc b/myproject/__pycache__/settings.cpython-312.pyc new file mode 100644 index 0000000..95bdd08 Binary files /dev/null and b/myproject/__pycache__/settings.cpython-312.pyc differ diff --git a/myproject/__pycache__/urls.cpython-312.pyc b/myproject/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000..a1dfc5e Binary files /dev/null and b/myproject/__pycache__/urls.cpython-312.pyc differ diff --git a/myproject/__pycache__/urls.cpython-313.pyc b/myproject/__pycache__/urls.cpython-313.pyc index 59583a9..371dc91 100644 Binary files a/myproject/__pycache__/urls.cpython-313.pyc and b/myproject/__pycache__/urls.cpython-313.pyc differ diff --git a/myproject/urls.py b/myproject/urls.py index a2205c1..27a2655 100644 --- a/myproject/urls.py +++ b/myproject/urls.py @@ -9,11 +9,14 @@ from django.views.static import serve from fireworks_detect.views import dashboard_view from hello.views import hello_view from members.language_views import set_anonymous_language +from members.views import register urlpatterns = [ path("language/", set_anonymous_language, name="set_anonymous_language"), path("admin/", admin.site.urls), path("login/", auth_views.LoginView.as_view(template_name="members/login.html"), name="login"), + path("register/", register, name="register"), + path("logout/", auth_views.LogoutView.as_view(next_page="/"), name="logout"), path("classifications/", include("fireworks_detect.classification_urls")), path("settings/", include("members.settings_urls")), path("fireworks/", include("fireworks_detect.urls")), diff --git a/notifications/__pycache__/__init__.cpython-312.pyc b/notifications/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..f6ffaac Binary files /dev/null and b/notifications/__pycache__/__init__.cpython-312.pyc differ diff --git a/notifications/__pycache__/services.cpython-312.pyc b/notifications/__pycache__/services.cpython-312.pyc new file mode 100644 index 0000000..d50a933 Binary files /dev/null and b/notifications/__pycache__/services.cpython-312.pyc differ diff --git a/package.json b/package.json index 29324f1..ebdf923 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dev": "concurrently --kill-others-on-fail --names django,vite --prefix-colors blue,magenta \"npm:django\" \"npm:vite\"", "django": "node scripts/dev-django.mjs", "vite": "vite", - "build": "vite build" + "build": "vite build && python manage.py collectstatic --noinput" }, "devDependencies": { "concurrently": "^9.1.2", diff --git a/staticfiles/vite/assets/browser-submission-processor-CY9AoNAZ.js b/staticfiles/vite/assets/browser-submission-processor-CY9AoNAZ.js new file mode 100644 index 0000000..e77b29a --- /dev/null +++ b/staticfiles/vite/assets/browser-submission-processor-CY9AoNAZ.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ffmpeg-video-extractor-C4WI0X-l.js","assets/frontend/src/entries/fireworks-home.js-BqdOneRR.js","assets/theme-DXAi27ON.js","assets/theme-CHgv-U5K.css","assets/fireworks-home-CoAZidqN.css","assets/fireworks-navigation-BViXwBBT.css","assets/browser-yamnet-classifier-0xdWK8Re.js"])))=>i.map(i=>d[i]); +import{_ as d}from"./frontend/src/entries/fireworks-home.js-BqdOneRR.js";/* empty css */import"./theme-DXAi27ON.js";const n="[BoomCast][BrowserBeta]";function f(){const v=document.querySelector("#boomcast-browser-config");if(!v)return{browserProcessingBeta:!1};try{return JSON.parse(v.textContent)}catch(e){return console.error(`${n} Configuration unavailable:`,e),{browserProcessingBeta:!1}}}class b{constructor(e=f(),t=null,s={}){this.config=e,this.extractVideo=t,this.dependencies=s,this.userEnabled=!1,this.activeController=null}isAvailable(){return this.config.browserProcessingBeta===!0}isEnabled(){return this.isAvailable()&&this.userEnabled}setEnabled(e){e||this.cancel(),this.userEnabled=this.isAvailable()&&e===!0,console.log(`${n} ${this.userEnabled?"Browser processing enabled by user.":"Browser processing disabled by user; using existing server flow."}`)}cancel(){var e;(e=this.activeController)==null||e.abort(),this.activeController=null}async process(e,{signal:t,onState:s}={}){this.cancel();const o=new AbortController;this.activeController=o;const i=()=>o.abort();t==null||t.addEventListener("abort",i,{once:!0}),t!=null&&t.aborted&&o.abort();try{return await this.prepare(e,{signal:o.signal,onState:s})}finally{t==null||t.removeEventListener("abort",i),this.activeController===o&&(this.activeController=null)}}canProcess(e){return this.isEnabled()&&!!e&&(b.isAudio(e)||b.isVideo(e))}static isAudio(e){return!!e&&(e.type.startsWith("audio/")||!e.type&&/\.(aac|aif|aiff|flac|m4a|mp3|ogg|opus|wav|weba)$/i.test(e.name||""))}static isVideo(e){return!!e&&(e.type.startsWith("video/")||!e.type&&/\.(mp4|mov|m4v|webm|mkv|avi)$/i.test(e.name||""))}async prepare(e,{signal:t,onState:s=()=>{}}={}){if(!this.canProcess(e))return{file:e,metadata:null,gate:"unavailable"};console.log(`${n} Initialising beta submission pipeline.`),console.log(`${n} File selected:`,{type:(e==null?void 0:e.type)||"",size:(e==null?void 0:e.size)||0});const o=b.isVideo(e),i=new AbortController,h=()=>i.abort();t==null||t.addEventListener("abort",h,{once:!0});const y=setTimeout(()=>i.abort(),5e3);let a;try{const r=await fetch(this.config.policyUrl,{cache:"no-store",credentials:"same-origin",signal:i.signal});if(!r.ok)throw new Error(`Policy HTTP ${r.status}`);if(a=await r.json(),!a.browser_processing_beta_enabled||a.version!==this.config.policyVersion)return console.log(`${n} Browser beta disabled or policy changed; using legacy submission flow.`),{file:e,metadata:null,gate:"unavailable"}}catch(r){if(t!=null&&t.aborted||(console.error(`${n} Policy unavailable:`,r),o))throw r;return{file:e,metadata:null,gate:"unavailable"}}finally{clearTimeout(y),t==null||t.removeEventListener("abort",h)}if(t!=null&&t.aborted)throw new DOMException("Cancelled","AbortError");let l=e;o&&(l=await(this.extractVideo||(await d(async()=>{const{extractVideoAudio:u}=await import("./ffmpeg-video-extractor-C4WI0X-l.js");return{extractVideoAudio:u}},__vite__mapDeps([0,1,2,3,4,5]))).extractVideoAudio)(e,{signal:t,onState:s}));const c={browser_processing_used:o,browser_processing_version:a.version,browser_gate_result:"unavailable",browser_override:!1};try{s("checking");let u=await(this.dependencies.prepareAudio||(await d(async()=>{const{AudioPreprocessor:m}=await import("./audio-preprocessor-B6FBlKED.js");return{AudioPreprocessor:m}},[])).AudioPreprocessor.prepare)(l,{signal:t});if(t!=null&&t.aborted)throw new DOMException("Cancelled","AbortError");try{const _=await(this.dependencies.classify||(await d(async()=>{const{BrowserYamnetClassifier:w}=await import("./browser-yamnet-classifier-0xdWK8Re.js");return{BrowserYamnetClassifier:w}},__vite__mapDeps([6,1,2,3,4,5]))).BrowserYamnetClassifier.classify)(u,{modelUrl:a.model_url,classMapUrl:a.class_map_url,signal:t});if(t!=null&&t.aborted)throw new DOMException("Cancelled","AbortError");const p=(this.dependencies.evaluate||(await d(async()=>{const{BrowserSubmissionGate:w}=await import("./browser-submission-gate-D8pBYGfs.js");return{BrowserSubmissionGate:w}},[])).BrowserSubmissionGate.evaluate)(_,a);return c.browser_processing_used=!0,c.browser_gate_result=p.result,c.browser_speech_detected=p.speechDetected,{file:l,metadata:c,gate:p.result,predictions:_.slice(0,5)}}finally{u=null,console.log("[BoomCast][Cleanup] Releasing waveform buffers.")}}catch(r){if(t!=null&&t.aborted)throw r;return console.error("[BoomCast][YAMNet] Local classification unavailable:",r),console.log("[BoomCast][Gate] Falling back to server classification."),c.browser_gate_result="unavailable",{file:l,metadata:c,gate:"unavailable"}}}cleanup(){this.cancel(),console.log("[BoomCast][Cleanup] Browser beta resources released.")}}export{b as BrowserSubmissionProcessor,f as readBrowserProcessingConfig}; diff --git a/staticfiles/vite/assets/browser-yamnet-classifier-0xdWK8Re.js b/staticfiles/vite/assets/browser-yamnet-classifier-0xdWK8Re.js new file mode 100644 index 0000000..0392ee1 --- /dev/null +++ b/staticfiles/vite/assets/browser-yamnet-classifier-0xdWK8Re.js @@ -0,0 +1 @@ +import{_}from"./frontend/src/entries/fireworks-home.js-BqdOneRR.js";/* empty css */import"./theme-DXAi27ON.js";const e="[BoomCast][YAMNet]";class v{static async classify(d,{modelUrl:b,classMapUrl:C,signal:o,loadTensorFlow:y}={}){let r,l,c,s;const M=performance.now();try{if(o!=null&&o.aborted)throw new DOMException("Cancelled","AbortError");if(console.log(`${e} Lazy-loading TensorFlow.js.`),r=y?await y():await _(()=>import("./index-jWGXPN38.js"),[]),o!=null&&o.aborted)throw new DOMException("Cancelled","AbortError");console.log(`${e} TensorFlow.js loaded.`),await r.ready(),console.log(`${e} Backend:`,r.getBackend()),console.log(`${e} Loading model.`);const[t,A]=await Promise.all([r.loadGraphModel(b),fetch(C,{cache:"force-cache",signal:o})]);if(l=t,!A.ok)throw new Error("YAMNet class map unavailable");const n=await A.json();if(!Array.isArray(n)||n.length!==521)throw new Error("Invalid YAMNet class map");if(o!=null&&o.aborted)throw new DOMException("Cancelled","AbortError");console.log(`${e} Model ready.`);const $=d.length<15600?Float32Array.from({length:15600},(a,i)=>d[i]||0):d;c=r.tensor1d($,"float32"),console.log(`${e} Starting inference.`);const m=await l.executeAsync(c);s=Array.isArray(m)?m:[m];const f=s.find(a=>a.shape.length===2&&a.shape[1]===n.length);if(!f)throw new Error("YAMNet score output unavailable");const g=await f.data();if(o!=null&&o.aborted)throw new DOMException("Cancelled","AbortError");const B=f.shape[0],w=n.map((a,i)=>{let h=-1,u=0;for(let p=0;ph&&(h=E,u=p)}return{class:a,score:h,frame:u,timeSeconds:Number((u*.48).toFixed(2))}});return w.sort((a,i)=>i.score-a.score),console.log(`${e} Inference completed in`,Math.round(performance.now()-M),"ms."),console.groupCollapsed(`${e} Top local predictions`),console.table(w.slice(0,10)),console.groupEnd(),w}catch(t){throw console.error(`${e} Local inference failed:`,t),t}finally{r&&console.log(`${e} TensorFlow memory before cleanup:`,r.memory()),console.log("[BoomCast][Cleanup] Disposing YAMNet tensors."),c==null||c.dispose(),s==null||s.forEach(t=>t==null?void 0:t.dispose()),console.log("[BoomCast][Cleanup] Disposing browser YAMNet model."),l==null||l.dispose(),console.log("[BoomCast][Cleanup] Releasing waveform buffers."),r&&console.log(`${e} TensorFlow memory after cleanup:`,r.memory()),console.log("[BoomCast][Cleanup] Browser classification cleanup complete.")}}}export{v as BrowserYamnetClassifier}; diff --git a/staticfiles/vite/assets/ffmpeg-video-extractor-C4WI0X-l.js b/staticfiles/vite/assets/ffmpeg-video-extractor-C4WI0X-l.js new file mode 100644 index 0000000..db49962 --- /dev/null +++ b/staticfiles/vite/assets/ffmpeg-video-extractor-C4WI0X-l.js @@ -0,0 +1 @@ +import{_ as p}from"./frontend/src/entries/fireworks-home.js-BqdOneRR.js";/* empty css */import"./theme-DXAi27ON.js";const t="[BoomCast][FFmpeg]";class r extends Error{constructor(e,d){super(e,{cause:d}),this.name="VideoExtractionError",this.code=e}}async function A(i,{signal:e,onState:d=()=>{},createFFmpeg:v}={}){var y;let o,_=!1,f=!1,l="module_load_failed";const $=performance.now(),u="input",w="audio.wav",s=()=>o==null?void 0:o.terminate();e==null||e.addEventListener("abort",s,{once:!0}),console.log(`${t} Video input detected.`,{mimeType:i.type,sizeBytes:i.size});try{if(e!=null&&e.aborted)throw new r("cancelled");d("loading_ffmpeg"),console.log(`${t} Starting lazy import.`);const a=await(v||(async()=>{const[{FFmpeg:m},{default:E},{default:x}]=await Promise.all([p(()=>import("./index-Cr8NHl2n.js"),[]),p(()=>import("./ffmpeg-core-CTa1UqMt.js"),[]),p(()=>import("./ffmpeg-core-DJ3ydieg.js"),[])]);return console.log(`${t} ffmpeg.wasm module imported.`),{ffmpeg:new m,coreURL:E,wasmURL:x}}))();if(o=a.ffmpeg,e!=null&&e.aborted)throw new r("cancelled");if((y=o.on)==null||y.call(o,"log",({message:m})=>console.log(`${t}[core]`,m)),l="core_load_failed",console.log(`${t} Loading FFmpeg core.`),await o.load({coreURL:a.coreURL,wasmURL:a.wasmURL}),console.log(`${t} FFmpeg core ready.`),e!=null&&e.aborted)throw new r("cancelled");if(d("extracting_audio"),l="resource_failed",console.log(`${t} Writing input to virtual filesystem.`),_=!0,await o.writeFile(u,new Uint8Array(await i.arrayBuffer())),e!=null&&e.aborted)throw new r("cancelled");if(l="extraction_failed",console.log(`${t} Starting audio extraction: mono / 16kHz WAV.`),f=!0,await o.exec(["-i",u,"-vn","-ac","1","-ar","16000","-c:a","pcm_s16le",w])!==0)throw new r("invalid_media");if(e!=null&&e.aborted)throw new r("cancelled");const n=await o.readFile(w);if(!(n!=null&&n.byteLength))throw new r("invalid_media");if(n.byteLength>25*1024*1024)throw new r("output_too_large");const h=new File([n],`${i.name.replace(/\.[^.]+$/,"")||"recording"}.wav`,{type:"audio/wav"});return console.log(`${t} Audio extraction completed.`,{outputSizeBytes:h.size}),console.log(`${t} Extraction finished in ${Math.round(performance.now()-$)} ms.`),h}catch(c){const a=e!=null&&e.aborted?"cancelled":c instanceof r?c.code:c instanceof RangeError?"resource_failed":l;throw a==="invalid_media"&&console.warn(`${t} Unsupported or undecodable video.`),console.error(`${t} Audio extraction failed:`,c),new r(a,c)}finally{console.log(`${t} Removing temporary files.`),o!=null&&o.loaded&&(_&&await o.deleteFile(u).catch(()=>{}),f&&await o.deleteFile(w).catch(()=>{})),console.log(`${t} Terminating worker.`),o==null||o.terminate(),o=null,e==null||e.removeEventListener("abort",s),console.log(`${t} Cleanup complete.`)}}export{r as VideoExtractionError,A as extractVideoAudio}; diff --git a/staticfiles/vite/assets/fireworks-navigation-BViXwBBT.css b/staticfiles/vite/assets/fireworks-navigation-BViXwBBT.css new file mode 100644 index 0000000..4455d9d --- /dev/null +++ b/staticfiles/vite/assets/fireworks-navigation-BViXwBBT.css @@ -0,0 +1 @@ +.fireworks-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:3.5rem}.fireworks-brand{display:flex;align-items:center;gap:.7rem;color:var(--ink, var(--i, #eef3ff));font-size:.9rem;font-weight:800;letter-spacing:.1em;text-decoration:none;text-transform:uppercase}.fireworks-header .brand-mark{display:grid;width:2.25rem;aspect-ratio:1;place-items:center;border-radius:.75rem;color:#141022;background:linear-gradient(135deg,#fcd34d,#fb7185);box-shadow:0 .5rem 1.5rem #fb718550}.fireworks-header__controls{display:flex;align-items:center;gap:.65rem}.fireworks-menu-toggle{display:none}.fireworks-nav{display:flex;gap:.3rem;padding:.25rem;border:1px solid var(--line, var(--l, #2b3d68));border-radius:.75rem;background:#111a31d9;box-shadow:0 .5rem 1.5rem #03071440}.fireworks-nav a,.fireworks-nav button{padding:.5rem .75rem;border-radius:.5rem;color:var(--muted, var(--m, #aab9d8));font-size:.86rem;font-weight:750;text-decoration:none}.fireworks-nav form{display:flex;margin:0}.fireworks-nav button{border:0;background:transparent;font:inherit;cursor:pointer}.fireworks-nav a:hover,.fireworks-nav button:hover{color:var(--ink, var(--i, #eef3ff));background:#20345f}.fireworks-nav a[aria-current=page]{color:var(--ink, var(--i, #eef3ff));background:#2a3b67}.theme-toggle--inline{position:static;flex:0 0 auto;min-height:2.35rem;padding:.45rem .7rem;white-space:nowrap}:root[data-theme=light] .fireworks-nav{border-color:#cbd9ed;background:#edf4ff;box-shadow:0 .45rem 1.25rem #2244751f}:root[data-theme=light] .fireworks-nav a,:root[data-theme=light] .fireworks-nav button{color:#47617f}:root[data-theme=light] .fireworks-nav a:hover,:root[data-theme=light] .fireworks-nav button:hover{color:#234a7b;background:#dceaff}:root[data-theme=light] .fireworks-nav a[aria-current=page]{color:#173d6a;background:#cfe3ff;box-shadow:inset 0 0 0 1px #9cc0ed}@media(max-width:44rem){.fireworks-header{flex-wrap:wrap;justify-content:flex-start;margin-bottom:2.5rem}.fireworks-menu-toggle{display:flex;flex:0 0 auto;flex-direction:column;align-items:center;justify-content:center;gap:.3rem;width:2.75rem;height:2.75rem;padding:0;border:1px solid var(--theme-line);border-radius:.7rem;color:var(--theme-ink);background:var(--theme-surface-raised);cursor:pointer}.fireworks-menu-toggle span{width:1.2rem;height:2px;border-radius:2px;background:currentColor}.fireworks-menu-toggle:focus-visible{outline:3px solid #8abaff;outline-offset:3px}.fireworks-header__controls{display:none;flex-basis:100%;width:100%;flex-direction:column;align-items:stretch}.fireworks-menu-toggle[aria-expanded=true]~.fireworks-header__controls{display:flex}.fireworks-nav{flex-direction:column}.fireworks-nav a,.fireworks-nav button{padding:.75rem}.fireworks-nav form,.fireworks-nav button{width:100%}.fireworks-nav button{text-align:left}.theme-toggle--inline{width:100%}} diff --git a/staticfiles/vite/assets/frontend/src/entries/dashboard.js-CEMXTgB1.js b/staticfiles/vite/assets/frontend/src/entries/dashboard.js-CEMXTgB1.js new file mode 100644 index 0000000..b5a4ed1 --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/dashboard.js-CEMXTgB1.js @@ -0,0 +1 @@ +/* empty css */import"./fireworks-home.js-BqdOneRR.js";import"./map.js-BLPiBo7S.js";import"../../../manual-report-DhCrCBpq.js";import"../../../theme-DXAi27ON.js"; diff --git a/staticfiles/vite/assets/frontend/src/entries/dashboard.js-DeRCNGiT.js b/staticfiles/vite/assets/frontend/src/entries/dashboard.js-DeRCNGiT.js new file mode 100644 index 0000000..15d61f2 --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/dashboard.js-DeRCNGiT.js @@ -0,0 +1 @@ +/* empty css */import"./fireworks-home.js-DBkY8wwM.js";import"./map.js-jpUFFpF3.js";import"../../../manual-report-DhCrCBpq.js";import"../../../theme-DXAi27ON.js"; diff --git a/staticfiles/vite/assets/frontend/src/entries/events.js-FXwVZPQ8.js b/staticfiles/vite/assets/frontend/src/entries/events.js-FXwVZPQ8.js new file mode 100644 index 0000000..a6e256c --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/events.js-FXwVZPQ8.js @@ -0,0 +1 @@ +/* empty css */import"../../../theme-DXAi27ON.js"; diff --git a/staticfiles/vite/assets/frontend/src/entries/fireworks-home.js-BqdOneRR.js b/staticfiles/vite/assets/frontend/src/entries/fireworks-home.js-BqdOneRR.js new file mode 100644 index 0000000..654c3ca --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/fireworks-home.js-BqdOneRR.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-submission-processor-CY9AoNAZ.js","assets/theme-DXAi27ON.js","assets/theme-CHgv-U5K.css","assets/fireworks-navigation-BViXwBBT.css"])))=>i.map(i=>d[i]); +/* empty css */import"../../../theme-DXAi27ON.js";const te="modulepreload",oe=function(o){return"/static/vite/"+o},W={},ae=function(k,r,V){let s=Promise.resolve();if(r&&r.length>0){let c=function(u){return Promise.all(u.map(x=>Promise.resolve(x).then(T=>({status:"fulfilled",value:T}),T=>({status:"rejected",reason:T}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),w=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=c(r.map(u=>{if(u=oe(u),u in W)return;W[u]=!0;const x=u.endsWith(".css"),T=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${T}`))return;const y=document.createElement("link");if(y.rel=x?"stylesheet":te,x||(y.as="script"),y.crossOrigin="",y.href=u,w&&y.setAttribute("nonce",w),document.head.appendChild(y),x)return new Promise((M,f)=>{y.addEventListener("load",M),y.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${u}`)))})}))}function U(c){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=c,window.dispatchEvent(i),!i.defaultPrevented)throw c}return s.then(c=>{for(const i of c||[])i.status==="rejected"&&U(i.reason);return k().catch(U)})},n=document.querySelector(".upload-form");if(n){let E=function(e,{progress:a=null,message:p=""}={}){for(const d of K)n.classList.toggle(`audio-upload--${d}`,d===e);const t=e==="uploading"||e==="processing";C=t,c.disabled=t,r.disabled=t,g&&(g.disabled=t),i.hidden=!t,t?n.setAttribute("aria-busy","true"):n.removeAttribute("aria-busy"),e==="uploading"?(s.setAttribute("role","progressbar"),s.setAttribute("aria-label",o.uploadingAudio||"Uploading audio"),s.setAttribute("aria-valuemin","0"),s.setAttribute("aria-valuemax","100"),a===null?(s.removeAttribute("aria-valuenow"),s.setAttribute("aria-valuetext",o.uploadingAudio||"Uploading audio"),U.textContent="↑"):(s.setAttribute("aria-valuenow",String(a)),s.setAttribute("aria-valuetext",`${o.uploadingAudio||"Uploading audio"}: ${a}%`),s.style.setProperty("--upload-progress",`${a}%`),U.textContent=`${a}%`),f.textContent=a===null?o.uploadingAudio||"Uploading audio…":""):(s.removeAttribute("role"),s.removeAttribute("aria-label"),s.removeAttribute("aria-valuemin"),s.removeAttribute("aria-valuemax"),s.removeAttribute("aria-valuenow"),s.removeAttribute("aria-valuetext"),U.textContent=e==="processing"?"◉":e==="success"?"✓":e==="error"?"!":"↑",f.textContent=p||{processing:o.uploadCompleteAnalysing||"Upload complete. Analysing audio…",success:o.analysisComplete||"Analysis complete.",cancelled:o.uploadCancelled||"Upload cancelled."}[e]||"")},H=function(e){V.textContent=e?e.name:o.noFile||"No file selected",C||E(e?"file-selected":"idle"),e&&console.log("[boomcast-upload] file selected",{size:e.size,type:e.type})},R=function(e,a){clearTimeout(O),console.error("[boomcast-upload] upload failed",a),E("error",{message:e}),v=null},J=function(e){_||(_=!0,console.log("[boomcast-upload] upload complete, awaiting classifier"),O=window.setTimeout(()=>{v===e&&C&&E("processing")},120))},Q=function(e){var t,d;clearTimeout(O),v=null;let a;try{a=new DOMParser().parseFromString(e.responseText,"text/html")}catch(L){R(o.analysisFailed||"Analysis could not be completed.",L);return}const p=a.querySelector(".results-card");if(!p){R(o.analysisFailed||"Analysis could not be completed.",`Unexpected response (HTTP ${e.status})`);return}if(w.replaceChildren(document.importNode(p,!0)),(t=window.htmx)==null||t.process(w),e.status>=400||p.classList.contains("error-card")){const L=((d=p.querySelector("p"))==null?void 0:d.textContent)||o.analysisFailed||"Analysis could not be completed.";console.error("[boomcast-upload] classification failed",{status:e.status,message:L}),E("error",{message:L});return}console.log("[boomcast-upload] classification response received",e.status),E("success"),n.dataset.scrollToResults==="true"&&w.scrollIntoView({behavior:Y.matches?"instant":"smooth",block:"start"})},$=function(e){if(A+=1,m==null||m.abort(),l==null||l.cancel(),m=null,h=null,B=!1,S=!1,F=!1,u.hidden=!0,C||w.replaceChildren(),H(e),C||(c.disabled=!1,i.hidden=!0),!e)return;if(console.log("[BoomCast][BrowserBeta] File selected.",{mimeType:e.type,sizeBytes:e.size}),!q()){console.log("[BoomCast][BrowserBeta] Server mode selected."),P(e)&&(S=!0,c.disabled=!0,f.textContent=o.serverAudioOnly||"Server processing currently accepts audio recordings. Choose an audio file or enable browser processing.");return}console.log("[BoomCast][BrowserBeta] Browser mode selected.");const a=A,p=new AbortController;m=p,B=!0,c.disabled=!0,i.hidden=!1,f.textContent=P(e)?o.extractingAudio||"Extracting audio from video…":o.preparingRecording||"Preparing recording…",Z().then(t=>a!==A||p.signal.aborted||!q()?null:(t.setEnabled(!0),t.process(e,{signal:p.signal,onState:d=>{a===A&&(f.textContent=d==="checking"?o.checkingRecording||"Checking recording…":o.extractingAudio||"Extracting audio from video…")}}))).then(t=>{if(!(!t||a!==A||p.signal.aborted||!q())){if(B=!1,i.hidden=!0,P(e)&&t.file===e){S=!0,c.disabled=!0,f.textContent=o.videoExtractionFailed||"Could not extract audio from this video. Please choose an audio recording.";return}h=t,F=t.gate==="speech_only"||t.gate==="no_match",F?(x.textContent=t.gate==="speech_only"?o.speechGateTitle||"This recording appears to contain speech, but no relevant sound was detected.":o.irrelevantGateTitle||"No relevant sound was detected.",T.textContent=t.gate==="speech_only"?o.speechGateMessage||"To protect people’s privacy, this recording will not be uploaded automatically. You can still submit it for manual review.":o.irrelevantGateMessage||"BoomCast could not identify a sound this service currently looks for. You can still submit it for manual review.",u.hidden=!1,c.disabled=!0,f.textContent=o.gateChooseMessage||"Recording checked. Choose another recording or submit for manual review."):(c.disabled=!1,f.textContent=t.gate==="unavailable"?o.localUnavailable||"Local checking was unavailable. BoomCast will use normal server processing.":P(e)?o.videoAudioOnly||"Video processed on this device. Only extracted audio will be sent if you submit.":o.readyToSubmit||"Ready to submit.")}}).catch(t=>{a!==A||!q()||(console.error("[BoomCast][BrowserBeta] Unexpected browser pipeline error:",t),B=!1,i.hidden=!0,P(e)?(S=!0,c.disabled=!0,f.textContent=o.videoExtractionFailed||"Could not extract audio from this video. Please choose an audio recording."):(console.warn("[BoomCast][BrowserBeta] Browser pipeline unavailable; falling back to server."),h={file:e,metadata:null,gate:"unavailable"},c.disabled=!1,f.textContent=o.localUnavailable||"Local checking was unavailable. BoomCast will use normal server processing."))})},ee=function(){if(!(!b||r.files[0]===b))try{const e=new DataTransfer;e.items.add(b),r.files=e.files}catch(e){console.error("[BoomCast][Cleanup] Could not restore original selection:",e),r.value="",b=null}},D=function(e,a=null){if(r.files[0]!==e)try{const d=new DataTransfer;if(d.items.add(e),r.files=d.files,r.files[0]!==e)throw new Error("Prepared audio could not replace video in form")}catch(d){console.error("[BoomCast][BrowserBeta] Could not secure native form upload:",d),S=!0,c.disabled=!0,f.textContent=o.secureVideoFailed||"Could not prepare this video for upload. Please choose an audio recording.";return}const p=new FormData(n);p.set("audio",e),a&&p.set("browser_processing_metadata",JSON.stringify(a));const t=new XMLHttpRequest;v=t,_=!1,w.replaceChildren(),E("uploading"),console.log("[boomcast-upload] upload started",{size:e.size,type:e.type}),t.open("POST",n.action),t.upload.addEventListener("progress",d=>{if(_||!d.lengthComputable||d.total<=0)return;const L=Math.min(100,Math.round(d.loaded/d.total*100));L!==Number(s.getAttribute("aria-valuenow"))&&(E("uploading",{progress:L}),console.log("[boomcast-upload] upload progress",L)),d.loaded>=d.total&&!_&&J(t)}),t.upload.addEventListener("load",()=>{J(t)}),t.addEventListener("load",()=>Q(t)),t.addEventListener("error",()=>R(o.uploadFailed||"Upload failed. Check your connection and try again.","Network error")),t.addEventListener("timeout",()=>R(o.uploadFailed||"Upload failed. Check your connection and try again.","Request timed out")),t.addEventListener("abort",()=>{clearTimeout(O),v=null,E("cancelled"),console.log("[boomcast-upload] upload cancelled")}),t.send(p)};const o=window.BOOMCAST_I18N||{},k=n.querySelector("#drop-zone"),r=n.querySelector("#audio-file"),V=n.querySelector("#file-name"),s=n.querySelector("#upload-progress-circle"),U=n.querySelector("#upload-icon-content"),c=n.querySelector('button[type="submit"]'),i=n.querySelector(".upload-cancel"),w=n.querySelector("#classification-results"),u=n.querySelector("#browser-gate"),x=n.querySelector("#browser-gate-title"),T=n.querySelector("#browser-gate-message"),y=n.querySelector("#browser-gate-choose"),M=n.querySelector("#browser-gate-override"),f=document.querySelector("#upload-status"),Y=window.matchMedia("(prefers-reduced-motion: reduce)"),g=n.querySelector("#browser-processing-toggle"),N=document.querySelector("#boomcast-browser-config");let z={browserProcessingBeta:!1};try{z=JSON.parse((N==null?void 0:N.textContent)||"{}")}catch(e){console.error("[BoomCast][BrowserBeta] Configuration unavailable:",e)}const j=z.browserProcessingBeta===!0&&!!g;g&&(g.checked=!1);const G=r.accept,X=",video/*,.mp4,.mov,.m4v,.webm,.mkv,.avi",q=()=>j&&g.checked,P=e=>!!e&&(e.type.startsWith("video/")||!e.type&&/\.(mp4|mov|m4v|webm|mkv|avi)$/i.test(e.name||""));let l=null,I=null,b=null;async function Z(){return l||(I||(I=ae(async()=>{const{BrowserSubmissionProcessor:e}=await import("../../../browser-submission-processor-CY9AoNAZ.js");return{BrowserSubmissionProcessor:e}},__vite__mapDeps([0,1,2,3])).then(({BrowserSubmissionProcessor:e})=>(l=new e(z),console.log("[BoomCast][BrowserBeta] Coordinator initialised."),l)).catch(e=>{throw I=null,e})),I)}const K=["idle","file-selected","uploading","processing","success","error","cancelled"];let v=null,C=!1,_=!1,O=null,A=0,m=null,h=null,B=!1,S=!1,F=!1;console.log(j?"[BoomCast][BrowserBeta] Browser processing disabled by user; using existing server flow.":"[BoomCast][BrowserBeta] Feature disabled globally; using existing server flow."),g==null||g.addEventListener("change",()=>{q()?(console.log("[BoomCast][BrowserBeta] Browser processing enabled by user."),r.accept=G+X,$(b||r.files[0])):(console.log("[BoomCast][BrowserBeta] Switching to server processing."),console.log("[BoomCast][Cleanup] Cancelling active browser processing job."),m==null||m.abort(),l==null||l.setEnabled(!1),l==null||l.cleanup(),r.accept=G,ee(),$(b||r.files[0]))}),r.addEventListener("change",()=>{b=r.files[0]||null,$(b)}),["dragenter","dragover"].forEach(e=>k.addEventListener(e,a=>{a.preventDefault(),C||k.classList.add("dragging")})),["dragleave","drop"].forEach(e=>k.addEventListener(e,a=>{a.preventDefault(),k.classList.remove("dragging")})),k.addEventListener("drop",e=>{C||!e.dataTransfer.files.length||(r.files=e.dataTransfer.files,b=r.files[0]||null,$(b))}),n.addEventListener("submit",e=>{if(e.preventDefault(),e.stopImmediatePropagation(),C||B||S||F||!n.reportValidity())return;const a=r.files[0];if(a){if(!q()){D(a);return}if(h){D(h.file,h.metadata);return}D(a)}},!0),y.addEventListener("click",()=>r.click()),M.addEventListener("click",()=>{if(!q()||!F||!h||C||B)return;console.warn("[BoomCast][Gate] User explicitly overrode local gate."),console.log("[BoomCast][Gate] Submission will enter manual review.");const e={...h.metadata,browser_override:!0};h.metadata=e,F=!1,u.hidden=!0,D(h.file,e)}),i.addEventListener("click",()=>{B?(m==null||m.abort(),l==null||l.cancel(),A+=1,B=!1,S=!0,c.disabled=!0,i.hidden=!0,f.textContent=o.extractionCancelled||o.preparationCancelled||"Preparation cancelled. Choose a recording to continue."):v==null||v.abort()}),window.addEventListener("pageshow",e=>{e.persisted&&(v==null||v.abort(),m==null||m.abort(),l==null||l.cancel(),A+=1,h=null,b=null,g&&(g.checked=!1,r.accept=G),l==null||l.setEnabled(!1),B=!1,S=!1,F=!1,u.hidden=!0,c.disabled=!1,r.value="",w.replaceChildren(),H())})}export{ae as _}; diff --git a/staticfiles/vite/assets/frontend/src/entries/home.js-DlLYf8OV.js b/staticfiles/vite/assets/frontend/src/entries/home.js-DlLYf8OV.js new file mode 100644 index 0000000..282c599 --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/home.js-DlLYf8OV.js @@ -0,0 +1 @@ +import"../../../manual-report-DhCrCBpq.js";import"../../../theme-DXAi27ON.js"; diff --git a/staticfiles/vite/assets/frontend/src/entries/map.js-BLPiBo7S.js b/staticfiles/vite/assets/frontend/src/entries/map.js-BLPiBo7S.js new file mode 100644 index 0000000..d1494bc --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/map.js-BLPiBo7S.js @@ -0,0 +1 @@ +/* empty css */import"../../../theme-DXAi27ON.js";const e=window.BOOMCAST_I18N||{},u=document.getElementById("event-map"),f=u.dataset.h3Resolution,t=L.map(u,{zoomControl:!1,scrollWheelZoom:!1}).setView([52.1326,5.2913],7);L.control.zoom({position:"bottomleft"}).addTo(t);const m=L.control({position:"topright"});m.onAdd=()=>{const o=L.DomUtil.create("div","map-compass");return o.setAttribute("role","img"),o.setAttribute("aria-label",e.mapCompass||"Map compass: north is up"),o.innerHTML='NESW↑',L.DomEvent.disableClickPropagation(o),o};m.addTo(t);L.tileLayer("https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png",{maxZoom:18,attribution:"© OpenStreetMap contributors"}).addTo(t);const y=JSON.parse(document.getElementById("h3-cells-data").textContent),M=JSON.parse(document.getElementById("map-events-data").textContent),d=L.latLngBounds([]);y.forEach(o=>{L.polygon(o.boundary,{color:"#f59e0b",weight:2,fillColor:"#f59e0b",fillOpacity:.25}).addTo(t).bindPopup('H3 '+o.cell+''+o.reports+" "+(o.reports===1?e.report||"report":e.reports||"reports")+" · "+o.occurrences+" "+(o.occurrences===1?e.occurrence||"occurrence":e.occurrences||"occurrences")+" · "+(e.resolution||"resolution")+" "+f+""),d.extend(L.latLngBounds(o.boundary))});function b(o){return["N","NE","E","SE","S","SW","W","NW"][Math.floor((o+22.5)%360/45)]}function v(o,n,s){const c=n*Math.PI/180,i=o[0]*Math.PI/180,h=o[1]*Math.PI/180,r=s/6378137,l=Math.asin(Math.sin(i)*Math.cos(r)+Math.cos(i)*Math.sin(r)*Math.cos(c)),g=h+Math.atan2(Math.sin(c)*Math.sin(r)*Math.cos(i),Math.cos(r)-Math.sin(i)*Math.sin(l));return[l*180/Math.PI,g*180/Math.PI]}const E=L.divIcon({className:"",html:'
✦
',iconSize:[37,37],iconAnchor:[19,19]});M.forEach(o=>{const n=o.visually_confirmed?e.visuallyConfirmed||"Visually confirmed":e.notVisuallyConfirmed||"Not visually confirmed";let s=o.occurrences+" "+(o.occurrences===1?e.occurrence||"occurrence":e.occurrences||"occurrences")+" · "+n+"
"+(e.reported||"Reported")+" "+o.reported_on;if(o.direction_degrees!==null&&(s+="
"+(e.compassDirection||"Compass direction")+" "+Math.round(o.direction_degrees)+"° ("+b(o.direction_degrees)+")",o.direction_accuracy_degrees!==null&&(s+=" (±"+Math.round(o.direction_accuracy_degrees)+"°)")),L.marker(o.center,{icon:E}).addTo(t).bindPopup(''+(e.manualReport||"Manual report")+" · H3 "+o.cell+''+s+""),o.direction_degrees!==null){const a=v(o.center,o.direction_degrees,900);L.polyline([o.center,a],{color:"#fff7e6",weight:9,opacity:.8}).addTo(t),L.polyline([o.center,a],{color:"#6d45a0",weight:5,opacity:1}).addTo(t);const c=L.divIcon({className:"",html:'
↑
',iconSize:[56,56],iconAnchor:[28,28]});L.marker(a,{icon:c,interactive:!1}).addTo(t)}});d.isValid()&&t.fitBounds(d.pad(.18));const p=document.getElementById("range");p&&document.querySelectorAll("#from-date, #to-date").forEach(o=>{o.addEventListener("change",()=>{p.value="custom"})}); diff --git a/staticfiles/vite/assets/frontend/src/entries/settings.js-5YKE7UII.js b/staticfiles/vite/assets/frontend/src/entries/settings.js-5YKE7UII.js new file mode 100644 index 0000000..9ab0cc1 --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/settings.js-5YKE7UII.js @@ -0,0 +1 @@ +/* empty css */import"../../../theme-DXAi27ON.js";var o;(o=document.querySelector("#ntfy-url"))==null||o.addEventListener("input",()=>{var t;(t=document.querySelector("#ntfy-test-result"))==null||t.replaceChildren()});document.addEventListener("click",async t=>{var n;if(!t.target.closest("[data-copy-sensor-token]"))return;const e=(n=document.querySelector("#sensor-token"))==null?void 0:n.textContent;e&&await navigator.clipboard.writeText(e)}); diff --git a/staticfiles/vite/assets/frontend/src/entries/settings.js-Bc-1fzOg.js b/staticfiles/vite/assets/frontend/src/entries/settings.js-Bc-1fzOg.js new file mode 100644 index 0000000..9ab0cc1 --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/settings.js-Bc-1fzOg.js @@ -0,0 +1 @@ +/* empty css */import"../../../theme-DXAi27ON.js";var o;(o=document.querySelector("#ntfy-url"))==null||o.addEventListener("input",()=>{var t;(t=document.querySelector("#ntfy-test-result"))==null||t.replaceChildren()});document.addEventListener("click",async t=>{var n;if(!t.target.closest("[data-copy-sensor-token]"))return;const e=(n=document.querySelector("#sensor-token"))==null?void 0:n.textContent;e&&await navigator.clipboard.writeText(e)}); diff --git a/staticfiles/vite/assets/frontend/src/entries/settings.js-CCqSSQuh.js b/staticfiles/vite/assets/frontend/src/entries/settings.js-CCqSSQuh.js new file mode 100644 index 0000000..5bb4faa --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/settings.js-CCqSSQuh.js @@ -0,0 +1 @@ +/* empty css */import"../../../theme-DXAi27ON.js";document.querySelector("#ntfy-url").addEventListener("input",()=>{document.querySelector("#ntfy-test-result").replaceChildren()}); diff --git a/staticfiles/vite/assets/frontend/src/entries/settings.js-DWelmNvI.js b/staticfiles/vite/assets/frontend/src/entries/settings.js-DWelmNvI.js new file mode 100644 index 0000000..5bb4faa --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/settings.js-DWelmNvI.js @@ -0,0 +1 @@ +/* empty css */import"../../../theme-DXAi27ON.js";document.querySelector("#ntfy-url").addEventListener("input",()=>{document.querySelector("#ntfy-test-result").replaceChildren()}); diff --git a/staticfiles/vite/assets/frontend/src/entries/settings.js-Dd9x_nVW.js b/staticfiles/vite/assets/frontend/src/entries/settings.js-Dd9x_nVW.js new file mode 100644 index 0000000..5bb4faa --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/settings.js-Dd9x_nVW.js @@ -0,0 +1 @@ +/* empty css */import"../../../theme-DXAi27ON.js";document.querySelector("#ntfy-url").addEventListener("input",()=>{document.querySelector("#ntfy-test-result").replaceChildren()}); diff --git a/staticfiles/vite/assets/frontend/src/entries/settings.js-DimwvNsP.js b/staticfiles/vite/assets/frontend/src/entries/settings.js-DimwvNsP.js new file mode 100644 index 0000000..9ab0cc1 --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/settings.js-DimwvNsP.js @@ -0,0 +1 @@ +/* empty css */import"../../../theme-DXAi27ON.js";var o;(o=document.querySelector("#ntfy-url"))==null||o.addEventListener("input",()=>{var t;(t=document.querySelector("#ntfy-test-result"))==null||t.replaceChildren()});document.addEventListener("click",async t=>{var n;if(!t.target.closest("[data-copy-sensor-token]"))return;const e=(n=document.querySelector("#sensor-token"))==null?void 0:n.textContent;e&&await navigator.clipboard.writeText(e)}); diff --git a/staticfiles/vite/assets/frontend/src/entries/settings.js-jZg7NWcI.js b/staticfiles/vite/assets/frontend/src/entries/settings.js-jZg7NWcI.js new file mode 100644 index 0000000..5bb4faa --- /dev/null +++ b/staticfiles/vite/assets/frontend/src/entries/settings.js-jZg7NWcI.js @@ -0,0 +1 @@ +/* empty css */import"../../../theme-DXAi27ON.js";document.querySelector("#ntfy-url").addEventListener("input",()=>{document.querySelector("#ntfy-test-result").replaceChildren()}); diff --git a/staticfiles/vite/assets/manual-report-CDvuF-ni.css b/staticfiles/vite/assets/manual-report-CDvuF-ni.css new file mode 100644 index 0000000..27d06f8 --- /dev/null +++ b/staticfiles/vite/assets/manual-report-CDvuF-ni.css @@ -0,0 +1 @@ +.burst-listener{width:min(100%,36rem);margin-top:1rem}.burst-listener__button,.burst-listener__actions button{min-height:2.75rem;padding:.65rem 1rem;border:1px solid #ffd18c;border-radius:.7rem;color:#fff2df;font:inherit;font-weight:750;background:#39243a;cursor:pointer}.burst-listener__panel{margin-top:.8rem;padding:1rem;border:1px solid #aa7294;border-radius:.8rem;background:#1b1730;color:#fff2df}.burst-listener__panel canvas{display:block;width:100%;height:90px;margin:.8rem 0;background:#171225;border-radius:.4rem}.burst-listener__panel p{margin:.5rem 0 1rem;color:#efc9dc}.burst-listener__panel audio{width:100%;margin-bottom:1rem}.burst-listener__actions{display:flex;flex-wrap:wrap;gap:.5rem}.burst-listener [hidden]{display:none!important}.burst-listener [role=alert]{color:#ffd18c}.manual-compass{display:grid;justify-items:center;width:7rem;margin:.6rem 0 0 auto;color:#fff3d7;font-size:.78rem;font-weight:850;font-variant-numeric:tabular-nums}.manual-compass[hidden]{display:none}.manual-compass__dial{position:relative;width:5.75rem;aspect-ratio:1;border:2px solid #f2d7a8;border-radius:50%;background:radial-gradient(circle,#342441 0,#342441 28%,#211a32 75%);box-shadow:0 .35rem 1rem #09061566,inset 0 0 0 .25rem #ffffff12}.manual-compass__rose{position:absolute;top:0;right:0;bottom:0;left:0;transition:transform .12s ease-out}.manual-compass__rose span{position:absolute;line-height:1}.manual-compass__north{top:.38rem;left:50%;color:#ff9e78;transform:translate(-50%)}.manual-compass__east{right:.47rem;top:50%;transform:translateY(-50%)}.manual-compass__south{bottom:.38rem;left:50%;transform:translate(-50%)}.manual-compass__west{left:.47rem;top:50%;transform:translateY(-50%)}.manual-compass__pointer{position:absolute;top:-.55rem;left:50%;width:0;height:0;border-right:.37rem solid transparent;border-bottom:.65rem solid #ffbd62;border-left:.37rem solid transparent;transform:translate(-50%);filter:drop-shadow(0 .1rem .15rem #160d1b)}.manual-compass__center{position:absolute;top:50%;left:50%;width:.5rem;aspect-ratio:1;border-radius:50%;background:#ffbd62;transform:translate(-50%,-50%)}.manual-compass__heading{margin-top:.5rem;white-space:nowrap}:root[data-theme=light] .manual-compass{color:#43243d}:root[data-theme=light] .manual-compass__dial{border-color:#996a9b;background:radial-gradient(circle,#f8ebf8 0,#f8ebf8 28%,#e8d7e9 75%)}:root[data-theme=light] .manual-compass__east,:root[data-theme=light] .manual-compass__south,:root[data-theme=light] .manual-compass__west{color:#43243d}@media(prefers-reduced-motion:reduce){.manual-compass__rose{transition:none}} diff --git a/staticfiles/vite/assets/manual-report-DhCrCBpq.js b/staticfiles/vite/assets/manual-report-DhCrCBpq.js new file mode 100644 index 0000000..cb630d7 --- /dev/null +++ b/staticfiles/vite/assets/manual-report-DhCrCBpq.js @@ -0,0 +1 @@ +const _=document.querySelector("#manual-report-form");function ee(){if(!_)return null;const e=document.querySelector("#burst-start"),c=document.querySelector("#burst-panel"),o=document.querySelector("#burst-heading"),A=document.querySelector("#burst-detail"),u=document.querySelector("#burst-waveform"),w=document.querySelector("#burst-preview"),O=document.querySelector("#burst-resume"),T=document.querySelector("#burst-discard"),E=document.querySelector("#burst-stop"),D=document.querySelector("#burst-error"),I=new Float32Array(300);let d=0,m="off",y,s,G,a,p,Z,H,b;function U(){const t=u.getContext("2d");t.clearRect(0,0,u.width,u.height),t.fillStyle="#ffbd62";const i=u.width/I.length,l=Math.max(.003,...I);for(let n=0;n{for(let L=0;L{if(i.type==="level"&&(m==="listening"||m==="tail"))I[d]=i.value,d=(d+1)%I.length,U();else if(i.type==="trigger"&&m==="listening")R("tail");else if(i.type==="clip"){const l=new File([Q(i.samples,i.sampleRate)],j(),{type:"audio/wav"});b?(b(l),b=null):m==="tail"&&(V(),H=l,Z=URL.createObjectURL(l),w.src=Z,w.hidden=!1,R("captured"))}},G.connect(a),a.connect(p).connect(s.destination),await s.resume(),I.fill(0),d=0,U(),R("listening")}catch(i){await B(),D.textContent=i.name==="NotAllowedError"?"Microphone permission was denied. Manual reporting is still available.":i.message||"Microphone capture failed.",D.hidden=!1}finally{e.disabled=!1}}async function B(){b&&(b(null),b=null),V(),a==null||a.disconnect(),G==null||G.disconnect(),p==null||p.disconnect(),y==null||y.getTracks().forEach(t=>t.stop()),await(s==null?void 0:s.close()),y=s=G=a=p=null,I.fill(0),d=0,R("off")}function F(){V(),I.fill(0),d=0,U(),a==null||a.port.postMessage("reset"),a&&R("listening")}return e.addEventListener("click",$),E.addEventListener("click",B),T.addEventListener("click",F),O.addEventListener("click",F),window.addEventListener("pagehide",B),document.addEventListener("visibilitychange",()=>{document.hidden&&B()}),{get active(){return m!=="off"},async clipForSubmission(){return H||(m==="off"||!a?null:new Promise(t=>{b=t,a.port.postMessage("snapshot")}))},submissionSucceeded:F}}const g=window.BOOMCAST_I18N||{},f=document.querySelector("#manual-report-form"),N=document.querySelector("#manual-submit"),te=document.querySelector("#manual-submission"),ne=document.querySelector("#manual-latitude"),oe=document.querySelector("#manual-longitude"),ie=document.querySelector("#manual-direction-degrees"),ae=document.querySelector("#manual-direction-accuracy"),K=document.querySelector("#manual-capture-direction"),r=document.querySelector("#manual-direction-status"),ge=document.querySelector("#manual-direction-panel"),q=document.querySelector("#manual-compass"),X=document.querySelector("#manual-compass-rose"),ce=document.querySelector("#manual-compass-heading"),se=/Android|iPhone|iPad|iPod|IEMobile|Opera Mini/.test(navigator.userAgent)||navigator.userAgent.includes("Macintosh")&&navigator.maxTouchPoints>1;se&&(ge.hidden=!1);let v,z,h=null;const W=ee(),P=e=>Number.isFinite(e),J=e=>["N","NE","E","SE","S","SW","W","NW"][Math.floor((e+22.5)%360/45)],Y=e=>Number(e.toFixed(1)).toString(),x=()=>{v&&window.removeEventListener("deviceorientation",v),window.clearTimeout(z),v=null,z=null,q.hidden=!0,h=null},Ie=e=>{const c=-e;if(h===null)h=c,X.style.transition="none",X.style.transform=`rotate(${h}deg)`,X.offsetWidth,X.style.transition="";else{const o=(c-h+540)%360-180;h+=o,X.style.transform=`rotate(${h}deg)`}ce.textContent=`${Y(e)}° · ${J(e)}`,q.setAttribute("aria-label",`${g.compassDirection||"Compass direction"} ${Y(e)}° ${J(e)}`),q.hidden=!1},le=(e,c)=>{const o=c===null?g.accuracyUnavailable||"Accuracy unavailable":(g.accuracy||"Accuracy")+": ±"+Y(c)+"°";r.innerHTML=""+Y(e)+"° · "+J(e)+"
"+o,K.textContent=g.stopCapture||"Stop direction capture"},Ce=()=>{x(),r.textContent=g.pointPhone||"Point the top of your phone toward the sound — direction will update live.",v=e=>{const c="webkitCompassHeading"in e,o=P(e.webkitCompassHeading)?e.webkitCompassHeading:!c&&e.absolute&&P(e.alpha)?(360-e.alpha)%360:null;if(o===null||o<0||o>=360)return;const A=P(e.webkitCompassAccuracy)&&e.webkitCompassAccuracy>=0?e.webkitCompassAccuracy:null;ie.value=o,ae.value=A===null?"":A,le(o,A),Ie(o),window.clearTimeout(z)},window.addEventListener("deviceorientation",v),z=window.setTimeout(()=>{x(),K.textContent=g.captureDirection||"Capture direction",r.textContent=g.compassUnavailable||"Compass unavailable on this device."},15e3)},re=async()=>{if(v){x(),K.textContent=g.captureAgain||"Capture again";return}if(!window.isSecureContext){r.textContent=g.secureCompass||"Compass capture requires a secure HTTPS connection.";return}if(typeof window.DeviceOrientationEvent>"u"){r.textContent=g.compassUnavailable||"Compass unavailable on this device.";return}if(typeof DeviceOrientationEvent.requestPermission=="function"){r.textContent=g.compassPermission||"Requesting compass permission…";try{if(await DeviceOrientationEvent.requestPermission(!0)!=="granted"){r.textContent=g.compassDenied||"Compass permission denied.";return}}catch{r.textContent=g.compassDenied||"Compass permission denied.";return}}Ce()},k=async()=>{if(x(),N.disabled=!0,W!=null&&W.active){try{const e=await W.clipForSubmission(),c=new FormData(f);e&&c.append("audio",e);const o=await fetch(f.action,{method:"POST",body:c,credentials:"same-origin"}),A=await o.text();document.querySelector("#manual-submission").outerHTML=A,o.ok&&W.submissionSucceeded()}catch{document.querySelector("#manual-submission").textContent="Could not send the report. Please try again."}finally{N.disabled=!1}return}window.htmx?htmx.ajax("POST",f.action,{source:f,target:"#manual-submission",swap:"outerHTML"}):f.submit()};K.addEventListener("click",re);N.addEventListener("click",()=>{if(!navigator.geolocation){k();return}te.textContent=g.requestingLocation||"Requesting your optional location…",navigator.geolocation.getCurrentPosition(e=>{ne.value=e.coords.latitude,oe.value=e.coords.longitude,k()},()=>k(),{enableHighAccuracy:!1,maximumAge:3e5,timeout:1e4})});document.body.addEventListener("htmx:afterRequest",e=>{e.detail.elt===f&&(N.disabled=!1)}); diff --git a/staticfiles/vite/assets/settings-C2YM3T2Q.css b/staticfiles/vite/assets/settings-C2YM3T2Q.css new file mode 100644 index 0000000..d832b0f --- /dev/null +++ b/staticfiles/vite/assets/settings-C2YM3T2Q.css @@ -0,0 +1 @@ +*{box-sizing:border-box}body{min-height:100vh;padding:0;color:var(--theme-ink);background:var(--theme-bg)}.settings-shell{width:min(100% - 3.5rem,73.75rem);margin:auto;padding:4rem 0 5rem}.settings-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2.25rem 2rem;width:100%}.settings-heading,.messages{grid-column:1/-1}.settings-heading{margin-bottom:0}.eyebrow{margin:0 0 .7rem;color:#9fc5ff;font-size:.74rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase}h1,h2{font-family:Georgia,ui-serif,serif;font-weight:700}h1{margin:0;font-size:clamp(2.3rem,4vw,3.5rem);letter-spacing:-.045em;line-height:1.12}h2{margin:0 0 .45rem;font-size:1.5rem;letter-spacing:-.02em}.intro,.help{margin:.45rem 0 0;color:var(--theme-muted);line-height:1.55}.card{min-width:0;width:100%;margin:0;padding:1.75rem;border:1px solid var(--theme-line);border-radius:1.125rem;background:var(--theme-surface);box-shadow:0 1.125rem 2.8rem #02071429}.settings-form{display:flex;flex-direction:column;gap:1rem}.settings-form h2+.field{margin-top:.4rem}.settings-form>.button[type=submit]{margin-top:auto}.field label{display:block;margin:0 0 .375rem;font-size:.85rem;font-weight:700}.field input,.field select{display:block;width:100%;min-height:2.625rem;padding:.55rem .625rem;border:1px solid var(--theme-line);border-radius:.56rem;color:var(--theme-ink);background:var(--theme-input);font:inherit}.field input:focus-visible,.field select:focus-visible,.button:focus-visible,.switch-control input:focus-visible+.switch-track{outline:3px solid #80b6ff;outline-offset:3px}.errorlist{margin:.5rem 0 0;padding:.7rem .9rem;border-radius:.55rem;color:#fee2e2;background:#7f1d1d}.button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:2.875rem;margin:0;padding:.65rem 1.2rem;border:1px solid transparent;border-radius:999px;color:#111c30;background:#a6ccff;font:inherit;font-size:.9rem;font-weight:800;text-align:center;text-decoration:none;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}.button:hover{transform:translateY(-1px);background:#c0ddff;box-shadow:0 .45rem 1rem #5899f733}.button--secondary{border-color:#6386bd;color:#d7e8ff;background:#223755}.button--secondary:hover{color:#111c30;background:#a6ccff}.switch-row{display:flex;align-items:center;justify-content:space-between;gap:1.125rem;min-height:4.375rem;padding:.8rem 1rem;border:1px solid #3d5879;border-radius:.94rem;background:#1a2a43;cursor:pointer}.switch-row:hover{border-color:#739ad0;background:#203554}.switch-copy{display:grid;gap:.2rem;min-width:0}.switch-copy strong{font-size:.92rem}.switch-copy small{color:var(--theme-muted);font-size:.77rem;line-height:1.35}.switch-control{position:relative;display:block;flex:0 0 3.1875rem;width:3.1875rem;height:1.9375rem}.switch-control input{position:absolute;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.switch-track{display:block;width:100%;height:100%;border-radius:999px;background:#62758b;pointer-events:none;transition:background .16s ease}.switch-track:after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0004;transition:transform .16s ease}.switch-control input:checked+.switch-track{background:#34c76a}.switch-control input:checked+.switch-track:after{transform:translate(20px)}.messages{margin:0;padding:0;list-style:none}.alert{margin:.5rem 0 0;padding:.75rem 1rem;border-radius:.65rem;line-height:1.45}#ntfy-test-result:empty{display:none}.sensor-list{display:grid;gap:1rem;margin:1.25rem 0}.sensor-card{min-width:0;margin:0;padding:1rem;border-radius:.8rem}.sensor-card__heading{display:flex;align-items:center;flex-wrap:wrap;gap:.35rem .7rem}.sensor-card p{line-height:1.45;overflow-wrap:anywhere}.sensor-card .button{margin-top:.65rem}.sensor-form{margin-top:1.25rem}.sensor-standalone>.card{grid-column:1/-1;width:min(100%,42.5rem);justify-self:center}.settings-content>#sensor-card:has(.sensor-detail){grid-column:1/-1}.sensor-detail__header{display:flex;align-items:start;justify-content:space-between;gap:1rem;padding-bottom:1.2rem;border-bottom:1px solid var(--theme-line)}.sensor-detail__header .eyebrow{margin-bottom:.35rem}.sensor-detail__header h2{margin:0;font-size:clamp(1.6rem,3vw,2rem);overflow-wrap:anywhere}.sensor-close{display:inline-flex;align-items:center;gap:.35rem;flex:none;padding:.45rem .85rem;border:1px solid var(--theme-line);border-radius:999px;color:var(--theme-ink);background:var(--theme-surface-raised);font-size:.85rem;font-weight:700;text-decoration:none}.sensor-close:hover{border-color:#86ade0;background:#2b4266}.sensor-close:focus-visible{outline:3px solid #80b6ff;outline-offset:3px}.sensor-detail__overview{margin:1.25rem 0 1.5rem;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__overview>.sensor-status{display:inline-flex;margin:0 0 1rem;padding:.35rem .7rem;border-radius:999px;background:var(--theme-input);font-size:.85rem}.sensor-detail__facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem 1.5rem;margin:0}.sensor-detail__facts div{min-width:0}.sensor-detail__facts dt{margin:0 0 .3rem;color:var(--theme-muted);font-size:.78rem;font-weight:700}.sensor-detail__facts dd{margin:0;overflow-wrap:anywhere;font-size:.92rem;font-weight:600}.sensor-detail__facts code{font:inherit}.sensor-detail__actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.sensor-detail__section{display:flex;flex-direction:column;min-width:0;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__section h3{margin:0 0 .35rem;font-family:Georgia,ui-serif,serif;font-size:1.15rem}.sensor-detail__section>.help{margin:0}.sensor-detail__section form{display:flex;flex:1;flex-direction:column;gap:.8rem;margin-top:1rem}.sensor-detail__section form .button{margin-top:auto}.sensor-detail__section .field{width:100%}.sensor-detail__section:last-child{border-color:#945f68;background:#392432}.sensor-detail__section:last-child .button--danger{border-color:#dc7b89;color:#fff;background:#a43c50}.sensor-detail__section:last-child .button--danger:hover{background:#bd4a60}.sensor-confirm{display:flex;align-items:start;gap:.6rem;line-height:1.4;font-size:.82rem;cursor:pointer}.sensor-confirm input{flex:none;width:1.1rem;height:1.1rem;margin:.15rem 0 0;accent-color:#84baff}.sensor-confirm input:focus-visible{outline:3px solid #80b6ff;outline-offset:3px}.sensor-messages{margin-top:1rem}.token-once{margin:1.25rem 0;padding:1rem;border:1px solid #e4ad55;border-radius:.8rem;background:var(--theme-surface-raised)}.token-once code{display:block;margin:.75rem 0;padding:.7rem;border-radius:.5rem;background:var(--theme-input);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}.button--danger{color:#fff;background:#991b1b}.button--danger:hover{color:#fff;background:#b91c1c}:root[data-theme=light] .eyebrow{color:#23578d}:root[data-theme=light] .card{box-shadow:0 1.125rem 2.8rem #20365c1a}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger){color:#fff;background:#245b96}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger):hover{background:#174877}:root[data-theme=light] .button--secondary{border-color:#9cc0ed;color:#245b96;background:#edf4ff}:root[data-theme=light] .button--secondary:hover{color:#fff;background:#245b96}:root[data-theme=light] .switch-row{border-color:#d4e0ef;background:#f2f7fe}:root[data-theme=light] .switch-row:hover{border-color:#9cc0ed;background:#eaf3ff}:root[data-theme=light] .switch-track{background:#c1cbd8}:root[data-theme=light] .switch-control input:checked+.switch-track{background:#34c76a}:root[data-theme=light] .sensor-close:hover{background:#e4efff}:root[data-theme=light] .sensor-detail__section:last-child{border-color:#ecc6cb;background:#fff5f6}:root[data-theme=light] .sensor-detail__section:last-child .button--danger{color:#fff;background:#a43c50}@media(max-width:48rem){.settings-content{grid-template-columns:minmax(0,1fr)}.settings-shell{width:min(100% - 2.25rem,73.75rem);padding:2.5rem 0 3rem}}@media(max-width:48rem){.sensor-detail__actions{grid-template-columns:minmax(0,1fr)}}@media(max-width:30rem){.sensor-detail__facts{grid-template-columns:minmax(0,1fr)}.sensor-detail__header{align-items:start}.sensor-close span{display:none}}@media(max-width:35rem){.card{padding:1.25rem}}@media(prefers-reduced-motion:reduce){.button,.switch-track,.switch-track:after{transition:none}.button:hover{transform:none}} diff --git a/staticfiles/vite/assets/settings-CM44qWoA.css b/staticfiles/vite/assets/settings-CM44qWoA.css new file mode 100644 index 0000000..81034b9 --- /dev/null +++ b/staticfiles/vite/assets/settings-CM44qWoA.css @@ -0,0 +1 @@ +*{box-sizing:border-box}body{min-height:100vh;padding:0;color:var(--theme-ink);background:var(--theme-bg)}.settings-shell{width:min(100% - 3.5rem,73.75rem);margin:auto;padding:4rem 0 5rem}.settings-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2.25rem 2rem;width:100%}.settings-heading,.messages{grid-column:1/-1}.settings-heading{margin-bottom:0}.eyebrow{margin:0 0 .7rem;color:#9fc5ff;font-size:.74rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase}h1,h2{font-family:Georgia,ui-serif,serif;font-weight:700}h1{margin:0;font-size:clamp(2.3rem,4vw,3.5rem);letter-spacing:-.045em;line-height:1.12}h2{margin:0 0 .45rem;font-size:1.5rem;letter-spacing:-.02em}.intro,.help{margin:.45rem 0 0;color:var(--theme-muted);line-height:1.55}.card{min-width:0;width:100%;margin:0;padding:1.75rem;border:1px solid var(--theme-line);border-radius:1.125rem;background:var(--theme-surface);box-shadow:0 1.125rem 2.8rem #02071429}.settings-form{display:flex;flex-direction:column;gap:1rem}.settings-form h2+.field{margin-top:.4rem}.settings-form>.button[type=submit]{margin-top:auto}.field label{display:block;margin:0 0 .375rem;font-size:.85rem;font-weight:700}.field input,.field select{display:block;width:100%;min-height:2.625rem;padding:.55rem .625rem;border:1px solid var(--theme-line);border-radius:.56rem;color:var(--theme-ink);background:var(--theme-input);font:inherit}.field input:focus-visible,.field select:focus-visible,.button:focus-visible,.switch-control input:focus-visible+.switch-track{outline:3px solid #80b6ff;outline-offset:3px}.errorlist{margin:.5rem 0 0;padding:.7rem .9rem;border-radius:.55rem;color:#fee2e2;background:#7f1d1d}.button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:2.875rem;margin:0;padding:.65rem 1.2rem;border:1px solid transparent;border-radius:999px;color:#111c30;background:#a6ccff;font:inherit;font-size:.9rem;font-weight:800;text-align:center;text-decoration:none;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}.button:hover{transform:translateY(-1px);background:#c0ddff;box-shadow:0 .45rem 1rem #5899f733}.button--secondary{border-color:#6386bd;color:#d7e8ff;background:#223755}.button--secondary:hover{color:#111c30;background:#a6ccff}.switch-row{display:flex;align-items:center;justify-content:space-between;gap:1.125rem;min-height:4.375rem;padding:.8rem 1rem;border:1px solid #3d5879;border-radius:.94rem;background:#1a2a43;cursor:pointer}.switch-row:hover{border-color:#739ad0;background:#203554}.switch-copy{display:grid;gap:.2rem;min-width:0}.switch-copy strong{font-size:.92rem}.switch-copy small{color:var(--theme-muted);font-size:.77rem;line-height:1.35}.switch-control{position:relative;display:block;flex:0 0 3.1875rem;width:3.1875rem;height:1.9375rem}.switch-control input{position:absolute;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.switch-track{display:block;width:100%;height:100%;border-radius:999px;background:#62758b;pointer-events:none;transition:background .16s ease}.switch-track:after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0004;transition:transform .16s ease}.switch-control input:checked+.switch-track{background:#34c76a}.switch-control input:checked+.switch-track:after{transform:translate(20px)}.messages{margin:0;padding:0;list-style:none}.alert{margin:.5rem 0 0;padding:.75rem 1rem;border-radius:.65rem;line-height:1.45}#ntfy-test-result:empty{display:none}.sensor-list{display:grid;gap:1rem;margin:1.25rem 0}.sensor-card{min-width:0;margin:0;padding:1rem;border-radius:.8rem}.sensor-card__heading{display:flex;align-items:center;flex-wrap:wrap;gap:.35rem .7rem}.sensor-card p{line-height:1.45;overflow-wrap:anywhere}.sensor-card .button{margin-top:.65rem}.sensor-form{margin-top:1.25rem}:root[data-theme=light] .eyebrow{color:#23578d}:root[data-theme=light] .card{box-shadow:0 1.125rem 2.8rem #20365c1a}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger){color:#fff;background:#245b96}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger):hover{background:#174877}:root[data-theme=light] .button--secondary{border-color:#9cc0ed;color:#245b96;background:#edf4ff}:root[data-theme=light] .button--secondary:hover{color:#fff;background:#245b96}:root[data-theme=light] .switch-row{border-color:#d4e0ef;background:#f2f7fe}:root[data-theme=light] .switch-row:hover{border-color:#9cc0ed;background:#eaf3ff}:root[data-theme=light] .switch-track{background:#c1cbd8}:root[data-theme=light] .switch-control input:checked+.switch-track{background:#34c76a}@media(max-width:48rem){.settings-content{grid-template-columns:minmax(0,1fr)}.settings-shell{width:min(100% - 2.25rem,73.75rem);padding:2.5rem 0 3rem}}@media(max-width:35rem){.card{padding:1.25rem}}@media(prefers-reduced-motion:reduce){.button,.switch-track,.switch-track:after{transition:none}.button:hover{transform:none}} diff --git a/staticfiles/vite/assets/settings-CqznN2Wf.css b/staticfiles/vite/assets/settings-CqznN2Wf.css new file mode 100644 index 0000000..b473768 --- /dev/null +++ b/staticfiles/vite/assets/settings-CqznN2Wf.css @@ -0,0 +1 @@ +*{box-sizing:border-box}body{min-height:100vh;padding:0;color:var(--theme-ink);background:var(--theme-bg)}.settings-shell{width:min(100% - 3.5rem,73.75rem);margin:auto;padding:4rem 0 5rem}.settings-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2.25rem 2rem;width:100%}.settings-heading,.messages{grid-column:1/-1}.settings-heading{margin-bottom:0}.eyebrow{margin:0 0 .7rem;color:#9fc5ff;font-size:.74rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase}h1,h2{font-family:Georgia,ui-serif,serif;font-weight:700}h1{margin:0;font-size:clamp(2.3rem,4vw,3.5rem);letter-spacing:-.045em;line-height:1.12}h2{margin:0 0 .45rem;font-size:1.5rem;letter-spacing:-.02em}.intro,.help{margin:.45rem 0 0;color:var(--theme-muted);line-height:1.55}.card{min-width:0;width:100%;margin:0;padding:1.75rem;border:1px solid var(--theme-line);border-radius:1.125rem;background:var(--theme-surface);box-shadow:0 1.125rem 2.8rem #02071429}.settings-form{display:flex;flex-direction:column;gap:1rem}.settings-form h2+.field{margin-top:.4rem}.settings-form>.button[type=submit]{margin-top:auto}.field label{display:block;margin:0 0 .375rem;font-size:.85rem;font-weight:700}.field input,.field select{display:block;width:100%;min-height:2.625rem;padding:.55rem .625rem;border:1px solid var(--theme-line);border-radius:.56rem;color:var(--theme-ink);background:var(--theme-input);font:inherit}.field input:focus-visible,.field select:focus-visible,.button:focus-visible,.switch-control input:focus-visible+.switch-track{outline:3px solid #80b6ff;outline-offset:3px}.errorlist{margin:.5rem 0 0;padding:.7rem .9rem;border-radius:.55rem;color:#fee2e2;background:#7f1d1d}.button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:2.875rem;margin:0;padding:.65rem 1.2rem;border:1px solid transparent;border-radius:999px;color:#111c30;background:#a6ccff;font:inherit;font-size:.9rem;font-weight:800;text-align:center;text-decoration:none;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}.button:hover{transform:translateY(-1px);background:#c0ddff;box-shadow:0 .45rem 1rem #5899f733}.button--secondary{border-color:#6386bd;color:#d7e8ff;background:#223755}.button--secondary:hover{color:#111c30;background:#a6ccff}.switch-row{display:flex;align-items:center;justify-content:space-between;gap:1.125rem;min-height:4.375rem;padding:.8rem 1rem;border:1px solid #3d5879;border-radius:.94rem;background:#1a2a43;cursor:pointer}.switch-row:hover{border-color:#739ad0;background:#203554}.switch-copy{display:grid;gap:.2rem;min-width:0}.switch-copy strong{font-size:.92rem}.switch-copy small{color:var(--theme-muted);font-size:.77rem;line-height:1.35}.switch-control{position:relative;display:block;flex:0 0 3.1875rem;width:3.1875rem;height:1.9375rem}.switch-control input{position:absolute;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.switch-track{display:block;width:100%;height:100%;border-radius:999px;background:#62758b;pointer-events:none;transition:background .16s ease}.switch-track:after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0004;transition:transform .16s ease}.switch-control input:checked+.switch-track{background:#34c76a}.switch-control input:checked+.switch-track:after{transform:translate(20px)}.messages{margin:0;padding:0;list-style:none}.alert{margin:.5rem 0 0;padding:.75rem 1rem;border-radius:.65rem;line-height:1.45}#ntfy-test-result:empty{display:none}.sensor-list{display:grid;gap:1rem;margin:1.25rem 0}.sensor-card{min-width:0;margin:0;padding:1rem;border-radius:.8rem}.sensor-card__heading{display:flex;align-items:center;flex-wrap:wrap;gap:.35rem .7rem}.sensor-card p{line-height:1.45;overflow-wrap:anywhere}.sensor-card .button{margin-top:.65rem}.sensor-form{margin-top:1.25rem}.settings-content>#sensor-card{grid-column:1/-1}.sensor-detail__header{display:flex;align-items:start;justify-content:space-between;gap:1rem;padding-bottom:1.2rem;border-bottom:1px solid var(--theme-line)}.sensor-detail__header .eyebrow{margin-bottom:.35rem}.sensor-detail__header h2{margin:0;font-size:clamp(1.6rem,3vw,2rem);overflow-wrap:anywhere}.sensor-close{display:inline-flex;align-items:center;gap:.35rem;flex:none;padding:.45rem .85rem;border:1px solid var(--theme-line);border-radius:999px;color:var(--theme-ink);background:var(--theme-surface-raised);font-size:.85rem;font-weight:700;text-decoration:none}.sensor-close:hover{border-color:#86ade0;background:#2b4266}.sensor-close:focus-visible{outline:3px solid #80b6ff;outline-offset:3px}.sensor-detail__overview{margin:1.25rem 0 1.5rem;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__overview>.sensor-status{display:inline-flex;margin:0 0 1rem;padding:.35rem .7rem;border-radius:999px;background:var(--theme-input);font-size:.85rem}.sensor-detail__facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem 1.5rem;margin:0}.sensor-detail__facts div{min-width:0}.sensor-detail__facts dt{margin:0 0 .3rem;color:var(--theme-muted);font-size:.78rem;font-weight:700}.sensor-detail__facts dd{margin:0;overflow-wrap:anywhere;font-size:.92rem;font-weight:600}.sensor-detail__facts code{font:inherit}.sensor-detail__actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.sensor-detail__section{display:flex;flex-direction:column;min-width:0;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__section h3{margin:0 0 .35rem;font-family:Georgia,ui-serif,serif;font-size:1.15rem}.sensor-detail__section>.help{margin:0}.sensor-detail__section form{display:flex;flex:1;flex-direction:column;gap:.8rem;margin-top:1rem}.sensor-detail__section form .button{margin-top:auto}.sensor-detail__section .field{width:100%}.sensor-detail__section:last-child{border-color:#945f68;background:#392432}.sensor-detail__section:last-child .button--danger{border-color:#dc7b89;color:#fff;background:#a43c50}.sensor-detail__section:last-child .button--danger:hover{background:#bd4a60}.sensor-confirm{display:flex;align-items:start;gap:.6rem;line-height:1.4;font-size:.82rem;cursor:pointer}.sensor-confirm input{flex:none;width:1.1rem;height:1.1rem;margin:.15rem 0 0;accent-color:#84baff}.sensor-confirm input:focus-visible{outline:3px solid #80b6ff;outline-offset:3px}.sensor-messages{margin-top:1rem}.token-once{margin:1.25rem 0;padding:1rem;border:1px solid #e4ad55;border-radius:.8rem;background:var(--theme-surface-raised)}.token-once code{display:block;margin:.75rem 0;padding:.7rem;border-radius:.5rem;background:var(--theme-input);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}.button--danger{color:#fff;background:#991b1b}.button--danger:hover{color:#fff;background:#b91c1c}:root[data-theme=light] .eyebrow{color:#23578d}:root[data-theme=light] .card{box-shadow:0 1.125rem 2.8rem #20365c1a}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger){color:#fff;background:#245b96}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger):hover{background:#174877}:root[data-theme=light] .button--secondary{border-color:#9cc0ed;color:#245b96;background:#edf4ff}:root[data-theme=light] .button--secondary:hover{color:#fff;background:#245b96}:root[data-theme=light] .switch-row{border-color:#d4e0ef;background:#f2f7fe}:root[data-theme=light] .switch-row:hover{border-color:#9cc0ed;background:#eaf3ff}:root[data-theme=light] .switch-track{background:#c1cbd8}:root[data-theme=light] .switch-control input:checked+.switch-track{background:#34c76a}:root[data-theme=light] .sensor-close:hover{background:#e4efff}:root[data-theme=light] .sensor-detail__section:last-child{border-color:#ecc6cb;background:#fff5f6}:root[data-theme=light] .sensor-detail__section:last-child .button--danger{color:#fff;background:#a43c50}@media(max-width:48rem){.settings-content{grid-template-columns:minmax(0,1fr)}.settings-shell{width:min(100% - 2.25rem,73.75rem);padding:2.5rem 0 3rem}}@media(max-width:48rem){.sensor-detail__actions{grid-template-columns:minmax(0,1fr)}}@media(max-width:30rem){.sensor-detail__facts{grid-template-columns:minmax(0,1fr)}.sensor-detail__header{align-items:start}.sensor-close span{display:none}}@media(max-width:35rem){.card{padding:1.25rem}}@media(prefers-reduced-motion:reduce){.button,.switch-track,.switch-track:after{transition:none}.button:hover{transform:none}} diff --git a/staticfiles/vite/assets/settings-D3H5dzmU.css b/staticfiles/vite/assets/settings-D3H5dzmU.css new file mode 100644 index 0000000..eecd0de --- /dev/null +++ b/staticfiles/vite/assets/settings-D3H5dzmU.css @@ -0,0 +1 @@ +*{box-sizing:border-box}body{min-height:100vh;padding:0;color:var(--theme-ink);background:var(--theme-bg)}.settings-shell{width:min(100% - 3.5rem,73.75rem);margin:auto;padding:4rem 0 5rem}.settings-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2.25rem 2rem;width:100%}.settings-heading,.messages{grid-column:1/-1}.settings-heading{margin-bottom:0}.eyebrow{margin:0 0 .7rem;color:#9fc5ff;font-size:.74rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase}h1,h2{font-family:Georgia,ui-serif,serif;font-weight:700}h1{margin:0;font-size:clamp(2.3rem,4vw,3.5rem);letter-spacing:-.045em;line-height:1.12}h2{margin:0 0 .45rem;font-size:1.5rem;letter-spacing:-.02em}.intro,.help{margin:.45rem 0 0;color:var(--theme-muted);line-height:1.55}.card{min-width:0;width:100%;margin:0;padding:1.75rem;border:1px solid var(--theme-line);border-radius:1.125rem;background:var(--theme-surface);box-shadow:0 1.125rem 2.8rem #02071429}.settings-form{display:flex;flex-direction:column;gap:1rem}.settings-form h2+.field{margin-top:.4rem}.settings-form>.button[type=submit]{margin-top:auto}.field label{display:block;margin:0 0 .375rem;font-size:.85rem;font-weight:700}.field input,.field select{display:block;width:100%;min-height:2.625rem;padding:.55rem .625rem;border:1px solid var(--theme-line);border-radius:.56rem;color:var(--theme-ink);background:var(--theme-input);font:inherit}.field input:focus-visible,.field select:focus-visible,.button:focus-visible,.switch-control input:focus-visible+.switch-track{outline:3px solid #80b6ff;outline-offset:3px}.errorlist{margin:.5rem 0 0;padding:.7rem .9rem;border-radius:.55rem;color:#fee2e2;background:#7f1d1d}.button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:2.875rem;margin:0;padding:.65rem 1.2rem;border:1px solid transparent;border-radius:999px;color:#111c30;background:#a6ccff;font:inherit;font-size:.9rem;font-weight:800;text-align:center;text-decoration:none;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}.button:hover{transform:translateY(-1px);background:#c0ddff;box-shadow:0 .45rem 1rem #5899f733}.button--secondary{border-color:#6386bd;color:#d7e8ff;background:#223755}.button--secondary:hover{color:#111c30;background:#a6ccff}.switch-row{display:flex;align-items:center;justify-content:space-between;gap:1.125rem;min-height:4.375rem;padding:.8rem 1rem;border:1px solid #3d5879;border-radius:.94rem;background:#1a2a43;cursor:pointer}.switch-row:hover{border-color:#739ad0;background:#203554}.switch-copy{display:grid;gap:.2rem;min-width:0}.switch-copy strong{font-size:.92rem}.switch-copy small{color:var(--theme-muted);font-size:.77rem;line-height:1.35}.switch-control{position:relative;display:block;flex:0 0 3.1875rem;width:3.1875rem;height:1.9375rem}.switch-control input{position:absolute;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.switch-track{display:block;width:100%;height:100%;border-radius:999px;background:#62758b;pointer-events:none;transition:background .16s ease}.switch-track:after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0004;transition:transform .16s ease}.switch-control input:checked+.switch-track{background:#34c76a}.switch-control input:checked+.switch-track:after{transform:translate(20px)}.messages{margin:0;padding:0;list-style:none}.alert{margin:.5rem 0 0;padding:.75rem 1rem;border-radius:.65rem;line-height:1.45}#ntfy-test-result:empty{display:none}.sensor-list__intro{padding-bottom:1.25rem;border-bottom:1px solid var(--theme-line)}.sensor-list__intro .eyebrow{margin-bottom:.35rem}.sensor-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;margin:1.5rem 0}.sensor-card{display:flex;flex-direction:column;min-width:0;margin:0;padding:1.3rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-card__heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.5rem 1rem}.sensor-card__heading h3{margin:0;font-family:Georgia,ui-serif,serif;font-size:1.25rem;overflow-wrap:anywhere}.sensor-card .sensor-status{display:inline-flex;padding:.32rem .65rem;border-radius:999px;background:var(--theme-input);font-size:.78rem;white-space:nowrap}.sensor-status{color:var(--theme-muted);font-weight:700}.sensor-status--online{color:#64dca0}.sensor-status--delayed{color:#f5c46b}.sensor-status--offline{color:#f49aa7}.sensor-access{align-self:flex-start;margin-top:.7rem;padding:.25rem .55rem;border:1px solid #3d806b;border-radius:999px;color:#8be0b9;font-size:.72rem;font-weight:800}.sensor-access--off{border-color:#806b75;color:#d4b9c5}.sensor-card__facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.8rem 1rem;margin:1.3rem 0}.sensor-card__facts div{min-width:0}.sensor-card__facts dt{margin-bottom:.25rem;color:var(--theme-muted);font-size:.75rem;font-weight:700}.sensor-card__facts dd{margin:0;font-size:.88rem;font-weight:600;overflow-wrap:anywhere}.sensor-card__facts code{font:inherit}.sensor-card__facts div:last-child{grid-column:1/-1}.sensor-card .button{margin-top:auto}.sensor-empty{grid-column:1/-1;margin:0;padding:1.5rem;border:1px dashed var(--theme-line);border-radius:1rem;color:var(--theme-muted);text-align:center;line-height:1.5}.sensor-form{margin-top:1.5rem;padding:1.3rem;border:1px dashed #6386bd;border-radius:1rem;background:var(--theme-surface-raised)}.sensor-form h3{margin:0;font-family:Georgia,ui-serif,serif;font-size:1.2rem}.sensor-form .help{margin-top:.3rem}.sensor-form__controls{display:grid;grid-template-columns:minmax(0,1fr) 11rem;align-items:end;gap:1rem}.settings-content>#sensor-card{grid-column:1/-1}.sensor-detail__header{display:flex;align-items:start;justify-content:space-between;gap:1rem;padding-bottom:1.2rem;border-bottom:1px solid var(--theme-line)}.sensor-detail__header .eyebrow{margin-bottom:.35rem}.sensor-detail__header h2{margin:0;font-size:clamp(1.6rem,3vw,2rem);overflow-wrap:anywhere}.sensor-close{display:inline-flex;align-items:center;gap:.35rem;flex:none;padding:.45rem .85rem;border:1px solid var(--theme-line);border-radius:999px;color:var(--theme-ink);background:var(--theme-surface-raised);font-size:.85rem;font-weight:700;text-decoration:none}.sensor-close:hover{border-color:#86ade0;background:#2b4266}.sensor-close:focus-visible{outline:3px solid #80b6ff;outline-offset:3px}.sensor-detail__overview{margin:1.25rem 0 1.5rem;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__overview>.sensor-status{display:inline-flex;margin:0 0 1rem;padding:.35rem .7rem;border-radius:999px;background:var(--theme-input);font-size:.85rem}.sensor-detail__facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem 1.5rem;margin:0}.sensor-detail__facts div{min-width:0}.sensor-detail__facts dt{margin:0 0 .3rem;color:var(--theme-muted);font-size:.78rem;font-weight:700}.sensor-detail__facts dd{margin:0;overflow-wrap:anywhere;font-size:.92rem;font-weight:600}.sensor-detail__facts code{font:inherit}.sensor-detail__actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.sensor-detail__section{display:flex;flex-direction:column;min-width:0;padding:1.2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface-raised)}.sensor-detail__section h3{margin:0 0 .35rem;font-family:Georgia,ui-serif,serif;font-size:1.15rem}.sensor-detail__section>.help{margin:0}.sensor-detail__section form{display:flex;flex:1;flex-direction:column;gap:.8rem;margin-top:1rem}.sensor-detail__section form .button{margin-top:auto}.sensor-detail__section .field{width:100%}.sensor-detail__section:last-child{border-color:#945f68;background:#392432}.sensor-detail__section:last-child .button--danger{border-color:#dc7b89;color:#fff;background:#a43c50}.sensor-detail__section:last-child .button--danger:hover{background:#bd4a60}.sensor-confirm{display:flex;align-items:start;gap:.6rem;line-height:1.4;font-size:.82rem;cursor:pointer}.sensor-confirm input{flex:none;width:1.1rem;height:1.1rem;margin:.15rem 0 0;accent-color:#84baff}.sensor-confirm input:focus-visible{outline:3px solid #80b6ff;outline-offset:3px}.sensor-messages{margin-top:1rem}.token-once{margin:1.25rem 0;padding:1rem;border:1px solid #e4ad55;border-radius:.8rem;background:var(--theme-surface-raised)}.token-once code{display:block;margin:.75rem 0;padding:.7rem;border-radius:.5rem;background:var(--theme-input);overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}.button--danger{color:#fff;background:#991b1b}.button--danger:hover{color:#fff;background:#b91c1c}:root[data-theme=light] .eyebrow{color:#23578d}:root[data-theme=light] .card{box-shadow:0 1.125rem 2.8rem #20365c1a}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger){color:#fff;background:#245b96}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger):hover{background:#174877}:root[data-theme=light] .button--secondary{border-color:#9cc0ed;color:#245b96;background:#edf4ff}:root[data-theme=light] .button--secondary:hover{color:#fff;background:#245b96}:root[data-theme=light] .switch-row{border-color:#d4e0ef;background:#f2f7fe}:root[data-theme=light] .switch-row:hover{border-color:#9cc0ed;background:#eaf3ff}:root[data-theme=light] .switch-track{background:#c1cbd8}:root[data-theme=light] .switch-control input:checked+.switch-track{background:#34c76a}:root[data-theme=light] .sensor-close:hover{background:#e4efff}:root[data-theme=light] .sensor-detail__section:last-child{border-color:#ecc6cb;background:#fff5f6}:root[data-theme=light] .sensor-detail__section:last-child .button--danger{color:#fff;background:#a43c50}:root[data-theme=light] .sensor-access{border-color:#b8dfca;color:#256147;background:#ecf8f0}:root[data-theme=light] .sensor-access--off{border-color:#dbcbd3;color:#80556a;background:#fbf4f7}:root[data-theme=light] .sensor-form{border-color:#9cc0ed}@media(max-width:48rem){.settings-content{grid-template-columns:minmax(0,1fr)}.settings-shell{width:min(100% - 2.25rem,73.75rem);padding:2.5rem 0 3rem}}@media(max-width:48rem){.sensor-detail__actions,.sensor-list{grid-template-columns:minmax(0,1fr)}}@media(max-width:30rem){.sensor-detail__facts{grid-template-columns:minmax(0,1fr)}.sensor-detail__header{align-items:start}.sensor-close span{display:none}}@media(max-width:35rem){.card{padding:1.25rem}.sensor-form__controls{grid-template-columns:minmax(0,1fr)}}@media(prefers-reduced-motion:reduce){.button,.switch-track,.switch-track:after{transition:none}.button:hover{transform:none}} diff --git a/staticfiles/vite/assets/settings-DRyEbE_R.css b/staticfiles/vite/assets/settings-DRyEbE_R.css new file mode 100644 index 0000000..6679e1e --- /dev/null +++ b/staticfiles/vite/assets/settings-DRyEbE_R.css @@ -0,0 +1 @@ +*{box-sizing:border-box}body{min-height:100vh;padding:0;color:var(--theme-ink);background:var(--theme-bg)}.settings-shell{width:min(100% - 3.5rem,73.75rem);margin:auto;padding:4rem 0 5rem}.settings-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2.25rem 2rem;width:100%}.settings-heading,.messages{grid-column:1/-1}.settings-heading{margin-bottom:0}.eyebrow{margin:0 0 .7rem;color:#9fc5ff;font-size:.74rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase}h1,h2{font-family:Georgia,ui-serif,serif;font-weight:700}h1{margin:0;font-size:clamp(2.3rem,4vw,3.5rem);letter-spacing:-.045em;line-height:1.12}h2{margin:0 0 .45rem;font-size:1.5rem;letter-spacing:-.02em}.intro,.help{margin:.45rem 0 0;color:var(--theme-muted);line-height:1.55}.card{min-width:0;width:100%;margin:0;padding:1.75rem;border:1px solid var(--theme-line);border-radius:1.125rem;background:var(--theme-surface);box-shadow:0 1.125rem 2.8rem #02071429}.settings-form{display:grid;align-content:start;grid-auto-rows:max-content;gap:1rem}.settings-form h2+.field{margin-top:.4rem}.field label{display:block;margin:0 0 .375rem;font-size:.85rem;font-weight:700}.field input,.field select{display:block;width:100%;min-height:2.625rem;padding:.55rem .625rem;border:1px solid var(--theme-line);border-radius:.56rem;color:var(--theme-ink);background:var(--theme-input);font:inherit}.field input:focus-visible,.field select:focus-visible,.button:focus-visible,.switch-control input:focus-visible+.switch-track{outline:3px solid #80b6ff;outline-offset:3px}.errorlist{margin:.5rem 0 0;padding:.7rem .9rem;border-radius:.55rem;color:#fee2e2;background:#7f1d1d}.button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:2.875rem;margin:0;padding:.65rem 1.2rem;border:1px solid transparent;border-radius:999px;color:#111c30;background:#a6ccff;font:inherit;font-size:.9rem;font-weight:800;text-align:center;text-decoration:none;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}.button:hover{transform:translateY(-1px);background:#c0ddff;box-shadow:0 .45rem 1rem #5899f733}.button--secondary{border-color:#6386bd;color:#d7e8ff;background:#223755}.button--secondary:hover{color:#111c30;background:#a6ccff}.switch-row{display:flex;align-items:center;justify-content:space-between;gap:1.125rem;min-height:4.375rem;padding:.8rem 1rem;border:1px solid #3d5879;border-radius:.94rem;background:#1a2a43;cursor:pointer}.switch-row:hover{border-color:#739ad0;background:#203554}.switch-copy{display:grid;gap:.2rem;min-width:0}.switch-copy strong{font-size:.92rem}.switch-copy small{color:var(--theme-muted);font-size:.77rem;line-height:1.35}.switch-control{position:relative;display:block;flex:0 0 3.1875rem;width:3.1875rem;height:1.9375rem}.switch-control input{position:absolute;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.switch-track{display:block;width:100%;height:100%;border-radius:999px;background:#62758b;pointer-events:none;transition:background .16s ease}.switch-track:after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0004;transition:transform .16s ease}.switch-control input:checked+.switch-track{background:#34c76a}.switch-control input:checked+.switch-track:after{transform:translate(20px)}.messages{margin:0;padding:0;list-style:none}.alert{margin:.5rem 0 0;padding:.75rem 1rem;border-radius:.65rem;line-height:1.45}#ntfy-test-result:empty{display:none}.sensor-list{display:grid;gap:1rem;margin:1.25rem 0}.sensor-card{min-width:0;margin:0;padding:1rem;border-radius:.8rem}.sensor-card__heading{display:flex;align-items:center;flex-wrap:wrap;gap:.35rem .7rem}.sensor-card p{line-height:1.45;overflow-wrap:anywhere}.sensor-card .button{margin-top:.65rem}.sensor-form{margin-top:1.25rem}:root[data-theme=light] .eyebrow{color:#23578d}:root[data-theme=light] .card{box-shadow:0 1.125rem 2.8rem #20365c1a}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger){color:#fff;background:#245b96}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger):hover{background:#174877}:root[data-theme=light] .button--secondary{border-color:#9cc0ed;color:#245b96;background:#edf4ff}:root[data-theme=light] .button--secondary:hover{color:#fff;background:#245b96}:root[data-theme=light] .switch-row{border-color:#d4e0ef;background:#f2f7fe}:root[data-theme=light] .switch-row:hover{border-color:#9cc0ed;background:#eaf3ff}:root[data-theme=light] .switch-track{background:#c1cbd8}:root[data-theme=light] .switch-control input:checked+.switch-track{background:#34c76a}@media(max-width:48rem){.settings-content{grid-template-columns:minmax(0,1fr)}.settings-shell{width:min(100% - 2.25rem,73.75rem);padding:2.5rem 0 3rem}}@media(max-width:35rem){.card{padding:1.25rem}}@media(prefers-reduced-motion:reduce){.button,.switch-track,.switch-track:after{transition:none}.button:hover{transform:none}} diff --git a/staticfiles/vite/assets/settings-DhCGWK8J.css b/staticfiles/vite/assets/settings-DhCGWK8J.css new file mode 100644 index 0000000..2bcc273 --- /dev/null +++ b/staticfiles/vite/assets/settings-DhCGWK8J.css @@ -0,0 +1 @@ +body{min-width:320px;margin:0;color:var(--theme-ink);font-family:Inter,system-ui,sans-serif;background:var(--theme-bg)}.settings-shell{width:min(100% - 2.5rem,70rem);margin:auto;padding:clamp(2rem,6vw,5rem) 0}.card{box-sizing:border-box;width:min(100%,42rem);margin:auto;padding:2rem;border:1px solid var(--theme-line);border-radius:1rem;background:var(--theme-surface)}h1{margin-top:0}h2{margin:0}.intro,.help{color:var(--theme-muted);line-height:1.5}.section{margin-top:2rem;padding-top:1.5rem;border-top:1px solid var(--theme-line)}label{display:block;margin:.9rem 0 .35rem;font-weight:700}input[type=url]{box-sizing:border-box;width:100%;min-height:2.8rem;padding:.65rem;border:1px solid var(--theme-line);border-radius:.55rem;color:var(--theme-ink);font:inherit;background:var(--theme-input)}.check{display:flex;gap:.6rem;align-items:center}.check label{margin:0}.button{min-height:2.8rem;margin-top:1rem;padding:.6rem 1rem;border:0;border-radius:.55rem;color:#17132b;font:inherit;font-weight:800;background:#a6ccff;cursor:pointer}.button--secondary{margin-right:.7rem;background:#d8c1fb}.alert,.errorlist{margin-top:1rem;padding:.75rem;border-radius:.55rem}.alert--success{color:#d1fae5;background:#14532d}.alert--error,.errorlist{color:#fee2e2;background:#7f1d1d}.messages{padding:0;list-style:none}@media(max-width:32rem){.settings-shell{width:min(100% - 2rem,70rem)}.card{padding:1.4rem}}.sensor-card{margin:1rem 0;padding:1rem;border:1px solid var(--theme-line);border-radius:.7rem;background:var(--theme-surface-raised)}.sensor-card p{margin:.5rem 0;color:var(--theme-muted)}.sensor-card .button{display:inline-block;text-decoration:none}.sensor-status{display:inline-block;margin-left:.5rem;color:#ef4444;font-weight:700}.sensor-status--online{color:#22c55e}.sensor-status--delayed{color:#f59e0b}input[type=text]{box-sizing:border-box;width:100%;min-height:2.8rem;padding:.65rem;border:1px solid var(--theme-line);border-radius:.55rem;color:var(--theme-ink);font:inherit;background:var(--theme-input)}.token-once{margin:1rem 0;padding:1rem;border:1px solid #f59e0b;border-radius:.7rem;background:var(--theme-surface-raised)}.token-once code{display:block;overflow-wrap:anywhere;margin-top:.7rem;padding:.7rem;border-radius:.4rem;background:var(--theme-input);-webkit-user-select:all;user-select:all}.button--danger{color:#fff;background:#991b1b}:root[data-theme=light] .sensor-status:not(.sensor-status--online):not(.sensor-status--delayed){color:#b91c1c} diff --git a/staticfiles/vite/assets/settings-cGIGto0G.css b/staticfiles/vite/assets/settings-cGIGto0G.css new file mode 100644 index 0000000..1cca9e0 --- /dev/null +++ b/staticfiles/vite/assets/settings-cGIGto0G.css @@ -0,0 +1 @@ +*{box-sizing:border-box}body{min-height:100vh;padding:0;color:var(--theme-ink);background:var(--theme-bg)}.settings-shell{width:min(100% - 3.5rem,73.75rem);margin:auto;padding:4rem 0 5rem}.settings-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2.25rem 2rem;width:100%}.settings-heading,.messages{grid-column:1/-1}.settings-heading{margin-bottom:0}.eyebrow{margin:0 0 .7rem;color:#9fc5ff;font-size:.74rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase}h1,h2{font-family:Georgia,ui-serif,serif;font-weight:700}h1{margin:0;font-size:clamp(2.3rem,4vw,3.5rem);letter-spacing:-.045em;line-height:1.12}h2{margin:0 0 .45rem;font-size:1.5rem;letter-spacing:-.02em}.intro,.help{margin:.45rem 0 0;color:var(--theme-muted);line-height:1.55}.card{min-width:0;width:100%;margin:0;padding:1.75rem;border:1px solid var(--theme-line);border-radius:1.125rem;background:var(--theme-surface);box-shadow:0 1.125rem 2.8rem #02071429}.settings-form{display:grid;gap:1rem}.settings-form h2+.field{margin-top:.4rem}.field label{display:block;margin:0 0 .375rem;font-size:.85rem;font-weight:700}.field input,.field select{display:block;width:100%;min-height:2.625rem;padding:.55rem .625rem;border:1px solid var(--theme-line);border-radius:.56rem;color:var(--theme-ink);background:var(--theme-input);font:inherit}.field input:focus-visible,.field select:focus-visible,.button:focus-visible,.switch-control input:focus-visible+.switch-track{outline:3px solid #80b6ff;outline-offset:3px}.errorlist{margin:.5rem 0 0;padding:.7rem .9rem;border-radius:.55rem;color:#fee2e2;background:#7f1d1d}.button{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:2.875rem;margin:0;padding:.65rem 1.2rem;border:1px solid transparent;border-radius:999px;color:#111c30;background:#a6ccff;font:inherit;font-size:.9rem;font-weight:800;text-align:center;text-decoration:none;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}.button:hover{transform:translateY(-1px);background:#c0ddff;box-shadow:0 .45rem 1rem #5899f733}.button--secondary{border-color:#6386bd;color:#d7e8ff;background:#223755}.button--secondary:hover{color:#111c30;background:#a6ccff}.switch-row{display:flex;align-items:center;justify-content:space-between;gap:1.125rem;min-height:4.375rem;padding:.8rem 1rem;border:1px solid #3d5879;border-radius:.94rem;background:#1a2a43;cursor:pointer}.switch-row:hover{border-color:#739ad0;background:#203554}.switch-copy{display:grid;gap:.2rem;min-width:0}.switch-copy strong{font-size:.92rem}.switch-copy small{color:var(--theme-muted);font-size:.77rem;line-height:1.35}.switch-control{position:relative;display:block;flex:0 0 3.1875rem;width:3.1875rem;height:1.9375rem}.switch-control input{position:absolute;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.switch-track{display:block;width:100%;height:100%;border-radius:999px;background:#62758b;pointer-events:none;transition:background .16s ease}.switch-track:after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #0004;transition:transform .16s ease}.switch-control input:checked+.switch-track{background:#34c76a}.switch-control input:checked+.switch-track:after{transform:translate(20px)}.messages{margin:0;padding:0;list-style:none}.alert{margin:.5rem 0 0;padding:.75rem 1rem;border-radius:.65rem;line-height:1.45}#ntfy-test-result:empty{display:none}.sensor-list{display:grid;gap:1rem;margin:1.25rem 0}.sensor-card{min-width:0;margin:0;padding:1rem;border-radius:.8rem}.sensor-card__heading{display:flex;align-items:center;flex-wrap:wrap;gap:.35rem .7rem}.sensor-card p{line-height:1.45;overflow-wrap:anywhere}.sensor-card .button{margin-top:.65rem}.sensor-form{margin-top:1.25rem}:root[data-theme=light] .eyebrow{color:#23578d}:root[data-theme=light] .card{box-shadow:0 1.125rem 2.8rem #20365c1a}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger){color:#fff;background:#245b96}:root[data-theme=light] .button:not(.button--secondary):not(.button--danger):hover{background:#174877}:root[data-theme=light] .button--secondary{border-color:#9cc0ed;color:#245b96;background:#edf4ff}:root[data-theme=light] .button--secondary:hover{color:#fff;background:#245b96}:root[data-theme=light] .switch-row{border-color:#d4e0ef;background:#f2f7fe}:root[data-theme=light] .switch-row:hover{border-color:#9cc0ed;background:#eaf3ff}:root[data-theme=light] .switch-track{background:#c1cbd8}:root[data-theme=light] .switch-control input:checked+.switch-track{background:#34c76a}@media(max-width:48rem){.settings-content{grid-template-columns:minmax(0,1fr)}.settings-shell{width:min(100% - 2.25rem,73.75rem);padding:2.5rem 0 3rem}}@media(max-width:35rem){.card{padding:1.25rem}}@media(prefers-reduced-motion:reduce){.button,.switch-track,.switch-track:after{transition:none}.button:hover{transform:none}} diff --git a/vite_integration/__pycache__/__init__.cpython-312.pyc b/vite_integration/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..25efc77 Binary files /dev/null and b/vite_integration/__pycache__/__init__.cpython-312.pyc differ diff --git a/vite_integration/__pycache__/apps.cpython-312.pyc b/vite_integration/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000..2d0a888 Binary files /dev/null and b/vite_integration/__pycache__/apps.cpython-312.pyc differ diff --git a/vite_integration/templatetags/__pycache__/__init__.cpython-312.pyc b/vite_integration/templatetags/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..5d835c4 Binary files /dev/null and b/vite_integration/templatetags/__pycache__/__init__.cpython-312.pyc differ diff --git a/vite_integration/templatetags/__pycache__/vite.cpython-312.pyc b/vite_integration/templatetags/__pycache__/vite.cpython-312.pyc new file mode 100644 index 0000000..4529b98 Binary files /dev/null and b/vite_integration/templatetags/__pycache__/vite.cpython-312.pyc differ