diff --git a/web/.gitignore b/web/.gitignore deleted file mode 100644 index 8d8e757..0000000 --- a/web/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# production -/build - -# IDEs and editors -/.idea -/.vscode - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/web/public/index.html b/web/public/index.html index b992636..232b0cf 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - +
diff --git a/web/public/static/img/basic-notification.png b/web/public/static/img/basic-notification.png deleted file mode 100644 index 3a8a245..0000000 Binary files a/web/public/static/img/basic-notification.png and /dev/null differ diff --git a/web/src/app/Notifier.js b/web/src/app/Notifier.js index 10bfc50..3129edf 100644 --- a/web/src/app/Notifier.js +++ b/web/src/app/Notifier.js @@ -1,6 +1,7 @@ import {formatMessage, formatTitleWithDefault, openUrl, playSound, topicShortUrl} from "./utils"; import prefs from "./Prefs"; import subscriptionManager from "./SubscriptionManager"; +import logo from "../img/ntfy.png"; class Notifier { async notify(subscriptionId, notification, onClickFallback) { @@ -17,7 +18,7 @@ class Notifier { console.log(`[Notifier, ${shortUrl}] Displaying notification ${notification.id}: ${message}`); const n = new Notification(title, { body: message, - icon: '/static/img/favicon.png' + icon: logo }); if (notification.click) { n.onclick = (e) => openUrl(notification.click); @@ -32,7 +33,6 @@ class Notifier { await playSound(sound); } catch (e) { console.log(`[Notifier, ${shortUrl}] Error playing audio`, e); - // FIXME show no sound allowed popup } } } diff --git a/web/src/app/Prefs.js b/web/src/app/Prefs.js index 6acc8f9..b444c6f 100644 --- a/web/src/app/Prefs.js +++ b/web/src/app/Prefs.js @@ -7,7 +7,7 @@ class Prefs { async sound() { const sound = await db.prefs.get('sound'); - return (sound) ? sound.value : "mixkit-correct-answer-tone"; + return (sound) ? sound.value : "ding"; } async setMinPriority(minPriority) { diff --git a/web/src/app/utils.js b/web/src/app/utils.js index 64dd9be..08979fb 100644 --- a/web/src/app/utils.js +++ b/web/src/app/utils.js @@ -1,4 +1,11 @@ import {rawEmojis} from "./emojis"; +import beep from "../sounds/beep.mp3"; +import juntos from "../sounds/juntos.mp3"; +import pristine from "../sounds/pristine.mp3"; +import ding from "../sounds/ding.mp3"; +import dadum from "../sounds/dadum.mp3"; +import pop from "../sounds/pop.mp3"; +import popSwoosh from "../sounds/pop-swoosh.mp3"; export const topicUrl = (baseUrl, topic) => `${baseUrl}/${topic}`; export const topicUrlWs = (baseUrl, topic) => `${topicUrl(baseUrl, topic)}/ws` @@ -34,7 +41,6 @@ const toEmojis = (tags) => { else return tags.filter(tag => tag in emojis).map(tag => emojis[tag]); } - export const formatTitleWithDefault = (m, fallback) => { if (m.title) { return formatTitle(m); @@ -123,8 +129,18 @@ export const subscriptionRoute = (subscription) => { return `/${subscription.topic}`; } +export const sounds = { + "beep": beep, + "juntos": juntos, + "pristine": pristine, + "ding": ding, + "dadum": dadum, + "pop": pop, + "pop-swoosh": popSwoosh +}; + export const playSound = async (sound) => { - const audio = new Audio(`/static/sounds/${sound}.mp3`); + const audio = new Audio(sounds[sound]); return audio.play(); }; diff --git a/web/src/components/ActionBar.js b/web/src/components/ActionBar.js index 32b32d9..0dcf696 100644 --- a/web/src/components/ActionBar.js +++ b/web/src/components/ActionBar.js @@ -20,6 +20,7 @@ import NotificationsIcon from '@mui/icons-material/Notifications'; import NotificationsOffIcon from '@mui/icons-material/NotificationsOff'; import api from "../app/Api"; import subscriptionManager from "../app/SubscriptionManager"; +import logo from "../img/ntfy.svg" const ActionBar = (props) => { const location = useLocation(); @@ -44,7 +45,7 @@ const ActionBar = (props) => { >