Additional descriptions for settings (#203), URL validation (#204)

This commit is contained in:
Philipp Heckel 2022-04-10 15:13:12 -04:00
parent 9c3f5929c7
commit 136883fd94
5 changed files with 123 additions and 46 deletions

View file

@ -24,7 +24,7 @@ export const expandUrl = (url) => [`https://${url}`, `http://${url}`];
export const expandSecureUrl = (url) => `https://${url}`;
export const validUrl = (url) => {
return url.match(/^https?:\/\//);
return url.match(/^https?:\/\/.+/);
}
export const validTopic = (topic) => {
@ -153,17 +153,38 @@ export const openUrl = (url) => {
};
export const sounds = {
"beep": beep,
"juntos": juntos,
"pristine": pristine,
"ding": ding,
"dadum": dadum,
"pop": pop,
"pop-swoosh": popSwoosh
"ding": {
file: ding,
label: "Ding"
},
"juntos": {
file: juntos,
label: "Juntos"
},
"pristine": {
file: pristine,
label: "Pristine"
},
"dadum": {
file: dadum,
label: "Dadum"
},
"pop": {
file: pop,
label: "Pop"
},
"pop-swoosh": {
file: popSwoosh,
label: "Pop swoosh"
},
"beep": {
file: beep,
label: "Beep"
}
};
export const playSound = async (sound) => {
const audio = new Audio(sounds[sound]);
export const playSound = async (id) => {
const audio = new Audio(sounds[id].file);
return audio.play();
};