Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extension/entrypoints/background/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export async function notifyUser(title: string, message: string, url?: string) {

if (matchedVoice) ttsMessage.voice = matchedVoice;
}
ttsMessage.rate = settings.notifications.ttsRate;
window.speechSynthesis.speak(ttsMessage);
} else {
// Offscreen documents
Expand All @@ -199,6 +200,7 @@ export async function notifyUser(title: string, message: string, url?: string) {
text: text,
volume: settings.notifications.volume / 100,
voice: settings.notifications.ttsVoice,
rate: settings.notifications.ttsRate,
} satisfies OffscreenMessage);
}
}
Expand Down
5 changes: 4 additions & 1 deletion extension/entrypoints/offscreen/offscreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ interface PlayTTSOptions {
text: string;
volume: number;
voice: string;
rate: number;
}

function playTTS({ text, volume, voice }: PlayTTSOptions) {
function playTTS({ text, volume, voice, rate }: PlayTTSOptions) {
const ttsMessage = new SpeechSynthesisUtterance(text);
ttsMessage.volume = volume;
if (voice !== "default") {
const matchedVoice = window.speechSynthesis.getVoices().find(({ name, lang }) => `${name} (${lang})` === voice);

if (matchedVoice) ttsMessage.voice = matchedVoice;
}
ttsMessage.rate = rate;

window.speechSynthesis.speak(ttsMessage);
}

Expand Down
4 changes: 4 additions & 0 deletions extension/entrypoints/options/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,10 @@ <h2>
<input id="notification-tts" type="checkbox" />
<label for="notification-tts">Use text-to-speech.</label>
</div>
<div class="option tabbed">
<label for="notification-ttsRate">Rate</label>
<input id="notification-ttsRate" type="number" min="0.1" max="10" step="0.1" />
</div>
<div class="option">
<input id="notification-link" type="checkbox" />
<label for="notification-link">Open the corresponding link when clicking a notification.</label>
Expand Down
2 changes: 2 additions & 0 deletions extension/entrypoints/options/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ async function setupPreferences(requireCleanup: boolean = false) {

_preferences.querySelector<HTMLInputElement>("#notification-sound").value = settings.notifications.sound;
_preferences.querySelector<HTMLInputElement>("#notification-tts").checked = settings.notifications.tts;
_preferences.querySelector<HTMLInputElement>("#notification-ttsRate").value = settings.notifications.ttsRate.toString();
_preferences.querySelector<HTMLInputElement>("#notification-link").checked = settings.notifications.link;
_preferences.querySelector<HTMLInputElement>("#notification-requireInteraction").checked = settings.notifications.requireInteraction;
_preferences.querySelector<HTMLInputElement>("#notification-volume").value = settings.notifications.volume.toString();
Expand Down Expand Up @@ -1202,6 +1203,7 @@ async function setupPreferences(requireCleanup: boolean = false) {

settings.notifications.tts = _preferences.querySelector<HTMLInputElement>("#notification-tts").checked;
settings.notifications.ttsVoice = _preferences.querySelector<HTMLInputElement>("#tts-voice").value;
settings.notifications.ttsRate = parseFloat(_preferences.querySelector<HTMLInputElement>("#notification-ttsRate").value);
settings.notifications.link = _preferences.querySelector<HTMLInputElement>("#notification-link").checked;
settings.notifications.requireInteraction = _preferences.querySelector<HTMLInputElement>("#notification-requireInteraction").checked;
settings.notifications.volume = parseInt(_preferences.querySelector<HTMLInputElement>("#notification-volume").value);
Expand Down
1 change: 1 addition & 0 deletions extension/utils/common/data/default-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const DEFAULT_STORAGE = {
soundCustom: new DefaultSetting("string", ""),
tts: new DefaultSetting("boolean", false),
ttsVoice: new DefaultSetting("string", "default"),
ttsRate: new DefaultSetting("number", 1),
link: new DefaultSetting("boolean", true),
volume: new DefaultSetting("number", 100),
requireInteraction: new DefaultSetting("boolean", false),
Expand Down
3 changes: 2 additions & 1 deletion public/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
{ "message": "'FF Scouter' score filter for ranked wars.", "contributor": "DeKleineKobini" },
{ "message": "Labels for stakeouts.", "contributor": "DeKleineKobini" },
{ "message": "Added bazaarOpen filter on abroad people page", "contributor": "mystify-321" },
{ "message": "More special filters to the 'Userlist Filter': has bounties and bazaar open", "contributor": "DeKleineKobini" }
{ "message": "More special filters to the 'Userlist Filter': has bounties and bazaar open", "contributor": "DeKleineKobini" },
{ "message": "Modify TTS speaking rate for notifications.", "contributor": "DeKleineKobini" }
],
"fixes": [
{ "message": "Filtering on profit in the 'Stocks Filter' gave errors for stocks you don't own.", "contributor": "DeKleineKobini" },
Expand Down