diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 012559a2..6386594d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -223,13 +223,17 @@ cd ui pnpm install ``` +> [!NOTE] +> Create a `.env` file in the `ui/` directory based on `.env.example` to configure environment variables. +> to link the frontend to the backend API. + 3. **Run the frontend development server:** ```bash pnpm dev ``` -The frontend will be available at `http://localhost:3000` (or the port shown in the terminal) +The frontend will be available at `http://localhost:8082` (or the port shown in the terminal) 4. **Verify the setup:** diff --git a/app/library/Notifications.py b/app/library/Notifications.py index 490ac303..0508da7a 100644 --- a/app/library/Notifications.py +++ b/app/library/Notifications.py @@ -438,7 +438,7 @@ class Notification(metaclass=Singleton): import apprise try: - notify = apprise.Apprise() + notify = apprise.Apprise(debug=self._debug) apr_config = Path(Config.get_instance().apprise_config) if apr_config.exists(): apprise_config = notify.AppriseConfig() @@ -448,11 +448,14 @@ class Notification(metaclass=Singleton): for t in target: notify.add(t.request.url) - notify.notify( + status = await notify.async_notify( body=ev.message or json.dumps(ev.serialize(), sort_keys=False, ensure_ascii=False), title=ev.title or f"YTPTube Event: {ev.event}", - notify_type=ev.event, ) + + if not status: + msg = "Apprise failed to send notification." + raise RuntimeError(msg) # noqa: TRY301 except Exception as e: LOG.exception(e) LOG.error(f"Error sending Apprise notification: {e!s}") diff --git a/app/routes/api/_static.py b/app/routes/api/_static.py index e2eba5ef..d1f40ca5 100644 --- a/app/routes/api/_static.py +++ b/app/routes/api/_static.py @@ -30,6 +30,7 @@ FRONTEND_ROUTES: list[str] = [ "/logs/", "/conditions/", "/browser/", + "/settings/", "/browser/{path:.*}", ] diff --git a/app/tests/test_notifications.py b/app/tests/test_notifications.py index 8d59b1a6..998b07bd 100644 --- a/app/tests/test_notifications.py +++ b/app/tests/test_notifications.py @@ -812,6 +812,8 @@ class TestNotification: # Mock apprise import mock_apprise = Mock() mock_notify = Mock() + # Mock async_notify as an AsyncMock that returns True + mock_notify.async_notify = AsyncMock(return_value=True) mock_apprise.Apprise.return_value = mock_notify mock_import.return_value = mock_apprise diff --git a/ui/.env.example b/ui/.env.example new file mode 100644 index 00000000..0aa72bd5 --- /dev/null +++ b/ui/.env.example @@ -0,0 +1,2 @@ +NUXT_API_URL="http://localhost:8081/api/" +NUXT_PUBLIC_WSS=":8081/" diff --git a/ui/app/components/NotifyDropdown.vue b/ui/app/components/NotifyDropdown.vue index 8ff79681..976f611f 100644 --- a/ui/app/components/NotifyDropdown.vue +++ b/ui/app/components/NotifyDropdown.vue @@ -43,14 +43,13 @@